Index: liacs/nc/low-correlation/initseq.m
===================================================================
--- liacs/nc/low-correlation/initseq.m	(revision 38)
+++ liacs/nc/low-correlation/initseq.m	(revision 38)
@@ -0,0 +1,10 @@
+% Simulated Annealing low-autocorrelation program
+% BSDLicence
+% Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
+
+function s = initseq(n)
+    % Generate a random column s={-1,1}^n
+    s = rand(n,1);
+    s = round(s);
+    s = s - (s == 0);
+end
Index: liacs/nc/low-correlation/mcs-call.m
===================================================================
--- liacs/nc/low-correlation/mcs-call.m	(revision 38)
+++ liacs/nc/low-correlation/mcs-call.m	(revision 38)
@@ -0,0 +1,35 @@
+% Monte-Carlo Search Algoritm on low-autocorrelation program
+% BSDLicence
+% Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
+
+% Brute-force result of length 20
+% best_20 = [-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,1];
+
+% Basic variables
+iterations = [1:10:200];
+repetitions = 20;
+length = 20;
+
+% Plot the stuff
+fitnesses = [];
+for iteration = iterations
+    fitness = [];
+    for rep = 1:repetitions
+        fprintf('Iter:%i, Rep:%i\n',iteration,rep);
+        [new_fitness, value] =  mcs(length,iteration);
+        fitness = [fitness, new_fitness];
+
+        % Little hack to display output nicely
+        % disp(rot90(value,-1));
+    end
+    fitnesses = [fitnesses,mean(fitness)];
+end
+
+plot(iterations,fitnesses);
+title(sprintf('Monte-Carlo Search on Low-Corretation set - repetitions %i',repetitions));
+ylabel('fitness');
+xlabel('iterations');
+grid on;
+legend(sprintf('Length %i',length));
+print('mcs-fitness.eps','-depsc2');
+
Index: liacs/nc/low-correlation/mcs.m
===================================================================
--- liacs/nc/low-correlation/mcs.m	(revision 37)
+++ liacs/nc/low-correlation/mcs.m	(revision 38)
@@ -21,38 +21,7 @@
             best_value = s;
             best_fitness = fitness;
-        endif
-    endfor
+        end
+    end
     fitness = best_fitness;
     value = best_value;
-endfunction
-
-% Basic variables
-iterations = [1:10:200];
-repetitions = 20;
-length = 20;
-
-
-% Plot the stuff
-fitnesses = [];
-for iteration = iterations
-    fitness = [];
-    for rep = 1:repetitions
-        printf('Iter:%i, Rep:%i\n',iteration,rep);
-        [new_fitness, value] =  mcs(length,iteration);
-        fitness = [fitness, new_fitness];
-
-        % Little hack to display output nicely
-        % disp(rot90(value,-1));
-    endfor
-    
-    fitnesses = [fitnesses,mean(fitness)];
-endfor
-
-plot(iterations,fitnesses);
-title(sprintf('Monte-Carlo Search on Low-Corretation set - repetitions %i',repetitions));
-ylabel('fitness');
-xlabel('iterations');
-grid on;
-legend(sprintf('Length %i',length));
-print("mcs-fitness.eps","-depsc2");
-
+end
Index: liacs/nc/low-correlation/mutation.m
===================================================================
--- liacs/nc/low-correlation/mutation.m	(revision 38)
+++ liacs/nc/low-correlation/mutation.m	(revision 38)
@@ -0,0 +1,9 @@
+% Simulated Annealing low-autocorrelation program
+% BSDLicence
+% Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
+
+function new = mutation(old)
+    loc = randint(1,length(old));
+    old(loc) = old(loc) * -1;
+    new = old;
+end
Index: liacs/nc/low-correlation/randint.m
===================================================================
--- liacs/nc/low-correlation/randint.m	(revision 38)
+++ liacs/nc/low-correlation/randint.m	(revision 38)
@@ -0,0 +1,7 @@
+% Simulated Annealing low-autocorrelation program
+% BSDLicence
+% Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
+
+function number = randint(low,high)
+    number = round(rand() * (high - low)) + low;
+end
Index: liacs/nc/low-correlation/sa-call.m
===================================================================
--- liacs/nc/low-correlation/sa-call.m	(revision 38)
+++ liacs/nc/low-correlation/sa-call.m	(revision 38)
@@ -0,0 +1,36 @@
+% Simulated Annealing low-autocorrelation program
+% BSDLicence
+% Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
+
+%% Basic variables
+iterations = [1:10:1000];
+repetitions = 20;
+length = 20;
+temperature = 1000;
+
+iteration_history = [];
+fitness_history = [];
+
+% Plot the stuff
+for iteration = iterations
+    fitness = [];
+    for rep = 1:repetitions
+        fprintf('Iter:%i, Rep:%i\n',iteration,rep);
+        [new_fitness, value] =  sa(length,iteration,temperature);
+        fitness = [fitness, new_fitness];
+
+        % Little hack to display output nicely
+        % disp(rot90(value,-1));
+   end
+    iteration_history = [iteration_history,iteration];
+    fitness_history = [fitness_history,mean(fitness)];
+end
+
+plot(iteration_history,fitness_history);
+title(sprintf('Simulated Annealing on Low-Corretation set - repetitions %i',repetitions));
+ylabel('fitness');
+xlabel('iterations');
+grid on;
+legend(sprintf('Length %i',length));
+print('sa-fitness.eps','-depsc2');
+
Index: liacs/nc/low-correlation/sa.m
===================================================================
--- liacs/nc/low-correlation/sa.m	(revision 37)
+++ liacs/nc/low-correlation/sa.m	(revision 38)
@@ -2,25 +2,4 @@
 % BSDLicence
 % Rick van der Zwet - 0433373 - <hvdzwet@liacs.nl>
-
-% Brute-force result of length 20
-% best_20 = [-1,1,1,-1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,1,1,1,1,1];
-% autocorrelation(best_20);
-
-function number = randint(low,high)
-    number = round(rand() * (high - low)) + low;
-endfunction
-
-function new = mutation(old)
-    loc = randint(1,length(old));
-    old(loc) = old(loc) * -1;
-    new = old;
-endfunction
-
-function s = initseq(n)
-    % Generate a random column s={-1,1}^n
-    s = rand(n,1);
-    s = round(s);
-    s = s - (s == 0);
-endfunction
 
 function [fitness,value] = sa(length, temperature, stopLimit)
@@ -39,6 +18,5 @@
             best_fitness = fitness;
             s = newseq;
-            fitness
-            disp(rot90(newseq,-1));
+            % disp(rot90(newseq,-1));
             stopCounter = 0;
         else
@@ -46,5 +24,5 @@
             temperature =- 1;
 
-            stopCounter += 1;
+            stopCounter =+ 1;
             % Accept on an certain probability
             if (temperature < 0)
@@ -53,41 +31,9 @@
                 if(randint(0,temperature) > temperature / 4)
                     s = newseq;
-                endif
-            endif
-        endif
-    endwhile
+               end
+           end
+       end
+   end
     value = best_value;
     fitness = best_fitness;
-endfunction
-
-%% Basic variables
-iterations = [1:10:1000];
-repetitions = 20;
-length = 20;
-temperature = 1000;
-
-
-% Plot the stuff
-fitnesses = [];
-for iteration = iterations
-    fitness = [];
-    for rep = 1:repetitions
-        printf('Iter:%i, Rep:%i\n',iteration,rep);
-        [new_fitness, value] =  sa(length,iteration,temperature);
-        fitness = [fitness, new_fitness];
-
-        % Little hack to display output nicely
-        % disp(rot90(value,-1));
-    endfor
-    
-    fitnesses = [fitnesses,mean(fitness)];
-endfor
-
-plot(iterations,fitnesses);
-title(sprintf('Simulated Annealing on Low-Corretation set - repetitions %i',repetitions));
-ylabel('fitness');
-xlabel('iterations');
-grid on;
-legend(sprintf('Length %i',length));
-print("sa-fitness.eps","-depsc2");
-
+end
