Skip to content

Manual sparsity patterns for generic IRK with stagewise controls#592

Merged
PierreMartinon merged 2 commits intomainfrom
sparsity-irk-stagewise
May 4, 2026
Merged

Manual sparsity patterns for generic IRK with stagewise controls#592
PierreMartinon merged 2 commits intomainfrom
sparsity-irk-stagewise

Conversation

@PierreMartinon
Copy link
Copy Markdown
Member

@PierreMartinon PierreMartinon commented May 4, 2026

Note: the changes from the stepwise constant control version are rather straightforward since the main difference is the size of the control variables block for each step (s instead of just 1).

Similarly to previous experiments, using manual sparsity patterns becomes faster for larger grid sizes, for instance starting around 1000 time steps for the benchmark below on a set of easy problems.

Keep in mind that the manual sparsity patterns could be significantly improved by computing the patterns for each OCP function and use them to build the Jacobian/Hessian patterns, instead of assuming full dense derivatives as in the current version.

julia> bench(; scheme=:gauss_legendre_2, timer=true, grid_size_list=[250,500,1000,2000])
Problem list: ["beam", "double_integrator_mintf", "double_integrator_minenergy", "electric_vehicle", "fuller", "goddard", "goddard_all", "jackson", "simple_integrator", "vanderpol"]
Grid size list: [250, 500, 1000, 2000]
beam                       0.11( 20)   0.26( 22)   0.69( 29)   1.72( 29) 
double_integrator_tf       0.12( 16)   0.34( 21)   1.05( 19)   3.18( 17) 
double_integrator_e        0.03(  1)   0.07(  1)   0.17(  1)   0.61(  1) 
electric_vehicle           0.15(  6)   0.40(  6)   1.58(  6)   5.56(  6) 
fuller                     0.13( 15)   0.23( 12)   0.52( 10)   1.26(  9) 
goddard                    1.48( 36)   3.90( 39)  11.66( 39)  27.02( 42) 
goddard_all_constraints    0.90( 21)   3.18( 23)   6.97( 23)  24.03( 24) 
jackson                    0.43( 29)   1.11( 27)   3.53( 34)  11.09( 22) 
simple_integrator          0.06(  8)   0.13(  8)   0.33(  8)   1.02(  8) 
vanderpol                  0.13(  3)   0.38(  3)   1.40(  3)   5.60(  3) 

SUCCESS 40/40      3.55(155)  10.00(162)  27.91(172)  81.10(161) 
julia> bench(; scheme=:gauss_legendre_2, timer=true, grid_size_list=[250,500,1000,2000], adnlp_backend=:manual)
Problem list: ["beam", "double_integrator_mintf", "double_integrator_minenergy", "electric_vehicle", "fuller", "goddard", "goddard_all", "jackson", "simple_integrator", "vanderpol"]
Grid size list: [250, 500, 1000, 2000]
beam                       0.26( 20)   0.69( 21)   2.22( 30)   5.10( 33) 
double_integrator_tf       0.20( 16)   0.71( 21)   1.39( 19)   2.90( 17) 
double_integrator_e        0.04(  1)   0.08(  1)   0.17(  1)   0.37(  1) 
electric_vehicle           0.16(  6)   0.34(  6)   0.73(  6)   1.62(  6) 
fuller                     0.22( 15)   0.42( 12)   0.76( 10)   1.62(  9) 
goddard                    1.48( 36)   4.61( 39)   8.96( 39)  16.54( 38) 
goddard_all_constraints    0.82( 21)   2.04( 23)   3.36( 15)  12.57( 26) 
jackson                    0.80( 29)   1.71( 27)   4.51( 34)   6.69( 22) 
simple_integrator          0.09(  8)   0.19(  8)   0.43(  8)   0.89(  8) 
vanderpol                  0.09(  3)   0.20(  3)   0.41(  3)   0.87(  3) 

SUCCESS 40/40      4.16(155)  10.98(161)  22.94(165)  49.17(163) 

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Breakage test results
Date: 2026-05-04 12:16:31

Name Latest Stable
OptimalControl compat: v1.0.11 compat: v1.0.11

@PierreMartinon PierreMartinon merged commit d79f8b2 into main May 4, 2026
9 checks passed
@PierreMartinon PierreMartinon deleted the sparsity-irk-stagewise branch May 4, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant