Changed: store conversion matrices as SparseMatrixCSC#212
Conversation
SparseMatrixCSC
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #212 +/- ##
=======================================
Coverage 98.92% 98.92%
=======================================
Files 26 26
Lines 4285 4286 +1
=======================================
+ Hits 4239 4240 +1
Misses 46 46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I also stored |
SparseMatrixCSCSparseMatrixCSC
|
On this subject, the prediction matrices and defect matrices for It is still a bad idea to store them as That is why I reverted my last commit. |
SparseMatrixCSCSparseMatrixCSC
Following discussion at adrhill/SparseConnectivityTracer.jl#248, the conversion matrices from decision variable$\mathbf{Z}$ to inputs $\mathbf{U}$ and input increments $\mathbf{\Delta U}$ are now hard-coded as
SparseMatrixCSC{NT, Int}, since the benchmarks indicated that it's not really slower than dense matrices on small plant models. It also ensures that sparsity detection for the differentiation ofNonLinMPCwithMultipleShootingis not overly-conservative. Side-bonus: it's more efficient on the memory.I reproduce the benchmark here for posterity:
resulting in:
The only case in which sparse multiplication is slightly slower is when
nu=2,Hp=50andHc=50, which I would argue that it's a bad tuning (the control periodTsshould be increased to reduce the horizons and the computational burden).Note this benchmark infirm my assumption in #202:
Morale: from now on I will rely more on
sparsematrices when they contain a fair amount of zeros.