diff --git a/Project.toml b/Project.toml index 53bc22750..f7bd0ddd5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ModelPredictiveControl" uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c" -version = "1.13.2" +version = "1.13.3" authors = ["Francis Gagnon"] [deps] @@ -20,6 +20,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5" SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35" +StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" [compat] ControlSystemsBase = "1.18.2" @@ -42,6 +43,7 @@ RecipesBase = "1" SparseArrays = "1.10" SparseConnectivityTracer = "0.6.13, 1" SparseMatrixColorings = "0.4.14" +StableRNGs = "1.0.4" TestItemRunner = "1" TestItems = "1" julia = "1.10" diff --git a/src/ModelPredictiveControl.jl b/src/ModelPredictiveControl.jl index 8bb73005f..efa05e3d9 100644 --- a/src/ModelPredictiveControl.jl +++ b/src/ModelPredictiveControl.jl @@ -3,6 +3,7 @@ module ModelPredictiveControl using PrecompileTools using LinearAlgebra, SparseArrays using Random: randn +using StableRNGs: StableRNG using RecipesBase @@ -15,7 +16,7 @@ using DifferentiationInterface: Constant, Cache using SparseConnectivityTracer: TracerSparsityDetector using SparseMatrixColorings: GreedyColoringAlgorithm, sparsity_pattern using SparseMatrixColorings: NaturalOrder, LargestFirst, SmallestLast -using SparseMatrixColorings: IncidenceDegree, DynamicLargestFirst +using SparseMatrixColorings: IncidenceDegree, DynamicLargestFirst, RandomOrder import ProgressLogging diff --git a/src/controller/nonlinmpc.jl b/src/controller/nonlinmpc.jl index 31660bcb4..3a42e8b15 100644 --- a/src/controller/nonlinmpc.jl +++ b/src/controller/nonlinmpc.jl @@ -293,11 +293,12 @@ NonLinMPC controller with a sample time Ts = 10.0 s: sparsity_detector = TracerSparsityDetector(), coloring_algorithm = GreedyColoringAlgorithm( ( - NaturalOrder(), - LargestFirst(), - SmallestLast(), - IncidenceDegree(), - DynamicLargestFirst() + NaturalOrder(), + LargestFirst(), + SmallestLast(), + IncidenceDegree(), + DynamicLargestFirst(), + RandomOrder(StableRNG(0), 0) ), postprocessing = true ) diff --git a/src/estimator/mhe/construct.jl b/src/estimator/mhe/construct.jl index 3f43aab6f..316529c3e 100644 --- a/src/estimator/mhe/construct.jl +++ b/src/estimator/mhe/construct.jl @@ -384,11 +384,12 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s: sparsity_detector = TracerSparsityDetector(), coloring_algorithm = GreedyColoringAlgorithm( ( - NaturalOrder(), - LargestFirst(), - SmallestLast(), - IncidenceDegree(), - DynamicLargestFirst() + NaturalOrder(), + LargestFirst(), + SmallestLast(), + IncidenceDegree(), + DynamicLargestFirst(), + RandomOrder(StableRNG(0), 0) ), postprocessing = true ) diff --git a/src/general.jl b/src/general.jl index 4ce717392..ea814bcd6 100644 --- a/src/general.jl +++ b/src/general.jl @@ -13,6 +13,7 @@ const ALL_COLORING_ORDERS = ( SmallestLast(), IncidenceDegree(), DynamicLargestFirst(), + RandomOrder(StableRNG(0), 0) ) "Termination status that means 'no solution available'."