GS - end solution(i,1)= i; %note the next 2 lines will...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function solution = GS(sinitial, maxiter) solution = zeros(maxiter,5); snew= sinitial; sbest= snew; COSTnew= cost(snew); COSTbest= cost(snew); for i=1:maxiter stest= neighbor(snew); COSTtest= cost(stest); if COSTtest<COSTbest COSTbest= COSTtest; COSTnew= COSTtest; snew= stest; sbest= snew;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end solution(i,1)= i; %note the next 2 lines will always be the same in this alg. solution(i,2)= snew; solution(i,3)= sbest; %note the next 2 lines will always be the same in this alg. solution(i,4)= COSTnew; solution(i,5)= COSTbest; end else display('s not in valid range'); end...
View Full 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).

Ask a homework question - tutors are online