From 0d5b3be7830395592a3b5cc7031a17d97265fb03 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Tue, 8 Sep 2026 05:11:02 +0000 Subject: [PATCH] Fix docs build: import OptimizationFunction and AutoForwardDiff explicitly OptimizationIpopt v1.4 stopped re-exporting the Optimization API, so OptimizationFunction, OptimizationProblem, solve and AutoForwardDiff are no longer available from `using OptimizationIpopt` alone. Import them from the packages that define them, SciMLBase and ADTypes. Both are already dependencies of OptimizationIpopt, so no new package is loaded. Co-Authored-By: Claude Fable 5.1 --- docs/Project.toml | 2 ++ docs/src/examples/automatic_differentiation.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index 3b92b3023..508bd2c97 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,4 +1,5 @@ [deps] +ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66" ControlSystemIdentification = "3abffc1c-5106-53b7-b354-a47bfc086282" ControlSystems = "a6e380b2-a6ca-5380-bf3e-84a91bcd477e" @@ -15,5 +16,6 @@ MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca" OptimizationGCMAES = "6f0a0517-dbc2-4a7a-8a20-99ae7f27e911" OptimizationIpopt = "43fad042-7963-4b32-ab19-e2a4f9a67124" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" TrajectoryLimiters = "9792e600-fe43-4e4e-833b-462f466b8006" diff --git a/docs/src/examples/automatic_differentiation.md b/docs/src/examples/automatic_differentiation.md index 4011c1cbd..8e709e267 100644 --- a/docs/src/examples/automatic_differentiation.md +++ b/docs/src/examples/automatic_differentiation.md @@ -110,6 +110,8 @@ The constraint function `constraints` enforces the peak of the sensitivity funct ```@example autodiff using Statistics, LinearAlgebra using OptimizationIpopt +using SciMLBase: OptimizationFunction, OptimizationProblem, solve +using ADTypes: AutoForwardDiff function plot_optimized(P, params, res, systems) fig = plot(layout=(1,3), size=(1200,400), bottommargin=2Plots.mm) @@ -181,7 +183,7 @@ solver = IpoptOptimizer(; ), ) -fopt = OptimizationFunction(cost, OptimizationIpopt.AutoForwardDiff(); cons=constraints) +fopt = OptimizationFunction(cost, AutoForwardDiff(); cons=constraints) prob = OptimizationProblem(fopt, params, (P, systemspid); lb = fill(-10.0, length(params)),