runAlgorithms - maxiter= 200; n numtrials= 30; savedRW=...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
maxiter= 200; numtrials= 30; n savedRW= zeros(maxiter,5,numtrials); savedRS= zeros(maxiter,5,numtrials); savedGD= zeros(maxiter,5,numtrials); savedGS= zeros(maxiter,5,numtrials); s RW for i = 1:numtrials sinitial= randi([0, 500]); savedRW(:,:,i) = RW(sinitial, maxiter); end RS for i = 1:numtrials sinitial= randi([0, 500]); savedRS(:,:,i) = RS(sinitial, maxiter); end GD for i = 1:numtrials sinitial= randi([0, 500]); savedGD(:,:,i) = GD(sinitial, maxiter); end GS for i = 1:numtrials sinitial= randi([0, 500]); savedGS(:,:,i) = GS(sinitial, maxiter); end e %plot 1 hold on plot(savedRW(:,1,1),savedRW(:,2,1),'r-') plot(savedRW(:,1,1),savedRW(:,3,1),'b-') title('scurrent, sbest vs. iteration for RW') xlabel('iteration') ylabel('scurrent (red) and sbest (blue)') y %plot 2 meanCurrent= zeros(maxiter, 1); meanBest= zeros(maxiter, 1); for i = 1:maxiter meanCurrent(i)= mean(savedRW(i,4,:)); meanBest(i)= mean(savedRW(i,5,:)); end hold on plot(savedRW(:,1,1),meanCurrent,'r-') plot(savedRW(:,1,1),meanBest,'b-')
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2011 for the course ORIE 5430 taught by Professor Shoemaker during the Fall '11 term at Cornell University (Engineering School).

Page1 / 2

runAlgorithms - maxiter= 200; n numtrials= 30; savedRW=...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online