In my model, I am tracking the production date of certain products. It is possible to produce a product at time t, while allocating it to demand on time t+3. However, there is a maximum ‘age’ of a product. For example ‘If a product is older that three days, it cannot be allocated’.
Now, given an allocation variable v_Allocate(i_Order, i_AllocationDay, i_Product, i_ProductionDay), indicating the allocation on day i_AllocationDay to order i_Order of i_Product which has production day i_Production day, I would like to restrict the index range to ‘valid’ combinations e.g. production day >= t-3.
If I would restrict the index domain on the variable like so:
index domain: (i_Order, i_AllocationDay, i_Product, i_ProductionDay) | i_ProductionDay >= i_AllocationDay - 3
Do I still need to add a separate constraint to ensure this production day restriction?
In addition: does it make sense to do this in the index domain?
Best answer by mohansxView original
Using index domain is a correct approach and is in fact more efficient than adding constraints to the model.
You might want to also add i_ProductionDay <= i_AllocationDay condition to the index domain condition so that you avoid combinations of allocation products produced in the future to an order in the past.
index domain: (i_Order, i_AllocationDay, i_Product, i_ProductionDay) | i_ProductionDay >= i_AllocationDay - 3 and i_ProductionDay <= i_AllocationDay