Skip to content

Commit

Permalink
fix: use SII instead of explicitly accessing SciMLFunction.syms
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Dec 14, 2023
1 parent aeaae4d commit 50e1e9e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"

[weakdeps]
Expand Down Expand Up @@ -61,6 +62,7 @@ ReverseDiff = "1"
SciMLBase = "1.79.0, 2"
SparseArrays = "1"
SparseDiffTools = "2"
SymbolicIndexingInterface = "0.3"
Symbolics = "5"
TerminalLoggers = "0.1"
Tracker = "0.2"
Expand Down
4 changes: 2 additions & 2 deletions lib/OptimizationMOI/src/nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function SciMLBase.get_syms(sol::SciMLBase.OptimizationSolution{
C <:
MOIOptimizationNLPCache,
}
sol.cache.evaluator.f.syms
variable_symbols(sol.cache.evaluator.f)
end
function SciMLBase.get_paramsyms(sol::SciMLBase.OptimizationSolution{
T,
Expand All @@ -99,7 +99,7 @@ function SciMLBase.get_paramsyms(sol::SciMLBase.OptimizationSolution{
C <:
MOIOptimizationNLPCache,
}
sol.cache.evaluator.f.paramsyms
parameter_symbols(sol.cache.evaluator.f)
end

function MOIOptimizationNLPCache(prob::OptimizationProblem,
Expand Down
1 change: 1 addition & 0 deletions src/Optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ end

using Logging, ProgressLogging, ConsoleProgressMonitor, TerminalLoggers, LoggingExtras
using ArrayInterface, Base.Iterators, SparseArrays, LinearAlgebra
using SymbolicIndexingInterface
using Pkg

import SciMLBase: OptimizationProblem, OptimizationFunction, ObjSense,
Expand Down
4 changes: 2 additions & 2 deletions src/function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function instantiate_function(f, x, ::SciMLBase.NoAD,
cons_jac_prototype = cons_jac_prototype,
cons_hess_prototype = cons_hess_prototype,
expr = expr, cons_expr = cons_expr,
syms = f.syms, paramsyms = f.paramsyms,
sys = f.sys,
observed = f.observed)
end

Expand Down Expand Up @@ -97,7 +97,7 @@ function instantiate_function(f, cache::ReInitCache, ::SciMLBase.NoAD,
cons_jac_prototype = cons_jac_prototype,
cons_hess_prototype = cons_hess_prototype,
expr = expr, cons_expr = cons_expr,
syms = f.syms, paramsyms = f.paramsyms,
sys = f.sys,
observed = f.observed)
end

Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ComponentArrays = ">= 0.13.9"
DiffEqFlux = ">= 2"
Enzyme = ">= 0.11.0"
FiniteDiff = ">= 2.8.1"
Flux = "0.13"
Flux = "0.13, 0.14"
ForwardDiff = ">= 0.10.19"
IterTools = ">= 1.3.0"
Lux = ">= 0.4.50"
Expand Down

0 comments on commit 50e1e9e

Please sign in to comment.