1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.

38 lines
2.2 KiB
MiniZinc

% RUNS ON mzn20_fd
% RUNS ON mzn-fzn_fd
% RUNS ON mzn20_mip
% Regression test.
% The bounds inferred for absolute values expressions where incorrect in r13710
% and before.
int: nr; % number of restaurants
set of int: Restaurant = 1..nr;
array[Restaurant] of string: name;
array[Restaurant] of 0..910: k; % kilometre position
set of int: ks = { k[r] | r in Restaurant };
set of Restaurant: first = { min(r in Restaurant where k[r] == pos)(r) | pos in ks };
int: number_of_depots;
set of int: Depot = 1..number_of_depots;
array[Depot] of var 0..910: p; % position of depot
constraint forall(d in Depot)(p[d] in ks);
constraint forall(d in 1..number_of_depots-1)(p[d] < p[d+1]);
solve minimize sum(r in Restaurant)(min(d in Depot)(abs(p[d] - k[r])));
%satisfy;
output [ show(p), "\n", show(ks), "\n", show(first), "\n"]++
[ if (fix(p[d]) == k[r]) then
"depot(" ++ name[r] ++ "," ++ show(p[d]) ++ ").\n"
else "" endif | d in Depot, r in first ];
nr = 4;
name = ["a", "b", "c", "d"];
k = [4,4,10,13];
number_of_depots = 2;