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.

15 lines
357 B
MiniZinc

include "alldifferent.mzn";
int: n;
array[1..n] of var 1..n: x; % sequence of numbers
array[1..n-1] of var 1..n-1: u; % sequence of differences
constraint alldifferent(x);
constraint alldifferent(u);
constraint forall(i in 1..n-1)(u[i] = abs(x[i+1] - x[i]));
solve :: int_search(x, first_fail, indomain_min)
satisfy;
output ["x = \(x);\n"];