I'm trying to solve the CVRP based on flow-formulation. In such a model, we have a decision variable with two-index, $x_{ij}$, where I'm using the MTZ formula to eliminate sub-tours. We have then a continuous variable that represents the flow of the vehicle after visiting a customer. Let's say $y_i$. In the case of delivery, the constraints that I formulate is: $y_j \le y_i - d_j*x_{ij}+ Q*(1-x_{ij})$ , where $(0 \le y_i \le Q - d_i$). For this example with $5$ customers : $\{1:19;2:30;3:16;4:23;5:11\}$ and $Q=35$, the solution I got is: $x : \{(0,3);(3,1);(1,0);(0,2);(2,0);(0,4);(4,5);(5,0)\}$ For the other variables, $x$ is null. $y: \{1:0;2:0;3:16;4:11;5:0\}$. I expected 12 for $y_4 = 35 - 23 = 12$ and $y_5 = 12 - 11 = 1$ [![enter image description here][1]][1] But something is wrong that I can not identify. mdl = Model('CVRP2') arc_k = {(i, j) for i in nodes for j in nodes if i != j} var = {(i) for i in customers} xt = mdl.addVars(arc_k, vtype=GRB.BINARY, name='xt') y = mdl.addVars(var, vtype=GRB.CONTINUOUS, name='y') mdl.modelSense = GRB.MINIMIZE mdl.setObjective(grb.quicksum(time_truck[i][j] * xt[i, j] if i!=j else 0 for i in nodes for j in nodes)) #Constraint 1- Exactly the total number of vehicles leaves and return to the depot mdl.addConstr(grb.quicksum(xt[0, j] for j in customers) <= nT) mdl.addConstr(grb.quicksum(xt[i, 0] for i in customers) <= nT) # Constraint 2- Customer is only served once by only one vehicle for j in customers: mdl.addConstr(grb.quicksum(xt[i, j] for i in nodes if i != j) == 1) # Constraint 3- Only one vehicle enters and leaves each customer for j in customers: mdl.addConstr(grb.quicksum(xt[i, j] if i != j else 0 for i in nodes) - grb.quicksum(xt[j, i] if i != j else 0 for i in nodes) == 0) # Constraint 4: Subtour Elimination for i in customers: for j in customers: if i != j: mdl.addConstr(y[j]<=y[i]-df.demand[j] + (truck_capacity) * (1- xt[i, j])) #Constraint 5: Capacity Bounding Constraint for i in customers: mdl.addConstr(y[i] >=0) mdl.addConstr(y[i] <= truck_capacity - df.demand[i]) [1]: https://i.sstatic.net/Ki57l.png