XPRSgetsol
PurposeThis function is deprecated and will be removed in version 18. Users should use the XPRSgetlpsol or XPRSgetmipsol functions instead. It is included for compatibility with version 16 and is used to obtain the solution values following optimization.Synopsisint XPRS_CC XPRSgetsol(XPRSprob prob, double x[], double slack[], double dual[], double dj[]);
Arguments
prob The current problem. x Double array of length COLS where the values of the primal variables will be returned. May be NULL if not required. slack Double array of length ROWS where the values of the slack variables will be returned. May be NULL if not required. dual Double array of length ROWS where the values of the dual variables will be returned. May be NULL if not required. dj Double array of length COLS where the reduced cost for each variable will be returned. May be NULL if not required.Related ControlsInteger
Enable/disable the binary solution file.
ExampleThe following sequence of commands will get the solution (x) at the top node and the optimal MIP solution (y) for a problem:int cols; double *x, *y; ... XPRSmaxim(prob,""); XPRSgetintattrib(prob,XPRS_ORIGINALCOLS,&cols); x = malloc(cols*sizeof(double)); XPRSgetsol(prob,x,NULL,NULL,NULL); XPRSglobal(prob); y = malloc(cols*sizeof(double)); XPRSgetsol(prob,y,NULL,NULL,NULL);Further information1. If the matrix is modified after calling XPRSmaxim or XPRSminim, then the solution will no longer be available.2. If the problem has been presolved, then XPRSgetsol returns the solution to the original problem. The only way to obtain the presolved solution is to call the related function, XPRSgetpresolvesol.Related topics
If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.