this repo has no description
1% RUNS ON mzn20_fd
2% RUNS ON mzn-fzn_fd
3% RUNS ON mzn20_fd_linear
4% RUNS ON mzn20_mip
5%------------------------------------------------------------------------------%
6% The classical 0/1 multidimensional knapsack problem.
7%
8% There is a knapsack with m different capacity constraints and n items with
9% profits and weights. The goal is to maximise the total profit of the items
10% in the knapsack while not violating any of the capacity constraints.
11%------------------------------------------------------------------------------%
12
13int: n;
14int: m;
15
16array[1..n] of int: Profits;
17array[1..n,1..m] of int: Weights;
18array[1..m] of int: Capacities;
19
20array[1..n] of var 0..1: x;
21
22constraint
23 forall(i in 1..m) (
24 sum([Weights[j,i] * x[j] | j in 1..n]) <= Capacities[i]
25 );
26
27solve maximize
28 sum([x[j] * Profits[j] | j in 1..n]);
29
30output [ "multidimknapsack_simple " ] ++
31 [ show(x[i]) ++ if i = n then "\n" else " " endif | i in 1..n ];
32
33%------------------------------------------------------------------------------%
34% data
35
36n = 5;
37m = 3;
38
39Profits = [5,6,3,7,4];
40
41Capacities = [5,10,15];
42
43Weights = [| 2, 3, 2
44 | 1, 4, 4
45 | 1, 2, 5
46 | 3, 2, 3
47 | 1, 3, 5 |];
48