Thursday, April 30, 2009

If-then-else in AMPL/Cplex

I´m making my final project working with AMPL and nobody in my university can help me. […] The question is the following: I must take a decision over a variable, DECISION[n]. This variable can be a number between 0 to 64. I want to obtain another variable, RESULT[n], that if the first variable is Zero, the second one is zero too. In the other cases, must be 1. In C language it could be: if DECISION[n] =0 then RESULT[n]=0 (else RESULT[n]=1). i´m working with CPLEX.

E.g. using Cplex indicator constraints:

EQ{n in N}: RESULT[n]=0 ==> DECISION[n]=0 else DECISION[n]>=0.0001;

You really should get advise from your professor. He/she gets paid to help you with this.