Skip to content

Commit 3b14da7

Browse files
authored
Merge pull request #286 from JuliaControl/random_order
added: `RandomOrder` in default sparse Jacobian and Hessian backends
2 parents 3c46387 + d9aa841 commit 3b14da7

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ModelPredictiveControl"
22
uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c"
3-
version = "1.13.2"
3+
version = "1.13.3"
44
authors = ["Francis Gagnon"]
55

66
[deps]
@@ -20,6 +20,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
2020
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2121
SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
2222
SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35"
23+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2324

2425
[compat]
2526
ControlSystemsBase = "1.18.2"
@@ -42,6 +43,7 @@ RecipesBase = "1"
4243
SparseArrays = "1.10"
4344
SparseConnectivityTracer = "0.6.13, 1"
4445
SparseMatrixColorings = "0.4.14"
46+
StableRNGs = "1.0.4"
4547
TestItemRunner = "1"
4648
TestItems = "1"
4749
julia = "1.10"

src/ModelPredictiveControl.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module ModelPredictiveControl
33
using PrecompileTools
44
using LinearAlgebra, SparseArrays
55
using Random: randn
6+
using StableRNGs: StableRNG
67

78
using RecipesBase
89

@@ -15,7 +16,7 @@ using DifferentiationInterface: Constant, Cache
1516
using SparseConnectivityTracer: TracerSparsityDetector
1617
using SparseMatrixColorings: GreedyColoringAlgorithm, sparsity_pattern
1718
using SparseMatrixColorings: NaturalOrder, LargestFirst, SmallestLast
18-
using SparseMatrixColorings: IncidenceDegree, DynamicLargestFirst
19+
using SparseMatrixColorings: IncidenceDegree, DynamicLargestFirst, RandomOrder
1920

2021
import ProgressLogging
2122

src/controller/nonlinmpc.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,12 @@ NonLinMPC controller with a sample time Ts = 10.0 s:
293293
sparsity_detector = TracerSparsityDetector(),
294294
coloring_algorithm = GreedyColoringAlgorithm(
295295
(
296-
NaturalOrder(),
297-
LargestFirst(),
298-
SmallestLast(),
299-
IncidenceDegree(),
300-
DynamicLargestFirst()
296+
NaturalOrder(),
297+
LargestFirst(),
298+
SmallestLast(),
299+
IncidenceDegree(),
300+
DynamicLargestFirst(),
301+
RandomOrder(StableRNG(0), 0)
301302
),
302303
postprocessing = true
303304
)

src/estimator/mhe/construct.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,12 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s:
384384
sparsity_detector = TracerSparsityDetector(),
385385
coloring_algorithm = GreedyColoringAlgorithm(
386386
(
387-
NaturalOrder(),
388-
LargestFirst(),
389-
SmallestLast(),
390-
IncidenceDegree(),
391-
DynamicLargestFirst()
387+
NaturalOrder(),
388+
LargestFirst(),
389+
SmallestLast(),
390+
IncidenceDegree(),
391+
DynamicLargestFirst(),
392+
RandomOrder(StableRNG(0), 0)
392393
),
393394
postprocessing = true
394395
)

src/general.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const ALL_COLORING_ORDERS = (
1313
SmallestLast(),
1414
IncidenceDegree(),
1515
DynamicLargestFirst(),
16+
RandomOrder(StableRNG(0), 0)
1617
)
1718

1819
"Termination status that means 'no solution available'."

0 commit comments

Comments
 (0)