Getting Binding Constraints
回答済みHi, I want to get tight constraints at optimality for a linear model . It is possible to check equalities of constraints, but it would be better to have a simple Gurobi function to give binding constraints. Is there a function like this or is it possible to build?
Thank you
0
-
正式なコメント
This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support. -
After optimizing, you can check if each (linear) constraint's Slack attribute is sufficiently close to \(0\). For example, in Python:
binding = [c for c in model.getConstrs() if abs(c.Slack) < 1e-6]
1 -
Thank you Mr Towle
0 -
Dear Mr. Towle, when I executed the code, It thrown me an error
AttributeError: 'ConcreteModel' object has no attribute 'getConstrs'0 -
any help for the error.
0 -
Hi Muhammed,
It sounds like you are mixing Pyomo code with gurobipy code (we don't have a ConcreteModel object in gurobipy) which will not work.
- Riley
0
投稿コメントは受け付けていません。
コメント
6件のコメント