File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
lib/OptimizationSophia/test Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -65,3 +65,14 @@ res1 = solve(optprob,
6565 OptimizationSophia. Sophia (), callback = callback,
6666 maxiters = 2000 )
6767@test 10 res1. objective < l1
68+
69+ # Test Sophia with ComponentArrays + Enzyme (shadow generation fix)
70+ using ComponentArrays
71+ x0_comp = ComponentVector (a = 0.0 , b = 0.0 )
72+ rosenbrock_comp (x, p = nothing ) = (1 - x. a)^ 2 + 100 * (x. b - x. a^ 2 )^ 2
73+
74+ optf_sophia = OptimizationFunction (rosenbrock_comp, AutoEnzyme ())
75+ prob_sophia = OptimizationProblem (optf_sophia, x0_comp)
76+ res_sophia = solve (prob_sophia, Optimization. Sophia (η= 0.01 , k= 5 ), maxiters = 50 )
77+ @test res_sophia. objective < rosenbrock_comp (x0_comp) # Test optimization progress
78+ @test res_sophia. retcode == Optimization. SciMLBase. ReturnCode. Success
You can’t perform that action at this time.
0 commit comments