I have a variable, that should only have a value under certain conditions, so it needs to be an optional variable, I suppose. If that condition is met, the optional variable should be restricted to elements of a set.
The problem is, that MiniZinc does not seem to like optional variables and sets.
How can this be rewritten, so that MiniZinc does not complain?
enum TYPES = { TYPE1, TYPE2 };
enum SUBTYPES = { SUBTYPE1, SUBTYPE2, SUBTYPE3, SUBTYPE4 };
var TYPES: mytype;
var opt SUBTYPES: subtype; % if "opt" is removed, it works
constraint mytype=TYPE1 -> subtype in { SUBTYPE1, SUBTYPE3 };