Method of moving asymptotes in pure Julia
Description
There are 2 versions of the method of moving asymptotes (MMA) that are available in NonconvexMMA.jl
:
- The original MMA algorithm from the 1987 paper.
- The globally convergent MMA (GCMMA) algorithm from the 2002 paper.
The MMA algorithm only supports inequality constraints. However, the original algorithm was slightly generalized to handle infinite variable bounds.
Quick start
Given a model model
and an initial solution x0
, the following can be used to optimize the model using MMA.
using Nonconvex
Nonconvex.@load MMA
alg = MMA87() # or MMA02()
options = MMAOptions()
result = optimize(model, alg, x0, options = options, convcriteria = KKTCriteria())
Construct an instance
To construct an instance of the original MMA algorithm, use:
alg = MMA87()
or alternatively:
alg = MMA()
To construct an instance of the globally convergent MMA algorithm, use:
alg = MMA02()
or alternatively:
alg = GCMMA()
NonconvexMMA.MMA87
— TypeMMA87
The original method of moving asymptotes (MMA) algorithm from the 1987 paper.
NonconvexMMA.MMA02
— TypeMMA02
The globally convergent method of moving asymptotes (MMA) algorithm from the 2002 paper.
Options
To specify options for the MMA algorithm, you can construct an instance of MMAOptions
and use keyword arguments.
NonconvexMMA.MMAOptions
— TypeMMAOptions
A struct that stores all the options of the MMA algorithms. Th following are the fields of MMAOptions
:
maxiter
: the maximum number of inner iterations. ForMMA87
, there is 1 inner iteration per outer iteration.outer_maxiter
: the maximum number of outer iterations.maxinner
: the maximum number of inner iterations per outer iteration ofMMA02
. Not applicable forMMA87
.tol
: a tolerance struct of typeTolerance
.s_init
: defined in the originalMMA02
paper.s_incr
: defined in the originalMMA02
paper.s_decr
: defined in the originalMMA02
paper.store_trace
: if true, a trace will be stored.dual_options
: the options passed to the dual optimizer fromOptim.jl
.convcriteria
: an instance ofConvergenceCriteria
that specifies the convergence criteria of the MMA algorithm.verbose
: true/false, when true prints convergence statistics.
The tol
option in MMA can be set to an instance of the Tolerance
struct:
NonconvexCore.Tolerance
— TypeTolerance
A struct specifying the different tolerances used to assess the convergence of the algorithms. The following are the fields of Tolerance
:
x
: the tolerance forΔx
inConvergenceState
.x_converged
will be true ifΔx
is less than thex
tolerance inTolerance
. This is used to assess convergence when theGenericCriteria
is used as the convergence criteria.fabs
: the tolerance forΔf
inConvergenceState
.f_converged
will be true ifΔf
is less than thefabs
tolerance inTolerance
. This is used to assess convergence when theGenericCriteria
is used as the convergence criteria.frel
: the tolerance forrelΔf
inConvergenceState
.f_converged
will be true ifrelΔf
is less than thefrel
tolerance inTolerance
. This is used to assess convergence when theGenericCriteria
is used as the convergence criteria.kkt
: the KKT tolerance.kkt_converged
inConvergenceState
will be true if thekkt_residual
is less than the KKT tolerance. Andipopt_converged
inConvergenceState
will be true ifipopt_residual
is less than the KKT tolerance. This is used to assess convergence when theKKTCriteria
, theScaledKKTCriteria
orIpoptCriteria
criteria is used as the convergence criteria.infeas
: the maximum infeasibility tolerance.infeas_converged
inConvergenceState
will be true if the maximum infeasibility is less than the infeasibility tolerance. This is used to assess convergence regardless of the convergence criteria used.
For more on convergence criteria, see GenericCriteria
, KKTCriteria
, ScaledKKTCriteria
and IpoptCriteria
.
NonconvexCore.ConvergenceState
— TypeConvergenceState
A struct that summarizes the convergence state of a solution. The fields in this struct are:
Δx
: the infinity norm of the change in the solutionx
.Δf
: the change in the objective valuef
.relΔf
: the ratio of change in the objective valuef
.kkt_residual
: the Karush-Kuhn-Tucker (KKT) residual of the solution. IfScaledKKTCriteria
is used instead ofKKTCriteria
, thekkt_residual
will be divided by a factor.ipopt_residual
: the modified KKT residual used in the IPOPT solver.infeas
: maximum infeasibility amount. This is 0 if the solution is feasible.x_converged
: true ifΔx
is less than thex
tolerance inMMAOptions
.fabs_converged
: true ifΔf
is less than thef
tolerance inMMAOptions
.frel_converged
: true ifrelΔf
is less than thef
tolerance inMMAOptions
.kkt_converged
: true if thekkt_residual
is less than the KKT tolerance inMMAOptions
.ipopt_converged
: true if theipopt_residual
is less than the KKT tolerance inMMAOptions
.infeas_converged
: true ifinfeas
is less than the infeasibility tolerance inMMAOptions
.f_increased
: true if the objective value of the current solution is higher than that of the previous solution.converged
: true if the solution satisfies the convergence criteria of choice. SeeConvergenceCriteria
for more on the different convergence criteria available.
Convergence criteria
There are 4 convergence criteria available for the MMA algorithm:
GenericCriteria
KKTCriteria
ScaledKKTCriteria
IpoptCriteria
NonconvexCore.ConvergenceCriteria
— TypeConvergenceCriteria
This an abstract type with 4 subtypes:
NonconvexCore.GenericCriteria
— TypeGenericCriteria
This is a generic convergence criteria that uses:
- The maximum change in the solution,
Δx
, - The change in the objective value,
Δf
, and - The change percentage in the objective value,
Δf
, and - The maximum infeasibility
infeas
.
to assess convergence. More details are given in assess_convergence!
.
NonconvexCore.KKTCriteria
— TypeKKTCriteria
This convergence criteria uses the Karush-Kuhn-Tucker residual and maximum infeasibility to assess convergence. More details are given in assess_convergence!
.
NonconvexCore.ScaledKKTCriteria
— TypeScaledKKTCriteria
This convergence criteria uses another scaled version of the Karush-Kuhn-Tucker (KKT) residual and maximum infeasibility to assess convergence. In particular if the objective was scaled by a factor m
, the KKT residual will be scaled down by a factor max(m, 1/m)
. This scaling was found to make the convergence criteria less sensitive to scale compared to using the traditional KKT residual. More details are given in assess_convergence!
.
NonconvexCore.IpoptCriteria
— TypeIpoptCriteria
This convergence criteria uses a scaled version of the Karush-Kuhn-Tucker (KKT) residual and maximum infeasibility to assess convergence. This scaled KKT residual is used in the IPOPT nonlinear programming solver as explained in this paper. More details are given in assess_convergence!
.
NonconvexCore.assess_convergence!
— Functionassess_convergence!(
solution::Solution,
model::AbstractModel,
tol::Tolerance,
criteria::ConvergenceCriteria,
verbose::Bool,
iter::Int
)
Evaluates the convergence state solution.convstate
given the current solution, solution
, the tolerance, tol
, and the convergence criteria criteria
. solution.convstate.converged
is then updated.
If criteria
is an instance of GenericCriteria
, converged = (x_converged || f_converged) && infeas_converged
. x_converged
, f_converged
and infeas_converged
are explained in Tolerance
. If criteria
is an instance of KKTCriteria
or ScaledKKTCriteria
, converged = kkt_converged && infeas_converged
. kkt_converged
and infeas_converged
are explained in Tolerance
. If criteria
is an instance of IpoptCriteria
, converged = ipopt_converged && infeas_converged
. ipopt_converged
and infeas_converged
are explained in Tolerance
.
To specify the convergence criteria, use:
converiteria = GenericCriteria()
replacing GenericCriteria()
by KKTCriteria()
, ScaledKKTCriteria()
or IpoptCriteria()
.