I have a working GAMS optimization model using LP. I want to modify one of my equations so that it excludes one of the terms when t = 1. Here's the simplification of this problem:
Set t "time in hours" / 1 * 8760/ ;
If t = 1: vDemand(t) =e= p1*(vInternal(t) - pAmbient(t))
else: vDemand(t) =e= p1*(vInternal(t) - pAmbient(t)) p2*(vInternal(t) - vInternal(t-1))
How do I modify this vDemand equation while keeping my optimization linear?
I looked up and tried the different ways to incorporate conditional statements on GAMS, but not successful so far.
CodePudding user response:
vDemand(t) =e= p1*(vInternal(t) - pAmbient(t)) (p2*(vInternal(t) - vInternal(t-1)))$(ord(t)>1);
The $
condition at the end of the second term makes sure, that that part is only used, if it is not the first element of the set t
.