Reference
Contents
Index
NLPModelsIpopt.IpoptSolverNLPModelsIpopt.ipoptNLPModelsIpopt.ipoptNLPModelsIpopt.set_callbacksSolverCore.reset!
NLPModelsIpopt.IpoptSolver — Type
IpoptSolver(nlp)Returns an IpoptSolver structure to solve the problem nlp with ipopt.
Besides the underlying IpoptProblem stored in problem, the solver holds the Ipopt-specific quantities reported at the current iteration, which can be accessed in a callback:
alg_mod: algorithm mode (0 = regular, 1 = restoration phase);mu: barrier parameter;d_norm: infinity norm of the primal step;regularization_size: size of the Hessian regularization;alpha_du: step size for the dual variables;alpha_pr: step size for the primal variables;ls_trials: number of line search trials.
NLPModelsIpopt.ipopt — Method
output = ipopt(nlp; kwargs...)Solves the NLPModel problem nlp using Ipopt.
For advanced usage, first define a IpoptSolver to preallocate the memory used in the algorithm, and then call solve!: solver = IpoptSolver(nlp) solve!(solver, nlp; kwargs...) solve!(solver, nlp, stats; kwargs...)
Optional keyword arguments
x0: a vector of sizeget_nvar(nlp)to specify an initial primal guessy0: a vector of sizeget_ncon(nlp)to specify an initial dual guess for the general constraintszL0: a vector of sizeget_nvar(nlp)to specify initial multipliers for the lower bound constraints; it may be empty ifnlphas no boundszU0: a vector of sizeget_nvar(nlp)to specify initial multipliers for the upper bound constraints; it may be empty ifnlphas no boundscallback: a functioncallback(nlp, solver, stats)called at each iteration, see below.
Callback
The callback is called at each iteration as callback(nlp, solver, stats) and must return a Bool: true to continue the optimization, false to stop it (the status is then :user). Before each call,
statsis updated with the current iteration number, objective value, primal and dual residuals, iterate and multipliers;solveris updated with the remaining Ipopt-specific quantities, seeIpoptSolver.
Ipopt-style callbacks callback(alg_mod, iter_count, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, alpha_du, alpha_pr, ls_trials) are deprecated.
All other keyword arguments will be passed to Ipopt as an option. See https://coin-or.github.io/Ipopt/OPTIONS.html for the list of options accepted.
Output
The returned value is a GenericExecutionStats, see SolverCore.jl.
Examples
using NLPModelsIpopt, ADNLPModels
nlp = ADNLPModel(x -> sum(x.^2), ones(3));
stats = ipopt(nlp, print_level = 0)using NLPModelsIpopt, ADNLPModels
nlp = ADNLPModel(x -> sum(x.^2), ones(3));
solver = IpoptSolver(nlp);
stats = solve!(solver, nlp, print_level = 0)NLPModelsIpopt.ipopt — Method
ipopt(nls::AbstractNLSModel; kwargs...)Solve the least-squares problem nls using IPOPT by moving the nonlinear residual to the constraints.
Arguments
nls::AbstractNLSModel: The least-squares problem to solve.
For advanced usage, first define an IpoptSolver to preallocate the memory used in the algorithm, and then call solve!: solver = IpoptSolver(nls) solve!(solver, nls; kwargs...)
Examples
using NLPModelsIpopt, ADNLPModels
nls = ADNLSModel(x -> [x[1] - 1, x[2] - 2], [0.0, 0.0], 2)
stats = ipopt(nls, print_level = 0)NLPModelsIpopt.set_callbacks — Method
set_callbacks(nlp::AbstractNLPModel)Return the set of functions needed to instantiate an IpoptProblem.
SolverCore.reset! — Method
solver = reset!(solver::IpoptSolver, nlp::AbstractNLPModel)Reset the solver with the new model nlp.
If nlp has different bounds on the variables/constraints or a different number of nonzeros elements in the Jacobian/Hessian, then you need to create a new IpoptSolver.