Multiple conditions in $Ifthen

Hi GAMS friends,

I used $ifthen dollar conditions to activate the equation constraints. But when there are more than 2 such constraints, the code did not work as expected.

For example, I have two values to be satisfied (LCFSindex and carbonindex) in order to show the set. The example code is attached below. However, I cannot activate the display even if I have the right condition in the model (–LCFSindex=1.3 --carbonindex=0 ). Did I miss anything when put this dollar condition?

Thanks,
Jia

set a/1/
$ifthen  (%LCFSindex%==1.3 and  %carbonindex%==0)
display a
$endif

The regular $ifThen does a string comparison, if you want to evaluate an expression, you need to use $ifThenE (https://www.gams.com/latest/docs/UG_DollarControlOptions.html#INDEX__25_ifThenE_2d__21_dollar_21_control_21_option):

$set LCFSindex 1.3
$set carbonindex 0

set a/1/
$ifThenE (%LCFSindex%=1.3)and(%carbonindex%=0)
display a
$endif

You can’t have any spaces in the expression, so make intensive use of ().

-Michael

Thanks Michael!