Retrieving the linear expression of a constraint
AnsweredHi
I'm implementing a Benders Decomposition with the so called Two-Phase Approach in which I add the benders cuts of the model without any integrality constraint solved by classical Benders (phase 1) to the model with reintroduced integrality constraints and callback function (phase 2) as lazy constraints. Therefore I need to acces to the linear expression of the benders cuts in the first model but I don't know how. I can image that the function getConstrByName() alone can't help because it returns a gurobi constraint instead of an expression. I appreciate your help in advance.
Best regards
Zheren
-
Hi Zheren,
If you know the constraint you can retrieve the corresponding linear expression for the left hand side by using Model.getRow which will return a gurobipy.LinExpr.
- Riley
0
Please sign in to leave a comment.
Comments
1 comment