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 — TypeMMA87The original method of moving asymptotes (MMA) algorithm from the 1987 paper.
NonconvexMMA.MMA02 — TypeMMA02The 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 — TypeMMAOptionsA 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 originalMMA02paper.s_incr: defined in the originalMMA02paper.s_decr: defined in the originalMMA02paper.store_trace: if true, a trace will be stored.dual_options: the options passed to the dual optimizer fromOptim.jl.convcriteria: an instance ofConvergenceCriteriathat 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 — TypeToleranceA struct specifying the different tolerances used to assess the convergence of the algorithms. The following are the fields of Tolerance:
x: the tolerance forΔxinConvergenceState.x_convergedwill be true ifΔxis less than thextolerance inTolerance. This is used to assess convergence when theGenericCriteriais used as the convergence criteria.fabs: the tolerance forΔfinConvergenceState.f_convergedwill be true ifΔfis less than thefabstolerance inTolerance. This is used to assess convergence when theGenericCriteriais used as the convergence criteria.frel: the tolerance forrelΔfinConvergenceState.f_convergedwill be true ifrelΔfis less than thefreltolerance inTolerance. This is used to assess convergence when theGenericCriteriais used as the convergence criteria.kkt: the KKT tolerance.kkt_convergedinConvergenceStatewill be true if thekkt_residualis less than the KKT tolerance. Andipopt_convergedinConvergenceStatewill be true ifipopt_residualis less than the KKT tolerance. This is used to assess convergence when theKKTCriteria, theScaledKKTCriteriaorIpoptCriteriacriteria is used as the convergence criteria.infeas: the maximum infeasibility tolerance.infeas_convergedinConvergenceStatewill 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 — TypeConvergenceStateA 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. IfScaledKKTCriteriais used instead ofKKTCriteria, thekkt_residualwill 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Δxis less than thextolerance inMMAOptions.fabs_converged: true ifΔfis less than theftolerance inMMAOptions.frel_converged: true ifrelΔfis less than theftolerance inMMAOptions.kkt_converged: true if thekkt_residualis less than the KKT tolerance inMMAOptions.ipopt_converged: true if theipopt_residualis less than the KKT tolerance inMMAOptions.infeas_converged: true ifinfeasis 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. SeeConvergenceCriteriafor more on the different convergence criteria available.
Convergence criteria
There are 4 convergence criteria available for the MMA algorithm:
GenericCriteriaKKTCriteriaScaledKKTCriteriaIpoptCriteria
NonconvexCore.ConvergenceCriteria — TypeConvergenceCriteriaThis an abstract type with 4 subtypes:
NonconvexCore.GenericCriteria — TypeGenericCriteriaThis 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 — TypeKKTCriteriaThis convergence criteria uses the Karush-Kuhn-Tucker residual and maximum infeasibility to assess convergence. More details are given in assess_convergence!.
NonconvexCore.ScaledKKTCriteria — TypeScaledKKTCriteriaThis 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 — TypeIpoptCriteriaThis 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().