Skip to content

Commit 2a3dcfe

Browse files
MOI update and Project.toml
1 parent 6afd236 commit 2a3dcfe

File tree

3 files changed

+7
-37
lines changed

3 files changed

+7
-37
lines changed

Project.toml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1111
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1212
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
13+
OptimizationBase = "bca83a33-5cc9-4baa-983d-23429ab6bcbb"
1314
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1415
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1516
ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c"
@@ -18,51 +19,22 @@ SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1819
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1920
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
2021

21-
[weakdeps]
22-
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
23-
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
24-
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
25-
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
26-
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
27-
SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
28-
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
29-
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
30-
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
31-
32-
[extensions]
33-
OptimizationEnzymeExt = "Enzyme"
34-
OptimizationFiniteDiffExt = "FiniteDiff"
35-
OptimizationForwardDiffExt = "ForwardDiff"
36-
OptimizationMTKExt = "ModelingToolkit"
37-
OptimizationReverseDiffExt = "ReverseDiff"
38-
OptimizationSparseDiffExt = ["SparseDiffTools", "Symbolics", "ReverseDiff"]
39-
OptimizationTrackerExt = "Tracker"
40-
OptimizationZygoteExt = "Zygote"
41-
4222
[compat]
4323
ADTypes = "0.2.5"
4424
ArrayInterface = "7.6"
4525
ConsoleProgressMonitor = "0.1.1"
4626
DocStringExtensions = "0.9"
47-
Enzyme = "0.11.11"
48-
FiniteDiff = "2.12"
49-
ForwardDiff = "0.10.26"
5027
LinearAlgebra = "1.10"
5128
Logging = "1.10"
5229
LoggingExtras = "0.4, 1"
53-
ModelingToolkit = "8.74"
5430
Pkg = "1"
5531
Printf = "1.10"
5632
ProgressLogging = "0.1"
5733
Reexport = "1.2"
58-
ReverseDiff = "1.14"
5934
SciMLBase = "2.23.0"
6035
SparseArrays = "1.10"
61-
SparseDiffTools = "2.14"
6236
Symbolics = "5.12"
6337
TerminalLoggers = "0.1"
64-
Tracker = "0.2.29"
65-
Zygote = "0.6.67"
6638
julia = "1.9"
6739

6840
[extras]

lib/OptimizationMOI/src/nlp.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ mutable struct MOIOptimizationNLPEvaluator{T, F <: OptimizationFunction, RC, LB,
2121
end
2222

2323
function Base.getproperty(evaluator::MOIOptimizationNLPEvaluator, x::Symbol)
24-
if x in fieldnames(Optimization.ReInitCache)
24+
if x in fieldnames(OptimizationBase.ReInitCache)
2525
return getfield(evaluator.reinit_cache, x)
2626
end
2727
return getfield(evaluator, x)
@@ -37,15 +37,15 @@ end
3737
function Base.getproperty(cache::MOIOptimizationNLPCache{E}, name::Symbol) where {E}
3838
if name in fieldnames(E)
3939
return getfield(cache.evaluator, name)
40-
elseif name in fieldnames(Optimization.ReInitCache)
40+
elseif name in fieldnames(OptimizationBase.ReInitCache)
4141
return getfield(cache.evaluator.reinit_cache, name)
4242
end
4343
return getfield(cache, name)
4444
end
4545
function Base.setproperty!(cache::MOIOptimizationNLPCache{E}, name::Symbol, x) where {E}
4646
if name in fieldnames(E)
4747
return setfield!(cache.evaluator, name, x)
48-
elseif name in fieldnames(Optimization.ReInitCache)
48+
elseif name in fieldnames(OptimizationBase.ReInitCache)
4949
return setfield!(cache.evaluator.reinit_cache, name, x)
5050
end
5151
return setfield!(cache, name, x)
@@ -110,7 +110,7 @@ function MOIOptimizationNLPCache(prob::OptimizationProblem,
110110
mtkize = false,
111111
callback = nothing,
112112
kwargs...)
113-
reinit_cache = Optimization.ReInitCache(prob.u0, prob.p) # everything that can be changed via `reinit`
113+
reinit_cache = OptimizationBase.ReInitCache(prob.u0, prob.p) # everything that can be changed via `reinit`
114114

115115
num_cons = prob.ucons === nothing ? 0 : length(prob.ucons)
116116
f = Optimization.instantiate_function(prob.f, reinit_cache, prob.f.adtype, num_cons)

src/Optimization.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Optimization
55

66
using DocStringExtensions
77
using Reexport
8-
@reexport using SciMLBase, ADTypes
8+
@reexport using SciMLBase, ADTypes, OptimizationBase
99

1010
if !isdefined(Base, :get_extension)
1111
using Requires
@@ -15,15 +15,13 @@ using Logging, ProgressLogging, ConsoleProgressMonitor, TerminalLoggers, Logging
1515
using ArrayInterface, Base.Iterators, SparseArrays, LinearAlgebra
1616
using Pkg
1717

18+
import OptimizationBase: instantiate_function
1819
import SciMLBase: OptimizationProblem,
1920
OptimizationFunction, ObjSense,
2021
MaxSense, MinSense, OptimizationStats
2122
export ObjSense, MaxSense, MinSense
2223

2324
include("utils.jl")
24-
include("function.jl")
25-
include("adtypes.jl")
26-
include("cache.jl")
2725
include("state.jl")
2826

2927
export solve, OptimizationCache

0 commit comments

Comments
 (0)