Skip to main content
Dear all,



In my model, I work with multiple factories. Each factory has a minimum lotsize requirement, meaning that IF a product run is initiated, it must be at least xxx big. I tried to put it in as follows:




  • I have a parameter MinimumSKULotsize(f), which specifies the minimum lotsize per factory;
  • I have a binary variable ProductInFactory(f,p,t), where 1 indicates a production run of that product at that factory in that time unit, and 0 does not.
  • I have a variable ProductionAllocation(p,f,t) which indicates how much of each product is allocated to which factory at which time unit.

I tried to add the constraints:



SKULotsizeConstraint0 with index (f,p,t) | ProductInFactory(f,p,t) = 0 and definition

ProductionAllocation(f,p,t) = 0



SKULotsizeConstraint1 with index (f,p,t) | ProductInFactory(f,p,t) = 1 and definition

ProductionAllocation(f,p,t) >= MinSKULotsize(f)



However, I am getting the warning: Warning: The index domain contains the variable "ProductInFactory". The use of a variable in an index domain is not allowed.



Before this, I tried to do it with an if-statement, but then I was also met with several errors. My question is: how could I correctly apply such a constraint in this situation?



Kind regards,



Koen

HI @ardhanaa. You cannot formulate this in one constraint or variable definition. You can reformulate it by using the following constraints:

sum[(i,m,t), x_jm(i,m,k,t)] >= b(k)
sum[(i,m,t), x_jm(i,m,k,t)] <= M * b(k)
UF(k) >= 0.7 * b(k)
UF(k) <= N * b(k)

Here b(k) is a (new) binary variable, and M and N are upper bounds on sums(i,m,t), x_jm(i,m,k,t)] and UF(k) respectively.


Koen,

Domain condition can only contain parameters. Variables cannot be used as domain condition. You need to linearize your constraint:

if ProductInFactory(f,p,t) = 0 then ProductionAllocation(f,p,t) = 0
if ProductInFactory(f,p,t) = 1 then ProductionAllocation(f,p,t) >= MinSKULotsize(f)

trying yourself first, if not people here can help

hello.. how to write the constraint like this in the model? should I write it in the constraint or in the variable?

In my model there is a binary variable x_jm(i,m,k,t) means that route selection from i to m using ship k in t time. And there is a positive variable UF(k) which is the Utilisation Factor of ship k. There are some ships in index k, not all of them to be selected/used. So once ship k (let’s say ship k1 and k2) are selected then those ships must have utilistation factor UF(k) above 0.7.

I put the constraint like below picture but there is a warning.

 

 

Could somebody help me how to write it in the model?

Thanks.

 

Regards,

Ardhana

 


Hi @KoenV did this answer your question? If so would you please mark "best answer" so others can find it easily? Thanks 🙂
Koen,



Domain condition can only contain parameters. Variables cannot be used as domain condition. You need to linearize your constraint:



if ProductInFactory(f,p,t) = 0 then ProductionAllocation(f,p,t) = 0

if ProductInFactory(f,p,t) = 1 then ProductionAllocation(f,p,t) >= MinSKULotsize(f)



trying yourself first, if not people here can 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