$ifThen set X or Y

Hello,

Is there a way to execute the following condition when solving a model?

$ifThen set X or Y
Solve MODEL using nlp minimizing OBJ;
$else
Solve MODEL using lp minimizing OBJ;
$endIf

X and Y are compilation variables, and either one exists at a time.

Thanks,
Zamry

No, the “$if set” only works on a single compile time variable name, not an expression. You can work around this by having a parallel set of numerical compile time variables and then use $ifThenE:

$set xset 0
$if set x $set xset 1
$set yset 0
$if set y $set yset 1
$log %xset%%yset%
$ifThenE (%xset%)or(%yset%)
Solve MODEL using nlp minimizing OBJ;
$else
Solve MODEL using lp minimizing OBJ;
$endIf

-Michael

Thanks Michael!