Please I am trying to add an if else statement to may code by I get an error (Number Primary Expected)
here is the if else statement that I wanna add
If (g(t) =g= d(t),
stored(t)= g(t)-d(t) ;
discharged(t)=0;
else
discharged(t)=d(t)-g(t);
stored(t)=0 ;
) ;
Please help
–
SizingAlmostSolved testing.gms (3.89 KB)
Hi Asmae:
Since the value of discharged and stored is fixed by this equations which only include parameters, they can be parameters (which allows to do this logical assignment). I’ve turned this variables into parameters, moved the assignment where it should go and rewrote it correctly. Seems to be working correctly.
Regards!
Claudio
PS: Name addition was beacuse I thought this was a disjunction and was thinking about using LOGMIP.
On Tue, Mar 4, 2014 at 9:49 AM, Lp wrote:
Please I am trying to add an if else statement to may code by I get an error (Number Primary Expected)
here is the if else statement that I wanna add
If (g(t) =g= d(t),
stored(t)= g(t)-d(t) ;
discharged(t)=0;
else
discharged(t)=d(t)-g(t);
stored(t)=0 ;
) ;
Please help
–
SizingAlmostSolved testingLOGMIP.gms (3.91 KB)