Variable upper bound is defined through addVars. Can we get active variables just like active constriants
回答済みSo for active constraints we can check as below. Then for active variables is there a way to check
if c.Slack < 1e-6:
When a variable lower bound and upper bound is defined in model
Is there any way to check active variables . A variable which hits upper bound or lower bound after the model is solved to optimality by Gurobi .
When Variable is in between lower and upper bound then I can consider as inactive variable.
-
Hi,
If the model is an LP and your goal is to find the optimal basic solution, you can rely on the variable attribute VBasis, after the optimization is over, to identify whether a variable is basic (0), non-basic at lower bound (-1), non-basic at upper bound (-2), or super-basis (-3). Otherwise, you would need to query the variable value using the X attribute and compare it with the variable attributes LB/UB.
Best regards,
Maliheh
0
サインインしてコメントを残してください。
コメント
1件のコメント