- Timestamp:
- Dec 17, 2009, 10:18:08 PM (15 years ago)
- Location:
- liacs/nc/low-correlation
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
liacs/nc/low-correlation/Makefile
r31 r42 2 2 CFLAGS=-lm 3 3 4 SOURCE=autocorrelation.m.tex initseq.m.tex mcs-call.m.tex \ 5 mcs.m.tex mutation.m.tex randint.m.tex sa-call.m.tex sa.m.tex 6 7 include latex.mk 8 4 9 mcs: mcs.m 5 10 @octave --silent mcs.m 11 12 13 %.m.tex: %.m 14 highlight --linenumbers --no-doc --latex --input $< --output $@ -
liacs/nc/low-correlation/initseq.m
-
Property svn:keywords
set to
autocorrelation.m
r38 r42 2 2 % BSDLicence 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 % $Id$ 4 5 5 6 function s = initseq(n) 6 7 8 9 7 % Generate a random column s={-1,1}^n 8 s = rand(n,1); 9 s = round(s); 10 s = s - (s == 0); 10 11 end -
Property svn:keywords
set to
-
liacs/nc/low-correlation/mcs-call.m
-
Property svn:keywords
set to
autocorrelation.m
r38 r42 2 2 % BSDLicence 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 % $Id$ 4 5 5 6 % Brute-force result of length 20 … … 14 15 fitnesses = []; 15 16 for iteration = iterations 16 17 18 19 20 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]; 21 22 22 23 24 25 23 % Little hack to display output nicely 24 % disp(rot90(value,-1)); 25 end 26 fitnesses = [fitnesses,mean(fitness)]; 26 27 end 27 28 -
Property svn:keywords
set to
-
liacs/nc/low-correlation/mcs.m
-
Property svn:keywords
set to
autocorrelation.m
r38 r42 2 2 % BSDLicence 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 % $Id$ 4 5 5 6 % Brute-force result of length 20 … … 8 9 9 10 function [fitness,value] = mcs(length, iterations) 10 best_fitness = 0; 11 for i = 1:iterations 12 % Generate a random column s={-1,1}^n 13 n = length; 14 s = rand(n,1); 15 s = round(s); 16 s = s - (s == 0); 17 18 % Find whether we are better than everything else 19 fitness = autocorrelation(s); 20 if (fitness > best_fitness) 21 best_value = s; 22 best_fitness = fitness; 23 end 11 best_fitness = 0; 12 for i = 1:iterations 13 % Generate a random column s={-1,1}^n 14 n = length; 15 s = rand(n,1); 16 s = round(s); 17 s = s - (s == 0); 18 19 % Find whether we are better than everything else 20 fitness = autocorrelation(s); 21 if (fitness > best_fitness) 22 best_value = s; 23 best_fitness = fitness; 24 24 end 25 fitness = best_fitness; 26 value = best_value; 25 end 26 fitness = best_fitness; 27 value = best_value; 27 28 end -
Property svn:keywords
set to
-
liacs/nc/low-correlation/mutation.m
-
Property svn:keywords
set to
autocorrelation.m
r38 r42 2 2 % BSDLicence 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 % $Id$ 4 5 5 6 function new = mutation(old) 6 7 8 7 loc = randint(1,length(old)); 8 old(loc) = old(loc) * -1; 9 new = old; 9 10 end -
Property svn:keywords
set to
-
liacs/nc/low-correlation/randint.m
-
Property svn:keywords
set to
autocorrelation.m
r38 r42 2 2 % BSDLicence 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 % $Id$ 4 5 5 6 function number = randint(low,high) 6 7 number = round(rand() * (high - low)) + low; 7 8 end -
Property svn:keywords
set to
-
liacs/nc/low-correlation/sa-call.m
-
Property svn:keywords
set to
autocorrelation.m
r39 r42 2 2 % BSDLicence 3 3 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl> 4 % $Id$ 4 5 5 6 %% Basic variables -
Property svn:keywords
set to
-
liacs/nc/low-correlation/sa.m
-
Property svn:keywords
set to
autocorrelation.m
-
Property svn:keywords
set to
Note:
See TracChangeset
for help on using the changeset viewer.