Skip to content

maximum and minimum: (ne,k) fails #34

Open

Description

@szczepanskiNicolas

ACE fails on the constraints maximum and minimum with the condition (ne,k), k being an integer.

<instance format="XCSP3" type="CSP">
  <variables>
    <array id="x" size="[3]"> 0..3 </array>
  </variables>
  <constraints>
    <maximum>
      <list> x[] </list>
      <condition> (ne,2) </condition>
    </maximum>
  </constraints>
</instance>

The expected solutions are the 45 tuples of 0..3³ whose maximum is not 2.

Solver Command Result
ACE (83e8b60) java -jar ACE.jar m.xml -s=all -xe -xc=false fails: ! ERROR (use -ev for more details)
CHOCO (4.10.15) java -cp choco-parsers.jar org.chocosolver.parser.xcsp.ChocoXCSP m.xml -a -f -flt correct: 45 solutions
cosoco (2.6.1) cosoco m.xml -model=2 -nbsols=0 wrong: 19 wrong solutions, those of (eq,2) (xcsp3team/cosoco#99)

The same with <minimum> (57 expected solutions). With -ev:

java.lang.AssertionError: NE is not implemented
	at constraints.global.Extremum$ExtremumCst.buildFrom(Extremum.java:579)
	at problem.Problem.extremum(Problem.java:3152)
	at problem.Problem.maximum(Problem.java:3210)

Cause: ExtremumCst.buildFrom() handles LT, LE, GE, GT and EQ, and throws AssertionError("NE is not implemented") otherwise (// TODO useful to have a propagator?), whereas (ne,y), y being a variable, is accepted: in Problem.extremum(), a condition with a variable other than EQ goes to the generic case at the end of the method (simplifyComplexCondition()). The condition (ne,k) could be handled in the same way, or refused with a message saying that it is not implemented.

This issue was found by the unit tests of PyCSP3: xcsp3team/pycsp3#243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Constraints (Global)Section Constraints (Global) of the APIbugSomething isn't workingmaximumminimumunit-testsFound by the unit tests of pycsp3 (pycsp3/tests)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions