this repo has no description
1% RUNS ON mzn20_fd 2% RUNS ON mzn-fzn_fd 3% RUNS ON mzn20_mip 4 5% mzn2fzn and minizinc aborted on this model with an error message about 6% being unable to compute set bounds. This was fixed in r8782. 7% (This is derived from the talent scheduling model in the MiniZinc 8% benchmarks.) 9 10include "all_different.mzn"; 11 12int: numActors; % number of actors 13int: numScenes; % numer of scenes 14 15%-- Types --------------------------------------------------------------------- 16set of int: Actors = 1..numActors; 17set of int: Scenes = 1..numScenes; 18 19array[Actors,Scenes] of 0..1: ia; % 01 definition of actors in scenes 20array[Scenes] of set of Actors: a = 21 [ { j | j in Actors where ia[j,i] == 1} | i in Scenes] ; % actors for each scene 22array[Scenes] of int: d; % duration of each scene 23array[Actors] of int: c; % cost of each actor 24 25numScenes = 6; 26numActors = 4; 27ia = [| 281,0,0,0,1,1| 291,1,0,1,0,0| 300,1,1,0,1,0| 310,0,1,1,0,1|]; 32c = [1,1,1,1]; 33d = [1,2,3,4,5,6]; 34 35%-- Decision variables -------------------------------------------------------- 36 37array[Scenes] of var Scenes: s; % schedule of scenes 38 39%-- Auxilliary variables ------------------------------------------------------ 40 41array[Scenes] of var set of Actors: bef; % actors appearing before time t 42array[Scenes] of var set of Actors: aft; % actors appearing after time t 43array[Scenes] of var set of Actors: dur; % actors on set at time t 44 45var int: cost; 46 47%-- Constraints --------------------------------------------------------------- 48 49constraint all_different(s); % each scene scheduled once 50 51constraint 52 bef[1] = {} /\ % no actors before time 1 53 aft[numScenes] = {} /\ % no actors after time numScenes 54 forall(t in 1..numScenes-1)( 55 bef[t+1] = a[s[t]] union bef[t] /\ 56 aft[t] = a[s[t+1]] union aft[t+1] ); 57 58constraint 59 dur[1] = a[s[1]] /\ 60 forall(t in 2..numScenes-1)( 61 dur[t] = bef[t+1] intersect aft[t] 62 ) /\ 63 dur[numScenes] = a[s[numScenes]]; 64 65constraint cost = sum(i in Scenes)( 66 sum(j in Actors)( 67 c[j] * d[s[i]] * bool2int(j in dur[i]) 68 ) 69 ); 70 71%-- symmetry breaking constraint 72constraint s[1] < s[numScenes]; 73 74%-- Solving objective and solution output ------------------------------------- 75 76solve :: int_search(s, first_fail, indomain, complete) 77 minimize cost; 78 79output ["cost = ", show(cost), ";\ns = ", show(s), 80 ";\ndur = ", show(dur), 81 ";\nbef = ", show(bef), 82 ";\naft = ", show(aft), 83 ";\na = ", show(a), 84 ";\n"];