Skip to content

Commit 60285ce

Browse files
SebastianM-Cclaude
andcommitted
Replace supports_opt_cache_interface with has_init in all optimizers
Updates all optimizer packages to use SciMLBase.has_init (requires SciMLBase 2.122). Co-Authored-By: Claude <[email protected]>
1 parent 37ed4f9 commit 60285ce

File tree

42 files changed

+53
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+53
-172
lines changed

lib/OptimizationAuglag/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ MLUtils = "0.4.8"
2121
LinearAlgebra = "1.10"
2222
OptimizationOptimisers = "0.3.8"
2323
Test = "1.10.0"
24-
SciMLBase = "2.58"
24+
SciMLBase = "2.122"
2525
julia = "1.10"
2626

2727
[targets]

lib/OptimizationAuglag/src/OptimizationAuglag.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ using LinearAlgebra: norm
1616
ϵ = 1e-8
1717
end
1818

19-
@static if isdefined(SciMLBase, :supports_opt_cache_interface)
20-
SciMLBase.supports_opt_cache_interface(::AugLag) = true
21-
end
22-
@static if isdefined(OptimizationBase, :supports_opt_cache_interface)
23-
OptimizationBase.supports_opt_cache_interface(::AugLag) = true
24-
end
19+
SciMLBase.has_init(::AugLag) = true
2520
SciMLBase.allowsbounds(::AugLag) = true
2621
SciMLBase.requiresgradient(::AugLag) = true
2722
SciMLBase.allowsconstraints(::AugLag) = true

lib/OptimizationBBO/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1515
julia = "1.10"
1616
BlackBoxOptim = "0.6"
1717
OptimizationBase = "4"
18-
SciMLBase = "2.58"
18+
SciMLBase = "2.122"
1919
Reexport = "1.2"
2020

2121
[targets]

lib/OptimizationBBO/src/OptimizationBBO.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ abstract type BBO end
99

1010
SciMLBase.requiresbounds(::BBO) = true
1111
SciMLBase.allowsbounds(::BBO) = true
12-
@static if isdefined(SciMLBase, :supports_opt_cache_interface)
13-
SciMLBase.supports_opt_cache_interface(opt::BBO) = true
14-
end
15-
@static if isdefined(OptimizationBase, :supports_opt_cache_interface)
16-
OptimizationBase.supports_opt_cache_interface(opt::BBO) = true
17-
end
12+
13+
SciMLBase.has_init(opt::BBO) = true
1814

1915
for j in string.(BlackBoxOptim.SingleObjectiveMethodNames)
2016
eval(Meta.parse("Base.@kwdef struct BBO_" * j * " <: BBO method=:" * j * " end"))

lib/OptimizationCMAEvolutionStrategy/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1515
CMAEvolutionStrategy = "0.2"
1616
julia = "1.10"
1717
OptimizationBase = "4"
18-
SciMLBase = "2.58"
18+
SciMLBase = "2.122"
1919
Reexport = "1.2"
2020

2121
[targets]

lib/OptimizationCMAEvolutionStrategy/src/OptimizationCMAEvolutionStrategy.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ export CMAEvolutionStrategyOpt
1010
struct CMAEvolutionStrategyOpt end
1111

1212
SciMLBase.allowsbounds(::CMAEvolutionStrategyOpt) = true
13-
@static if isdefined(SciMLBase, :supports_opt_cache_interface)
14-
SciMLBase.supports_opt_cache_interface(opt::CMAEvolutionStrategyOpt) = true
15-
end
16-
@static if isdefined(OptimizationBase, :supports_opt_cache_interface)
17-
OptimizationBase.supports_opt_cache_interface(opt::CMAEvolutionStrategyOpt) = true
18-
end
13+
SciMLBase.has_init(opt::CMAEvolutionStrategyOpt) = true
1914
SciMLBase.requiresgradient(::CMAEvolutionStrategyOpt) = false
2015
SciMLBase.requireshessian(::CMAEvolutionStrategyOpt) = false
2116
SciMLBase.requiresconsjac(::CMAEvolutionStrategyOpt) = false

lib/OptimizationEvolutionary/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1616
julia = "1.10"
1717
OptimizationBase = "4"
1818
Evolutionary = "0.11"
19-
SciMLBase = "2.58"
19+
SciMLBase = "2.122"
2020
Reexport = "1.2"
2121

2222
[targets]

lib/OptimizationEvolutionary/src/OptimizationEvolutionary.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ using SciMLBase
66

77
SciMLBase.allowsbounds(opt::Evolutionary.AbstractOptimizer) = true
88
SciMLBase.allowsconstraints(opt::Evolutionary.AbstractOptimizer) = true
9-
@static if isdefined(SciMLBase, :supports_opt_cache_interface)
10-
SciMLBase.supports_opt_cache_interface(opt::Evolutionary.AbstractOptimizer) = true
11-
end
12-
@static if isdefined(OptimizationBase, :supports_opt_cache_interface)
13-
function OptimizationBase.supports_opt_cache_interface(opt::Evolutionary.AbstractOptimizer)
14-
true
15-
end
16-
end
9+
SciMLBase.has_init(opt::Evolutionary.AbstractOptimizer) = true
1710
SciMLBase.requiresgradient(opt::Evolutionary.AbstractOptimizer) = false
1811
SciMLBase.requiresgradient(opt::Evolutionary.NSGA2) = false
1912
SciMLBase.requireshessian(opt::Evolutionary.AbstractOptimizer) = false

lib/OptimizationGCMAES/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1515
[compat]
1616
julia = "1.10"
1717
OptimizationBase = "4"
18-
SciMLBase = "2.58"
18+
SciMLBase = "2.122"
1919
Reexport = "1.2"
2020
GCMAES = "0.1"
2121

lib/OptimizationGCMAES/src/OptimizationGCMAES.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ struct GCMAESOpt end
1111
SciMLBase.requiresbounds(::GCMAESOpt) = true
1212
SciMLBase.allowsbounds(::GCMAESOpt) = true
1313
SciMLBase.allowscallback(::GCMAESOpt) = false
14-
@static if isdefined(SciMLBase, :supports_opt_cache_interface)
15-
SciMLBase.supports_opt_cache_interface(opt::GCMAESOpt) = true
16-
end
17-
@static if isdefined(OptimizationBase, :supports_opt_cache_interface)
18-
OptimizationBase.supports_opt_cache_interface(opt::GCMAESOpt) = true
19-
end
14+
SciMLBase.has_init(opt::GCMAESOpt) = true
2015
SciMLBase.requiresgradient(::GCMAESOpt) = true
2116
SciMLBase.requireshessian(::GCMAESOpt) = false
2217
SciMLBase.requiresconsjac(::GCMAESOpt) = false

0 commit comments

Comments
 (0)