44
55const NLoptConstraint = Pair{Any, Number}
66
7- """
8- Uses *NLopt.jl* as the optimization engine.
9- Only available if *NLopt.jl* is loaded in the current Julia session!
7+ struct SemOptimizerNLopt <: SemOptimizer{:NLopt}
8+ algorithm:: Symbol
9+ local_algorithm:: Union{Symbol, Nothing}
10+ options:: Dict{Symbol, Any}
11+ local_options:: Dict{Symbol, Any}
12+ equality_constraints:: Vector{NLoptConstraint}
13+ inequality_constraints:: Vector{NLoptConstraint}
14+ end
15+
16+ SEM. sem_optimizer_subtype (:: Val{:NLopt} ) = SemOptimizerNLopt
1017
11- # Constructor
18+ # ###########################################################################################
19+ # ## Constructor
20+ # ###########################################################################################
1221
22+ """
1323 SemOptimizer(;
1424 engine = :NLopt,
1525 algorithm = :LD_LBFGS,
@@ -21,6 +31,10 @@ Only available if *NLopt.jl* is loaded in the current Julia session!
2131 constraint_tol::Number = 0.0,
2232 kwargs...)
2333
34+ Uses *NLopt.jl* as the optimization engine. For more information on the available algorithms
35+ and options, see the [*NLopt.jl*](https://github.com/JuliaOpt/NLopt.jl) package and
36+ the [NLopt docs](https://nlopt.readthedocs.io/en/latest/).
37+
2438# Arguments
2539- `algorithm`: optimization algorithm.
2640- `options::Dict{Symbol, Any}`: options for the optimization algorithm
@@ -38,8 +52,10 @@ Each constraint could be a function or any other callable object that
3852takes the two input arguments:
3953 - the vector of the model parameters;
4054 - the array for the in-place calculation of the constraint gradient.
41- To override the default tolerance, the constraint could be specified
55+ To override the default tolerance, the constraint can be specified
4256as a pair of the function and its tolerance: `constraint_func => tol`.
57+ For information on how to use inequality and equality constraints,
58+ see [Constrained optimization](@ref) in our online documentation.
4359
4460# Example
4561```julia
@@ -55,42 +71,14 @@ my_constrained_optimizer = SemOptimizer(;
5571)
5672```
5773
58- # Usage
59- All algorithms and options from the *NLopt* library are available, for more information see
60- the [*NLopt.jl*](https://github.com/JuliaOpt/NLopt.jl) package and the
61- [NLopt docs](https://nlopt.readthedocs.io/en/latest/).
62- For information on how to use inequality and equality constraints,
63- see [Constrained optimization](@ref) in our online documentation.
64-
65- # Extended help
66-
67- ## Interfaces
74+ # Interfaces
6875- `algorithm(::SemOptimizerNLopt)`
6976- `local_algorithm(::SemOptimizerNLopt)`
7077- `options(::SemOptimizerNLopt)`
7178- `local_options(::SemOptimizerNLopt)`
7279- `equality_constraints(::SemOptimizerNLopt)`
7380- `inequality_constraints(::SemOptimizerNLopt)`
74-
75- ## Implementation
76-
77- Subtype of `SemOptimizer`.
7881"""
79- struct SemOptimizerNLopt <: SemOptimizer{:NLopt}
80- algorithm:: Symbol
81- local_algorithm:: Union{Symbol, Nothing}
82- options:: Dict{Symbol, Any}
83- local_options:: Dict{Symbol, Any}
84- equality_constraints:: Vector{NLoptConstraint}
85- inequality_constraints:: Vector{NLoptConstraint}
86- end
87-
88- SEM. sem_optimizer_subtype (:: Val{:NLopt} ) = SemOptimizerNLopt
89-
90- # ###########################################################################################
91- # ## Constructor
92- # ###########################################################################################
93-
9482function SemOptimizerNLopt (;
9583 algorithm = :LD_LBFGS ,
9684 local_algorithm = nothing ,
0 commit comments