Initializing help system before first use

problem.getlpsol

problem.getlpsol


Purpose
Used to obtain the LP solution values following optimization.
Synopsis
problem.getlpsol(x, slack, dual, dj)
Arguments
Array to store the values of the primal variables. May be None if not required.
slack 
Array to store the values of the slack variables. May be None if not required.
dual 
Array to store the values of the dual variables ( cBTB-1). May be None if not required.
dj 
Array to store the reduced cost for each variable ( cT-cBTB-1A). May be None if not required.
Example
The following sequence of commands will get the LP solution ( x) at the top node of a MIP and the optimal MIP solution ( y):
p.mipoptimize("l") # only solve the LP relaxation
x = []
p.getlpsol(x)
print("root LP solution:", x)
p.mipoptimize() # solve the MIP problem
p.getmipsol(x)
print("final MIP solution", x)
Further information
1. If called during a global callback the solution of the current node will be returned.
2. When an integer solution is found during a global search, it is always set up as a solution to the current node; therefore the integer solution is available as the current node solution and can be retrieved with getlpsol and problem.getpresolvesol.
3. If the problem is modified after calling lpoptimize, then the solution will no longer be available.
4. If the problem has been presolved, then getlpsol returns the solution to the original problem. The only way to obtain the presolved solution is to call the related function, problem.getpresolvesol.
Related topics