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 solve
- ms- BisectionMethodtype method struct
- tol- ResidualToleranceor- SolutionTolerancetype tolerance struct
- steppingOptional. 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 solve
- ms- NewtonBisectionMethodtype method struct
- tol- ResidualToleranceor- SolutionTolerancetype tolerance struct
- steppingOptional. 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 solve
- ms- NewtonRaphsonMethodtype method struct
- tol- ResidualToleranceor- SolutionTolerancetype tolerance struct
- steppingOptional. 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 solve
- ms- ReduceStepMethodtype method struct
- tol- ResidualToleranceor- SolutionTolerancetype tolerance struct
- steppingOptional. 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::AbstractFloat- lower bound 
- x_max::AbstractFloat- upper bound 
- xy::Matrix{FT} where FT<:AbstractFloat- matrix that stores x and y, used in find_peak 
- history::Vector- history of all simulations 
ConstrainedRootSolvers.NelderMeadMethod — TypeNelder-Mead method for 2D and above solvers
mutable struct NelderMeadMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
- N::Int64- Number of parameters to optimize 
- x_inis::Vector{FT} where FT<:AbstractFloat- Initial values 
- simplex::Array{Vector{FT}, 1} where FT<:AbstractFloat- Simplex vector of vector with dimension (N+1) * (N+1) 
- cen_x::Vector{FT} where FT<:AbstractFloat- Centroid 
- ref_x::Vector{FT} where FT<:AbstractFloat- Reflection 
- exp_x::Vector{FT} where FT<:AbstractFloat- Expansion 
- con_x::Vector{FT} where FT<:AbstractFloat- Contraction 
- history::Array{Vector{FT}, 1} where FT<:AbstractFloat- history 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::AbstractFloat- Lower bound 
- x_max::AbstractFloat- Upper bound 
- x_ini::AbstractFloat- Initial guess 
- history::Vector- history of all simulations 
ConstrainedRootSolvers.NewtonRaphsonMethod — TypeNewton raphson method for 1D root solver
mutable struct NewtonRaphsonMethod{FT<:AbstractFloat} <: ConstrainedRootSolvers.AbstractCRSMethod{FT<:AbstractFloat}Fields
- x_ini::AbstractFloat- Initial guess 
- history::Vector- history 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::AbstractFloat- Lower bound 
- x_max::AbstractFloat- Upper bound 
- x_ini::AbstractFloat- Initial guess 
- Δ_ini::AbstractFloat- Initial step 
- history::Vector- history 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<:AbstractFloat- Lower bound 
- x_maxs::Vector{FT} where FT<:AbstractFloat- Upper bound 
- x_inis::Vector{FT} where FT<:AbstractFloat- Initial guess 
- x_targ::Vector{FT} where FT<:AbstractFloat- Target x 
- x_temp::Vector{FT} where FT<:AbstractFloat- Temporary x 
- Δ_inis::Vector{FT} where FT<:AbstractFloat- Initial step 
- Δ_oper::Vector{FT} where FT<:AbstractFloat- Operation 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::Any- Tolerance for residual 
- n_limit::Int64- limit of iterations 
ConstrainedRootSolvers.SolutionTolerance — TypeTolerance for solution
struct SolutionTolerance{FT} <: ConstrainedRootSolvers.AbstractTolerance{FT}Fields
- tol::Any- Tolerance for solution 
- n_limit::Int64- limit of iterations 
ConstrainedRootSolvers.SolutionToleranceND — TypeTolerance for 2D and above solution
struct SolutionToleranceND{FT} <: ConstrainedRootSolvers.AbstractTolerance{FT}Fields
- tol::Vector- Tolerance for solution 
- n_limit::Int64- limit 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 peak
- xyMatrix of x (1st column) and y (2nd column)
- historyA vector to save simulations
- steppingOptional. If true, save the optimization steps to the history field in method struct.