Initializing help system before first use

XPRSgetlpsol

Purpose
Used to obtain the LP solution values following optimization.
Topic areas
Synopsis
int XPRS_CC XPRSgetlpsol(XPRSprob prob, double x[], double slack[], double duals[], double djs[]);
Arguments
prob 
The current problem.
Double array of length ORIGINALCOLS where the values of the primal variables will be returned. May be NULL if not required.
slack 
Double array of length ORIGINALROWS where the values of the slack variables will be returned. May be NULL if not required.
duals 
Double array of length ORIGINALROWS where the values of the dual variables ( cBTB-1) will be returned. May be NULL if not required.
djs 
Double array of length ORIGINALCOLS where the reduced cost for each variable ( cT-cBTB-1A) will be returned. May be NULL if not required.
Example
The following sequence of commands will get the LP solution ( x) at the root node of a MIP and the optimal MIP solution ( y):
int cols;
double *x, *y;
...
XPRSmipoptimize(prob,"l");
XPRSgetintattrib(prob,XPRS_ORIGINALCOLS,&cols);
x = malloc(cols*sizeof(double));
XPRSgetlpsol(prob,x,NULL,NULL,NULL);
XPRSmipoptimize(prob,"");
y = malloc(cols*sizeof(double));
XPRSgetsolution(prob,NULL,y,0,cols-1);
See also example fixbv.c.
Further information
1. After solving an LP, it is recommended to use XPRSgetsolution to retrieve the solution.
2. When an integer solution is found during a tree search, it is always set up as a solution to the current node; therefore the integer solution is available as the current node. It is recommended to retrieved the solution with XPRSgetcallbacksolution and XPRSgetcallbackpresolvesolution.
3. The function always returns data in the original space, even if the problem is currently in presolved state. Use XPRSgetpresolvesol if you need the solution in terms of the presolved model.
4. If the matrix is modified after calling XPRSlpoptimize, then the solution will no longer be available.
5. If the problem has been presolved, then XPRSgetlpsol returns the solution to the original problem. The only way to obtain the presolved solution is to call the related function, XPRSgetpresolvesol.
Related topics

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.