Solved

Questions about specific summation

  • 10 April 2020
  • 4 replies
  • 52 views

Hello everyone, 

I face some issues to implement a constraint on AIMMS. 

Just to introduce you the problem: 

Y(o,l,t) is a binary variable which is equal to 1 if a liquid l (a beer) is ready in tank o at period t;

Delta(l) is the fermentation time for a liquid l;

How can I implement this constraint? 

Thank you for your help. 

Regards

icon

Best answer by mohansx 13 April 2020, 02:43

@amadeodum , you are right. You should use the ord function but only in the sum condition. The t-t’ in the variable will act as a lead/lag operator. 

 

Try the below and let me know if that works as you expect or not

sum[(l,u)|ord(u)<=FermTime(l), Y(o,l,t-ord(u)] <= 1
View original

4 replies

Userlevel 4

@amadeodum , I assume you want this constraint to apply for all (o, t) and Delta(l) is a parameter? If yes, then the index domain of your constraint must be 

(o,t)

Declare a second index t’ in your set of time periods as described here: https://how-to.aimms.com/Articles/184/184-use-multiple-indices-for-set.html

Now your constraint definition can be 

sum[(l, t’)|(t’ <= Delta(l)), Y(o, l, t - t’)] <= 1

I am assuming that your set L starts from 1 and set T starts from 0. 

@mohansx thank you for your answer. 

Your assumptions are right, I forgot to mention it. 

However, it does not work when I implement your constraint in AIMMS. 

(I replace t’ by u and Delta(l) by FermTime(l)). 

 

Shouldn’t I write the following code: 

sum[(l,u)|ord(u)<=FermTime(l), Y(o,l,ord(t)-ord(u)] <= 1

Or does it change the meaning of the constraint? 

 

Regards,

Userlevel 4

@amadeodum , you are right. You should use the ord function but only in the sum condition. The t-t’ in the variable will act as a lead/lag operator. 

 

Try the below and let me know if that works as you expect or not

sum[(l,u)|ord(u)<=FermTime(l), Y(o,l,t-ord(u)] <= 1

@mohansx It works!

Thank you for your help :) 

Reply


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

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