Last change
on this file since 28 was 28, checked in by Rick van der Zwet, 15 years ago |
Initial commit of my first octave/matlab program ever. Give me some base pointer on what todo and how
|
File size:
549 bytes
|
Line | |
---|
1 | % Monte-Carlo Search Algoritm on low-autocorrelation program
|
---|
2 | % BSDLicence
|
---|
3 | % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
|
---|
4 |
|
---|
5 | best_fitness = 0;
|
---|
6 | while (1)
|
---|
7 | % Generate a column s={-1,1}^n
|
---|
8 | n = 20;
|
---|
9 | s = rand(n,1);
|
---|
10 | s = round(s);
|
---|
11 | s = (s == 0) .- 1
|
---|
12 |
|
---|
13 | % Find whether we are better than everything else
|
---|
14 | fitness = SHG(s)
|
---|
15 | if (fitness > best_fitness)
|
---|
16 | best_array = s;
|
---|
17 | best_fitness = fitness;
|
---|
18 | % Little hack to display output nicely
|
---|
19 | printf("%f", fitness);
|
---|
20 | disp(rot90(s,-1));
|
---|
21 | endif
|
---|
22 | endwhile
|
---|
23 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.