this repo has no description
1/***
2!Test
3solvers: [gecode, chuffed]
4expected:
5- !Result
6 solution: !Solution
7 end: 53
8 objective: 53
9 s: [0, 0, 0, 4, 7, 7, 6, 8, 12, 8, 6, 4, 14, 19, 12, 12, 13, 18, 8, 11, 14, 18, 19, 4, 16, 10, 20, 9, 14, 6, 24, 26, 21, 16, 9, 21, 24, 28, 31, 22, 24, 11, 25, 16, 30, 26, 38, 25, 25, 30, 33, 36, 39, 34, 33, 47, 25, 44, 50, 38]
10***/
11
12% The following is a regression test for a flattening bug with predicate
13% parameter expansion. See the log message for r7550.
14% It is derived from g12/zinc/benchmarks/minizinc/rcpsp/rcpsp.mzn with 02.dzn
15
16%-----------------------------------------------------------------------------%
17
18include "globals.mzn";
19
20%-----------------------------------------------------------------------------%
21% Model parameters.
22%
23
24% Resource parameters
25%
26int: n_res; % The number of resources
27array [ 1..n_res ] of int: rc; % The resource capacities
28
29% Task parameters
30%
31int: n_tasks; % The number of tasks
32array [ 1..n_tasks ] of int: d; % The task durations
33int: sum_d = sum( i in 1..n_tasks ) (d[i]); % The total duration
34array [ 1..n_res, 1..n_tasks ] of int: rr; % The resource requirements
35array [ 1..n_tasks ] of set of int: suc; % The task successors
36
37n_res = 4;
38rc = [ 18, 22, 20, 14 ];
39n_tasks = 60;
40d = [ 4, 7, 9, 2, 6, 5, 2, 7, 4, 3, 4, 10, 4, 5, 8, 2, 7, 10, 8, 8, 8, 1, 5, 5, 7, 2, 1, 8, 10, 1, 1, 4, 10, 9, 3, 3, 7, 10, 6, 6, 9, 9, 1, 10, 2, 10, 6, 8, 9, 2, 6, 2, 8, 3, 4, 3, 9, 3, 3, 7 ];
41rr = [| 1, 0, 0, 5, 0, 4, 9, 0, 0, 0, 0, 0, 0, 9, 0, 0, 1, 3, 8, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 5, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 5, 0, 0, 9, 0, 1, 6, 0
42 | 0, 0, 3, 0, 1, 0, 0, 3, 2, 0, 0, 3, 10, 0, 0, 8, 0, 0, 0, 0, 0, 3, 0, 3, 6, 0, 0, 0, 0, 0, 0, 0, 4, 0, 7, 0, 0, 3, 2, 0, 0, 4, 0, 0, 0, 0, 0, 9, 0, 0, 9, 4, 0, 0, 0, 0, 6, 0, 0, 0
43 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 4, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 9, 5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 7, 0, 0, 0, 0, 9
44 | 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 2, 4, 0, 0, 9, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 7, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0 |];
45suc = [ { 4, 12, 24 },
46 { 5, 6, 19 },
47 { 35 },
48 { 7, 11, 30 },
49 { 14, 17, 52 },
50 { 9, 15, 16 },
51 { 8, 10 },
52 { 34 },
53 { 44 },
54 { 20, 31, 42 },
55 { 26 },
56 { 13, 21, 29 },
57 { 18, 22 },
58 { 32, 49 },
59 { 40, 46, 55 },
60 { 46 },
61 { 27, 41 },
62 { 38 },
63 { 25, 60 },
64 { 23 },
65 { 31 },
66 { 48 },
67 { 38, 39, 54 },
68 { 28 },
69 { 37 },
70 { 58 },
71 { 33, 36, 51 },
72 { 49 },
73 { 43, 57 },
74 { 33, 47 },
75 { 45, 48 },
76 { 50 },
77 { 54 },
78 { 57 },
79 { 50 },
80 { 38, 57 },
81 { 39 },
82 { 47 },
83 { 47 },
84 { 53 },
85 { 51 },
86 { 56 },
87 { 51, 58 },
88 { 46 },
89 { 55 },
90 { 52 },
91 { 58 },
92 { 55 },
93 { 54 },
94 { 56 },
95 { 53 },
96 { 60 },
97 { 56 },
98 { 59 },
99 { 60 },
100 { 59 },
101 { 59 },
102 { },
103 { },
104 { } ];
105
106%-----------------------------------------------------------------------------%
107% Model variables.
108%
109% s: start times
110% end: total end time (makespan)
111%
112array [ 1..n_tasks ] of var 0..sum_d: s;
113var 0..sum_d: end;
114
115
116%-----------------------------------------------------------------------------%
117% Constraints.
118%
119% successor constraints
120constraint
121 forall ( i in 1..n_tasks, j in suc[i] )
122 (
123 s[i] + d[i] <= s[j]
124 );
125
126% cumulative resource constraints
127constraint
128 forall ( i in 1..n_res )
129 (
130 cumulative(
131 s,
132 d,
133 [ rr[i,j] | j in 1..n_tasks ],
134 rc[i]
135 )
136 );
137
138% makespan constraints
139constraint
140 forall ( i in 1..n_tasks )
141 (
142 s[i] + d[i] <= end
143 );
144
145%-----------------------------------------------------------------------------%
146% Objective.
147%
148solve
149 :: int_search( s, smallest, indomain_min, complete )
150 minimize end;
151
152output [
153 "s = ",
154 show( s ),
155 ";\n",
156 "end = ",
157 show( end ),
158 ";\n"
159];
160
161%-----------------------------------------------------------------------------%
162%%% EOF %%%
163