1 /* TODD, a class of hard instances of zero-one knapsack problems */
3 /* Written in GNU MathProg by Andrew Makhorin <mao@gnu.org> */
5 /* Chvatal describes a class of instances of zero-one knapsack problems
6 due to Todd. He shows that a wide class of algorithms - including all
7 based on branch and bound or dynamic programming - find it difficult
8 to solve problems in the Todd class. More exactly, the time required
9 by these algorithms to solve instances of problems that belong to the
10 Todd class grows as an exponential function of the problem size.
13 Chvatal V. (1980), Hard knapsack problems, Op. Res. 28, 1402-1411. */
17 param log2_n := log(n) / log(2);
19 param k := floor(log2_n);
21 param a{j in 1..n} := 2 ** (k + n + 1) + 2 ** (k + n + 1 - j) + 1;
23 param b := 0.5 * floor(sum{j in 1..n} a[j]);
27 maximize obj: sum{j in 1..n} a[j] * x[j];
29 s.t. cap: sum{j in 1..n} a[j] * x[j] <= b;
34 /* change this parameter to choose a particular instance */