# Vessel readiness notification (a list of 6 dates as a string in 'YYYY-MM-DD' format
vessel_notice_of_readiness_date = dict(
  zip(demurrage_df.index, demurrage_df['notice_of_readiness_date'])
)
# Decision Variable: Vessel Load Date
load_start_date = pulp.LpVariable.dicts(
  'Vessel Load Date',
  ((date, vessel) for date, vessel in demurrage_df.reset_index().set_index(['eta_date', 'vessel_name']).index),
  cat='Binary',
  lowBound=0,
  upBound=1
)
# Instantiate class
model = pulp.LpProblem('Demurrage Optimisation Test 1', pulp.LpMinimize)
# Objective Function
model += pulp.lpSum([
  demurrage_charge_vars[vessel]
  for vessel in demurrage_charge_vars]
), 'Minimise Demurrage'
# Omitted full logic for clarity's sake.
# Vessels can only load when material is available
for date, vessel, grade in sales_demand_by_vessel:
 model += port_inventory_vars[(date, grade)] >= sales_demand_by_vessel[(date, vessel, grade)] == load_start_date[(date, vessel)]
# Vessels can only load AFTER notice of readiness.
for date, vessel in load_start_date:
 model += load_start_date[(date, vessel)] >= vessel_notice_of_readiness_date[vessel]
 model += pulp.lpSum(load_start_date[vessel] - vessel_notice_of_readiness_date[vessel] * demurrage_per_day_charges[vessel]) == demurrage_charge_vars[vessel]
RecursionError Traceback (most recent call last) <ipython-input-567-cabf4432e589> in <module>
 77 # Vessels can only load AFTER notice of readiness.
 78 for date, vessel in load_start_date:
---> 79 model += load_start_date[(date, vessel)] >= vessel_notice_of_readiness_date[vessel]
 80 # model += pulp.lpSum(load_start_date[vessel] - vessel_notice_of_readiness_date[vessel] * demurrage_per_day_charges[vessel]) == demurrage_charge_vars[vessel]
https://stackoverflow.com/help/minimal-reproducible-example
That would really increase the chance of someone helping out since it greatly reduces the time invested for the person who answers.
F.
--
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/d3459c8a-d11f-4752-8fc6-f85b971a397do%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/CAOuNk4Z2S1n-rqAqD0zveNp8Z5-O8StgRo%3D6zpvGH5RW8BdTVw%40mail.gmail.com.
No change - still receiving same error?
On Sat, Jun 13, 2020 at 1:14 PM 'Stuart Mitchell' via pulp-or-discuss <pulp-or-discuss@googlegroups.com> wrote:
Remove the pulp.lpsum on line 80
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/d3459c8a-d11f-4752-8fc6-f85b971a397do%40googlegroups.com.
--
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-discuss+unsubscribe@googlegroups.com.
your code is still missing the dates
and grades
python variables to be defined.
Also, the the pandas, pulp and numpy library imports.
Is it possible that the date format is causing the error? Line 80 is comparing date strings in YYYY-MM-DD format - should I use an integer for comparing the dates?
On Saturday, June 13, 2020 at 5:11:13 PM UTC+1, Chris Price wrote:
No change - still receiving same error?
On Sat, Jun 13, 2020 at 1:14 PM 'Stuart Mitchell' via pulp-or-discuss <pulp-or...@googlegroups.com> wrote:
Remove the pulp.lpsum on line 80
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/d3459c8a-d11f-4752-8fc6-f85b971a397do%40googlegroups.com.
--
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/CAOuNk4Z2S1n-rqAqD0zveNp8Z5-O8StgRo%3D6zpvGH5RW8BdTVw%40mail.gmail.com.
--
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 a topic in the Google Groups "pulp-or-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pulp-or-discuss/GqDc8xI-Iyk/unsubscribe.
To unsubscribe from this group and all its topics, 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/98d9af14-50f6-4eb4-a440-ce2369a61ea7o%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/d3459c8a-d11f-4752-8fc6-f85b971a397do%40googlegroups.com.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pulp-or-discuss/CAOuNk4Z2S1n-rqAqD0zveNp8Z5-O8StgRo%3D6zpvGH5RW8BdTVw%40mail.gmail.com.
--
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 a topic in the Google Groups "pulp-or-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pulp-or-discuss/GqDc8xI-Iyk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pulp-or...@googlegroups.com.
You’re still missing variables (plan_start_date
, port_inventory_df
, planning_horizon_max
). I suggest you copy the whole code into a new python file and try to execute it by itself until you reproduce the original problem with pulp. Please read the stackoverflow link I sent, they probably talk about this and how to do it properly.
Until you manage to reproduce your pulp problem in a MWE and then share it, it will be very hard to help you further.
regards,
F.
To unsubscribe from this group and all its topics, 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/06ecd79b-1254-4da6-acfa-6d7f3b46a985o%40googlegroups.com.