Constraint with lagged index

Userlevel 2
Badge +4

Dear All,

In a model, I have a constraint as:

y(g,t) - z(g,t) = u(g,t) - u(g,t-1) forall (g,t)


All variable are binary variable. g is a set of generator unit and t is a set of time. How to implement this constraint in AIMMS if there a three generator units and the time periods (t) are 1,2, and 3. For the initial condition, generator units #1 and #2 are off-line prior to the first time period indicated by the value of u = 0 while generator unit #3 is online indicated by the value of u = 1.


Thank you.


Best answer by Chris Kuip 7 June 2024, 07:55

View original

2 replies

Userlevel 5
Badge +7

Hi Rahmat,


To refer to the previous period of the first planning period, I usually use a parameter with initial data.


So let

    iu(g) := data { '#1' : 0, '#2' : 0, '#3' : 1 } ;

Then I can use it in a constraint like:
     y(g,t) - z(g,t) = 

     u(g,t) - if t = first( s_TimePeriods ) then iu(g) else u(g,t-1) endif


Hope this helps.


With kind regards,



Userlevel 2
Badge +4

@Chris Kuip 

Thank you for your very prompt reply. I’ll try this to the model.

Thank you.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator