Search code examples
pythonoptimizationmixed-integer-programmingscip

Getting LP relaxation solution values


To get the final solution after optimization in pyscipopt, we can do

# define x to be a vector of x_ij variables
model.data = x
model.optimize()
X = model.getVal(x)

I would like to get the LP relaxation solutions at every node of the branch and bound tree. One method for doing this would be to use model.getVal(t_x_ij) for every (transformed) variable 'x_ij'. Is there a more efficient way of doing this than looping over all the transformed variables? Please let me know if you need any further clarifications.


Solution

  • If you are solving a MIP, you would need to get the LP solution values during the solving process. You need to implement a callback that is executed whenever a new node LP is solved.

    You might want to check out TreeD, a project I created to inspect and visualize various LP-related information during the MIP solving process of PySCIPOpt.