Changeset 30


Ignore:
Timestamp:
Dec 13, 2009, 2:45:50 PM (15 years ago)
Author:
Rick van der Zwet
Message:

Working version using brute-force

Location:
liacs/nc/low-correlation
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • liacs/nc/low-correlation/mcs.m

    r29 r30  
    33% Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
    44
     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
    510best_fitness = 0;
    611while (1)
    7     % Generate a column s={-1,1}^n
     12    % Generate a random column s={-1,1}^n
    813    n = 20;
    914    s = rand(n,1);
    1015    s = round(s);
    11     s = (s == 0) .- 1;
     16    s = s - (s == 0);
    1217
    1318    % Find whether we are better than everything else
    14     fitness = SHG(s);
     19    fitness = autocorrelation(s);
    1520    if (fitness > best_fitness)
    16         best_array = s;
     21        best_result = s;
    1722        best_fitness = fitness
    1823        % Little hack to display output nicely
    19         disp(rot90(s,-1));
     24        disp(rot90(best_result,-1));
    2025    endif
    2126endwhile
Note: See TracChangeset for help on using the changeset viewer.