scipopt / PySCIPOpt

Python interface for the SCIP Optimization Suite
https://scipopt.github.io/PySCIPOpt
MIT License
786 stars 252 forks source link

.getObj() vs. .getLPSol() #582

Closed rgreen13 closed 2 years ago

rgreen13 commented 2 years ago

I want to get the value of a variable directly from the variable object. It is not 100% clear to me what the difference is between the methods .getObj() and .getLPSol(). Could some clarity be provided?

mattmilten commented 2 years ago

The objective value of a variable corresponds to the current integer feasible solution. The LP solution value on the other hand, refers to just the current value of the linear relaxation of the original problem.

In case, you are just solving an LP in the first place, there should not be a difference in those values. Typically, though, PySCIPOpt is used to solve mixed-integer or even nonlinear mixed-integer programming problems (MIPs, MILPs, MINLPs).