@@ -100,6 +100,29 @@ using Test, Random
100
100
@test sol. retcode == ReturnCode. MaxTime
101
101
end
102
102
103
+ @testset " dual_ftol_rel parameter" begin
104
+ # Test that dual_ftol_rel parameter can be passed to NLopt without errors
105
+ # This parameter is specific to MMA/CCSA algorithms for dual optimization tolerance
106
+ x0_test = zeros (2 )
107
+ optprob = OptimizationFunction (rosenbrock, Optimization. AutoZygote ())
108
+ prob = OptimizationProblem (optprob, x0_test, _p)
109
+
110
+ # Test with NLopt.Opt interface
111
+ opt = NLopt. Opt (:LD_MMA , 2 )
112
+ # This should not throw an error - the PR fixed the UndefVarError
113
+ sol = solve (prob, opt, dual_ftol_rel = 1e-6 , maxiters = 100 )
114
+ @test sol. retcode ∈ [ReturnCode. Success, ReturnCode. MaxIters]
115
+
116
+ # Test with direct algorithm interface
117
+ sol = solve (prob, NLopt. LD_MMA (), dual_ftol_rel = 1e-5 , maxiters = 100 )
118
+ @test sol. retcode ∈ [ReturnCode. Success, ReturnCode. MaxIters]
119
+
120
+ # Verify it works with other solver options
121
+ sol = solve (prob, NLopt. LD_MMA (), dual_ftol_rel = 1e-4 , ftol_rel = 1e-6 ,
122
+ xtol_rel = 1e-6 , maxiters = 100 )
123
+ @test sol. retcode ∈ [ReturnCode. Success, ReturnCode. MaxIters]
124
+ end
125
+
103
126
@testset " constrained" begin
104
127
Random. seed! (1 )
105
128
cons = (res, x, p) -> res .= [x[1 ]^ 2 + x[2 ]^ 2 - 1.0 ]
0 commit comments