function makeGraphs0518b()

perComb    = 5;
savePrefix = 'randomsearch_fitness-ratio';
figwidth   = 0.80;
label_x    = 'Ratio of f_{PSG} to f_{RS} [%]';
label_y    = 'ISCAS circuit';
figTitle   = 'Comparison between PSG and random search (RS)';

data = getDataRandomSearch();

if mod(length(data), perComb)
  error('data has wrong length');
end
numC = length(data) / (perComb);

combs = zeros(1, numC);
circuits = cell(1,numC);
data_1 = zeros(1,numC);
data_2 = zeros(1,numC);
data_4 = zeros(1,numC);
data_7 = zeros(1,numC);

i=0;
for offset = 0 : (perComb) : (perComb*(numC-1))
  i=i+1;

  %%% Get the problem instance
  comb = data(offset+1,1);
  combs(i) = comb;
  circuit = getIscasName(comb);
  circuits{i} = circuit;
  
  %%% Get solution quality of random search
  fRS = data(offset+1, 3);
  
  %%% Get ratios
  data_1(i) = 100 * data(offset+2, 3) / fRS;
  data_2(i) = 100 * data(offset+3, 3) / fRS;
  data_4(i) = 100 * data(offset+4, 3) / fRS;
  data_7(i) = 100 * data(offset+5, 3) / fRS;
end

%%% Plot graph
combs  = fliplr(combs);
circuits  = fliplr(circuits);
data_1 = fliplr(data_1);
data_2 = fliplr(data_2);
data_4 = fliplr(data_4);
data_7 = fliplr(data_7);

colormap mycolormap0518b;
bardata = [ data_1' data_2' data_4' data_7' ];
barh( bardata, 1.3 );

for i = 1:numC;
  comb = combs(i);
  n = getNumGenes(sprintf('comb%02g', comb));
  x = max(bardata(i, :)) + 4;
  text( x, i, ...
        sprintf('n = %g', n ), ...
        'BackgroundColor', [0.8 0.8 0.8], ...
        'EdgeColor', 'k', ...
        'FontAngle', 'italic' );
end

xlabel(label_x);
ylabel(label_y);
set(gca,'YTickLabel',circuits);
title(figTitle);
legend('\delta = 1', '\delta = 2', '\delta = 4', '\delta = 7', ...
       'Orientation','vertical', 'Location','SouthEast');
% ylim([0 numC+1]);
xlim([0 150]);
grid on;
orient tall;

saveas(gcf, [savePrefix '.eps'], 'psc2' );
saveas(gcf, [savePrefix '.fig'] );
saveas(gcf, [savePrefix '.png'] );

set(gcf,'PaperUnits','normalized');
set(gcf,'PaperType','A4');
set(gcf,'PaperOrientation','Landscape');
set(gcf,'PaperPosition',[.1 .1 .8 .8]);
saveas(gcf, [savePrefix '.pdf'] );


%%% Write out stuff to paste into thesis.
width = num2str(figwidth);
fid = fopen('randomsearch.figures.txt','wt');

fprintf(fid, '\n\n%%%%%% Figure showing comparison with random search\n');
  filename = sprintf('miscfigs/%s', savePrefix);
  label    = 'fig:RandomSearch';
  capShort = 'Comparison of solution qualities of PSG and random search (RS).';
  capLong  = sprintf('%s The ratio $f_{PSG}/f_{RS}$ is shown, where $f_{PSG}$ and $f_{RS}$ are the best fitness values found by PSG and random search, respectively. Additionally, the number of inputs $n$ is shown for each problem instance.', capShort);
  
  fprintf(fid, '\\begin{figure}[htbp]\n');
  fprintf(fid, '  \\sffamily\n');
  fprintf(fid, '  \\begin{center}\n');
  fprintf(fid, '    \\includegraphics[width=%s\\textwidth]{%s}\n', width, filename);
  fprintf(fid, '    \\caption[%s]\n', capShort);
  fprintf(fid, '            {%s}\n', capLong);
  fprintf(fid, '    \\label{%s}\n', label);
  fprintf(fid, '  \\end{center}\n');
  fprintf(fid, '\\end{figure}\n\n');


fprintf(fid, '\n\n%%%%%% References to graph\n');
  fprintf(fid, '\\autoref{%s}\n', label);
  fprintf(fid, '\\ref{%s}\n\n', label);

fclose(fid);

end
