From 7ab29dea24fa0d19747c10b092e85ccea2cc4dc9 Mon Sep 17 00:00:00 2001 From: franckgaga Date: Sat, 8 Nov 2025 19:03:16 -0500 Subject: [PATCH 1/3] changed: sparse backends default to post-processing --- src/controller/nonlinmpc.jl | 2 +- src/estimator/mhe/construct.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controller/nonlinmpc.jl b/src/controller/nonlinmpc.jl index 7ac5ddc75..b1d4ae4d9 100644 --- a/src/controller/nonlinmpc.jl +++ b/src/controller/nonlinmpc.jl @@ -5,7 +5,7 @@ const DEFAULT_NONLINMPC_JACDENSE = AutoForwardDiff() const DEFAULT_NONLINMPC_JACSPARSE = AutoSparse( AutoForwardDiff(); sparsity_detector=TracerSparsityDetector(), - coloring_algorithm=GreedyColoringAlgorithm(ALL_COLORING_ORDERS), + coloring_algorithm=GreedyColoringAlgorithm(ALL_COLORING_ORDERS, postprocessing=true), ) const DEFAULT_NONLINMPC_HESSIAN = DEFAULT_NONLINMPC_JACSPARSE diff --git a/src/estimator/mhe/construct.jl b/src/estimator/mhe/construct.jl index 5d7c9120a..ba2d5c4b5 100644 --- a/src/estimator/mhe/construct.jl +++ b/src/estimator/mhe/construct.jl @@ -5,7 +5,7 @@ const DEFAULT_NONLINMHE_JACOBIAN = AutoForwardDiff() const DEFAULT_NONLINMHE_HESSIAN = AutoSparse( AutoForwardDiff(); sparsity_detector=TracerSparsityDetector(), - coloring_algorithm=GreedyColoringAlgorithm(ALL_COLORING_ORDERS), + coloring_algorithm=GreedyColoringAlgorithm(ALL_COLORING_ORDERS, postprocessing=true), ) @doc raw""" From 24dda297ae605fc22f4cb732a23e6b152c4fe9e6 Mon Sep 17 00:00:00 2001 From: franckgaga Date: Sun, 9 Nov 2025 10:09:47 -0500 Subject: [PATCH 2/3] changed: bump `DifferentiationInterface.jl` compat --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 9634f41de..53bc22750 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ModelPredictiveControl" uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c" -version = "1.13.1" +version = "1.13.2" authors = ["Francis Gagnon"] [deps] @@ -24,7 +24,7 @@ SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35" [compat] ControlSystemsBase = "1.18.2" DAQP = "0.6, 0.7.1" -DifferentiationInterface = "0.6.45, 0.7" +DifferentiationInterface = "0.7.11" Documenter = "1" FiniteDiff = "2" ForwardDiff = "0.10, 1" From a5f25e7f2dcb59991edac1c3ef40dea206d8e628 Mon Sep 17 00:00:00 2001 From: franckgaga Date: Sun, 9 Nov 2025 10:34:12 -0500 Subject: [PATCH 3/3] doc: adding `postprocessing` in default sparse backend --- src/controller/nonlinmpc.jl | 7 +++++-- src/estimator/mhe/construct.jl | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/controller/nonlinmpc.jl b/src/controller/nonlinmpc.jl index b1d4ae4d9..31660bcb4 100644 --- a/src/controller/nonlinmpc.jl +++ b/src/controller/nonlinmpc.jl @@ -291,13 +291,16 @@ NonLinMPC controller with a sample time Ts = 10.0 s: AutoSparse( AutoForwardDiff(); sparsity_detector = TracerSparsityDetector(), - coloring_algorithm = GreedyColoringAlgorithm(( + coloring_algorithm = GreedyColoringAlgorithm( + ( NaturalOrder(), LargestFirst(), SmallestLast(), IncidenceDegree(), DynamicLargestFirst() - )) + ), + postprocessing = true + ) ) ``` that is, it will test many coloring orders at preparation and keep the best. This is diff --git a/src/estimator/mhe/construct.jl b/src/estimator/mhe/construct.jl index ba2d5c4b5..3f43aab6f 100644 --- a/src/estimator/mhe/construct.jl +++ b/src/estimator/mhe/construct.jl @@ -382,13 +382,16 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s: AutoSparse( AutoForwardDiff(); sparsity_detector = TracerSparsityDetector(), - coloring_algorithm = GreedyColoringAlgorithm(( + coloring_algorithm = GreedyColoringAlgorithm( + ( NaturalOrder(), LargestFirst(), SmallestLast(), IncidenceDegree(), DynamicLargestFirst() - )) + ), + postprocessing = true + ) ) ``` that is, it will test many coloring orders at preparation and keep the best.