Purpose
Set a user callback to be called at the end of the cascading process, after the
last variable has been cascaded
Synopsis
int XPRS_CC XSLPsetcbcascadeend(XSLPprob Prob,
int (XPRS_CC *UserFunc) (XSLPprob myProb, void *myObject),
void *Object);
Arguments
|
Prob
|
The current SLP problem.
|
|
UserFunc
|
The function to be called at the end of the cascading process.
UserFunc returns an integer value.
The return value is noted by Xpress-SLP but it has no effect on the optimization.
|
|
myProb
|
The problem passed to the callback function.
|
|
myObject
|
The user-defined object passed as Object to
XSLPsetcbcascadeend.
|
|
Object
|
Address of a user-defined object, which can be used for any purpose
by the function. Object is passed to UserFunc as myObject.
|
Example
The following example sets up a callback to be executed at the end of the cascading process
which checks if any of the values have been changed significantly:
double *cSol;
XSLPsetcbcascadeend(Prob, CBCascEnd, &cSol);
A suitable callback function might resemble this:
int XPRS_CC CBCascEnd(XSLPprob MyProb, void *Obj) {
int iCol, nCol;
double *cSol, Value;
cSol = * (double **) Obj;
XSLPgetintcontrol(MyProb, XPRS_COLS, &nCol);
for (iCol=0;iCol<nCol;iCol++) {
XSLPgetvar(MyProb, iCol, NULL, NULL, NULL,
NULL, NULL, NULL, &Value,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
if (fabs(Value-cSol[iCol]) > .01)
printf("\nCol %d changed from %lg to %lg",
iCol, cSol[iCol], Value);
}
return 0;
}
The Object argument is used here to hold the address of the array cSol
which we assume has been populated with the original solution values.
Further information
This callback can be used at the end of the cascading, when all the
solution values have been recalculated.
When used with VB, the callback function has the prototype:
Public Function mycbfunc (ByVal prob As Long, ByVal object As Long) As Long
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.