Prev  Next 
# include <cppad/ipopt/solve.hpp>
ipopt::solve(
options, xi, xl, xu, gl, gu, fg_eval, solution
)
ipopt::solve
solves nonlinear programming
problems of the form
@[@
\begin{array}{rll}
{\rm minimize} & f (x)
\\
{\rm subject \; to} & gl \leq g(x) \leq gu
\\
& xl \leq x \leq xu
\end{array}
@]@
This is done using
Ipopt
optimizer and CppAD for the derivative and sparsity calculations.
cppad/ipopt/solve.hpp
is included by cppad/cppad.hpp
.
Otherwise,
cppad/ipopt/solve.hpp
can be included directly
(If cppad/cppad.hpp
has not yet been included,
cppad/ipopt/solve.hpp
will automatically include it.)
Bvector
must be a SimpleVector
class with
elements of type
bool
.
DVector
must be a SimpleVector
class with
elements of type
double
.
options
has prototype
const std::string options
It contains a list of options.
Each option, including the last option,
is terminated by the '\n'
character.
Each line consists of two or three tokens separated by one or more spaces.
Retape value
If the value is true
, ipopt::solve
with retape the
operation sequence
for each
new value of
x
.
If the value is false
, ipopt::solve
will tape the operation sequence at the value
of
xi
and use that sequence for the entire optimization process.
The default value is false
.
Sparse value direction
If the value is true
, ipopt::solve
will use a sparse
matrix representation for the computation of Jacobians and Hessians.
Otherwise, it will use a full matrix representation for
these calculations.
The default for
value
is false
.
If sparse is true, retape must be false.
It is unclear if sparse_jacobian
would be faster user
forward or reverse mode so you are able to choose the direction.
If
value == true && direction == forward
the Jacobians will be calculated using SparseJacobianForward
.
If
value == true && direction == reverse
the Jacobians will be calculated using SparseJacobianReverse
.
String name value
Here
name
is any valid Ipopt string option
and
value
is its setting.
Numeric name value
Here
name
is any valid Ipopt numeric option
and
value
is its setting.
Integer name value
Here
name
is any valid Ipopt integer option
and
value
is its setting.
xi
has prototype
const Vector& xi
and its size is equal to
nx
.
It specifies the initial point where Ipopt starts the optimization process.
xl
has prototype
const Vector& xl
and its size is equal to
nx
.
It specifies the lower limits for the argument in the optimization problem.
xu
has prototype
const Vector& xu
and its size is equal to
nx
.
It specifies the upper limits for the argument in the optimization problem.
gl
has prototype
const Vector& gl
and its size is equal to
ng
.
It specifies the lower limits for the constraints in the optimization problem.
gu
has prototype
const Vector& gu
and its size is equal to
ng
.
It specifies the upper limits for the constraints in the optimization problem.
fg_eval
has prototype
FG_eval fg_eval
where the class
FG_eval
is unspecified except for the fact that
it supports the syntax
FG_eval::ADvector
fg_eval(fg, x)
The type
ADvector
and the arguments to
fg
,
x
have the following meaning:
FG_eval::ADvector
must be a SimpleVector
class with
elements of type
AD<double>
.
fg_eval
argument
x
has prototype
const ADvector& x
where
nx = x.size()
.
fg_eval
argument
fg
has prototype
ADvector& fg
where
1 + ng = fg.size()
.
The input value of the elements of
fg
does not matter.
Upon return from
fg_eval
,
fg[0] =
@(@
f (x)
@)@
and for @(@
i = 0, \ldots , ng1
@)@,
fg[1 + i] =
@(@
g_i (x)
@)@
solution
has prototype
ipopt::solve_result<Dvector>& solution
After the optimization process is completed,
solution
contains
the following information:
status
field of
solution
has prototype
ipopt::solve_result<Dvector>::status_type solution.status
It is the final Ipopt status for the optimizer.
Here is a list of the possible values for the status:
status
 Meaning 
not_defined  The optimizer did not return a final status for this problem. 
unknown 
The status returned by the optimizer is not defined in the Ipopt
documentation for finalize_solution .

success  Algorithm terminated successfully at a point satisfying the convergence tolerances (see Ipopt options). 
maxiter_exceeded  The maximum number of iterations was exceeded (see Ipopt options). 
stop_at_tiny_step  Algorithm terminated because progress was very slow. 
stop_at_acceptable_point  Algorithm stopped at a point that was converged, not to the 'desired' tolerances, but to 'acceptable' tolerances (see Ipopt options). 
local_infeasibility  Algorithm converged to a nonfeasible point (problem may have no solution). 
user_requested_stop  This return value should not happen. 
diverging_iterates  It the iterates are diverging. 
restoration_failure  Restoration phase failed, algorithm doesn't know how to proceed. 
error_in_step_computation  An unrecoverable error occurred while Ipopt tried to compute the search direction. 
invalid_number_detected 
Algorithm received an invalid number (such as nan or inf )
from the users function
fg_info.eval
or from the CppAD evaluations
of its derivatives
(see the Ipopt option check_derivatives_for_naninf ).

internal_error  An unknown Ipopt internal error occurred. Contact the Ipopt authors through the mailing list. 
x
field of
solution
has prototype
Vector solution.x
and its size is equal to
nx
.
It is the final @(@
x
@)@ value for the optimizer.
zl
field of
solution
has prototype
Vector solution.zl
and its size is equal to
nx
.
It is the final Lagrange multipliers for the
lower bounds on @(@
x
@)@.
zu
field of
solution
has prototype
Vector solution.zu
and its size is equal to
nx
.
It is the final Lagrange multipliers for the
upper bounds on @(@
x
@)@.
g
field of
solution
has prototype
Vector solution.g
and its size is equal to
ng
.
It is the final value for the constraint function @(@
g(x)
@)@.
lambda
field of
solution
has prototype
Vector> solution.lambda
and its size is equal to
ng
.
It is the final value for the
Lagrange multipliers corresponding to the constraint function.
obj_value
field of
solution
has prototype
double solution.obj_value
It is the final value of the objective function @(@
f(x)
@)@.
ipopt::solve
taken from the Ipopt manual.