Model is infeasible. Is it due to the way I modelled the non-linear constraint?
AnsweredHi, my model became infeasible when I added the following constraints. May I check if this is the right way for me to model the nonlinear constraints in python Gurobi?

Ebrated, Cb and Battery cost are the parameters.
Depth_of_discharge = m.addConstr(DOD[t] * Eba[t] == Pb[t])
DOD_Power = m.addGenConstrPow(DOD[t], DOD_gc[t], -0.795)
Battery_lifetime = m.addConstr(BL[t] == 694 * DOD_gc[t])
Ebrated_divide_BatteryLifetime_degraloss = m.addConstr(degra_loss[t] * BL[t] == Ebrated)
Enery_capacity = m.addConstr(energy_cap[t+1] == energy_cap[t] - degra_loss[t])
For degradation cost : The objective function
energycap_dod = m.addConstr(cap_dod[t] == energy_cap[t] * DOD[t])
energycap_dod2 = m.addConstr(cap_dod2[t] == cap_dod[t] * BL[t])
inverser_value = m.addGenConstrPow(cap_dod2[t], invr[t], -1)
m.setObjective(gp.quicksum(((Batt_cost/2) * invr[t]) * Pb[t] for t in range(TimePeriod)), GRB.MINIMIZE)
All the variables above with subscript t were included in GUROBI using addVars. May I know if the infeasibility is due to wrong modelling of the constraints?
Thank you,
Tan Sheng Hui
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Tan Sheng Hui,
The addGenConstrPow function is only defined for positive exponents, i.e., \(x^a\) with \(a>0\). You have to model the inverse in the objective the same way as you did for the other constraints.
Best regards,
Jaromił0 -
Hi Jaromil Najman,
I changed all the negative using the following line :
DOD_inverse = m.addConstr(DOD_invr[t] * DOD[t] == 1, name = 'DOD_Inverse')
inverse_value = DR.addConstr(invr[t] * cap_dod2[t] == 1, name = 'invr'However, the model remains unfeasible. I compute the IIS and it returns the following :
IIS computed: 5 constraints, 1 bound
Just to check if the constraints as shown in the IIS .ilp file are removed, does it make the model feasible again?
Thank you,
Tan Sheng Hui
0 -
Hi Tan Sheng Hui,
It is worth having a look at the documentation of the IIS. If you remove 1 of the 5 constraints or the bound listed in the ILP file, your problem will become feasible again. This means that the 5 constraints are either incompatible together forming an infeasible subproblem or the bound is not set correctly.
Best regards,
Jaromił0
Post is closed for comments.
Comments
4 comments