Optimization: principles and algorithms, by Michel Bierlaire
run2702simAnn.m
Go to the documentation of this file.
1 %> \file
2 %> Runs example 27.2 of \cite Bier15-book, solving the problem using the simulated annealing method (see Section 27.4.1 of \cite Bier15-book).
3 %>
4 %> @note Calls \ref ksSimulatedAnnealing
5 %>
6 %> @ingroup Running
7 %> @author Michel Bierlaire
8 %> @date Sun Apr 19 13:24:43 2015
9 %> @ingroup chap27
10 
11 u = [80 31 48 17 27 84 34 39 46 58 23 67]' ;
12 w = [84 27 47 22 21 96 42 46 54 53 32 78]' ;
13 capacity = 300 ;
14 x0 = zeros(12,1) ;
15 [bestSack, bestSackUtility, bestSackWeight] = ksSimulatedAnnealing(u,w,capacity,x0) ;
16 printf("Solution found: ") ;
17 printf("%d ",bestSack) ;
18 printf("\n");
19 printf("Final utility: %d, final weight: %d\n",bestSackUtility, bestSackWeight)
function ksSimulatedAnnealing(in u, in w, in c, in x0)
Copyright 2015-2016 Michel Bierlaire