VRP model and code
Hello everyone, I am currently working on reproducing the 2EVRP model and have encountered some issues.
I want to complete the second echelon part.
this is my code
y = m.addVars(A1, vtype=gp.GRB.BINARY, name="y")
f = m.addVars(A1, vtype=gp.GRB.INTEGER, lb=0, name="f")
m.modelSense = gp.GRB.MINIMIZE
m.setObjective(gp.quicksum(c[i, j] * y[i, j] for i, j in A1))
m.addConstrs((gp.quicksum(y[i, j] for j in V if (i, j) in A1) == gp.quicksum(y[j, i]
for j in V if (i, j) in A1) for i in V),
name='E7')
m.addConstrs((gp.quicksum(y[i, j] for j in V if (i, j) in A1) == 1 for i in V),
name='E9')
m.addConstrs((gp.quicksum(f[j, i] for j in V if (j,i) in A1) - gp.quicksum(f[i, j]
for j in V if (i, j) in A1) == d[i]for i in S),
name='E10')
m.addConstrs( (f[i,j] <= Q1* y[i, j]
for i in V for j in V if (i, j) in A1),
name='E11')
The issue is that a solution exists only when Q1(vehicle capacity) can satisfy the total demand of all points. To simplify the model, I did not set a limit on the number of vehicles k. However, why doesn't the model distribute the delivery across multiple vehicles?
I would greatly appreciate your help.
Thank you very much!
0
Please sign in to leave a comment.
Comments
0 comments