Solved

limit a sum

  • 17 August 2019
  • 2 replies
  • 144 views

Hello,

my model has the following constraint:

s(i,j)*x(j)+sum((m,t_), MW(i,j,m,t_)*y(j,m,t_))+sum((k,t_),MWK(i,j,k,t_))+dM(i,j,t)-dP(i,j,t)=B(i,t)

The index domain is: (i,j,t)

I want the system to accumulate all MWK(i,j,k,t_) respectively all MW(i,j,m,t_)*y(j,m,t_) from t_0 until t_=t and then to add this solution to s(i,j)*x(j). Because t (periods) is already in the index domain I defined a second index t_ in the period set. Unfortunately the system sums up all MWK(i,j,k,t_) over all periods and add this in every t. So if there is a MWK(1,1,1,5)=1 then the system adds this also in t=0.
Is there any possibility to determine that the sum should start at t_=0 and end in t_=t?

Thanks in advance!
icon

Best answer by deannezhang 19 August 2019, 08:08

you can add condition in your sum (assuming you already have the set of t correctly ordered):

code:
s(i,j)*x(j)+sum((m,t_)|ord(t_)<= ord(t), MW(i,j,m,t_)*y(j,m,t_))+sum((k,t_),MWK(i,j,k,t_))+dM(i,j,t)-dP(i,j,t)=B(i,t)
View original

2 replies

Userlevel 3
you can add condition in your sum (assuming you already have the set of t correctly ordered):

code:
s(i,j)*x(j)+sum((m,t_)|ord(t_)<= ord(t), MW(i,j,m,t_)*y(j,m,t_))+sum((k,t_),MWK(i,j,k,t_))+dM(i,j,t)-dP(i,j,t)=B(i,t)
It works!
Thanks a lot!

Reply


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

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