this repo has no description
at develop 942 B view raw
1include "gbac.mzn"; 2%-----------------------------------------------------------------------------% 3% Objective 4%-----------------------------------------------------------------------------% 5 6function int: uniform_set(set of int: S) = 7 if card(S) == max(S) - min(S) + 1 then 8 uniform(min(S),max(S)) 9 else 10 [ i | i in S ][uniform(1,card(S))] 11 endif; 12 13 14predicate random_allocation() = 15 forall(i in courses) ( 16 (uniform(1,100) < 80) -> (period_of[i] == sol(period_of[i])) 17 ); 18 19predicate free_period() = 20 let { 21 int: period = uniform_set(periods); 22 } in forall(i in courses) ( 23 (sol(period_of[i]) != period) -> (period_of[i] == sol(period_of[i])) 24 ); 25 26predicate LNS(int: choice) ::export = 27 objective < sol(objective) /\ 28 if choice == 0 then 29 free_period() 30 else 31 random_allocation() 32 endif; 33 34constraint output_this([objective] ++ period_of); 35solve :: int_search(period_of,first_fail,indomain_min,complete) satisfy;