In my gurobi code i have the two following constraints:
Constraint (12-1)
for j in J:
for r in R:
model.addConstr((
B[j, 1, r] <= C_r[r] – (tt[i_CD][i_in][j_emp] + tt[i_in][1 + 1][j + 1]) +
(2 – gp.quicksum(x[j, j_prime, 1] for j_prime in J_ext if j_prime != j) –
gp.quicksum(y_0[j, 1, r_prime] for r_prime in R)) * M
), name=”ct.12.1″)
Constraint (13)
# Battery bounds
for r in R:
for j in J:
for i in I_ext:
model.addConstr((B[j, i, r] <= C_r[r]), name=”ct.13.1″)
model.addConstr((B[j, i, r] >= 0), name=”ct.13.2″)
Unfortunately the solver does not choose the expected value of 491.86 but instead chooses 5.52 (a way lower value). My model.lp file does show me the following (correct) calculation:
ct.12.1: 10000 y_0[2,1,1] + 10000 x[2,0,1] + 10000 x[2,1,1]
- 10000 x[2,3,1] + B[2,1,1] <= 20491.86
The solver therefore chooses a feasible but not exact solution. This constraint is not influenced by any others forcing it to have a lower value.