virtual bool get_starting_point(Index n, bool init_x, Number* x,
bool init_z, Number* z_L, Number* z_U,
Index m, bool init_lambda, Number* lambda)
Give IPOPT the starting point before it begins iterating.
The variables n and m are passed in for your convenience. These variables will have the same values you specified in get_nlp_info.
Depending on the options that have been set, IPOPT may or may not
require bounds for the primal variables
, the bound multipliers
and
, and the constraint multipliers
. The boolean
flags init_x, init_z, and init_lambda tell you
whether or not you should provide initial values for
,
,
, or
respectively. The default options only require an initial
value for the primal variables
. Note, the initial values for
bound multiplier components for ``infinity'' bounds
(
or
) are ignored.
In our example, we provide initial values for
as specified in the
example problem. We do not provide any initial values for the dual
variables, but use an assert to immediately let us know if we are ever
asked for them.
bool HS071_NLP::get_starting_point(Index n, bool init_x, Number* x,
bool init_z, Number* z_L, Number* z_U,
Index m, bool init_lambda,
Number* lambda)
{
// Here, we assume we only have starting values for x, if you code
// your own NLP, you can provide starting values for the dual variables
// if you wish to use a warmstart option
assert(init_x == true);
assert(init_z == false);
assert(init_lambda == false);
// initialize to the given starting point
x[0] = 1.0;
x[1] = 5.0;
x[2] = 5.0;
x[3] = 1.0;
return true;
}