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.
on-restart-benchmarks/share/minizinc/g12_fd/all_different_int.mzn
Jip J. Dekker f2a1c4e389 Squashed 'software/mza/' content from commit f970a59b17
git-subtree-dir: software/mza
git-subtree-split: f970a59b177c13ca3dd8aaef8cc6681d83b7e813
2021-07-11 16:34:30 +10:00

22 lines
991 B
MiniZinc

%-----------------------------------------------------------------------------%
% Constrains the array of objects 'x' to be all different.
%-----------------------------------------------------------------------------%
predicate all_different_int(array[int] of var int: x) =
g12fd_int_all_different(x);
%-----------------------------------------------------------------------------%
% The implementation of the all_different constraint in the G12/FD solver.
% This should not be called directly, instead the definition above should
% be used.
predicate g12fd_int_all_different(array[int] of var int: x);
% G12/FD doesn't provide a reified all_different so we use the following
% definition if g12fd_int_all_different is called from a reified context.
%
predicate g12fd_int_all_different_reif(array[int] of var int: x, var bool: r) =
r <-> forall(i,j in index_set(x) where i < j) ( x[i] != x[j] );
%-----------------------------------------------------------------------------%