Skip to content

MZN 2.5.3 flattening bug: xorall #451

Closed

Description

@matsc-at-sics-se

Illustration:

$ cat foo.mzn
var 0..1: A;
var 0..1: B;
constraint
    xorall(p in [A=1])(p) <-> B=1;
$ minizinc -c foo.mzn 
$ minizinc -a foo.mzn 
A = 1;
B = 1;
----------
==========
$ cat foo.fzn
var 1..1: A;
var 1..1: B;
solve  satisfy;

There should be a second solution: A=0, B=0. The flattener does some invalid transformation, it seems. The bug surfaces for lists of length greater than one as well.

Activity

  1. matsc-at-sics-se commented on Jan 27, 2021

    @matsc-at-sics-se
    Author

    It's more general than that. The bug surfaces if you replace xorall by exists or forall as well.

  2. zayenz commented on Jan 28, 2021

    @zayenz
    Contributor

    As an additional data-point, breaking out the array comprehension into it's own variable like this

    var 0..1: A;
    var 0..1: B;
    array [1..1] of var bool: X = [A=1];
    constraint xorall(X) <-> B=1;
    

    gives the expected behavior with two solutions.

  3. added a commit that references this issue on Mar 5, 2021
    d5d5d0d
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions