Skip to content

Commit 5c01e51

Browse files
Merge pull request #626 from AayushSabharwal/as/indexing-rework
fix: use SII instead of explicitly accessing SciMLFunction.syms
2 parents aeaae4d + 50e1e9e commit 5c01e51

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1717
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1818
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1919
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
20+
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
2021
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
2122

2223
[weakdeps]
@@ -61,6 +62,7 @@ ReverseDiff = "1"
6162
SciMLBase = "1.79.0, 2"
6263
SparseArrays = "1"
6364
SparseDiffTools = "2"
65+
SymbolicIndexingInterface = "0.3"
6466
Symbolics = "5"
6567
TerminalLoggers = "0.1"
6668
Tracker = "0.2"

lib/OptimizationMOI/src/nlp.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function SciMLBase.get_syms(sol::SciMLBase.OptimizationSolution{
8585
C <:
8686
MOIOptimizationNLPCache,
8787
}
88-
sol.cache.evaluator.f.syms
88+
variable_symbols(sol.cache.evaluator.f)
8989
end
9090
function SciMLBase.get_paramsyms(sol::SciMLBase.OptimizationSolution{
9191
T,
@@ -99,7 +99,7 @@ function SciMLBase.get_paramsyms(sol::SciMLBase.OptimizationSolution{
9999
C <:
100100
MOIOptimizationNLPCache,
101101
}
102-
sol.cache.evaluator.f.paramsyms
102+
parameter_symbols(sol.cache.evaluator.f)
103103
end
104104

105105
function MOIOptimizationNLPCache(prob::OptimizationProblem,

src/Optimization.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ end
1313

1414
using Logging, ProgressLogging, ConsoleProgressMonitor, TerminalLoggers, LoggingExtras
1515
using ArrayInterface, Base.Iterators, SparseArrays, LinearAlgebra
16+
using SymbolicIndexingInterface
1617
using Pkg
1718

1819
import SciMLBase: OptimizationProblem, OptimizationFunction, ObjSense,

src/function.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function instantiate_function(f, x, ::SciMLBase.NoAD,
6868
cons_jac_prototype = cons_jac_prototype,
6969
cons_hess_prototype = cons_hess_prototype,
7070
expr = expr, cons_expr = cons_expr,
71-
syms = f.syms, paramsyms = f.paramsyms,
71+
sys = f.sys,
7272
observed = f.observed)
7373
end
7474

@@ -97,7 +97,7 @@ function instantiate_function(f, cache::ReInitCache, ::SciMLBase.NoAD,
9797
cons_jac_prototype = cons_jac_prototype,
9898
cons_hess_prototype = cons_hess_prototype,
9999
expr = expr, cons_expr = cons_expr,
100-
syms = f.syms, paramsyms = f.paramsyms,
100+
sys = f.sys,
101101
observed = f.observed)
102102
end
103103

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ComponentArrays = ">= 0.13.9"
3232
DiffEqFlux = ">= 2"
3333
Enzyme = ">= 0.11.0"
3434
FiniteDiff = ">= 2.8.1"
35-
Flux = "0.13"
35+
Flux = "0.13, 0.14"
3636
ForwardDiff = ">= 0.10.19"
3737
IterTools = ">= 1.3.0"
3838
Lux = ">= 0.4.50"

0 commit comments

Comments
 (0)