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