Skip to content

iff with more than two arguments: the arguments after the second one are ignored #74

Closed

Description

@szczepanskiNicolas

With three arguments, the constraint iff is handled by cosoco 2.6.1 as if only its first two arguments were given.

<instance format="XCSP3" type="CSP">
  <variables>
    <var id="a"> 0 1 </var>
    <var id="b"> 0 1 </var>
    <var id="c"> 0 1 </var>
  </variables>
  <constraints>
    <intension> iff(a,b,c) </intension>
  </constraints>
</instance>

Observed: with cosoco model.xml -model=2 -nbsols=0, the solutions are:

<values> 0 0 0 </values>
<values> 0 0 1 </values>
<values> 1 1 0 </values>
<values> 1 1 1 </values>

that is to say all the tuples where a = b, whatever the value of c.

Expected: the value of c should be taken into account. The specification writes x1 ⇔ ... ⇔ xr (Table 4.1 of XCSP3-Core); ACE considers that all the arguments must be equivalent (solutions 0 0 0 and 1 1 1), and CHOCO computes a ⇔ (b ⇔ c) (solutions 0 0 1, 0 1 0, 1 0 0, 1 1 1). The semantics is discussed in xcsp3team/pycsp3#102, but in both cases, c matters.

In PyCSP3: satisfy(iff(x > 0, y > 0, b)).

Tests: test_xor_iff_imply[COSOCO-iff(x > 0, y > 0, b)] in pycsp3/tests/test_constraints_intension.py of xcsp3team/pycsp3.

Results of the other solvers

On the instance above (with java -jar ACE-2.6.jar model.xml -s=all -xe -xc=false and java -cp choco-parsers-4.10.15-beta.jar org.chocosolver.parser.xcsp.ChocoXCSP model.xml -a -f -flt):

  • ACE gives 2 solutions: (0, 0, 0), (1, 1, 1) (all the arguments are equivalent);
  • CHOCO gives 4 solutions: (0, 0, 1), (0, 1, 0), (1, 0, 0), (1, 1, 1) (a ⇔ (b ⇔ c)).

Both take the third argument into account, but they do not agree on the semantics (see xcsp3team/pycsp3#102).


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

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 (Intension)Section Constraints (Intension) of the APIbugSomething isn't workingiffOperator iff of XCSP3unit-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