2 %> Solves the knapsack problem
using integer optimization. See section 25.2.1 of \cite Bier15-book
4 %> @note Tested with \ref run2702.m
6 %> @author Michel Bierlaire
7 %> @date Tue Apr 14 10:27:36 2015
12 [n,shouldBeOne] = size(u) ;
14 error(
"A column vector is expected for u") ;
16 [nw,shouldBeOne] = size(w) ;
18 error(
"A column vector is expected for w") ;
21 error(
"The two vectors must have the same size")
25 vtype = repmat('I',1,n) ;
28 [xopt, fmin, errnum, extra] = glpk (-u, w', capacity, lb, ub, ctype, vtype) ;
function knapsackExact(in u, in w, in capacity)