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