Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/OptimizationAuglag/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ LinearAlgebra = "1.10"
MLUtils = "0.4.8"
OptimizationBase = "5"
OptimizationOptimisers = "0.3.16"
Reexport = "1.2"
Reexport = "1.2.2"
SciMLBase = "2.122.1, 3"
Random = "1.10"
Test = "1.10.0"
julia = "1.10"

Expand Down
6 changes: 5 additions & 1 deletion lib/OptimizationAuglag/test/qa/qa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ using OptimizationAuglag, Aqua, JET
using Test

@testset "Aqua" begin
Aqua.test_all(OptimizationAuglag)
# OptimizationOptimisers is used in tests as the inner solver, not in src.
Aqua.test_all(
OptimizationAuglag;
stale_deps = (; ignore = [:OptimizationOptimisers])
)
end

@testset "JET static analysis" begin
Expand Down
10 changes: 6 additions & 4 deletions lib/OptimizationBBO/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
OptimizationBase = {path = "../OptimizationBase"}

[compat]
Pkg = "1"
SafeTestsets = "0.1"
julia = "1.10"
BlackBoxOptim = "0.6.3"
OptimizationBase = "5"
SciMLBase = "2.122.1, 3"
Pkg = "1"
Random = "1.10"
Reexport = "1.2"
SafeTestsets = "0.1"
SciMLBase = "2.122.1, 3"
Test = "1.10"
julia = "1.10"

[targets]
test = ["Random", "Test", "SafeTestsets", "Pkg"]
9 changes: 4 additions & 5 deletions lib/OptimizationBase/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Expand Down Expand Up @@ -56,7 +55,7 @@ BenchmarkTools = "1"
ChainRulesCore = "1"
ComponentArrays = ">= 0.13.9"
DifferentiationInterface = "0.7.13"
DocStringExtensions = "0.9"
DocStringExtensions = "0.9.5"
Enzyme = "0.13.2"
FastClosures = "0.3"
FiniteDiff = "2.12"
Expand All @@ -66,13 +65,13 @@ LinearAlgebra = "1.9, 1.10"
Lux = "1.12"
MLDataDevices = "1"
MLUtils = "0.4"
Manifolds = "0.10"
Mooncake = "0.4.138, 0.5"
Manifolds = "0.10, 0.11"
ModelingToolkit = "11"
Optim = ">= 1.4.1"
Optimisers = ">= 0.2.5"
OptimizationLBFGSB = "1.1"
OptimizationManopt = "1.1"
PDMats = "0.11"
Pkg = "1"
PrecompileTools = "1"
Random = "1.10"
Expand Down Expand Up @@ -120,4 +119,4 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["ADTypes", "Aqua", "BenchmarkTools", "ChainRulesCore", "ComponentArrays", "DifferentiationInterface", "Enzyme", "FiniteDiff", "ForwardDiff", "IterTools", "LinearAlgebra", "Lux", "MLUtils", "Manifolds", "ModelingToolkit", "Optim", "Optimisers", "OptimizationLBFGSB", "OptimizationManopt", "Pkg", "Random", "ReverseDiff", "SafeTestsets", "SciMLBase", "SparseArrays", "SparseConnectivityTracer", "SymbolicAnalysis", "Symbolics", "Test", "Tracker", "Zygote"]
test = ["Aqua", "BenchmarkTools", "ChainRulesCore", "ComponentArrays", "Enzyme", "FiniteDiff", "ForwardDiff", "IterTools", "Lux", "MLUtils", "Manifolds", "ModelingToolkit", "Optim", "Optimisers", "OptimizationLBFGSB", "OptimizationManopt", "Pkg", "Random", "ReverseDiff", "SafeTestsets", "SymbolicAnalysis", "Symbolics", "Test", "Tracker", "Zygote"]
38 changes: 19 additions & 19 deletions lib/OptimizationBase/src/OptimizationDISparseExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,25 @@ function instantiate_function(
cons = let f = f, p = p
(res, θ, p_call = p) -> f.cons(res, θ, p_call)
end
end

function cons_oop(x)
_res = zeros(eltype(x), num_cons)
f.cons(_res, x, p)
return _res
end
function cons_oop(x)
_res = zeros(eltype(x), num_cons)
f.cons(_res, x, p)
return _res
end

function cons_oop(x, i)
_res = zeros(eltype(x), num_cons)
f.cons(_res, x, p)
return _res[i]
end
function cons_oop(x, i)
_res = zeros(eltype(x), num_cons)
f.cons(_res, x, p)
return _res[i]
end

function lagrangian(θ, σ, λ, p)
if eltype(θ) <: SparseConnectivityTracer.AbstractTracer || !iszero(θ)
return σ * f.f(θ, p) + dot(λ, cons_oop(θ))
else
return dot(λ, cons_oop(θ))
end
function lagrangian(θ, σ, λ, p)
if eltype(θ) <: SparseConnectivityTracer.AbstractTracer || !iszero(θ)
return σ * f.f(θ, p) + dot(λ, cons_oop(θ))
else
return dot(λ, cons_oop(θ))
end
end

Expand Down Expand Up @@ -452,10 +452,10 @@ function instantiate_function(
cons = let f = f, p = p
(x, p_call = p) -> f.cons(x, p_call)
end
end

function lagrangian(θ, σ, λ, p)
return σ * f.f(θ, p) + dot(λ, f.cons(θ, p))
end
function lagrangian(θ, σ, λ, p)
return σ * f.f(θ, p) + dot(λ, f.cons(θ, p))
end

cons_jac_prototype = f.cons_jac_prototype
Expand Down
3 changes: 2 additions & 1 deletion lib/OptimizationBase/src/function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ function instantiate_function(
else
min(open_nrmlbrkt_ind, open_squigllybrkt_ind)
end
adpkg = adtypestr[strtind:(open_brkt_ind - 1)]
lastidx = isnothing(open_brkt_ind) ? lastindex(adtypestr) : (open_brkt_ind - 1)
adpkg = adtypestr[strtind:lastidx]
throw(ArgumentError("The passed automatic differentiation backend choice is not available. Please load the corresponding AD package $adpkg."))
end
13 changes: 12 additions & 1 deletion lib/OptimizationBase/test/qa/qa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@ using OptimizationBase, Aqua, JET
using Test

@testset "Aqua" begin
Aqua.test_all(OptimizationBase)
# OptimizationBase defines the Optimization solve interface itself, so it
# extends SciMLBase's __init/__solve and CommonSolve's init/solve/solve! (the
# latter reexported through SciMLBase) on SciMLBase.OptimizationProblem /
# AbstractOptimizationCache. Those are our *own* interface functions, so mark
# them as own for the piracy check rather than flagging the SciML types.
SB = OptimizationBase.SciMLBase
Aqua.test_all(
OptimizationBase;
piracies = (
treat_as_own = [SB.__init, SB.__solve, SB.init, SB.solve, SB.solve!],
)
)
end

@testset "JET static analysis" begin
Expand Down
10 changes: 6 additions & 4 deletions lib/OptimizationEvolutionary/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
OptimizationBase = {path = "../OptimizationBase"}

[compat]
Evolutionary = "0.11"
OptimizationBase = "5"
Pkg = "1"
Random = "1.10"
Reexport = "1.2"
SafeTestsets = "0.1"
julia = "1.10"
OptimizationBase = "5"
Evolutionary = "0.11"
SciMLBase = "2.122.1, 3"
Reexport = "1.2"
Test = "1.10"
julia = "1.10"

[targets]
test = ["Random", "Test", "SafeTestsets", "Pkg"]
23 changes: 22 additions & 1 deletion lib/OptimizationEvolutionary/test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
using OptimizationEvolutionary, Aqua, JET
using Test
using Evolutionary

@testset "Aqua" begin
Aqua.test_all(OptimizationEvolutionary)
# SciML trait/interface methods are our own, not piracy — mark them as such.
# The Evolutionary.trace! override IS genuine piracy (changes Evolutionary's
# tracing globally); mark the piracy test broken until it's replaced.
SB = OptimizationEvolutionary.SciMLBase
Aqua.test_all(
OptimizationEvolutionary;
piracies = (
broken = true,
treat_as_own = [
SB.__solve,
SB.allowsbounds,
SB.allowscallback,
SB.allowsconstraints,
SB.has_init,
SB.requiresconshess,
SB.requiresconsjac,
SB.requiresgradient,
SB.requireshessian,
],
)
)
end

@testset "JET static analysis" begin
Expand Down
10 changes: 6 additions & 4 deletions lib/OptimizationGCMAES/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
OptimizationBase = {path = "../OptimizationBase"}

[compat]
ForwardDiff = "0.10, 1"
GCMAES = "0.1.34"
OptimizationBase = "5.1"
Pkg = "1"
Reexport = "1.2"
SafeTestsets = "0.1"
julia = "1.10"
OptimizationBase = "5.1"
SciMLBase = "2.122.1, 3"
Reexport = "1.2"
GCMAES = "0.1.34"
Test = "1.10"
julia = "1.10"

[targets]
test = ["ForwardDiff", "Test", "SafeTestsets", "Pkg"]
8 changes: 3 additions & 5 deletions lib/OptimizationGCMAES/src/OptimizationGCMAES.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ function SciMLBase.__solve(cache::OptimizationCache{O}) where {O <: GCMAESOpt}
return x[1]
end

if !isnothing(cache.f.grad)
g = function (θ)
cache.f.grad(G, θ)
return G
end
g = function (θ)
cache.f.grad(G, θ)
return G
end

maxiters = OptimizationBase._check_and_convert_maxiters(cache.solver_args.maxiters)
Expand Down
11 changes: 8 additions & 3 deletions lib/OptimizationIpopt/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"

[compat]
Pkg = "1"
SafeTestsets = "0.1"
Aqua = "0.8"
Ipopt = "1.10.3"
LinearAlgebra = "1.10.0"
ModelingToolkit = "11"
OptimizationBase = "5.1"
Pkg = "1"
Random = "1.10"
Reexport = "1.2"
ReverseDiff = "1"
SafeTestsets = "0.1"
SciMLBase = "2.122.1, 3"
SparseArrays = "1.10.0"
SymbolicIndexingInterface = "0.3.40"
SymbolicIndexingInterface = "0.3.46"
Symbolics = "7"
Test = "1.10"
Zygote = "0.7"
julia = "1.10"

Expand Down
1 change: 1 addition & 0 deletions lib/OptimizationLBFGSB/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ MLUtils = "0.4.8"
OptimizationBase = "5"
Reexport = "1.2"
SciMLBase = "2.122.1, 3"
Test = "1.10"
Zygote = "0.7.10"
julia = "1.10"

Expand Down
1 change: 1 addition & 0 deletions lib/OptimizationLBFGSB/src/OptimizationLBFGSB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function SciMLBase.__solve(cache::OptimizationCache{O}) where {O <: LBFGSB}
end

opt_ret = ReturnCode.MaxIters
res = (cache.u0, nothing)
n = length(cache.u0)

if cache.lb === nothing
Expand Down
4 changes: 2 additions & 2 deletions lib/OptimizationMOI/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Ipopt = "1.10.4"
Ipopt_jll = "300.1400"
Juniper = "0.9"
LinearAlgebra = "1"
MathOptInterface = "1.40.2"
MathOptInterface = "1.45"
ModelingToolkit = "11"
ModelingToolkitBase = "1"
NLopt = "1"
Expand All @@ -41,7 +41,7 @@ ReverseDiff = "1"
SciMLBase = "2.130, 3"
SciMLStructures = "1"
SparseArrays = "1.6"
SymbolicIndexingInterface = "0.3"
SymbolicIndexingInterface = "0.3.46"
SymbolicUtils = "4.10"
Symbolics = "7"
Test = "1.6"
Expand Down
26 changes: 22 additions & 4 deletions lib/OptimizationMOI/test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
using OptimizationMOI, Aqua, JET
using Test
using MathOptInterface

@testset "Aqua" begin
# OptimizationMOI deliberately extends SciMLBase's solver-trait interface onto the
# MathOptInterface optimizer types, so those methods are intentional, not piracy.
# OptimizationMOI implements the SciML optimization interface for
# MathOptInterface, so the trait/interface methods it adds extend SciML's *own*
# functions rather than committing type piracy — mark those functions as own.
SB = OptimizationMOI.SciMLBase
OB = OptimizationMOI.OptimizationBase
Aqua.test_all(
OptimizationMOI;
piracies = (
treat_as_own = [
OptimizationMOI.MOI.AbstractOptimizer,
OptimizationMOI.MOI.OptimizerWithAttributes,
SB.__init,
SB.__solve,
SB.allowsbounds,
SB.allowscallback,
SB.allowsconstraints,
SB.get_observed,
SB.get_p,
SB.get_paramsyms,
SB.get_syms,
SB.has_init,
SB.requiresconshess,
SB.requiresconsjac,
SB.requiresgradient,
SB.requireshessian,
SB.supports_opt_cache_interface,
OB.supports_sense,
],
)
)
Expand Down
17 changes: 12 additions & 5 deletions lib/OptimizationMadNLP/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,26 @@ SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"

[compat]
Pkg = "1"
SafeTestsets = "0.1"
DifferentiationInterface = "0.7"
ADTypes = "1.14"
Aqua = "0.8"
DifferentiationInterface = "0.7.13"
ForwardDiff = "1.2.1"
LinearAlgebra = "1.10.0"
MadNLP = "0.9.1, 0.10"
ModelingToolkit = "11"
NLPModels = "0.21.5"
OptimizationBase = "5.1"
OptimizationNLPModels = "1.3"
Pkg = "1"
Random = "1.10"
Reexport = "1.2"
SciMLBase = "2.122.1, 3"
SymbolicIndexingInterface = "0.3.40"
ReverseDiff = "1"
SafeTestsets = "0.1"
SciMLBase = "2.130, 3"
SparseArrays = "1.10"
SymbolicIndexingInterface = "0.3.46"
Symbolics = "7"
Test = "1.10"
Zygote = "0.7"
julia = "1.10"

Expand Down
9 changes: 8 additions & 1 deletion lib/OptimizationMadNLP/test/qa/qa.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ using OptimizationMadNLP, Aqua, JET
using Test

@testset "Aqua" begin
Aqua.test_all(OptimizationMadNLP)
# `@reexport using OptimizationBase` brings in SciMLBase's `solve!` while
# `using MadNLP` also pulls a `solve!` into scope; the clash leaves
# OptimizationMadNLP's `solve!` export pointing at neither binding.
# Mark broken until the reexport is restructured.
Aqua.test_all(
OptimizationMadNLP;
undefined_exports = (; broken = true)
)
end

@testset "JET static analysis" begin
Expand Down
Loading
Loading