Skip to content

Commit f961236

Browse files
committed
drop some deps
1 parent e5a218d commit f961236

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

docs/Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ ImplicitDifferentiation = "57b37032-215b-411a-8a7c-41a003a55207"
1212
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
1313
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1414
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
15-
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
1615
OptimizationGCMAES = "6f0a0517-dbc2-4a7a-8a20-99ae7f27e911"
17-
OptimizationMOI = "fd9f6733-72f4-499f-8506-86b2bdd0dea1"
16+
OptimizationIpopt = "43fad042-7963-4b32-ab19-e2a4f9a67124"
1817
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1918
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2019
TrajectoryLimiters = "9792e600-fe43-4e4e-833b-462f466b8006"

docs/src/examples/automatic_differentiation.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ We start by defining a helper function `plot_optimized` that will evaluate the p
108108
The constraint function `constraints` enforces the peak of the sensitivity function to be below `Msc`. Finally, we use [Optimization.jl](https://github.com/SciML/Optimization.jl) to optimize the cost function and tell it to use ForwardDiff.jl to compute the gradient of the cost function. The optimizer we use in this example is `Ipopt`.
109109

110110
```@example autodiff
111-
using Optimization, Statistics, LinearAlgebra
112-
using Ipopt, OptimizationMOI; MOI = OptimizationMOI.MOI
111+
using Statistics, LinearAlgebra
112+
using OptimizationIpopt
113113
114114
function plot_optimized(P, params, res, systems)
115115
fig = plot(layout=(1,3), size=(1200,400), bottommargin=2Plots.mm)
@@ -170,15 +170,18 @@ Msc = 1.3 # Constraint on Ms
170170
171171
params = [kp, ki, kd, 0.01] # Initial guess for parameters
172172
173-
solver = Ipopt.Optimizer()
174-
MOI.set(solver, MOI.RawOptimizerAttribute("print_level"), 0)
175-
MOI.set(solver, MOI.RawOptimizerAttribute("max_iter"), 200)
176-
MOI.set(solver, MOI.RawOptimizerAttribute("acceptable_tol"), 1e-1)
177-
MOI.set(solver, MOI.RawOptimizerAttribute("acceptable_constr_viol_tol"), 1e-2)
178-
MOI.set(solver, MOI.RawOptimizerAttribute("acceptable_iter"), 5)
179-
MOI.set(solver, MOI.RawOptimizerAttribute("hessian_approximation"), "limited-memory")
173+
solver = IpoptOptimizer(;
174+
acceptable_tol = 1e-1,
175+
acceptable_iter = 5,
176+
hessian_approximation = "limited-memory",
177+
additional_options = Dict(
178+
"print_level" => 0,
179+
"max_iter" => 200,
180+
"acceptable_constr_viol_tol" => 1e-2,
181+
),
182+
)
180183
181-
fopt = OptimizationFunction(cost, Optimization.AutoForwardDiff(); cons=constraints)
184+
fopt = OptimizationFunction(cost, OptimizationIpopt.AutoForwardDiff(); cons=constraints)
182185
183186
prob = OptimizationProblem(fopt, params, (P, systemspid);
184187
lb = fill(-10.0, length(params)),

0 commit comments

Comments
 (0)