while sum(solution_new.*w)>W index=randi([1,length(w)],1,1); solution_new(1,index)=~solution_new(1,index); end
value_new=sum(solution_new.*v);
possibility=exp((value_new-value_current)/t); if possibility>rand value_current=value_new; solution_current=solution_new; else solution_new=solution_current; end
if value_current>value_best value_best=value_current; solution_best=solution_current; end
end
value_list(counter,:)=value_best; solution_list(counter,:)=solution_best; t=t*alpha; end