# How to include a variable lead time in a rolling horizon?

• 4 replies
• 202 views

• Newcomer
• 1 reply
Hi,

For my graduation product, I am modelling a production planning system in the context of a rolling horizon. The model can allocated products to plant A and plant B, based on the expected demand for the upcoming periods. Plant A has a production lead-time of 1 week and plant B has a production lead-time of 2 weeks.

Note that for some products, it is cheaper to produce at plant A, whereas for other products, it is cheaper to produce at plant B.

I formulated the following constraint in AIMMS to update the inventory:
Inventory(p,h)=Inventory(p,h-1)-sum(r,ProductionRelease(p,r,h-LeadTime(r)))+LostSales(p,h)

In which p refers to the set of products, h to the horizon, and r to the set of plants. The LeadTime(r) is modeled as a parameter and takes value 1 for plant A and value 2 for plant B.

However, with this constraint, AIMMS always allocates all products to plant A.

When modelling the inventory constraint by:
Inventory(p,h)=Inventory(p,h-1)-sum(r,ProductionRelease(p,r,h-1))+LostSales(p,h)
the model does allocate some products to plant A and some to plant B (when production is cheaper at plant A, the product are allocated to plant A and otherwise to B.
Additionally, the first-formulated constraint (unnecessary) counts Lost sales, while the second constraint does not count them (even if the products are allocated to the same plant).

My questions:
• Why does the model behave less optimal by included the first constraint compared to the second constraint?
• How to correctly include a plant-dependent lead time in the horizon?
Thank you a lot!!

Regards,
Eva

### 4 replies

Userlevel 5
+5
@evavanesseveldt , to provide more information regarding your problem - it would be very helpful to look at your AIMMS project. Can you share that after zipping the entire project folder ? Along with the data case file ?
@Jess Es , unfortunately the problem is not solved yet. Correct solutions are obtained when including a fixed lead-time of 1 (or e.g. 2). However is does not function when including the parameter LeadTime(r).
Userlevel 6
+6
Hi @evavanesseveldt - just wondering if this worked for you? Or did you find another solution you could share?
Userlevel 4
+3
Hi Eva,

Your syntax looks correct. From the piece of information here, it is hard to explain the result.

However, AIMMS provides diagnostic tools to help you find out why the model does not work as expected. In your case, you may use MPI to check if the constraint is generated correctly.

To use MPI, you need first solve your model, and then go to menu Tools->Diagnostic Tools -> Math Program Inspector, where you can see all the generated constraints and variables. You can find each constraint, open each node and see if the individual constraint is generated as expected.

If you could not solve the problem, you can share your AIMMS project here.

### Reply

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