Hi there,
I’m trying out different solvers for my problem which requires evaluation of non-linear constraints. Currently I’m trying NLopt
thought Optimization
in particular LD_CCSAQ
solver. However, its taking forever across iterations so I wanted to increase the parameter dual_ftol_rel
as suggested by NLopt documentation. However, Optimization
does not seem to support this.
MWE:
rosenbrock_inp(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
p = [1.0, 100.0]
x0 = [0.0, 0.0]
f2 = OptimizationFunction(rosenbrock_inp, AutoEnzyme())
prob = OptimizationProblem(f2, x0, p)
sol = solve(prob, NLopt.LD_CCSAQ(), xtol_rel = 1e-7, dual_ftol_rel = 1e-7)
with error message:
julia> sol = solve(prob, NLopt.LD_CCSAQ(), xtol_rel = 1e-7, dual_ftol_rel = 1e-7)
┌ Warning: The selected optimization algorithm requires second order derivatives, but `SecondOrder` ADtype was not provided.
│ So a `SecondOrder` with AutoForwardDiff() for both inner and outer will be created, this can be suboptimal and not work in some cases so
│ an explicit `SecondOrder` ADtype is recommended.
└ @ OptimizationBase ~/.julia/packages/OptimizationBase/UXLhR/src/cache.jl:49
ERROR: UndefVarError: `dual_ftol_rel!` not defined
Stacktrace:
[1] eval
@ ./boot.jl:385 [inlined]
[2] eval
@ ~/.julia/packages/OptimizationNLopt/YE3fr/src/OptimizationNLopt.jl:1 [inlined]
[3] __map_optimizer_args!(cache::OptimizationCache{…}, opt::Opt; callback::Function, maxiters::Nothing, maxtime::Nothing, abstol::Nothing, reltol::Nothing, local_method::Nothing, local_maxiters::Nothing, local_maxtime::Nothing, local_options::Nothing, kwargs::@Kwargs{…})
@ OptimizationNLopt ~/.julia/packages/OptimizationNLopt/YE3fr/src/OptimizationNLopt.jl:140
[4] __solve(cache::OptimizationCache{…})
@ OptimizationNLopt ~/.julia/packages/OptimizationNLopt/YE3fr/src/OptimizationNLopt.jl:289
[5] solve!(cache::OptimizationCache{…})
@ SciMLBase ~/.julia/packages/SciMLBase/OKLBE/src/solve.jl:227
[6] solve(::OptimizationProblem{…}, ::Algorithm; kwargs::@Kwargs{…})
@ SciMLBase ~/.julia/packages/SciMLBase/OKLBE/src/solve.jl:129
[7] top-level scope
@ REPL[70]:1
I expected this error since the documentation for Optimization
says: " Beyond the common arguments, the following optimizer parameters can be set as kwargs
:" where none of them are dual_ftol_rel
but maybe allowing this is an option in the near future?
Alternative I can directly interact with NLopt.jl
but given all the hard work done by Optimization.jl
this seems inefficient in this case (?)