You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using gecode solver with a model that imports globals.mzn raises several import related warnings, and according to the constraints used might lead to syntactic errors. My feeling is that, when gecode is used, libraries that the system uses are not aligned with their counterparts in minizinc, resulting in clashes among the functions and predicates definitions. The cbc solver doesn't seems to have the same problem.
I'm not familiar enough with minizinc internals to really track down the real issue.
Steps to reproduce
Use gecode solver for a model that requires standard library predicates, e.g.:
% nqueens.mzn
include "globals.mzn";
int: n = 8;
array[1..n] of var 1..n: queens;
constraint all_different(queens);
constraint all_different([queens[i]+i | i in 1..n]);
constraint all_different([queens[i]-i | i in 1..n]);
solve satisfy;
The model can be solved with the minizic distribution downloaded from minizinc.org or their online playground but fails on nixpkgs#minizinc:
❯ nix run nixpkgs#minizinc -- nqueens.mzn --solver gecode
...
Error: type error: no functionor predicate with this signature found: `global_cardinality(array[int] of var opt int,array[int] of int,array[int] of var int)'Cannot use the following functions or predicates with the same identifier:function array [$Y] of var int : global_cardinality(array [$X] of var $$E: x,array [$Y] of $$E: cover):: promise_total; (requires 2 arguments, but 3 given)function array [$Y] of var int : global_cardinality(array [$X] of var opt $$E: x,array [$Y] of $$E: cover):: promise_total; (requires 2 arguments, but 3 given)predicate global_cardinality(array [int] of var int: x,array [int] of int: cover,array [int] of var int: counts); (argument 1 expects type array[int] of var int, but type array[int] of var opt int given)/nix/store/irhwkcrl1p5741kf5ab1yifdqf24qls6-minizinc-2.8.7/share/minizinc/std/global_cardinality_fn.mzn:20.20-66
Warning: included file "sum_pred.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "sort.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "roots.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "regular.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "range.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "partition_set.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "nvalue.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "link_set_to_booleans.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "inverse_set.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "inverse.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "int_set_channel.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "global_cardinality_low_up_closed.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "global_cardinality_low_up.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "global_cardinality_closed.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "global_cardinality.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "distribute.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "disjunctive_strict.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "disjoint.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "diffn.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: included file "cumulative.mzn" overrides a global constraint file from the standard library. This is deprecated. For a solver-specific redefinition of a global constraint, override "fzn_<global>.mzn" instead.Warning: Further warnings have been suppressed.Error: type error: no function or predicate with this signature found: `global_cardinality(array[int] of var opt int,array[int] of int,array[int] of var int)'Cannot use the following functions or predicates with the same identifier:function array [$Y] of var int : global_cardinality(array [$X] of var $$E: x,array [$Y] of $$E: cover):: promise_total; (requires 2 arguments, but 3 given)function array [$Y] of var int : global_cardinality(array [$X] of var opt $$E: x,array [$Y] of $$E: cover):: promise_total; (requires 2 arguments, but 3 given)predicate global_cardinality(array [int] of var int: x,array [int] of int: cover,array [int] of var int: counts); (argument 1 expects type array[int] of var int, but type array[int] of var opt int given)/nix/store/irhwkcrl1p5741kf5ab1yifdqf24qls6-minizinc-2.8.7/share/minizinc/std/global_cardinality_fn.mzn:20.20-66
Nixpkgs version
Describe the bug
Using
gecode
solver with a model that importsglobals.mzn
raises several import related warnings, and according to the constraints used might lead to syntactic errors. My feeling is that, whengecode
is used, libraries that the system uses are not aligned with their counterparts inminizinc
, resulting in clashes among the functions and predicates definitions. Thecbc
solver doesn't seems to have the same problem.I'm not familiar enough with
minizinc
internals to really track down the real issue.Steps to reproduce
Use
gecode
solver for a model that requires standard library predicates, e.g.:The model can be solved with the
minizic
distribution downloaded from minizinc.org or their online playground but fails onnixpkgs#minizinc
:Solving with
cbc
works as expected:❯ nix run nixpkgs#minizinc -- nqueens.mzn --solver cbc queens = [3, 7, 2, 8, 5, 1, 4, 6]; ----------
Same problem in Linux and OSX
Expected behaviour
gecode
should solve the model without errorsScreenshots
No response
Relevant log output
Additional context
No response
System metadata
"x86_64-darwin"
Darwin 22.6.0, macOS 10.16
yes
no
nix-env (Nix) 2.24.12
"nixpkgs"
/nix/var/nix/profiles/per-user/root/channels/nixpkgs
Notify maintainers
@sheenobu
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE
.)I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: