The syntaxis of if-else statement in minizinc is
if 〈boolexp〉 then 〈exp1〉 else 〈exp2〉 endif
But i need to use more than just one exp
for example
var int: a;
var int: b;
if 5==abs(5) then a = 5, b > 2 else a = 0 endif
In this case, I want to set a to 5 and impose a restriction on b to be greater than 2 when the condition is true. Unfortunately, the syntax only allows me to perform one operation at a time.
MiniZinc is a language based on logic. Although it is easy to fall into a mindset of “operations”, in MiniZinc it is better to think about relationships that you put in place.
This is all to say that in this case you can combine the two Boolean expressions using the “logical and” operation, /\
, to enforce both relationships.
For your specific example, you can write:
var int: a;
var int: b;
constraint if 5==abs(5) then a = 5 /\ b > 2 else a = 0 endif