From f7096b8941e9f040c880a180cc24ea035d0883f7 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Wed, 3 Jul 2024 12:20:39 +0000 Subject: [PATCH] build based on 36ded4f --- dev/active-set/index.html | 2 +- dev/api/index.html | 2 +- dev/backls/index.html | 2 +- dev/benchmark/index.html | 2 +- dev/buffer/index.html | 2 +- dev/checkpointing/index.html | 2 +- dev/example-basic-Newton/index.html | 2 +- dev/fixed-point/index.html | 2 +- dev/gradient-lbfgs/index.html | 10 +++++----- dev/howstopcheckoptimality/index.html | 2 +- dev/howtostate-nlp/index.html | 2 +- dev/howtostate/index.html | 2 +- dev/howtostop-2/index.html | 2 +- dev/howtostop-nlp/index.html | 2 +- dev/howtostop/index.html | 2 +- dev/idcard-state/index.html | 2 +- dev/idcard-stoppingmeta/index.html | 2 +- dev/idcard-stopremote/index.html | 2 +- dev/idcard/index.html | 2 +- dev/index.html | 2 +- dev/index_tuto/index.html | 2 +- dev/lastopping/index.html | 2 +- dev/linear-algebra/index.html | 2 +- dev/nlpstopping/index.html | 2 +- dev/overfitting/index.html | 2 +- dev/penalty/index.html | 2 +- dev/run-optimsolver/index.html | 2 +- dev/search/index.html | 2 +- dev/speak-to-stopping/index.html | 2 +- dev/stop-workflow/index.html | 2 +- dev/uncons/index.html | 2 +- 31 files changed, 35 insertions(+), 35 deletions(-) diff --git a/dev/active-set/index.html b/dev/active-set/index.html index 4a91ee8..c372bca 100644 --- a/dev/active-set/index.html +++ b/dev/active-set/index.html @@ -68,4 +68,4 @@ end #end of main loop return stp -end +end diff --git a/dev/api/index.html b/dev/api/index.html index 4abd23f..a676409 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,2 +1,2 @@ -API · Stopping.jl

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}

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}

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

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}, :: Union{AbstractGPUVector, 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}, :: Union{AbstractGPUVector, 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)

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{T, Nothing}; fx :: Union{T, Nothing} = nothing, gx :: Union{T, Nothing} = nothing, Hx :: Union{MatrixType, Nothing} = nothing, cx :: Union{T, Nothing} = nothing, Jx :: Union{MatrixType, Nothing} = nothing, lambda :: Union{T, Nothing} = nothing, mu :: Union{T, 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
+API · Stopping.jl

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}

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}

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

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}, :: Union{AbstractGPUVector, 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}, :: Union{AbstractGPUVector, 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)

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{T, Nothing}; fx :: Union{T, Nothing} = nothing, gx :: Union{T, Nothing} = nothing, Hx :: Union{MatrixType, Nothing} = nothing, cx :: Union{T, Nothing} = nothing, Jx :: Union{MatrixType, Nothing} = nothing, lambda :: Union{T, Nothing} = nothing, mu :: Union{T, 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
diff --git a/dev/backls/index.html b/dev/backls/index.html index 8ba9f0e..3b0e586 100644 --- a/dev/backls/index.html +++ b/dev/backls/index.html @@ -69,4 +69,4 @@ function ParamLS(;back_update :: Float64 = 0.1) return new(back_update) end -end +end diff --git a/dev/benchmark/index.html b/dev/benchmark/index.html index 3c6b48c..fa893fa 100644 --- a/dev/benchmark/index.html +++ b/dev/benchmark/index.html @@ -54,4 +54,4 @@ finalize(nlp_cutest) end #end of main loop
for name in names
 @show stats[name]
-end
+end diff --git a/dev/buffer/index.html b/dev/buffer/index.html index 7d09179..5a7a688 100644 --- a/dev/buffer/index.html +++ b/dev/buffer/index.html @@ -47,4 +47,4 @@ solveIpopt(stop) #Final status is :IterationLimit -@show stop.current_state.x, status(stop) +@show stop.current_state.x, status(stop) diff --git a/dev/checkpointing/index.html b/dev/checkpointing/index.html index 9a2942e..f721d29 100644 --- a/dev/checkpointing/index.html +++ b/dev/checkpointing/index.html @@ -30,4 +30,4 @@ user_check_func! = save_check, max_iter = 99) # Let's go fixed_step_steepest_descent(stp)

The algorithm has now generated two files checkpoint_stopping_0.jld2 and checkpoint_stopping_50.jld2 that can be analyzed.

stp0 = load("checkpoint_stopping_0.jld2")["stp"]
-stp50 = load("checkpoint_stopping_50.jld2")["stp"]
+stp50 = load("checkpoint_stopping_50.jld2")["stp"] diff --git a/dev/example-basic-Newton/index.html b/dev/example-basic-Newton/index.html index 74055a7..0cbe63e 100644 --- a/dev/example-basic-Newton/index.html +++ b/dev/example-basic-Newton/index.html @@ -15,4 +15,4 @@ end return stp -end

This example shows the most basic features of Stopping. It does many checks for you. In this innocent-looking algorithm, the call to update_and_start! and update_and_stop! will verifies unboundedness of x, the time spent in the algorithm, the number of iterations (= number of call to stop!), and the domain of x (in case some of its components become NaN for instance).

FAQ: How can I disable some checks done by Stopping?

The native instances of AbstractStopping available in Stopping.jl all contain an attribute stop_remote. This is a remote control for Stopping's checks.

typeof(stp.stop_remote) <: StopRemoteControl #stop_remote is an instance of StopRemoteControl

This attributes contains boolean values for each check done by Stopping, see

fieldnames(stp.stop_remote) #get all the attributes of the remote control

For instance, we can remove the unboundedness and domain check done on x by setting:

stp.stop_remote = StopRemoteControl(unbounded_and_domain_x_check = false)
+end

This example shows the most basic features of Stopping. It does many checks for you. In this innocent-looking algorithm, the call to update_and_start! and update_and_stop! will verifies unboundedness of x, the time spent in the algorithm, the number of iterations (= number of call to stop!), and the domain of x (in case some of its components become NaN for instance).

FAQ: How can I disable some checks done by Stopping?

The native instances of AbstractStopping available in Stopping.jl all contain an attribute stop_remote. This is a remote control for Stopping's checks.

typeof(stp.stop_remote) <: StopRemoteControl #stop_remote is an instance of StopRemoteControl

This attributes contains boolean values for each check done by Stopping, see

fieldnames(stp.stop_remote) #get all the attributes of the remote control

For instance, we can remove the unboundedness and domain check done on x by setting:

stp.stop_remote = StopRemoteControl(unbounded_and_domain_x_check = false)
diff --git a/dev/fixed-point/index.html b/dev/fixed-point/index.html index 73a159f..ce4a4b3 100644 --- a/dev/fixed-point/index.html +++ b/dev/fixed-point/index.html @@ -44,4 +44,4 @@ #In this scenario, the algorithm stops because it attains a fixed point #Hence, status is :SubOptimal. @show status(stop) -@test status(stop) == :SubOptimal +@test status(stop) == :SubOptimal diff --git a/dev/gradient-lbfgs/index.html b/dev/gradient-lbfgs/index.html index dd077bc..e70ea8a 100644 --- a/dev/gradient-lbfgs/index.html +++ b/dev/gradient-lbfgs/index.html @@ -82,7 +82,7 @@ )
NLPStopping{ADNLPModels.ADNLPModel{Float64, Vector{Float64}, Vector{Int64}}, StoppingMeta{Float64, Float64, Nothing, Stopping.var"#46#54", Stopping.var"#47#55"{Stopping.var"#46#54"}, typeof(unconstrained_check)}, StopRemoteControl, NLPAtX{Float64, Float64, Vector{Float64}}, VoidStopping{Any, StoppingMeta, StopRemoteControl, GenericState, Nothing, VoidListofStates}, VoidListofStates}
 It has no main_stp.
 It doesn't keep track of the state history.
-Problem is ADNLPModel - Model with automatic differentiation backend ADNLPModels.ADModelBackend{ADNLPModels.ForwardDiffADGradient, ADNLPModels.ForwardDiffADHvprod, ADNLPModels.ForwardDiffADJprod, ADNLPModels.ForwardDiffADJtprod, ADNLPModels.ForwardDiffADJacobian, ADNLPModels.ForwardDiffADHessian, ADNLPModels.ForwardDiffADGHjvprod}(ADNLPModels.ForwardDiffADGradient(ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(Main.fH), Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}, Float64, 2}}}((Partials(1.0, 0.0), Partials(0.0, 1.0)), ForwardDiff.Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}, Float64, 2}[Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}}(6.89882674576156e-310,6.89882674576314e-310,6.89885337279634e-310), Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}}(6.8988267457663e-310,6.8988267457679e-310,6.89882674576946e-310)])), ADNLPModels.ForwardDiffADHvprod(), ADNLPModels.ForwardDiffADJprod(), ADNLPModels.ForwardDiffADJtprod(), ADNLPModels.ForwardDiffADJacobian(0), ADNLPModels.ForwardDiffADHessian(3), ADNLPModels.ForwardDiffADGHjvprod())
+Problem is ADNLPModel - Model with automatic differentiation backend ADNLPModels.ADModelBackend{ADNLPModels.ForwardDiffADGradient, ADNLPModels.ForwardDiffADHvprod, ADNLPModels.ForwardDiffADJprod, ADNLPModels.ForwardDiffADJtprod, ADNLPModels.ForwardDiffADJacobian, ADNLPModels.ForwardDiffADHessian, ADNLPModels.ForwardDiffADGHjvprod}(ADNLPModels.ForwardDiffADGradient(ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(Main.fH), Float64}, Float64, 2, Vector{ForwardDiff.Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}, Float64, 2}}}((Partials(1.0, 0.0), Partials(0.0, 1.0)), ForwardDiff.Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}, Float64, 2}[Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}}(6.9118642514387e-310,6.91186019307676e-310,6.9118642514395e-310), Dual{ForwardDiff.Tag{typeof(Main.fH), Float64}}(6.91186019307676e-310,6.9118644694402e-310,6.91186019307676e-310)])), ADNLPModels.ForwardDiffADHvprod(), ADNLPModels.ForwardDiffADJprod(), ADNLPModels.ForwardDiffADJtprod(), ADNLPModels.ForwardDiffADJacobian(0), ADNLPModels.ForwardDiffADHessian(3), ADNLPModels.ForwardDiffADGHjvprod())
   Problem name: Generic
    All variables: ████████████████████ 2      All constraints: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0     
             free: ████████████████████ 2                 free: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0     
@@ -107,10 +107,10 @@
 

Our first elementary runs will use separately the steepest descent method and the quasi-Newton method to solve the problem.

Steepest descent

reinit!(stp, rstate = true, x = nlp.meta.x0)
 steepest_descent(stp)
 
-(status(stp), elapsed_time(stp), get_list_of_states(stp), neval_obj(nlp), neval_grad(nlp))
(:Optimal, 1.101201057434082, VoidListofStates(), 889, 37)

BFGS quasi-Newton

reinit!(stp, rstate = true, x = nlp.meta.x0, rcounters = true)
+(status(stp), elapsed_time(stp), get_list_of_states(stp), neval_obj(nlp), neval_grad(nlp))
(:Optimal, 1.091270923614502, VoidListofStates(), 889, 37)

BFGS quasi-Newton

reinit!(stp, rstate = true, x = nlp.meta.x0, rcounters = true)
 bfgs_quasi_newton_armijo(stp)
 
-(status(stp), elapsed_time(stp), get_list_of_states(stp), neval_obj(nlp), neval_grad(nlp))
(:Optimal, 0.009181976318359375, VoidListofStates(), 91, 18)

Mix of Algorithms

NLPModels.reset!(nlp)
+(status(stp), elapsed_time(stp), get_list_of_states(stp), neval_obj(nlp), neval_grad(nlp))
(:Optimal, 0.009361982345581055, VoidListofStates(), 91, 18)

Mix of Algorithms

NLPModels.reset!(nlp)
 stp_warm = NLPStopping(
   nlp,
   optimality_check = unconstrained_check,
@@ -131,7 +131,7 @@
 end
reinit!(stp_warm)
 stp_warm.meta.max_iter = 100
 bfgs_quasi_newton_armijo(stp_warm, Hk = Hwarm)
-(status(stp_warm), elapsed_time(stp_warm), get_list_of_states(stp_warm), neval_obj(nlp), neval_grad(nlp))
(:Optimal, 0.009320974349975586, ListofStates{NLPAtX{Float64, Float64, Vector{Float64}}, VoidListofStates}(-1, 10, Tuple{NLPAtX{Float64, Float64, Vector{Float64}}, VoidListofStates}[(NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
+(status(stp_warm), elapsed_time(stp_warm), get_list_of_states(stp_warm), neval_obj(nlp), neval_grad(nlp))
(:Optimal, 0.008723020553588867, ListofStates{NLPAtX{Float64, Float64, Vector{Float64}}, VoidListofStates}(-1, 10, Tuple{NLPAtX{Float64, Float64, Vector{Float64}}, VoidListofStates}[(NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
 , VoidListofStates()), (NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
 , VoidListofStates()), (NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
 , VoidListofStates()), (NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
@@ -141,4 +141,4 @@
 , VoidListofStates()), (NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
 , VoidListofStates()), (NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
 , VoidListofStates()), (NLPAtX{Float64, Float64, Vector{Float64}} with an iterate of type Vector{Float64} and a score of type Float64.
-, VoidListofStates())]), 192, 16)
+, VoidListofStates())]), 192, 16) diff --git a/dev/howstopcheckoptimality/index.html b/dev/howstopcheckoptimality/index.html index 2373836..0de3533 100644 --- a/dev/howstopcheckoptimality/index.html +++ b/dev/howstopcheckoptimality/index.html @@ -6,4 +6,4 @@ optimal = _inequality_check(optimality, check_pos, check_neg)

So, overall Stopping does:

check_pos = stp.meta.tol_check(stp.meta.atol, stp.meta.rtol, stp.meta.optimality0)
 check_neg = stp.meta.tol_check_neg(stp.meta.atol, stp.meta.rtol, stp.meta.optimality0)
 score     = stp.meta.optimality_check(stp.pb, stp.current_state)
-check_pos ≤ score ≤ check_neg

FAQ: Does it work for vector scores as well?

The type of the score and tolerances are respectively initialized in the State and the Meta at the initialization of the Stopping. Hence one can use vectorized scores as long as they can be compared with the tolerances. For instance:

FAQ: How do I implement AND and OR conditions?

The concatenation of two scores (AND condition) that need to be tested to zero can be represented as a vector. The disjunction of two score (OR condition) are represented as tuple.

FAQ: Do Stopping really computes the tolerances each time?

It does unless meta.recomp_tol is set as true. This entry can be set as true from the beginning as the tol_check functions are evaluated once at the initialization of the meta.

+check_pos ≤ score ≤ check_neg

FAQ: Does it work for vector scores as well?

The type of the score and tolerances are respectively initialized in the State and the Meta at the initialization of the Stopping. Hence one can use vectorized scores as long as they can be compared with the tolerances. For instance:

FAQ: How do I implement AND and OR conditions?

The concatenation of two scores (AND condition) that need to be tested to zero can be represented as a vector. The disjunction of two score (OR condition) are represented as tuple.

FAQ: Do Stopping really computes the tolerances each time?

It does unless meta.recomp_tol is set as true. This entry can be set as true from the beginning as the tol_check functions are evaluated once at the initialization of the meta.

diff --git a/dev/howtostate-nlp/index.html b/dev/howtostate-nlp/index.html index 54d80e4..4932339 100644 --- a/dev/howtostate-nlp/index.html +++ b/dev/howtostate-nlp/index.html @@ -30,4 +30,4 @@ @test getfield(state_bnd.evals, :neval_obj) == 102 @test sum_counters(state_bnd.evals) - 102 == 0

III. Domain Error

Similar to the GenericState we can use domain_check to verify there are no NaN

@test Stopping._domain_check(state_bnd) == false
 update!(state_bnd, fx = NaN)
-@test Stopping._domain_check(state_bnd) == true

IV. Use the NLPAtX

For algorithmic use, it might be conveninent to fill in all the entries of then State. In this case, we can use the Stopping:

stop = NLPStopping(nlp, (x,y) -> unconstrained_check(x,y), state_unc)

Note that the fillin! can receive known informations via keywords. If we don't want to store the hessian matrix, we turn the keyword matrixinfo as false.

fill_in!(stop, x0, matrix_info = false)
@test stop.current_state.Hx == nothing

We can now use the updated step in the algorithmic procedure

@test start!(stop) #return true
+@test Stopping._domain_check(state_bnd) == true

IV. Use the NLPAtX

For algorithmic use, it might be conveninent to fill in all the entries of then State. In this case, we can use the Stopping:

stop = NLPStopping(nlp, (x,y) -> unconstrained_check(x,y), state_unc)

Note that the fillin! can receive known informations via keywords. If we don't want to store the hessian matrix, we turn the keyword matrixinfo as false.

fill_in!(stop, x0, matrix_info = false)
@test stop.current_state.Hx == nothing

We can now use the updated step in the algorithmic procedure

@test start!(stop) #return true
diff --git a/dev/howtostate/index.html b/dev/howtostate/index.html index b385c05..f158aaf 100644 --- a/dev/howtostate/index.html +++ b/dev/howtostate/index.html @@ -18,4 +18,4 @@ @test Stopping._domain_check(state2) == false update!(state2, x=[NaN, 0.0]) -@test Stopping._domain_check(state2) == true +@test Stopping._domain_check(state2) == true diff --git a/dev/howtostop-2/index.html b/dev/howtostop-2/index.html index d7767c4..f7f8174 100644 --- a/dev/howtostop-2/index.html +++ b/dev/howtostop-2/index.html @@ -22,4 +22,4 @@ @test sub_stop.meta.main_pb == true @test status(main_stop, list = true) == [:Tired] @test main_stop.meta.tired == true -@test main_stop.meta.main_pb == false +@test main_stop.meta.main_pb == false diff --git a/dev/howtostop-nlp/index.html b/dev/howtostop-nlp/index.html index 0c25e52..c4c495c 100644 --- a/dev/howtostop-nlp/index.html +++ b/dev/howtostop-nlp/index.html @@ -33,4 +33,4 @@ @test OK == true @test stop_nlp_2.meta.optimal == true

However, note that the same cannot be achieved with updateandstop!:

reinit!(stop_nlp_2)
 OK = update_and_stop!(stop_nlp_2, a = 0.0)
-@test OK == false
+@test OK == false diff --git a/dev/howtostop/index.html b/dev/howtostop/index.html index 36c1202..6a0d48f 100644 --- a/dev/howtostop/index.html +++ b/dev/howtostop/index.html @@ -22,4 +22,4 @@ @test stop3.meta.iteration_limit == true #as stop3.meta.nb_of_stop > 3.

Overall we activated three flags:

@test status(stop3, list = true) == [:Unbounded, :IterationLimit, :Tired]

Once we are done with an algorithm and want to reuse a stopping, we need to reinitialize all the entries.

reinit!(stop3)

the status boolean are back to false

@test !stop3.meta.iteration_limit && !stop3.meta.tired && !stop3.meta.unbounded

reinitialize also the entries updated by the start!

@test isnan(stop3.meta.start_time) && (stop3.meta.optimality0 == 1.0)
 @test stop3.meta.nb_of_stop == 0 #and the counter of stop

Note that by default reinit! does not reinitialize the currentstate. This can be done by switching the keyword rstate to true. In this case, keywords are forwarded to the reinit! of currentstate.

reinit!(stop3, rstate =  true, x = zeros(2))
 @test stop3.current_state.current_time == nothing
-@test stop3.current_state.x == zeros(2)
+@test stop3.current_state.x == zeros(2) diff --git a/dev/idcard-state/index.html b/dev/idcard-state/index.html index 92d842e..fe3b812 100644 --- a/dev/idcard-state/index.html +++ b/dev/idcard-state/index.html @@ -42,4 +42,4 @@ return new{S, T, Matrix{eltype(T)}}(x, fx, gx, Hx, mu, cx, Jx, lambda, d, res, current_time, current_score, evals) end -end

_init_field(T) initializes a value for a given type guaranteing type stability and minimal storage.

+end

_init_field(T) initializes a value for a given type guaranteing type stability and minimal storage.

diff --git a/dev/idcard-stoppingmeta/index.html b/dev/idcard-stoppingmeta/index.html index 09f3934..18a04f6 100644 --- a/dev/idcard-stoppingmeta/index.html +++ b/dev/idcard-stoppingmeta/index.html @@ -5,4 +5,4 @@ inttype(meta) #IntType: type of integer tolerances

FAQ: What is user_check_func!?

This is a callback function called in the execution of the function stop! or start!. This function takes two input stp <: AbstractStopping and a boolean set as true if called from start! and false if called from stop!. To eventually returns a stopping status, the function has to update stp.meta.stopbyuser.

For instance, if one want to stop when $\log(x) < 1$ in stop!:

function test(stp, start)
   stp.meta.stopbyuser = !start && (log(stp.current_state.x) < 1)
 end
-user_check_func! = test

The exclamation mark (!) is a naming convention used when the function modifies input.

+user_check_func! = test

The exclamation mark (!) is a naming convention used when the function modifies input.

diff --git a/dev/idcard-stopremote/index.html b/dev/idcard-stopremote/index.html index 02f1355..10c46a8 100644 --- a/dev/idcard-stopremote/index.html +++ b/dev/idcard-stopremote/index.html @@ -2,4 +2,4 @@ Stop remote control · Stopping.jl

Stopping's attributes ID: StopRemoteControl

Usual instances of AbstractStopping contains a StopRemoteControl <: AbstractStopRemoteControl (stp.stop_remote), which controls the various checks run by the functions start! and stop!. An instance of StopRemoteControl contains:

  • unbounded_and_domain_x_check :: Bool
  • domain_check :: Bool
  • optimality_check :: Bool
  • infeasibility_check :: Bool
  • unbounded_problem_check :: Bool
  • tired_check :: Bool
  • resources_check :: Bool
  • stalled_check :: Bool
  • iteration_check :: Bool
  • main_pb_check :: Bool
  • user_check :: Bool
  • user_start_check :: Bool
  • cheap_check :: Bool

Only the last attributes, cheap_check, is not related with a specific check. Set as true, it stopped whenever one of the checks is successful and the algorithm needs to stop. It is false by default. All the other entries are set as true by default, i.e.

#initializes a remote control with all the checks on.
 src = StopRemoteControl()

In order to remove some checks, it suffices to use keywords:

#remove time and iteration checks.
 src = StopRemoteControl(tired_check = false, iteration_check = false)

FAQ: Is there performance issues with all these checks?

Assuming that x is a vector of length n, some of these checks are indeed in O(n), which can be undesirable for some applications. In this case, you can either initialize a "cheap" remote control as follows

#initialize a StopRemoteControl with 0(n) checks set as false
-src = cheap_stop_remote_control()

or deactivate the tests by hand as shown previously.

FAQ: How can I fine-tune these checks?

All these checks can be fine-tuned by selecting entries in the StoppingMeta.

+src = cheap_stop_remote_control()

or deactivate the tests by hand as shown previously.

FAQ: How can I fine-tune these checks?

All these checks can be fine-tuned by selecting entries in the StoppingMeta.

diff --git a/dev/idcard/index.html b/dev/idcard/index.html index 6e3c74c..4b3538b 100644 --- a/dev/idcard/index.html +++ b/dev/idcard/index.html @@ -1,2 +1,2 @@ -Stopping's ID · Stopping.jl

Stopping

A Stopping is an instance (a subtype) of an AbstractStopping. Such instances minimally contain:

  • problem :: Any an arbitrary instance of a problem;
  • meta :: AbstractStoppingMeta contains the used parameters and stopping statuses;
  • current_state :: AbstractState current information/state of the problem.

While the problem is up to the user, the meta and the current_state are specific features of Stopping.jl. The meta contains all the parameters relative to the stopping criteria (tolerances, limits ...). We implemented StoppingMeta() which offers a set of default parameters that can be easily modified with keyword arguments. See StoppingMeta for more detailed information. The native instances of AbstractStopping (GenericStopping, NLPStoppping, etc) contains more attributes (stop_remote, main_stp, listofstates, stopping_user_struct) that we will developed later on.

The current_state contains all the information relative to a problem. We implemented a GenericState as an illustration of the behavior of such object that typically contains:

  • x the current iterate;
  • d the current direction;
  • res the current residual;
  • current_time the current time;
  • current_score the current optimality score;
  • ... other information relative to the problems.

When running the iterative loop, the State is updated and the Stopping make a decision based on this information.

Main Methods

Stopping's main behavior is represented by two functions:

  • start!(:: AbstractStopping) initializes the time and the tolerance at the starting point and stopping criteria.
  • stop!(:: AbstractStopping) checks stopping criteria

Stopping uses the information furnished by the State to make a decision. Communication between the two can be done through the following functions:

  • update_and_start!(stp :: AbstractStopping; kwargs...) updates the states with information furnished as kwargs and then call start!.
  • update_and_stop!(stp :: AbstractStopping; kwargs...) updates the states with information furnished as kwargs and then call stop!.
  • fill_in!(stp :: AbstractStopping, x :: xtype(stp.current_state)) a function that fills in all the State with all the information required to evaluate the stopping functions correctly. This can reveal useful, for instance, if the user do not trust the information furnished by the algorithm in the State.
  • reinit!(stp :: AbstractStopping) reinitialize the entries of the Stopping to reuse for another call.

FAQ: How do I get more information?

As usual in Julia, we can use ? to get functions' documentation.

? Stopping.stop!
+Stopping's ID · Stopping.jl

Stopping

A Stopping is an instance (a subtype) of an AbstractStopping. Such instances minimally contain:

  • problem :: Any an arbitrary instance of a problem;
  • meta :: AbstractStoppingMeta contains the used parameters and stopping statuses;
  • current_state :: AbstractState current information/state of the problem.

While the problem is up to the user, the meta and the current_state are specific features of Stopping.jl. The meta contains all the parameters relative to the stopping criteria (tolerances, limits ...). We implemented StoppingMeta() which offers a set of default parameters that can be easily modified with keyword arguments. See StoppingMeta for more detailed information. The native instances of AbstractStopping (GenericStopping, NLPStoppping, etc) contains more attributes (stop_remote, main_stp, listofstates, stopping_user_struct) that we will developed later on.

The current_state contains all the information relative to a problem. We implemented a GenericState as an illustration of the behavior of such object that typically contains:

  • x the current iterate;
  • d the current direction;
  • res the current residual;
  • current_time the current time;
  • current_score the current optimality score;
  • ... other information relative to the problems.

When running the iterative loop, the State is updated and the Stopping make a decision based on this information.

Main Methods

Stopping's main behavior is represented by two functions:

  • start!(:: AbstractStopping) initializes the time and the tolerance at the starting point and stopping criteria.
  • stop!(:: AbstractStopping) checks stopping criteria

Stopping uses the information furnished by the State to make a decision. Communication between the two can be done through the following functions:

  • update_and_start!(stp :: AbstractStopping; kwargs...) updates the states with information furnished as kwargs and then call start!.
  • update_and_stop!(stp :: AbstractStopping; kwargs...) updates the states with information furnished as kwargs and then call stop!.
  • fill_in!(stp :: AbstractStopping, x :: xtype(stp.current_state)) a function that fills in all the State with all the information required to evaluate the stopping functions correctly. This can reveal useful, for instance, if the user do not trust the information furnished by the algorithm in the State.
  • reinit!(stp :: AbstractStopping) reinitialize the entries of the Stopping to reuse for another call.

FAQ: How do I get more information?

As usual in Julia, we can use ? to get functions' documentation.

? Stopping.stop!
diff --git a/dev/index.html b/dev/index.html index 7ff2899..29c9862 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,4 +1,4 @@ Home · Stopping.jl

Stopping.jl

This package provides general tools for the uniformization of stopping criteria for iterative solvers. When calling an iterative solver, four outcomes may happen:

  1. An approximate solution is obtained;
  2. The problem is declared unsolvable (unboundedness, infeasibility, etc);
  3. The maximum available resources are not sufficient to compute the solution;
  4. An algorithm's dependent failure happens.

There are many advantages in using Stopping:

  • Make your code more readable by outsourcing some tests to Stopping;
  • Let the user a hand on the stopping criteria;
  • Encourage reusability of codes.

Stopping.jl offers several advanced facilities, but a basic usage is already beneficial for your code.

How to install

Install and test the Stopping package with the Julia package manager:

pkg> add Stopping
 pkg> test Stopping

You can access the most up-to-date version of the Stopping package using:

pkg> add https://github.com/SolverStoppingJulia/Stopping.jl
-pkg> test Stopping

Stopping.jl most evolved facilities are based on JuliaSmoothOptimizers' tools.

Stopping.jl in action

Stopping.jl is already used in other Julia packages:

+pkg> test Stopping

Stopping.jl most evolved facilities are based on JuliaSmoothOptimizers' tools.

Stopping.jl in action

Stopping.jl is already used in other Julia packages:

diff --git a/dev/index_tuto/index.html b/dev/index_tuto/index.html index 2ce1a10..ce2b5e5 100644 --- a/dev/index_tuto/index.html +++ b/dev/index_tuto/index.html @@ -34,4 +34,4 @@ end

Finally, we can call the algorithm with our Stopping:

stop_nlp = newton(stop_nlp)

and consult the Stopping to know what happened

#We can then ask stop_nlp the final status
 @test :Optimal in status(stop_nlp, list = true)
 #Explore the final values in stop_nlp.current_state
-printstyled("Final solution is $(stop_nlp.current_state.x)", color = :green)

We reached optimality, and thanks to the Stopping structure this simple looking algorithm verified at each step of the algorithm:

Long-Term Goals

Stopping is aimed as a tool for improving the reusability and robustness in the implementation of iterative algorithms. We warmly welcome any feedback or comment leading to potential improvements.

Future work will address more sophisticated problems such as mixed-integer optimization problems, optimization with uncertainty. The list of suggested optimality functions will be enriched with state of the art conditions.

+printstyled("Final solution is $(stop_nlp.current_state.x)", color = :green)

We reached optimality, and thanks to the Stopping structure this simple looking algorithm verified at each step of the algorithm:

Long-Term Goals

Stopping is aimed as a tool for improving the reusability and robustness in the implementation of iterative algorithms. We warmly welcome any feedback or comment leading to potential improvements.

Future work will address more sophisticated problems such as mixed-integer optimization problems, optimization with uncertainty. The list of suggested optimality functions will be enriched with state of the art conditions.

diff --git a/dev/lastopping/index.html b/dev/lastopping/index.html index c4b5d9b..4ff1de5 100644 --- a/dev/lastopping/index.html +++ b/dev/lastopping/index.html @@ -17,4 +17,4 @@ GenericState(x0), max_iter = 150000, rtol = 1e-6, - max_cntrs = init_max_counters_linear_operators(nprod = 150000)) + max_cntrs = init_max_counters_linear_operators(nprod = 150000)) diff --git a/dev/linear-algebra/index.html b/dev/linear-algebra/index.html index 834139a..06c82f5 100644 --- a/dev/linear-algebra/index.html +++ b/dev/linear-algebra/index.html @@ -76,4 +76,4 @@ return stp end
RandomizedBlockKaczmarz(la_stop)
-@test status(la_stop) == :Optimal
+@test status(la_stop) == :Optimal diff --git a/dev/nlpstopping/index.html b/dev/nlpstopping/index.html index d2ed8e3..61709f4 100644 --- a/dev/nlpstopping/index.html +++ b/dev/nlpstopping/index.html @@ -2,4 +2,4 @@ NLPStopping · Stopping.jl

NLPStopping: A Stopping for NLPModels

The Stopping-structure can be adapted to any problem solved by iterative methods. We discuss here NLPStopping a specialization of an AbstractStopping for problems of type NLPModels. We highlight here the specifities of such instance:

  • The problem is an NLPModel
  • The problem has a funcion-evaluation counter, so we setup a maximum-counters structure in the meta.
  • The State is an NLPAtX with entries corresponding to usual information for nonlinear optimization models.
  • The unboundedness check verifies that the objective function is unbounded below for minimization problems, and above for maximization;
  • The problem is declared infeasibility if the score is Inf for minimization problems, and -Inf for maximization.
nlp = ADNLPModel(x->sum(x.^2), zeros(5))
 nlp_at_x = NLPAtX(zeros(5))
 meta  = StoppingMeta(max_cntrs = init_max_counters())
-stp   = NLPStopping(pb, meta, state)

By default for NLPStopping the optimality function is a function checking the KKT conditions using information in the State. The function fill_in! computes all the missing entries in the State. This is an potentially expensive operation, but might be useful.

+stp = NLPStopping(pb, meta, state)

By default for NLPStopping the optimality function is a function checking the KKT conditions using information in the State. The function fill_in! computes all the missing entries in the State. This is an potentially expensive operation, but might be useful.

diff --git a/dev/overfitting/index.html b/dev/overfitting/index.html index fceb05f..7c59958 100644 --- a/dev/overfitting/index.html +++ b/dev/overfitting/index.html @@ -65,4 +65,4 @@ steepest_descent(train_stp)
nb_iter = train_stp.meta.nb_of_stop
 hcat(log.(train_stp.stopping_user_struct[:train_obj][1:nb_iter+1]), log.(train_stp.stopping_user_struct[:test_obj][1:nb_iter+1]))
 plot(log.(train_stp.stopping_user_struct[:train_obj][1:nb_iter+1]), label=["train obj"])
-plot!(log.(train_stp.stopping_user_struct[:test_obj][1:nb_iter+1]), label=["test obj"], title="overfitting")

+plot!(log.(train_stp.stopping_user_struct[:test_obj][1:nb_iter+1]), label=["test obj"], title="overfitting")

diff --git a/dev/penalty/index.html b/dev/penalty/index.html index ee1e1e0..a053e14 100644 --- a/dev/penalty/index.html +++ b/dev/penalty/index.html @@ -81,4 +81,4 @@ armijo_prm, wolfe_prm, onedsolve, ls_func, back_update) end -end +end diff --git a/dev/run-optimsolver/index.html b/dev/run-optimsolver/index.html index 4d73cca..a7ea088 100644 --- a/dev/run-optimsolver/index.html +++ b/dev/run-optimsolver/index.html @@ -92,4 +92,4 @@ @show status(stop_nlp_c) #We can check afterwards, the score -@show KKT(stop_nlp_c.pb, stop_nlp_c.current_state) +@show KKT(stop_nlp_c.pb, stop_nlp_c.current_state) diff --git a/dev/search/index.html b/dev/search/index.html index d40b40a..07308f6 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Stopping.jl

Loading search...

    +Search · Stopping.jl

    Loading search...

      diff --git a/dev/speak-to-stopping/index.html b/dev/speak-to-stopping/index.html index 94e0e8b..00ea28d 100644 --- a/dev/speak-to-stopping/index.html +++ b/dev/speak-to-stopping/index.html @@ -6,4 +6,4 @@ meta = StoppingMeta(max_time = 10.) stp = GenericStopping(pb, meta, state)

      Once the Stopping has been initialized, we call the algorithm and exploit the output.

      stp = rand_solver(stp, x) #call your favorite solver

      To understand why the algorithm stopped we use status.

      status(stp) #or `status(stp, rlist = true)` to have the complete list.

      The solution as well as problem-related information can be accessed from the state.

      sol = stp.current_state.x

      FAQ: How do I know the entries in the Stopping, State or the Meta?

      You can use Julia's build-in fieldnames function.

      fieldnames(stp)
       fieldnames(stp.current_state)
      -fieldnames(stp.meta)
      +fieldnames(stp.meta) diff --git a/dev/stop-workflow/index.html b/dev/stop-workflow/index.html index c41660f..2debc80 100644 --- a/dev/stop-workflow/index.html +++ b/dev/stop-workflow/index.html @@ -1,2 +1,2 @@ -Stopping workflow · Stopping.jl

      Stopping-work flow

      The table below depict the various checks done by the function stop! and their connection with the meta, current_state and current_state. The function entry correspond to the function used internally by stop!, they can be imported and redifined to be adapted for a specific problem, for instance NLPStopping for NLPModels. The remote_control entry corresponds to the attribute in the remote_control that could be set as true/false to activate/deactivate this check. The meta_status gives the attribute in the meta with the check's answer. Finally the last column corresponds to entries in the meta parametrizing this check.

      Check descriptionFunctionremote controlmeta statusesmeta tolerances
      Check unboundedness and the domain of x_unbounded_and_domain_x_check!unbounded_and_domain_x_checkdomainerror and unbounded_problem_xstp.meta.unbounded_x
      Check the domain in state (NaN's ...)_domain_checkdomain_checkdomainerror
      Check optimality_optimality_check! and _null_testoptimality_checkoptimalSee how to check optimality with Stopping
      Check for infeasibility_infeasibility_check!infeasibility_checkinfeasible
      Check for unboundedness in problem values_unbounded_problem_check!unbounded_problem_checkunbounded_problem
      Check time-limit_tired_check!tired_checktiredstart_time, max_time
      Check for limits in resources_resources_check!resources_checkresources
      Check if algo is stalling_stalled_check!stalled_checkstalled
      Count the number of stop! and limits_iteration_check!iteration_checkiteration_limitmax_iter
      Check if the main_stp stops_main_pb_check!main_pb_checkmain_pb
      Callback user check_user_check!user_checkstopbyuseruser_check_func!

      FAQ: Is Stopping initializing meta.start_time on its own?

      Yes, it does when you call start! as well as optimality0 if start! check the optimality.

      FAQ: How to set-up the user_check?

      Stopping call the user_check_func! defined in the meta.

      FAQ: How does Stopping check the optimality?

      See the tutorial on this topic.

      +Stopping workflow · Stopping.jl

      Stopping-work flow

      The table below depict the various checks done by the function stop! and their connection with the meta, current_state and current_state. The function entry correspond to the function used internally by stop!, they can be imported and redifined to be adapted for a specific problem, for instance NLPStopping for NLPModels. The remote_control entry corresponds to the attribute in the remote_control that could be set as true/false to activate/deactivate this check. The meta_status gives the attribute in the meta with the check's answer. Finally the last column corresponds to entries in the meta parametrizing this check.

      Check descriptionFunctionremote controlmeta statusesmeta tolerances
      Check unboundedness and the domain of x_unbounded_and_domain_x_check!unbounded_and_domain_x_checkdomainerror and unbounded_problem_xstp.meta.unbounded_x
      Check the domain in state (NaN's ...)_domain_checkdomain_checkdomainerror
      Check optimality_optimality_check! and _null_testoptimality_checkoptimalSee how to check optimality with Stopping
      Check for infeasibility_infeasibility_check!infeasibility_checkinfeasible
      Check for unboundedness in problem values_unbounded_problem_check!unbounded_problem_checkunbounded_problem
      Check time-limit_tired_check!tired_checktiredstart_time, max_time
      Check for limits in resources_resources_check!resources_checkresources
      Check if algo is stalling_stalled_check!stalled_checkstalled
      Count the number of stop! and limits_iteration_check!iteration_checkiteration_limitmax_iter
      Check if the main_stp stops_main_pb_check!main_pb_checkmain_pb
      Callback user check_user_check!user_checkstopbyuseruser_check_func!

      FAQ: Is Stopping initializing meta.start_time on its own?

      Yes, it does when you call start! as well as optimality0 if start! check the optimality.

      FAQ: How to set-up the user_check?

      Stopping call the user_check_func! defined in the meta.

      FAQ: How does Stopping check the optimality?

      See the tutorial on this topic.

      diff --git a/dev/uncons/index.html b/dev/uncons/index.html index 646c2f9..902060c 100644 --- a/dev/uncons/index.html +++ b/dev/uncons/index.html @@ -73,4 +73,4 @@ back_update :: Float64 = 0.5) return new(armijo_prm,wolfe_prm,onedsolve,ls_func,back_update) end -end +end