Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 9a8cfac

Browse files
refactor: update MTKExt to MTK@10
1 parent 7441459 commit 9a8cfac

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ext/OptimizationMTKExt.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function OptimizationBase.instantiate_function(
2020
ucons = fill(0.0,
2121
num_cons))))
2222
#sys = ModelingToolkit.structural_simplify(sys)
23-
f = OptimizationProblem(sys, x, p, grad = g, hess = h,
23+
# don't need to pass `x` or `p` since they're defaults now
24+
f = OptimizationProblem(sys, nothing; grad = g, hess = h,
2425
sparse = true, cons_j = cons_j, cons_h = cons_h,
2526
cons_sparse = true).f
2627

@@ -70,7 +71,8 @@ function OptimizationBase.instantiate_function(
7071
ucons = fill(0.0,
7172
num_cons))))
7273
#sys = ModelingToolkit.structural_simplify(sys)
73-
f = OptimizationProblem(sys, cache.u0, cache.p, grad = g, hess = h,
74+
# don't need to pass `x` or `p` since they're defaults now
75+
f = OptimizationProblem(sys, nothing; grad = g, hess = h,
7476
sparse = true, cons_j = cons_j, cons_h = cons_h,
7577
cons_sparse = true).f
7678

@@ -118,7 +120,8 @@ function OptimizationBase.instantiate_function(
118120
ucons = fill(0.0,
119121
num_cons))))
120122
#sys = ModelingToolkit.structural_simplify(sys)
121-
f = OptimizationProblem(sys, x, p, grad = g, hess = h,
123+
# don't need to pass `x` or `p` since they're defaults now
124+
f = OptimizationProblem(sys, nothing; grad = g, hess = h,
122125
sparse = false, cons_j = cons_j, cons_h = cons_h,
123126
cons_sparse = false).f
124127

@@ -168,7 +171,8 @@ function OptimizationBase.instantiate_function(
168171
ucons = fill(0.0,
169172
num_cons))))
170173
#sys = ModelingToolkit.structural_simplify(sys)
171-
f = OptimizationProblem(sys, cache.u0, cache.p, grad = g, hess = h,
174+
# don't need to pass `x` or `p` since they're defaults now
175+
f = OptimizationProblem(sys, nothing; grad = g, hess = h,
172176
sparse = false, cons_j = cons_j, cons_h = cons_h,
173177
cons_sparse = false).f
174178

0 commit comments

Comments
 (0)