API
Numerical methods
Find zero
ConstrainedRootSolvers.find_zero — FunctionFunction to find the first root that gives a target function result of zero. If the root does not exist, the function returns the point where the target function is most close to zero.
find_zero(f, ms, tol; stepping)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/find_zero.jl:40.
find_zero(f, ms, tol; stepping)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/find_zero.jl:144.
find_zero(f, ms, tol; stepping)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/find_zero.jl:258.
find_zero(f, ms, tol; stepping)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/find_zero.jl:322.
ConstrainedRootSolvers.find_zero — MethodThis method uses BisectionMethod method:
find_zero(f::Function,
ms::BisectionMethod{FT},
tol::Union{ResidualTolerance{FT}, SolutionTolerance{FT}};
stepping::Bool = false
) where {FT<:AbstractFloat}Returns the solution where target function is zero, given
fFunction to solvemsBisectionMethodtype method structtolResidualToleranceorSolutionTolerancetype tolerance structsteppingOptional. If true, save the optimization steps to the history field in method struct.
ConstrainedRootSolvers.find_zero — MethodThis method uses NewtonBisectionMethod method:
find_zero(f::Function,
ms::NewtonBisectionMethod{FT},
tol::Union{ResidualTolerance{FT}, SolutionTolerance{FT}};
stepping::Bool = false
) where {FT<:AbstractFloat}Returns the solution where target function is zero, given
fFunction to solvemsNewtonBisectionMethodtype method structtolResidualToleranceorSolutionTolerancetype tolerance structsteppingOptional. If true, save the optimization steps to the history field in method struct.
ConstrainedRootSolvers.find_zero — MethodThis method uses NewtonRaphsonMethod method:
find_zero(f::Function,
ms::NewtonRaphsonMethod{FT},
tol::Union{ResidualTolerance{FT}, SolutionTolerance{FT}};
stepping::Bool = false
) where {FT<:AbstractFloat}Returns the solution where target function is zero, given
fFunction to solvemsNewtonRaphsonMethodtype method structtolResidualToleranceorSolutionTolerancetype tolerance structsteppingOptional. If true, save the optimization steps to the history field in method struct.
ConstrainedRootSolvers.find_zero — MethodThis method uses ReduceStepMethod method:
find_zero(f::Function,
ms::ReduceStepMethod{FT},
tol::Union{ResidualTolerance{FT}, SolutionTolerance{FT}};
stepping::Bool = false
) where {FT<:AbstractFloat}Returns the solution where target function is zero, given
fFunction to solvemsReduceStepMethodtype method structtolResidualToleranceorSolutionTolerancetype tolerance structsteppingOptional. If true, save the optimization steps to the history field in method struct.
Find peak
ConstrainedRootSolvers.find_peak — FunctionFunction to find the first root that gives a target function result of maximum. Note that to compute the lowest value, use -f to make it a peak.
find_peak(f, ms, tol; stepping)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/find_peak.jl:144.
find_peak(f, ms, tol; stepping)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/find_peak.jl:197.
find_peak(f, ms, tol)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/findpeak/neldermead.jl:6.
find_peak(f, ms, tol)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/findpeak/reducestep.jl:6.
find_peak(f, ms, tol)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/findpeak/reducestepND.jl:6.
Method options
ConstrainedRootSolvers.AbstractCRSMethod — TypeAbstract type of the ConstrainedRootSolvers methods
abstract type AbstractCRSMethod{FT<:AbstractFloat}ConstrainedRootSolvers.BisectionMethod — TypeBisection method for 1D root solvers
mutable struct BisectionMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
x_min::AbstractFloatlower bound
x_max::AbstractFloatupper bound
xy::Matrix{FT} where FT<:AbstractFloatmatrix that stores x and y, used in find_peak
history::Vectorhistory of all simulations
ConstrainedRootSolvers.NelderMeadMethod — TypeNelder-Mead method for 2D and above solvers
mutable struct NelderMeadMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
N::Int64Number of parameters to optimize
x_inis::Vector{FT} where FT<:AbstractFloatInitial values
simplex::Array{Vector{FT}, 1} where FT<:AbstractFloatSimplex vector of vector with dimension (N+1) * (N+1)
cen_x::Vector{FT} where FT<:AbstractFloatCentroid
ref_x::Vector{FT} where FT<:AbstractFloatReflection
exp_x::Vector{FT} where FT<:AbstractFloatExpansion
con_x::Vector{FT} where FT<:AbstractFloatContraction
history::Array{Vector{FT}, 1} where FT<:AbstractFloathistory of all simulations
ConstrainedRootSolvers.NewtonBisectionMethod — TypeNewton's method constrained by mininum and maximum ranges for 1D root solver
mutable struct NewtonBisectionMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
x_min::AbstractFloatLower bound
x_max::AbstractFloatUpper bound
x_ini::AbstractFloatInitial guess
history::Vectorhistory of all simulations
ConstrainedRootSolvers.NewtonRaphsonMethod — TypeNewton raphson method for 1D root solver
mutable struct NewtonRaphsonMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
x_ini::AbstractFloatInitial guess
history::Vectorhistory of all simulations
ConstrainedRootSolvers.ReduceStepMethod — TypeReduce step method for 1D root solver. This method increases or decreases from initial guess until no improvement is found. Then the incremantal step decreases, and then the root solver continues.
mutable struct ReduceStepMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
x_min::AbstractFloatLower bound
x_max::AbstractFloatUpper bound
x_ini::AbstractFloatInitial guess
Δ_ini::AbstractFloatInitial step
history::Vectorhistory of all simulations
ConstrainedRootSolvers.ReduceStepMethodND — TypeReduce step method for 2D and above root solver. This method increases or decreases each variable in the initial guess until no improvement is found. Then the incremental steps decreases, and then the root solver continues.
mutable struct ReduceStepMethodND{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
x_mins::Vector{FT} where FT<:AbstractFloatLower bound
x_maxs::Vector{FT} where FT<:AbstractFloatUpper bound
x_inis::Vector{FT} where FT<:AbstractFloatInitial guess
x_targ::Vector{FT} where FT<:AbstractFloatTarget x
x_temp::Vector{FT} where FT<:AbstractFloatTemporary x
Δ_inis::Vector{FT} where FT<:AbstractFloatInitial step
Δ_oper::Vector{FT} where FT<:AbstractFloatOperation step
Δjd::Vector{Bool}Vector of judges
Tolerance options
ConstrainedRootSolvers.AbstractTolerance — TypeAbstract tolerance type
abstract type AbstractTolerance{FT}ConstrainedRootSolvers.ResidualTolerance — TypeTolerance for target function residual
struct ResidualTolerance{FT} <: ConstrainedRootSolvers.AbstractTolerance{FT}Fields
tol::AnyTolerance for residual
n_limit::Int64limit of iterations
ConstrainedRootSolvers.SolutionTolerance — TypeTolerance for solution
struct SolutionTolerance{FT} <: ConstrainedRootSolvers.AbstractTolerance{FT}Fields
tol::AnyTolerance for solution
n_limit::Int64limit of iterations
ConstrainedRootSolvers.SolutionToleranceND — TypeTolerance for 2D and above solution
struct SolutionToleranceND{FT} <: ConstrainedRootSolvers.AbstractTolerance{FT}Fields
tol::VectorTolerance for solution
n_limit::Int64limit of iterations
ConstrainedRootSolvers.if_break — FunctionDetermine whether to stopping finding the solution depending on the tolerance type.
if_break(tol, x1, x2, y, n)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/tolerance.jl:118.
if_break(tol, x1, x2, y, n)defined at /home/runner/work/ConstrainedRootSolvers.jl/ConstrainedRootSolvers.jl/src/tolerance.jl:148.
ConstrainedRootSolvers.next_xy! — Functionnext_xy!(f::Function,
xy::Matrix{FT},
history::Vector{Vector{FT}},
stepping::Bool
) where {FT<:AbstractFloat}Determine the next points to simulate, given
fFunction to find peakxyMatrix of x (1st column) and y (2nd column)historyA vector to save simulationssteppingOptional. If true, save the optimization steps to the history field in method struct.