Closed frestyle closed 3 weeks ago
Thanks for pointing out the issue.
In general, if you have an XCSP3 instance (file), as e.g., TestAllEqual.xml:
<instance format="XCSP3" type="CSP">
<variables>
<array id="x" size="[5][3]">
<domain for="x[0][0] x[0][2] x[1][0] x[1][2] x[2][0] x[2][2] x[3][0] x[3][2] x[4][0] x[4][2]"> 0 1 2 3 4 5 6 7 8 9 </domain>
<domain for="x[][1]"> 0 </domain>
</array>
</variables>
<constraints>
<allEqual> x[][1] </allEqual>
</constraints>
</instance>
If you use the option "-ev"
java ace TestAllEqual.xml -ev
you get the trace where the problem rises:
java.lang.Exception
at utility.Kit.control(Kit.java:169)
at utility.Kit.control(Kit.java:179)
at constraints.global.AllEqual.<init>(AllEqual.java:97)
at problem.Problem.allEqual(Problem.java:1644)
at problem.XCSP3.buildCtrAllEqual(XCSP3.java:461)
at org.xcsp.parser.loaders.CtrLoaderInteger.allEqual(CtrLoaderInteger.java:415)
at org.xcsp.parser.loaders.CtrLoaderInteger.load(CtrLoaderInteger.java:202)
at org.xcsp.parser.callbacks.XCallbacks.loadCtr(XCallbacks.java:542)
at problem.XCSP3.loadCtr(XCSP3.java:345)
at org.xcsp.parser.callbacks.XCallbacks.loadConstraints(XCallbacks.java:444)
at org.xcsp.parser.callbacks.XCallbacks.loadConstraints(XCallbacks.java:422)
at org.xcsp.parser.callbacks.XCallbacks.loadInstance(XCallbacks.java:305)
at org.xcsp.parser.callbacks.XCallbacks.loadInstance(XCallbacks.java:328)
at problem.XCSP3.model(XCSP3.java:159)
at problem.Problem.<init>(Problem.java:720)
at main.Head.buildProblem(Head.java:400)
at main.Head.solveInstance(Head.java:431)
at main.Head.run(Head.java:447
Here, the problem is the control made at line 97 of AllEqual.java
If we replace, values.length >1
by values.length >=1
, the problem is fixed (the propagator is fine for this extreme case).
You can also write if solve(options="ev") is SAT
or in you code, ace.setting("-ev")
This has been fixed (and pushed) in the code on Github for ACE. (note that you can build a jar instance from this repository, and replace the jar from the PyCSP3 distribution, if deployed on your machine).
This will be part of the next PyCSP3 version (including Pypi one) that is planned around the beginning of september.
Best.
Thank you so much for fixing this issue! really appreciate.
When using the ACE solver with PyCsp3, the
AllEqual
constraint (orNValues == 1
) fails if a domain variable is limited to one value. This issue occurs even when the constraint should be satisfied trivially.Steps to Reproduce
VarArray
where one column has a single-value domain.AllEqual
constraint to the single-value column.Example Code
Current Behavior
The ACE solver fails to solve the model, producing the following error:
Expected Behavior
The solver should recognize that the
AllEqual
constraint is trivially satisfied for the column with a single-value domain and proceed to solve the rest of the model.Additional Context
Environment
Questions
Thank you for your assistance in resolving this problem.