Define a set for the domain of a variable


(O No1 Kraxtis) #1

I have defined a vector of angle signs. This vector can get only 1 and -1 values for positive and negative angles.

One way to express this, would be to define the variable as integer and then constraint it between -1 and +1 and finally exclude the 0 value with a different constraint. But this seems a total overkill.

Could I define somehow a set and then say something of the sort: Anglesigns PlusMinus ?


(Mark L. Stone) #2
variable angle_binary binary
angle_plus_or_minus_one_indicator = 2*angle_binary - 1