Gecode / gecode

Generic Constraint Development Environment
https://www.gecode.org
Other
275 stars 76 forks source link

fzn-gecode, maximum_arg, abort on co-occurrences #169

Open matsc-at-sics-se opened 1 year ago

matsc-at-sics-se commented 1 year ago

On Ubuntu 22.04.2 LTS.

$ cat /tmp/latest.mzn
include "globals.mzn";
var 1..2 union 4..6: A;
var 1..7: B;
var 1..3 union 5..7: C;
var 1..1 union 7..7: D;
var 1..4 union 6..7: E;
constraint
maximum_arg([C,B,D,A,E],A);
$ minizinc /tmp/latest.mzn
Error: Gecode: Int::argmax: Argument array contains same variable multiply
zayenz commented 1 year ago

This is a good point, in Gecode when used directly we require that arrays do not have shared variables for many constraints. Usage from a modelling system like MiniZinc (that does lots of common subexpression elimination) is different.

We should most likely make sure that all constraints posted form the registry are unshared beforehand.