2 %> Algorithm 27.5: neighborhood
for the knapsack problem. Implementation of algorithm 27.5 of \cite Bier15-book
7 %> @author Michel Bierlaire
8 %> @date Tue Apr 14 13:06:01 2015
12 %> Generate a random neighbor in a neighborhood of a given size
for the knpasack problem
13 %> @param x0 current solution
14 %> @param s size of the neighborhood
15 %> @
return x generated neighbor
17 order = randperm(size(x0)) ;
19 error(
"Size %d is larger than the size of the problem %d",size,size(x0))
23 x(order(i)) = 1-x0(order(i)) ;
function ksRandomNeighbor(in x0, in s)
function ksSimulatedAnnealing(in u, in w, in c, in x0)
function ksLocalSearchRandom(in u, in w, in c, in x0, in s, in maxiter)