Skip to content

Commit 60fee6e

Browse files
Merge pull request #71 from SciML/cacheres
Fix handling for MTK models and nothings
2 parents 0507fa8 + 4ddcb89 commit 60fee6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cache.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ function OptimizationCache(prob::SciMLBase.OptimizationProblem, opt, data = DEFA
105105
sys = f.sys isa SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing} ?
106106
nothing : f.sys
107107
obj_expr = f.expr
108-
cons_expr = f.cons_expr
108+
cons_expr = f.cons_expr === nothing ? nothing : getfield.(f.cons_expr, Ref(:lhs))
109109
end
110110

111-
if obj_expr !== nothing
111+
if obj_expr !== nothing && structural_analysis
112112
obj_expr = obj_expr |> Symbolics.unwrap
113113
if manifold === nothing
114114
obj_res = analyze(obj_expr)
@@ -125,7 +125,7 @@ function OptimizationCache(prob::SciMLBase.OptimizationProblem, opt, data = DEFA
125125
obj_res = nothing
126126
end
127127

128-
if cons_expr !== nothing
128+
if cons_expr !== nothing && structural_analysis
129129
cons_expr = cons_expr .|> Symbolics.unwrap
130130
if manifold === nothing
131131
cons_res = analyze.(cons_expr)

0 commit comments

Comments
 (0)