this repo has no description
at develop 1.1 kB view raw
1include "gbac.mzn"; 2include "restart.mzn"; 3 4predicate int_eq_imp(var int: x, var int: y, var bool: b); 5predicate bool_eq_imp(var bool: x, var bool: y, var bool: b); 6 7predicate random_allocation(var bool: b) = forall(i in courses) ( 8 int_eq_imp(period_of[i], sol(period_of[i]), b /\ (uniform_internal(1,100) < 80)) 9); 10 11predicate free_period(var bool: b) = let { 12 var int: period = uniform_internal(periods); 13 } in forall(i in courses) ( 14 int_eq_imp(period_of[i], sol(period_of[i]), b /\ (sol(period_of[i]) != period)) 15 ); 16 17% Round Robin 18array[1..2] of var bool: nbh; 19constraint random_allocation(nbh[1]); 20constraint free_period(nbh[2]); 21var 1..2: select; 22constraint lastval(select) mod 2 + 1 = select; 23constraint bool_eq_imp(nbh[1], false, status() == START); 24constraint bool_eq_imp(nbh[2], false, status() == START); 25constraint bool_eq_imp(nbh[1], select == 1, status() != START); 26constraint bool_eq_imp(nbh[2], select == 2, status() != START); 27 28annotation main_vars(array[int] of var int: vars); 29 30solve 31 :: int_search(period_of,first_fail,indomain_min,complete) minimize objective;