this repo has no description
1/*** 2!Test 3expected: 4- !Result 5 solution: !Solution 6 _output_item: | 7 [4, 10] 8 {4,10,13} 9 {1,3,4} 10 depot(a,4). 11 depot(c,10). 12 13***/ 14 15% Regression test. 16% The bounds inferred for absolute values expressions where incorrect in r13710 17% and before. 18 19int: nr; % number of restaurants 20set of int: Restaurant = 1..nr; 21array[Restaurant] of string: name :: add_to_output; 22 23array[Restaurant] of 0..910: k; % kilometre position 24set of int: ks :: add_to_output = { k[r] | r in Restaurant }; 25 26set of Restaurant: first :: add_to_output = { min(r in Restaurant where k[r] == pos)(r) | pos in ks }; 27 28int: number_of_depots; 29set of int: Depot = 1..number_of_depots; 30array[Depot] of var 0..910: p :: add_to_output; % position of depot 31 32constraint forall(d in Depot)(p[d] in ks); 33constraint forall(d in 1..number_of_depots-1)(p[d] < p[d+1]); 34 35solve minimize sum(r in Restaurant)(min(d in Depot)(abs(p[d] - k[r]))); 36 %satisfy; 37 38output [ show(p), "\n", show(ks), "\n", show(first), "\n"]++ 39 [ if (fix(p[d]) == k[r]) then 40 "depot(" ++ name[r] ++ "," ++ show(p[d]) ++ ").\n" 41 else "" endif | d in Depot, r in first ]; 42 43nr = 4; 44name = ["a", "b", "c", "d"]; 45k = [4,4,10,13]; 46 47number_of_depots = 2;