1 | % Monte-Carlo Search Algoritm on low-autocorrelation program
|
---|
2 | % BSDLicence
|
---|
3 | % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
|
---|
4 | % $Id: mcs-call.m 43 2009-12-17 22:18:48Z rick $
|
---|
5 |
|
---|
6 | % Brute-force result of length 20
|
---|
7 | % best_20 = [-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,1];
|
---|
8 |
|
---|
9 | % Basic variables
|
---|
10 | iterations = [1:10:200];
|
---|
11 | repetitions = 20;
|
---|
12 | length = 20;
|
---|
13 |
|
---|
14 | % Plot the stuff
|
---|
15 | fitnesses = [];
|
---|
16 | for iteration = iterations
|
---|
17 | fitness = [];
|
---|
18 | for rep = 1:repetitions
|
---|
19 | fprintf('Iter:%i, Rep:%i\n',iteration,rep);
|
---|
20 | [new_fitness, value] = mcs(length,iteration);
|
---|
21 | fitness = [fitness, new_fitness];
|
---|
22 |
|
---|
23 | % Little hack to display output nicely
|
---|
24 | % disp(rot90(value,-1));
|
---|
25 | end
|
---|
26 | fitnesses = [fitnesses,mean(fitness)];
|
---|
27 | end
|
---|
28 |
|
---|
29 | plot(iterations,fitnesses);
|
---|
30 | title(sprintf('Monte-Carlo Search on Low-Corretation set - repetitions %i',repetitions));
|
---|
31 | ylabel('fitness');
|
---|
32 | xlabel('iterations');
|
---|
33 | grid on;
|
---|
34 | legend(sprintf('Length %i',length));
|
---|
35 | print('mcs-fitness.eps','-depsc2');
|
---|
36 |
|
---|