Search code examples
booleanoperatorsminizinc

'And', 'Or' operators in Minizinc?


This is probably an easy answer, like no there are is no 'or' or 'and' operators in Minizinc, but I can't seem to find anything related to it on google.

In most programming languages you can do this:

boolean s = (a != 1 && b != 2);

But nowhere can I find a Minizinc version of this statement, like: constraint a != 1 and b != 2;

Cheers


Solution

  • The disjunction (or) and conjunction (and) are written in MiniZinc as \/ and /\ respectively.

    So your example should be written as

    constraint a != 1 /\ b != 2;
    

    See a little more here: https://www.minizinc.org/doc-2.5.5/en/modelling2.html?highlight=conjunction