Skip to content

Adding dual_ftol_rel keyword for NLopt #922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
miguelborrero5 opened this issue May 30, 2025 · 0 comments
Open

Adding dual_ftol_rel keyword for NLopt #922

miguelborrero5 opened this issue May 30, 2025 · 0 comments

Comments

@miguelborrero5
Copy link

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.

e.g:

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)

Giving the following error:

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

Could we add support for dual_ftol_rel keyword please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant