Pulp Python: How to formulate a time-based variable for shipping demurrage

46 views
Skip to first unread message

Chris Price

unread,
Jun 10, 2020, 3:02:35 PM6/10/20
to pulp-or-discuss

I am working on a shipping optimisation problem that aims to minimise demurrage charges as a result of low/insufficient inventory.

I have daily vessel requirement (sales) data in the format sales[vessel_start_date][vessel][product_required_tonnes]. I also have the daily stock inventory level in the form port_inventory[date][product_availability_tonnes]

  • Demurrage is defined as: (total_days_in_port - laycan_days) * per_diem_charge. It is incurred when there is insufficient material at the port to load the vessel and the vessel's laycan period (vessel_start_date plus 10 days) has expired.
  • Each vessel takes two days to load. 
  • Each vessel can carry multiple products

As demurrage is only incurred if one or all elements of the vessel requirements are not satisfied I need to understand whether I need a binary variable and a decision var combination to understand which vessels incur demurrage. The model will inevitable have to allow some vessels to incur demurrage if they are cheaper than others.

I would be very grateful if anyone could help me formulate this expression in pulp or mathematically or even give me a steer. Many thanks.

Stuart Mitchell

unread,
Jun 10, 2020, 5:46:19 PM6/10/20
to pulp-or...@googlegroups.com
At a first glance I would have a binary variable defining vessel loading (start date)

The cost of this variable with include possible Demurrage,
And there will be a constraint that only one start date is 1 for a particular vessel.

Other constraints on product availability and loading capacity should be able to be formulated with these variables

Stu

Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru


--
New posters to this group are moderated which can take up to 48 hours, so please be patient if your first post takes a while to turn up.
---
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/4cca6adb-6c34-489c-ae85-77bbaa76e270o%40googlegroups.com.

Chris Price

unread,
Jun 11, 2020, 3:32:02 AM6/11/20
to pulp-or-discuss
Many thanks for your help Stuart.

Could you please describe how this binary variable would control the cost of demurrage if a vessel is waiting after its 10-day loading period?

Chris
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or...@googlegroups.com.

Chris Price

unread,
Jun 17, 2020, 6:32:58 AM6/17/20
to pulp-or-discuss
Circling back on this, could you please kindly show a brief example of how you would formulate this in Pulp?

Many thanks

Stuart Mitchell

unread,
Jun 17, 2020, 7:07:22 AM6/17/20
to pulp-or...@googlegroups.com
given this statement

Each vessel takes two days to load. 

Cost of X_{vessel, start-date} = (start-date+2 - laycan_days) * per_diem_charge.

Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru

To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/49246ab5-be9a-45ce-9964-e83a338b059co%40googlegroups.com.

Chris Price

unread,
Jun 17, 2020, 7:24:18 AM6/17/20
to pulp-or-discuss
Thank you Stuart. 

My question is, how can I calculate the difference between the two dates in pulp using variables? because pulp doesnt recognise datetime format?

Essentially I need to work out how to model the below:

vessel_ready_to_load[date][vessel]-vessel_actual_load_date[vessel]*per_diem_charge ==demurrage_charge[vessel]


Many thanks,
Chris


Stuart Mitchell

unread,
Jun 17, 2020, 6:07:58 PM6/17/20
to pulp-or...@googlegroups.com
Hi chris you need to be quite clear on what is a pulp variable and what is data.

Without knowing this it is hard to give advice

Stu

To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/a6713b9f-6c07-4262-968d-e137677915cbo%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages