Mult-period VRP Inventory stuck in creating the syntax
OngoingHi Gurobi Team,
I am working on my undergraduate thesis on multi period VRP in collection scheduling and routing. The inventory will be the fundamental point to trigger the multiperiod method. I want to make sure in scheduling selection will consider the demand satisfaction. I tried to code this logic:
- if t = 0,
sum of e[i,v,t] >= d[t] + ss - initial_inventory - else:
sum of e[i,v,t+1] >= d[t+1] + ss - I[t]
The concept is creating constraint to make sure inventory is not stocked out. To give further context, inventory I[t] is calculated by I[t-1] - d[t] + sum of e[i,v,t].
Notes:
- I[t] = inventory in period t
- e[i,v,t] = amount of goods picked up from nodes i by vehicle v in period t
- d[t] = demand in period t
- initial_inventory = initial inventory in the beginning of period
- ss = safety stock
I code this but doesn't work
"constraint pickup minimal quantity - considering multi period inventory"
for t in range (t+1):
if t == 0:
M.addConstr(gb.quicksum(gb.quicksum(e[i, v, t] for i in range (n)) for v in range (v)) >= d[t] + ss - initial_inventory )
if k <= t:
M.addConstr(gb.quicksum(gb.quicksum(e[i, v, t+1] for i in range (m)) for j in range (n)) >= d[t+1] + ss - I[t])
M.update()
Could you help me to check?
Thank you!
-
Hi Maura,
Thank you for reaching us.
We can understand what you want and your model looks fine.
However, because we don't know what the error message is, we cannot investigate your issue further.Could you share the error message?
And could you let us know what 'k' means in the second if condition(though it seems less important)?Best regards,
Chung-Kyun Han0
Please sign in to leave a comment.
Comments
1 comment