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.

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

**Best answer by deannezhang**

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