Hello,
I have been solving a problem with AMPL (Knitro solver) where I create other variables based on the choice variables with If-then-else statements, for example (a few other variables are omitted for brevity):
var c1{i in N}= if (I[i]>=CutOff[i]) then ((Per1NetInc[i]/PweightC)+(Need/2)) else (omega1*(TotNetInc[i]/PweightC)+(Need/2)) ;
Here I[i] and another variable in CutOff[i] are the true choice variables. This has been working so far. Now, I am facing a situation where I have two cutoff values, this means that I would need something like the "elif" in Python or the nested if...else in R (
https://www.programiz.com/r-programming/if-else-statement).
Is a nested if-else statement possible in AMPL?
For example, could I write
var c1{i in N}= if (I[i]>CutOff1[i]) then (X1) else ( if (I[i]<CutOff2[i]) then (X2) else (X3) )?
Thank you so much for your time.
Regards,
Louis Perrault