State

Types

Stopping.GenericStateType

Type: GenericState

Methods: update!, reinit!

A generic State to describe the state of a problem at a point x.

Tracked data include:

  • x : current iterate
  • d [opt] : search direction
  • res [opt] : residual
  • current_time : time
  • current_score : score

Constructors: GenericState(:: T, :: S; d :: T = _init_field(T), res :: T = _init_field(T), current_time :: Float64 = NaN) where {S, T <:AbstractVector}

`GenericState(:: T; d :: T = _init_field(T), res :: T = _init_field(T), current_time :: Float64 = NaN, current_score :: Union{T,eltype(T)} = _init_field(eltype(T))) where T <:AbstractVector`

Note:

  • By default, unknown entries are set using _init_field.
  • By default the type of current_score is eltype(x) and cannot be changed once the State is created. To have a vectorized current_score of length n, try something like GenericState(x, Array{eltype(x),1}(undef, n)).

Examples: GenericState(x) GenericState(x, Array{eltype(x),1}(undef, length(x))) GenericState(x, current_time = 1.0) GenericState(x, current_score = 1.0)

See also: Stopping, NLPAtX

source
Stopping.ListofStatesType

Type: list of States

Constructor:

ListofStates(:: AbstractState)

ListofStates(n :: Int, :: Val{AbstractState})

ListofStates(n :: Int, list :: Array{AbstractState,1})

ListofStates(state :: S; n :: Int = -1, kwargs...)

Note:

  • If n != -1, then it stores at most n AbstractState.
  • ListofStates recursively handles sub-list of states as the attribute list is

an array of pair whose first component is a, AbstractState and the second component is a ListofStates (or VoidListofStates).

Examples: ListofStates(state) ListofStates(state, n = 2) ListofStates(-1, Val{NLPAtX}()) ListofStates(-1, [(state1, VoidListofStates), (state2, VoidListofStates)], 2)

source
Stopping.NLPAtXType

Type: NLPAtX

Methods: update!, reinit!

NLPAtX contains the information concerning a nonlinear optimization model at the iterate x.

min_{x ∈ ℜⁿ} f(x) subject to lcon <= c(x) <= ucon, lvar <= x <= uvar.

Tracked data include:

  • x : the current iterate

  • fx [opt] : function evaluation at x

  • gx [opt] : gradient evaluation at x

  • Hx [opt] : hessian evaluation at x

  • mu [opt] : Lagrange multiplier of the bounds constraints

  • cx [opt] : evaluation of the constraint function at x

  • Jx [opt] : jacobian matrix of the constraint function at x

  • lambda : Lagrange multiplier of the constraints

  • d [opt] : search direction

  • res [opt] : residual

  • current_time : time

  • current_score : score

(import the type NLPModels.Counters)

Constructors: NLPAtX(:: T, :: T, :: S; fx :: eltype(T) = _init_field(eltype(T)), gx :: T = _init_field(T), Hx :: Matrix{eltype(T)} = _init_field(Matrix{eltype(T)}), mu :: T = _init_field(T), cx :: T = _init_field(T), Jx :: SparseMatrixCSC{eltype(T), Int64} = _init_field(SparseMatrixCSC{eltype(T), Int64}), d :: T = _init_field(T), res :: T = _init_field(T), current_time :: Float64 = NaN) where {S, T <: AbstractVector}

NLPAtX(:: T; fx :: eltype(T) = _init_field(eltype(T)), gx :: T = _init_field(T), Hx :: Matrix{eltype(T)} = _init_field(Matrix{eltype(T)}), mu :: T = _init_field(T), current_time :: Float64 = NaN, current_score :: Union{T,eltype(T)} = _init_field(eltype(T))) where {T <: AbstractVector}

NLPAtX(:: T, :: T; fx :: eltype(T) = _init_field(eltype(T)), gx :: T = _init_field(T), Hx :: Matrix{eltype(T)} = _init_field(Matrix{eltype(T)}), mu :: T = _init_field(T), cx :: T = _init_field(T), Jx :: SparseMatrixCSC{eltype(T), Int64} = _init_field(SparseMatrixCSC{eltype(T), Int64}), d :: T = _init_field(T), res :: T = _init_field(T), current_time :: Float64 = NaN, current_score :: Union{T,eltype(T)} = _init_field(eltype(T))) where T <: AbstractVector

Note:

  • By default, unknown entries are set using _init_field.
  • By default the type of current_score is eltype(x) and cannot be changed once the State is created. To have a vectorized current_score of length n, try something like GenericState(x, Array{eltype(x),1}(undef, n)).
  • All these information (except for x and lambda) are optionnal and need to be update when required. The update is done through the update! function.
  • x and lambda are mandatory entries. If no constraints lambda = [].
  • The constructor check the size of the entries.

See also: GenericState, update!, update_and_start!, update_and_stop!, reinit!

source
Stopping.OneDAtXType

Type: OneDAtX

Methods: update!, reinit!, copy

A structure designed to track line search information from one iteration to another. Given f : ℜⁿ → ℜ, define h(θ) = f(x + θ*d) where x and d are vectors of same dimension and θ is a scalar, more specifically the step size.

Tracked data can include:

  • x : the current step size
  • fx [opt] : h(θ) at the current iteration
  • gx [opt] : h'(θ)
  • f₀ [opt] : h(0)
  • g₀ [opt] : h'(0)
  • d [opt] : search direction
  • res [opt] : residual
  • current_time : the time at which the line search algorithm started.
  • current_score : the score at which the line search algorithm started.

Constructors: OneDAtX(:: T, :: S; fx :: T = _init_field(T), gx :: T = _init_field(T), f₀ :: T = _init_field(T), g₀ :: T = _init_field(T), current_time :: Float64 = NaN) where {S, T <: Number}

OneDAtX(:: T; fx :: T = _init_field(T), gx :: T = _init_field(T), f₀ :: T = _init_field(T), g₀ :: T = _init_field(T), current_time :: Float64 = NaN, current_score :: T = _init_field(T)) where T <: Number

Note:

  • By default, unknown entries are set using _init_field.
  • By default the type of current_score is eltype(x) and cannot be changed once the State is created. To have a vectorized current_score of length n, use OneDAtX(x, Array{eltype(x),1}(undef, n)).
source

General Functions

Stopping.update!Function
`update!(:: AbstractState; convert = false, kwargs...)`

Generic update function for the State The function compares the kwargs and the entries of the State. If the type of the kwargs is the same as the entry, then it is updated.

Set kargs convert to true to update even incompatible types.

Examples: update!(state1) update!(state1, current_time = 2.0) update!(state1, convert = true, current_time = 2.0)

See also: GenericState, reinit!, update_and_start!, update_and_stop!

source
`update!(stp::AbstractStopping; kwargs...)`

update!: generic update function for the Stopping

Shortcut for update!(stp.current_state; kwargs...)

source
Stopping.reinit!Function
`reinit!(:: AbstractState, :: T; kwargs...)`

Function that set all the entries at _init_field except the mandatory x.

Note: If x is given as a kargs it will be prioritized over the second argument.

Examples: reinit!(state2, zeros(2)) reinit!(state2, zeros(2), current_time = 1.0)

There is a shorter version of reinit! reusing the x in the state

`reinit!(:: AbstractState; kwargs...)`

Examples: reinit!(state2) reinit!(state2, current_time = 1.0)

source

reinit!: function that set all the entries at void except the mandatory x

reinit!(:: NLPAtX, x :: AbstractVector, l :: AbstractVector; kwargs...)

reinit!(:: NLPAtX; kwargs...)

Note: if x or lambda are given as keyword arguments they will be prioritized over the existing x, lambda and the default Counters.

source
`reinit!(:: AbstractStopping; rstate :: Bool = false, kwargs...)`

Reinitialize the meta-data in the Stopping.

Note:

  • If rstate is set as true it reinitializes the current State

(with the kwargs).

  • If rlist is set as true the list of states is also reinitialized, either

set as a VoidListofStates if rstate is true or a list containing only the current state otherwise.

source

For NLPStopping, rcounters set as true also reinitialize the counters.

source
Missing docstring.

Missing docstring for Stopping.copy, Stopping.compress_state!, Stopping.copy_compress_state. Check Documenter's build log for details.

Stopping.add_to_list!Function

add_to_list!: add a State to the list of maximal size n. If a n+1-th State is added, the first one in the list is removed. The given is State is compressed before being added in the list (via State.copy_compress_state).

add_to_list!(:: AbstractListofStates, :: AbstractState; kwargs...)

Note:

  • kwargs are passed to the compress_state call.
  • does nothing for VoidListofStates

see also: ListofStates, State.compress_state, State.copy_compress_state

source
Base.lengthFunction

length: return the number of States in the list.

length(:: ListofStates)

see also: print, addtolist!, ListofStates

source
Base.printFunction

print: output formatting. return a DataFrame.

print(:: ListofStates; verbose :: Bool = true, print_sym :: Union{Nothing,Array{Symbol,1}})

Note:

  • set verbose to false to avoid printing.
  • if print_sym is an Array of Symbol, only those symbols are printed. Note that

the returned DataFrame still contains all the columns.

  • More information about DataFrame: http://juliadata.github.io/DataFrames.jl

see also: add_to_list!, length, ListofStates

source

Stopping

Types

Stopping.GenericStoppingType

Type: GenericStopping

Methods: start!, stop!, update_and_start!, update_and_stop!, fill_in!, reinit!, status

A generic Stopping to solve instances with respect to some optimality conditions. Optimality is decided by computing a score, which is then tested to zero.

Tracked data include:

  • pb : A problem
  • current_state : The information relative to the problem, see GenericState.
  • (opt) meta : Metadata relative to a stopping criteria, see StoppingMeta.
  • (opt) main_stp : Stopping of the main loop in case we consider a Stopping of a subproblem. If not a subproblem, then VoidStopping.
  • (opt) listofstates : ListofStates designed to store the history of States.
  • (opt) stopping_user_struct : Contains a structure designed by the user.

Constructors:

  • GenericStopping(pb, meta::AbstractStoppingMeta, stop_remote::AbstractStopRemoteControl, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The default constructor.
  • GenericStopping(pb, meta::AbstractStoppingMeta, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The one passing the kwargs to the stop_remote.
  • GenericStopping(pb, state::AbstractState; stop_remote::AbstractStopRemoteControl = StopRemoteControl(), main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The one passing the kwargs to the meta.
  • GenericStopping(pb, stop_remote::AbstractStopRemoteControl, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The one passing the kwargs to the meta.
  • GenericStopping(pb, x; n_listofstates=, kwargs...) The one setting up a default state using x, and initializing the list of states if n_listofstates>0.

Note: Metadata can be provided by the user or created with the Stopping constructor via kwargs. If a specific StoppingMeta is given and kwargs are provided, the kwargs have priority.

Examples: GenericStopping(pb, GenericState(ones(2)), rtol = 1e-1)

Besides optimality conditions, we consider classical emergency exit:

  • domain error (for instance: NaN in x)
  • unbounded problem (not implemented)
  • unbounded x (x is too large)
  • tired problem (time limit attained)
  • resources exhausted (not implemented)
  • stalled problem (not implemented)
  • iteration limit (maximum number of iteration (i.e. nb of stop) attained)
  • main_pb limit (tired or resources of main problem exhausted)

There is an additional default constructor which creates a Stopping with a default State.

GenericStopping(:: Any, :: Union{Number, AbstractVector}; kwargs...)

Note: Keywords arguments are forwarded to the classical constructor.

Examples: GenericStopping(pb, x0, rtol = 1e-1)

source
Stopping.NLPStoppingType

Type: NLPStopping

Methods: start!, stop!, update_and_start!, update_and_stop!, fill_in!, reinit!, status, KKT, unconstrained_check, optim_check_bounded

Specialization of GenericStopping. Stopping structure for non-linear optimization models using NLPModels ( https://github.com/JuliaSmoothOptimizers/NLPModels.jl ).

Attributes:

  • pb : An AbstractNLPModel.
  • current_state : The information relative to the problem, see GenericState or NLPAtX.
  • (opt) meta : Metadata relative to stopping criteria, see StoppingMeta.
  • (opt) main_stp : Stopping of the main loop in case we consider a Stopping of a subproblem. If not a subproblem, then VoidStopping.
  • (opt) listofstates : ListofStates designed to store the history of States.
  • (opt) stopping_user_struct : Contains any structure designed by the user.

Constructors:

  • NLPStopping(pb::AbstractNLPModel, meta::AbstractStoppingMeta, stop_remote::AbstractStopRemoteControl, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The default constructor.
  • NLPStopping(pb::AbstractNLPModel, meta::AbstractStoppingMeta, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The one passing the kwargs to the stop_remote.
  • GenericStopping(pb::AbstractNLPModel, state::AbstractState; stop_remote::AbstractStopRemoteControl = StopRemoteControl(), main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), kwargs...) The one passing the kwargs to the meta.
  • GenericStopping(pb::AbstractNLPModel; n_listofstates=, kwargs...) The one setting up a default state NLPAtX using pb.meta.x0, and initializing the list of states if n_listofstates>0. The optimality function is the function KKT unless optimality_check is in the kwargs.

Notes:

  • Designed for NLPAtX State. Constructor checks that the State has the required entries.
source
Stopping.LAStoppingType

Type: LAStopping

Methods: start!, stop!, update_and_start!, update_and_stop!, fill_in!, reinit!, status, linear_system_check, normal_equation_check

Specialization of GenericStopping. Stopping structure for linear algebra solving either

$Ax = b$

or

\[min\_{x} \tfrac{1}{2}\|Ax - b\|^2\]

Attributes:

  • pb : a problem using, for instance, either LLSModel (designed for linear least square problem, see https://github.com/JuliaSmoothOptimizers/LLSModels.jl ) or LinearSystem.
  • current_state : The information relative to the problem, see GenericState.
  • (opt) meta : Metadata relative to stopping criteria, see StoppingMeta.
  • (opt) main_stp : Stopping of the main loop in case we consider a Stopping of a subproblem. If not a subproblem, then VoidStopping.
  • (opt) listofstates : ListofStates designed to store the history of States.
  • (opt) stopping_user_struct : Contains a structure designed by the user.

Constructors:

  • LAStopping(pb, meta::AbstractStoppingMeta, stop_remote::AbstractStopRemoteControl, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), zero_start::Bool = false) The default constructor.
  • LAStopping(pb, meta::AbstractStoppingMeta, state::AbstractState; main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), zero_start::Bool = false, kwargs...) The one passing the kwargs to the stop_remote.
  • LAStopping(pb, state::AbstractState; stop_remote::AbstractStopRemoteControl = StopRemoteControl(), main_stp::AbstractStopping=VoidStopping(), list::AbstractListofStates = VoidListofStates(), user_struct::AbstractDict = Dict(), zero_start::Bool = false, kwargs...) The one passing the kwargs to the meta.
  • LAStopping(:: Union{AbstractLinearOperator, AbstractMatrix}, :: AbstractVector; sparse::Bool = true, n_listofstates::Int = 0, kwargs...) The one setting up a default problem (sparse ? LLSModel(A, b) : LinearSystem(A, b)), a default GenericState using x, and initializing the list of states if n_listofstates>0.
  • LAStopping(:: Union{AbstractLinearOperator, AbstractMatrix}, :: AbstractVector, :: AbstractState; sparse::Bool = true, kwargs...) The one setting up a default problem (sparse ? LLSModel(A, b) : LinearSystem(A, b)).

Notes:

  • No specific State targeted
  • State don't necessarily keep track of evals
  • Evals are checked only for pb.A being a LinearOperator
  • zero_start is true if 0 is the initial guess (not check automatically)
  • LLSModel counter follow NLSCounters (see init_max_counters_NLS)
  • By default, meta.max_cntrs is initialized with an NLSCounters

See also GenericStopping, NLPStopping, linear_system_check, normal_equation_check

source
Stopping.StoppingMetaType

Type: StoppingMeta

Methods: no methods.

Attributes:

  • atol: absolute tolerance.
  • rtol: relative tolerance.
  • optimality0: optimality score at the initial guess.
  • tol_check: Function of atol, rtol and optimality0 testing a score to zero.
  • tol_check_neg: Function of atol, rtol and optimality0 testing a score to zero.
  • check_pos: pre-allocation for positive tolerance
  • check_neg: pre-allocation for negative tolerance
  • recomp_tol: true if tolerances are updated
  • optimality_check: a stopping criterion via an admissibility function
  • unbounded_threshold: threshold for unboundedness of the problem.
  • unbounded_x: threshold for unboundedness of the iterate.
  • max_f: maximum number of function (and derivatives) evaluations.
  • max_cntrs: Dict contains the maximum number of evaluations
  • max_eval: maximum number of function (and derivatives) evaluations.
  • max_iter: threshold on the number of stop! call/number of iteration.
  • max_time: time limit to let the algorithm run.
  • nb_of_stop: keep track of the number of stop! call/iteration.
  • start_time: keep track of the time at the beginning.
  • fail_sub_pb: status.
  • unbounded: status.
  • unbounded_pb: status.
  • tired: status.
  • stalled: status.
  • iteration_limit: status.
  • resources: status.
  • optimal: status.
  • infeasible: status.
  • main_pb: status.
  • domainerror: status.
  • suboptimal: status.
  • stopbyuser: status.
  • exception: status.
  • meta_user_struct: Any
  • user_check_func!: Function (AbstractStopping, Bool) -> callback.

StoppingMeta(;atol :: Number = 1.0e-6, rtol :: Number = 1.0e-15, optimality0 :: Number = 1.0, tol_check :: Function = (atol,rtol,opt0) -> max(atol,rtol*opt0), tol_check_neg :: Function = (atol,rtol,opt0) -> -max(atol,rtol*opt0), unbounded_threshold :: Number = 1.0e50, unbounded_x :: Number = 1.0e50, max_f :: Int = typemax(Int), max_eval :: Int = 20000, max_iter :: Int = 5000, max_time :: Number = 300.0, start_time :: Float64 = NaN, meta_user_struct :: Any = nothing, kwargs...)

an alternative with constant tolerances:

StoppingMeta(tol_check :: T, tol_check_neg :: T;atol :: Number = 1.0e-6, rtol :: Number = 1.0e-15, optimality0 :: Number = 1.0, unbounded_threshold :: Number = 1.0e50, unbounded_x :: Number = 1.0e50, max_f :: Int = typemax(Int), max_eval :: Int = 20000, max_iter :: Int = 5000, max_time :: Number = 300.0, start_time :: Float64 = NaN, meta_user_struct :: Any = nothing, kwargs...)

Note:

  • It is a mutable struct, therefore we can modify elements of a StoppingMeta.
  • The nb_of_stop is incremented everytime stop! or update_and_stop! is called
  • The optimality0 is modified once at the beginning of the algorithm (start!)
  • The start_time is modified once at the beginning of the algorithm (start!) if not precised before.
  • The different status: fail_sub_pb, unbounded, unbounded_pb, tired, stalled, iteration_limit, resources, optimal, main_pb, domainerror, suboptimal, infeasible
  • fail_sub_pb, suboptimal, and infeasible are modified by the algorithm.
  • optimality_check takes two inputs (AbstractNLPModel, NLPAtX)

and returns a Number or an AbstractVector to be compared to 0.

  • optimality_check does not necessarily fill in the State.

Examples: StoppingMeta(), StoppingMeta(1., -1.)

source

General Functions

Stopping.start!Function
`start!(stp::AbstractStopping; no_opt_check::Bool = false, kwargs...)`

Update the Stopping and return true if we must stop.

Purpose is to know if there is a need to even perform an optimization algorithm or if we are at an optimal solution from the beginning. Set no_opt_check to true avoid checking optimality and domain errors.

The function start! successively calls: _domain_check(stp, x), _optimality_check!(stp, x), _null_test(stp, x) and _user_check!(stp, x, true).

Note: - start! initializes stp.meta.start_time (if not done before), stp.current_state.current_time and stp.meta.optimality0 (if no_opt_check is false). - Keywords argument are passed to the _optimality_check! call. - Compatible with the StopRemoteControl.

source
Stopping.update_and_start!Function
`update_and_start!(stp::AbstractStopping; no_opt_check::Bool = false, kwargs...)`

Update values in the State and initialize the Stopping. Returns the optimality status of the problem as a boolean.

Note:

  • Kwargs are forwarded to the update! call.
  • no_opt_check skip optimality check in start! (false by default).
source
Stopping.stop!Function
`stop!(:: AbstractStopping; kwargs...)`

Update the Stopping and return a boolean true if we must stop.

It serves the same purpose as start! in an algorithm; telling us if we stop the algorithm (because we have reached optimality or we loop infinitely, etc).

The function stop! successively calls: _domain_check, _optimality_check, _null_test, _unbounded_check!, _tired_check!, _resources_check!, _stalled_check!, _iteration_check!, _main_pb_check!, add_to_list!

Note:

  • kwargs are sent to the _optimality_check! call.
  • If listofstates != VoidListofStates, call add_to_list!.
source
Stopping.update_and_stop!Function
`update_and_stop!(stp :: AbstractStopping; kwargs...)`

Update the values in the state and return the optimality status of the problem as a boolean.

Note: Kwargs are forwarded to the update! call.

source
Missing docstring.

Missing docstring for Stopping.reinit!. Check Documenter's build log for details.

Stopping.fill_in!Function
`fill_in!(stp::AbstractStopping, x::T) where {T}`

fill_in!: fill in the unspecified values of the AbstractState.

Note: NotImplemented for Abstract/Generic-Stopping.

source

fill_in!: (NLPStopping version) a function that fill in the required values in the NLPAtX.

fill_in!( :: NLPStopping, :: Union{AbstractVector, Nothing}; fx :: Union{AbstractVector, Nothing} = nothing, gx :: Union{AbstractVector, Nothing} = nothing, Hx :: Union{MatrixType, Nothing} = nothing, cx :: Union{AbstractVector, Nothing} = nothing, Jx :: Union{MatrixType, Nothing} = nothing, lambda :: Union{AbstractVector, Nothing} = nothing, mu :: Union{AbstractVector, Nothing} = nothing, matrix_info :: Bool = true, kwargs...)

source
Stopping.statusFunction
`status(:: AbstractStopping; list = false)`

Returns the status of the algorithm:

The different statuses are:

  • Optimal: reached an optimal solution.
  • SubProblemFailure
  • SubOptimal: reached an acceptable solution.
  • Unbounded: current iterate too large in norm.
  • UnboundedPb: unbouned problem.
  • Stalled: stalled algorithm.
  • IterationLimit: too many iterations of the algorithm.
  • TimeLimit: time limit.
  • EvaluationLimit: too many ressources used, i.e. too many functions evaluations.
  • ResourcesOfMainProblemExhausted: in the case of a substopping, EvaluationLimit or TimeLimit for the main stopping.
  • Infeasible: default return value, if nothing is done the problem is considered feasible.
  • StopByUser: stopped by the user.
  • DomainError: there is a NaN somewhere.
  • Exception: unhandled exception
  • Unknwon: if stopped for reasons unknown by Stopping.

Note:

  • Set keyword argument list to true, to get an Array with all the statuses.
  • The different statuses correspond to boolean values in the meta.
source
Stopping.init_max_countersFunction

init_max_counters: initialize the maximum number of evaluations on each of the functions present in the NLPModels.Counters, e.g.

init_max_counters(; allevals :: T = typemax(T), obj = allevals, grad = allevals, cons = allevals, jcon = allevals, jgrad = allevals, jac = allevals, jprod = allevals, jtprod = allevals, hess = allevals, hprod = allevals, jhprod = allevals, sum = 11 * allevals, kwargs...)

:neval_sum is by default limited to |Counters| * allevals.

source
Stopping.init_max_counters_NLSFunction

init_max_counters_NLS: initialize the maximum number of evaluations on each of the functions present in the NLPModels.NLSCounters, e.g.

init_max_counters_NLS(; allevals = typemax(T), residual = allevals, jac_residual = allevals, jprod_residual = allevals, jtprod_residual = allevals, hess_residual = allevals, jhess_residual = allevals, hprod_residual = allevals, kwargs...)

source
Stopping.init_max_counters_linear_operatorsFunction

init_max_counters_linear_operators: counters for LinearOperator

init_max_counters_linear_operators(; allevals :: T = 20000, nprod = allevals, ntprod = allevals, nctprod = allevals, sum = 11 * allevals)

source

Non-linear admissibility functions

Stopping.KKTFunction
`KKT( :: AbstractNLPModel, :: NLPAtX; pnorm :: Real = Inf, kwargs...)`

Check the KKT conditions.

Note: state.gx is mandatory + if bounds state.mu + if constraints state.cx, state.Jx, state.lambda.

See also unconstrained_check, optim_check_bounded

source
Stopping.unconstrained_checkFunction
`unconstrained_check( :: AbstractNLPModel, :: NLPAtX; pnorm :: Real = Inf, kwargs...)`

Return the pnorm-norm of the gradient of the objective function.

Require state.gx (filled if not provided).

See also optim_check_bounded, KKT

source
Missing docstring.

Missing docstring for Stopping.unconstrained2nd_check. Check Documenter's build log for details.

Stopping.optim_check_boundedFunction
`optim_check_bounded( :: AbstractNLPModel, :: NLPAtX; pnorm :: Real = Inf, kwargs...)`

Check the pnorm-norm of the gradient of the objective function projected over the bounds.

Require state.gx (filled if not provided).

See also unconstrained_check, KKT

source

Linear algebra admissibility functions

Stopping.linear_system_checkFunction

linear_system_check: return ||Ax-b||_p

linear_system_check(:: Union{LinearSystem, LLSModel}, :: AbstractState; pnorm :: Real = Inf, kwargs...)

Note:

  • Returns the p-norm of state.res
  • state.res is filled in if nothing.
source
Stopping.normal_equation_checkFunction

normal_equation_check: return ||A'Ax-A'b||_p

normal_equation_check(:: Union{LinearSystem, LLSModel}, :: AbstractState; pnorm :: Real = Inf, kwargs...)

Note: pb must have A and b entries

source

Line search admissibility functions

Stopping.armijoFunction
`armijo(h::Any, h_at_t::OneDAtX{S, T}; τ₀::T = T(0.01), kwargs...) where {S, T}`

Check if a step size is admissible according to the Armijo criterion.

Armijo criterion: f(x + θd) - f(x) - τ₀ θ ∇f(x+θd)d < 0

This function returns the maximum between the left-hand side and 0.

Note: fx, f₀ and g₀ are required in the OneDAtX.

See also wolfe, armijo_wolfe, shamanskii_stop, goldstein

source
Stopping.wolfeFunction
`wolfe(h::Any, h_at_t::OneDAtX{S, T}; τ₁::T = T(0.99), kwargs...) where {S, T}`

Check if a step size is admissible according to the Wolfe criterion.

Strong Wolfe criterion: |∇f(x+θd)| - τ₁||∇f(x)|| < 0.

This function returns the maximum between the left-hand side and 0.

Note: gx and g₀ are required in the OneDAtX.

See also armijo, armijo_wolfe, shamanskii_stop, goldstein

source
Stopping.armijo_wolfeFunction
`armijo_wolfe(h::Any, h_at_t::OneDAtX{S, T}; τ₀::T = T(0.01), τ₁::T = T(0.99), kwargs...) where {S, T}`

Check if a step size is admissible according to the Armijo and Wolfe criteria.

Note: fx, f₀, gx and g₀ are required in the OneDAtX.

See also armijo, wolfe, shamanskii_stop, goldstein

source
Stopping.shamanskii_stopFunction
`shamanskii_stop(h :: Any, h_at_t :: OneDAtX; γ :: Float64 = 1.0e-09, kwargs...)`

Check if a step size is admissible according to the "Shamanskii" criteria.

This criteria was proposed in:

Lampariello, F., & Sciandrone, M. (2001). Global convergence technique for the Newton method with periodic Hessian evaluation. Journal of optimization theory and applications, 111(2), 341-358.

Note:

  • h.d accessible (specific LineModel).
  • fx, f₀ are required in the OneDAtX.

See also armijo, wolfe, armijo_wolfe, goldstein

source
Stopping.goldsteinFunction
`goldstein(h::Any, h_at_t::OneDAtX{S, T}; τ₀::T = T(0.0001), τ₁::T = T(0.9999), kwargs...) where {S, T}`

Check if a step size is admissible according to the Goldstein criteria.

Note: fx, f₀ and g₀ are required in the OneDAtX.

See also armijo, wolfe, armijo_wolfe, shamanskii_stop

source