-
With the StrongBranchingScores observation function, we can get strong branching scores for every candidate variable in each step. However, I wonder about how to get the branching scores for only one variable. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @msublee |
Beta Was this translation helpful? Give feedback.
-
In theory you should be able to compute individual SB scores using PySCIPOpt and probing. Something like that: # we want the SB score of variable var
# var = ...
var_val = var.getLPSol()
lp_val = model.getLPObjVal()
# left child LP value
model.startProbing()
model.chgVarUbProbing(var, int(math.floor(var_val)))
model.applyCutsProbing()
model.solveProbingLP()
left_lp_val = model.getLPObjVal()
left_lp_stat = model.getLPSolstat()
model.endProbing()
# right child LP value
model.startProbing()
model.chgVarLbProbing(var, int(math.ceil(var_val)))
model.applyCutsProbing()
model.solveProbingLP()
right_lp_val = model.getLPObjVal()
right_lp_stat = model.getLPSolstat()
model.endProbing()
# compute the score using lp_val, right_lp_stat, right_lp_val, left_lp_stat, left_lp_val
# see SCIPbranchGetScore()
# https://www.scipopt.org/doc/html/branch_8c.php#ae8ac00429821abf2b2b2f4ab2338a568 You should also mind that things happening in probing are not 100% idempotent. That is, the state of the solver might be altered by the operations made during probing mode, due mostly I think to conflict analysis, and also because at the end of probing the original LP (the one before probing) will be solved again, which might lead to a different basis (LP solution) before / after probing. So you might want to at least deactivate conflict analysis during probing. See this discussion. Best, |
Beta Was this translation helpful? Give feedback.
In theory you should be able to compute individual SB scores using PySCIPOpt and probing. Something like that: