Skip to content

Commit eeaa2ff

Browse files
Merge pull request #143 from AayushSabharwal/as/mtk-v10
build: bump MTK compat
2 parents fbac4da + 9a8cfac commit eeaa2ff

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ForwardDiff = "0.10.26"
5252
LinearAlgebra = "1.9, 1.10"
5353
MLDataDevices = "1"
5454
MLUtils = "0.4"
55-
ModelingToolkit = "9"
55+
ModelingToolkit = "9, 10"
5656
PDMats = "0.11"
5757
Reexport = "1.2"
5858
Requires = "1"

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)