From 7441459f404ee78ebbebcd11130fb63b482ac23b Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Mon, 14 Apr 2025 19:58:50 +0530 Subject: [PATCH 1/2] build: bump MTK compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a14ded2..22582ab 100644 --- a/Project.toml +++ b/Project.toml @@ -52,7 +52,7 @@ ForwardDiff = "0.10.26" LinearAlgebra = "1.9, 1.10" MLDataDevices = "1" MLUtils = "0.4" -ModelingToolkit = "9" +ModelingToolkit = "9, 10" PDMats = "0.11" Reexport = "1.2" Requires = "1" From 9a8cfac00300bf92f11532f527589a35b3358cc6 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 29 May 2025 21:53:23 +0530 Subject: [PATCH 2/2] refactor: update MTKExt to MTK@10 --- ext/OptimizationMTKExt.jl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ext/OptimizationMTKExt.jl b/ext/OptimizationMTKExt.jl index dbc08c4..a15ba31 100644 --- a/ext/OptimizationMTKExt.jl +++ b/ext/OptimizationMTKExt.jl @@ -20,7 +20,8 @@ function OptimizationBase.instantiate_function( ucons = fill(0.0, num_cons)))) #sys = ModelingToolkit.structural_simplify(sys) - f = OptimizationProblem(sys, x, p, grad = g, hess = h, + # don't need to pass `x` or `p` since they're defaults now + f = OptimizationProblem(sys, nothing; grad = g, hess = h, sparse = true, cons_j = cons_j, cons_h = cons_h, cons_sparse = true).f @@ -70,7 +71,8 @@ function OptimizationBase.instantiate_function( ucons = fill(0.0, num_cons)))) #sys = ModelingToolkit.structural_simplify(sys) - f = OptimizationProblem(sys, cache.u0, cache.p, grad = g, hess = h, + # don't need to pass `x` or `p` since they're defaults now + f = OptimizationProblem(sys, nothing; grad = g, hess = h, sparse = true, cons_j = cons_j, cons_h = cons_h, cons_sparse = true).f @@ -118,7 +120,8 @@ function OptimizationBase.instantiate_function( ucons = fill(0.0, num_cons)))) #sys = ModelingToolkit.structural_simplify(sys) - f = OptimizationProblem(sys, x, p, grad = g, hess = h, + # don't need to pass `x` or `p` since they're defaults now + f = OptimizationProblem(sys, nothing; grad = g, hess = h, sparse = false, cons_j = cons_j, cons_h = cons_h, cons_sparse = false).f @@ -168,7 +171,8 @@ function OptimizationBase.instantiate_function( ucons = fill(0.0, num_cons)))) #sys = ModelingToolkit.structural_simplify(sys) - f = OptimizationProblem(sys, cache.u0, cache.p, grad = g, hess = h, + # don't need to pass `x` or `p` since they're defaults now + f = OptimizationProblem(sys, nothing; grad = g, hess = h, sparse = false, cons_j = cons_j, cons_h = cons_h, cons_sparse = false).f