Skip to content

Commit a5bc3b0

Browse files
Update optimizationsystem.jl
1 parent be6cbb1 commit a5bc3b0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/optimizationsystem.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using ModelingToolkit: get_metadata
5050
cons_h = true)
5151
@test prob.f.sys === combinedsys
5252
sol = solve(prob, Ipopt.Optimizer(); print_level = 0)
53-
@test sol.minimum < -1e5
53+
@test sol.objective < -1e5
5454
end
5555

5656
@testset "inequality constraint" begin
@@ -66,14 +66,14 @@ end
6666
grad = true, hess = true, cons_j = true, cons_h = true)
6767
@test prob.f.sys === sys
6868
sol = solve(prob, IPNewton())
69-
@test sol.minimum < 1.0
69+
@test sol.objective < 1.0
7070
sol = solve(prob, Ipopt.Optimizer(); print_level = 0)
71-
@test sol.minimum < 1.0
71+
@test sol.objective < 1.0
7272

7373
prob = OptimizationProblem(sys, [x => 0.0, y => 0.0], [a => 1.0, b => 1.0],
7474
grad = false, hess = false, cons_j = false, cons_h = false)
7575
sol = solve(prob, AmplNLWriter.Optimizer(Ipopt_jll.amplexe))
76-
@test_skip sol.minimum < 1.0
76+
@test_skip sol.objective < 1.0
7777
end
7878

7979
@testset "equality constraint" begin
@@ -88,18 +88,18 @@ end
8888
prob = OptimizationProblem(sys, [x => 0.0, y => 0.0, z => 0.0], [a => 1.0, b => 1.0],
8989
grad = true, hess = true, cons_j = true, cons_h = true)
9090
sol = solve(prob, IPNewton())
91-
@test sol.minimum < 1.0
91+
@test sol.objective < 1.0
9292
@test sol.u[0.808, -0.064] atol=1e-3
9393
@test sol[x]^2 + sol[y]^2 1.0
9494
sol = solve(prob, Ipopt.Optimizer(); print_level = 0)
95-
@test sol.minimum < 1.0
95+
@test sol.objective < 1.0
9696
@test sol.u[0.808, -0.064] atol=1e-3
9797
@test sol[x]^2 + sol[y]^2 1.0
9898

9999
prob = OptimizationProblem(sys, [x => 0.0, y => 0.0, z => 0.0], [a => 1.0, b => 1.0],
100100
grad = false, hess = false, cons_j = false, cons_h = false)
101101
sol = solve(prob, AmplNLWriter.Optimizer(Ipopt_jll.amplexe))
102-
@test_skip sol.minimum < 1.0
102+
@test_skip sol.objective < 1.0
103103
@test_skip sol.u[0.808, -0.064] atol=1e-3
104104
@test_skip sol[x]^2 + sol[y]^2 1.0
105105
end
@@ -108,7 +108,7 @@ end
108108
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
109109
x0 = zeros(2)
110110
p = [1.0, 100.0]
111-
f = OptimizationFunction(rosenbrock, Optimization.AutoModelingToolkit())
111+
f = OptimizationFunction(rosenbrock, Optimization.AutoSymbolics())
112112
prob = OptimizationProblem(f, x0, p)
113113
sol = solve(prob, Newton())
114114
@test sol.u [1.0, 1.0]
@@ -215,15 +215,15 @@ end
215215
Ipopt.Optimizer();
216216
print_level = 0))
217217
#=
218-
@test sol.minimum < -1e5
218+
@test sol.objective < -1e5
219219
220220
prob = OptimizationProblem(sys2, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0],
221221
grad = true, hess = true, cons_j = true, cons_h = true)
222222
@test prob.f.sys === sys2
223223
sol = solve(prob, IPNewton())
224-
@test sol.minimum < 1.0
224+
@test sol.objective < 1.0
225225
sol = solve(prob, Ipopt.Optimizer(); print_level = 0)
226-
@test sol.minimum < 1.0
226+
@test sol.objective < 1.0
227227
=#
228228
end
229229

0 commit comments

Comments
 (0)