Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upstream] wrong number of solutions #84

Closed
blegat opened this issue Sep 4, 2024 · 6 comments · Fixed by #87
Closed

[upstream] wrong number of solutions #84

blegat opened this issue Sep 4, 2024 · 6 comments · Fixed by #87

Comments

@blegat
Copy link
Member

blegat commented Sep 4, 2024

CP experts told le during the presentation thatvthis should be 92, not 52. They checked writing the problem directly in MiniZinc and using Chuffed and they got 92 so it seems to be a problem in the minizinc writer here

@odow
Copy link
Member

odow commented Sep 4, 2024

I changed this when I updated to a newer version of Chuffed:
d3fef25

Let me take a look

@odow
Copy link
Member

odow commented Sep 4, 2024

The .mzn file is correct:

shell> cat test.mzn
var 1 .. 8: x1;
var 1 .. 8: x2;
var 1 .. 8: x3;
var 1 .. 8: x4;
var 1 .. 8: x5;
var 1 .. 8: x6;
var 1 .. 8: x7;
var 1 .. 8: x8;
var int: x9;
var int: x10;
var int: x11;
var int: x12;
var int: x13;
var int: x14;
var int: x15;
var int: x16;
var int: x17;
var int: x18;
var int: x19;
var int: x20;
var int: x21;
var int: x22;
var int: x23;
var int: x24;
constraint 1*x1 + -1*x9 = -1;
constraint 1*x2 + -1*x10 = -2;
constraint 1*x3 + -1*x11 = -3;
constraint 1*x4 + -1*x12 = -4;
constraint 1*x5 + -1*x13 = -5;
constraint 1*x6 + -1*x14 = -6;
constraint 1*x7 + -1*x15 = -7;
constraint 1*x8 + -1*x16 = -8;
constraint 1*x1 + -1*x17 = 1;
constraint 1*x2 + -1*x18 = 2;
constraint 1*x3 + -1*x19 = 3;
constraint 1*x4 + -1*x20 = 4;
constraint 1*x5 + -1*x21 = 5;
constraint 1*x6 + -1*x22 = 6;
constraint 1*x7 + -1*x23 = 7;
constraint 1*x8 + -1*x24 = 8;
constraint alldifferent([x1, x2, x3, x4, x5, x6, x7, x8]);
constraint alldifferent([x9, x10, x11, x12, x13, x14, x15, x16]);
constraint alldifferent([x17, x18, x19, x20, x21, x22, x23, x24]);
solve satisfy;
include "alldifferent.mzn";

and if I solve with Chuffed 0.13 in minizincIDE it also finds 52 solutions. So this is not a bug in MiniZinc.jl

@blegat
Copy link
Member Author

blegat commented Sep 5, 2024

The issue seems to be that var int: sets a lower bound of 0 by default while the slack variables should be allowed to be negative

@odow
Copy link
Member

odow commented Sep 5, 2024

I don't think that is true:
image

@odow
Copy link
Member

odow commented Sep 5, 2024

We updated in a big jump: chuffed/chuffed@0.10.4...0.13.2

I haven't bisected, but a scan of the issues shows:

and then this temporary fix:

I'll open an issue and discuss with them.

@odow
Copy link
Member

odow commented Sep 5, 2024

I've opened an issue in Chuffed: chuffed/chuffed#200. This is their bug. With the same .mzn file, other solvers like Gecode can find the correct number of solutions.

@odow odow changed the title Wrong number of solutions [upstream] wrong number of solutions Sep 5, 2024
@odow odow closed this as completed in #87 Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants