Skip to content

Commit 3da3cdf

Browse files
Add support for dual_ftol_rel parameter in NLopt
Fixes #922 - Added handling for the dual_ftol_rel parameter which is used by MMA/CCSA algorithms in NLopt to control the dual optimization subproblem tolerance. Previously, passing dual_ftol_rel would throw: ``` ERROR: UndefVarError: `dual_ftol_rel\!` not defined ``` Now the parameter is properly handled using NLopt.nlopt_set_param() since it's not a direct setter function but a named parameter. Changes: - Added special case handling for dual_ftol_rel in __map_optimizer_args\! - Uses NLopt.nlopt_set_param(opt, "dual_ftol_rel", value) instead of trying to call a non-existent dual_ftol_rel\! function This enables users to control the dual problem tolerance for faster convergence in high-dimensional problems with CCSA/MMA algorithms. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c5648ec commit 3da3cdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/OptimizationNLopt/src/OptimizationNLopt.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ function __map_optimizer_args!(cache::OptimizationCache, opt::NLopt.Opt;
9393
# add optimiser options from kwargs
9494
for j in kwargs
9595
if j.first != :cons_tol
96-
eval(Meta.parse("NLopt." * string(j.first) * "!"))(opt, j.second)
96+
# Handle special parameters that use nlopt_set_param
97+
if j.first == :dual_ftol_rel
98+
NLopt.nlopt_set_param(opt, "dual_ftol_rel", j.second)
99+
else
100+
eval(Meta.parse("NLopt." * string(j.first) * "!"))(opt, j.second)
101+
end
97102
end
98103
end
99104

0 commit comments

Comments
 (0)