- Timestamp:
- Dec 13, 2009, 2:45:50 PM (15 years ago)
- Location:
- liacs/nc/low-correlation
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
liacs/nc/low-correlation/mcs.m
r29 r30 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 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 % autocorrelation(best_20); 8 9 5 10 best_fitness = 0; 6 11 while (1) 7 % Generate a column s={-1,1}^n12 % Generate a random column s={-1,1}^n 8 13 n = 20; 9 14 s = rand(n,1); 10 15 s = round(s); 11 s = (s == 0) .- 1;16 s = s - (s == 0); 12 17 13 18 % Find whether we are better than everything else 14 fitness = SHG(s);19 fitness = autocorrelation(s); 15 20 if (fitness > best_fitness) 16 best_ array= s;21 best_result = s; 17 22 best_fitness = fitness 18 23 % Little hack to display output nicely 19 disp(rot90( s,-1));24 disp(rot90(best_result,-1)); 20 25 endif 21 26 endwhile
Note:
See TracChangeset
for help on using the changeset viewer.