Skip to main content
Solved

Constraint with lagged index

  • June 7, 2024
  • 2 replies
  • 28 views

rahmat
Forum|alt.badge.img+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

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,

 

Chris

2 replies

Chris Kuip
AIMMSian
Forum|alt.badge.img+7
  • AIMMSian
  • 125 replies
  • Answer
  • June 7, 2024

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,

 

Chris


rahmat
Forum|alt.badge.img+4
  • Author
  • Ace
  • 33 replies
  • June 7, 2024

@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