Adding initial values
So far, Xpress NonLinear has started by using values which it estimates for itself. Because most of the variables are bounded, these initial values are fairly reasonable, and the model will solve. However, in general, you will need to provide initial values for at least some of the variables. Initial values, and other information for SLP variables, are provided using the XSLPloadvars function.
int VarType[MAXCOL]; double InitialValue[MAXCOL];
To load initial values using XSLPloadvars, we need an array (InitialValue) to hold the initial values, and a VarType array which is a bitmap to describe what information is being set for each variable.
for(i=1; i<nSide; i++) { ... InitialValue[nCol] = 3.14159*((double)i) / ((double)nSide); VarType[nCol] = 4; ... } ... for(i=1; i<nSide; i++) { InitialValue[nCol] = 1; VarType[nCol] = 4; }
These sections extend the loops for the columns in the earlier example. We set initial values for the thetas so that the vertices are spaced at equal angles; the rhos are all started at 1. We do not need to set a value for the equals column, because it is fixed at one. However, it is good practice to do so. In each case we set VarType to 4 because (as described in the Xpress NonLinear Reference Manual) Bit 2 of the type indicates that the initial value is being set.
for(i=0; i<nCol; i++) ColIndex[i] = i XSLPloadvars(sprob, nCol-1, &ColIndex[1], &VarType[1], NULL, NULL, NULL, &InitialValue[1], NULL);
XSLPloadvars can take several other arguments apart from the initial value. It is a general principle in Xpress NonLinear that using NULL for an argument means that there is no information being provided, and the current or default value will not be changed.
Because we built up the initial values as we went, the VarType and InitialValue arrays include column 0, which is OBJX and is not an SLP variable. As all the rest are SLP variables, we can simply start these arrays at the second item, and reduce the variable count by 1.
© 2001-2019 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.