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% cutstock.mzn
7% Jakob Puchinger <jakobp@cs.mu.oz.au>
8% December 2007
9% vim: ft=zinc ts=4 sw=4 et tw=0
10%
11% The cutting stock problem: Kantorovitch formulation for colgen.
12%
13%------------------------------------------------------------------------------%
14
15int: L; % stock length
16int: K; % upper bound on number of stock pieces
17int: N; % number of stock pieces
18
19array[1..N] of int: i_length;
20array[1..N] of int: i_demand;
21
22array[1..K] of var 0..1: pieces;
23array[1..K, 1..N] of var int: items;
24
25constraint
26 forall(k in 1..K, i in 1..N)( items[k,i] >=0 );
27
28solve ::int_search(array1d(1..K*N,items)++pieces,input_order,indomain_min,complete) minimize
29 sum([ pieces[k] | k in 1..K]);
30
31constraint
32 forall(i in 1..N)
33 (
34 sum( [ items[k, i] | k in 1..K] ) >= i_demand[i]
35 );
36
37constraint
38 forall( k in 1..K ) (
39 sum(i in 1..N)( items[k,i] * i_length[i] ) <= pieces[k] * L
40 );
41
42 % required for showing the objective function
43var int: obj;
44constraint
45 obj = sum([ pieces[k] | k in 1..K]);
46
47output
48[ "Cost = ", show( obj ), "\n" ] ++
49[ "Pieces = \n\t" ] ++ [show(pieces)] ++ [ "\n" ] ++
50[ "Items = \n\t" ] ++
51[ show(items[k, i]) ++ if k = K then "\n\t" else " " endif |
52 i in 1..N, k in 1..K ] ++
53[ "\n" ];
54
55
56% data:
57N = 3;
58K = sum(i_demand);
59L = 10;
60i_length = [7, 5, 3];
61i_demand = [2, 2, 4];
62