Skip to content

Add script to calculate specializations using dynamic programming#341

Merged
LorenzSchueler merged 4 commits into
mainfrom
lorenz/dynamic-programming-specs
Feb 17, 2026
Merged

Add script to calculate specializations using dynamic programming#341
LorenzSchueler merged 4 commits into
mainfrom
lorenz/dynamic-programming-specs

Conversation

@LorenzSchueler

@LorenzSchueler LorenzSchueler commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

This PR adds a Python script to compute the best node specializations based on node counts obtained from the statistics module using a dynamic programming approach.
It produces the same results as the ILP implementations, but for num_specializations >= 4 it is significantly faster.

I did not incorporate this into the existing script, because the used data types are different. This can be done in another PR if needed.

The output looks like this:

--- Node type: Inner ---
Num Specializations: 1
Min cost: 214650615200
Specializations: [256]

Num Specializations: 2
Min cost: 154199374790
Specializations: [102, 256]

Num Specializations: 3
Min cost: 141878721821
Specializations: [9, 105, 256]

Num Specializations: 4
Min cost: 135478558857
Specializations: [4, 78, 109, 256]

Num Specializations: 5
Min cost: 132960791105
Specializations: [4, 68, 91, 113, 256]

--- Node type: Leaf ---
Num Specializations: 1
Min cost: 503024231374.0
Specializations: [256]

Num Specializations: 2
Min cost: 74731897003.0
Specializations: [7, 256]

Num Specializations: 3
Min cost: 55646058849.0
Specializations: [4, 149, 256]

Num Specializations: 4
Min cost: 46106649717.0
Specializations: [2, 26, 149, 256]

Num Specializations: 5
Min cost: 43565650674.0
Specializations: [2, 16, 91, 149, 256]

This is the output when DEBUG and PRINT_TABLE are set to True

Num Specializations: 1
Min cost: 850
Specializations: [4]

10:[0]    40:[1]    210:[2]   360:[3]   850:[4]   
          INF:[]    INF:[]    INF:[]    INF:[]    
                    INF:[]    INF:[]    INF:[]    
                              INF:[]    INF:[]    
                                        INF:[]    
Num Specializations: 2
Min cost: 710
Specializations: [2, 4]

10:[0], INF:[]       40:[1], INF:[]       210:[2], INF:[]      360:[3], INF:[]      850:[4], INF:[]      
                     INF:[], 30:[0, 1]    INF:[], 190:[0, 2]   INF:[], 330:[0, 3]   INF:[], 810:[0, 4]   
                                          INF:[], 190:[1, 2]   INF:[], 320:[1, 3]   INF:[], 790:[1, 4]   
                                                               INF:[], 290:[2, 3]   INF:[], 710:[2, 4]   
                                                                                    INF:[], 760:[3, 4]   
Num Specializations: 3
Min cost: 690
Specializations: [0, 2, 4]

10:[0], INF:[], INF:[]              40:[1], INF:[], INF:[]              210:[2], INF:[], INF:[]             360:[3], INF:[], INF:[]             850:[4], INF:[], INF:[]             
                                    INF:[], 30:[0, 1], INF:[]           INF:[], 190:[0, 2], INF:[]          INF:[], 330:[0, 3], INF:[]          INF:[], 810:[0, 4], INF:[]          
                                                                        INF:[], 190:[1, 2], 180:[0, 1, 2]   INF:[], 320:[1, 3], 310:[0, 1, 3]   INF:[], 790:[1, 4], 780:[0, 1, 4]   
                                                                                                            INF:[], 290:[2, 3], 270:[0, 2, 3]   INF:[], 710:[2, 4], 690:[0, 2, 4]   
                                                                                                                                                INF:[], 760:[3, 4], 690:[2, 3, 4]
                                                                                                                                                                                    ```

@LorenzSchueler
LorenzSchueler force-pushed the lorenz/dynamic-programming-specs branch 2 times, most recently from 2d86e85 to c87c1bc Compare February 6, 2026 09:55
@codecov

codecov Bot commented Feb 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread analytics/verkle_best_specializations_dynamic_programming.py
Comment thread analytics/verkle_best_specializations_dynamic_programming.py Outdated
Comment thread analytics/verkle_best_specializations_dynamic_programming.py
Comment thread analytics/verkle_best_specializations_dynamic_programming.py Outdated
Comment thread analytics/verkle_best_specializations_dynamic_programming.py Outdated
ihtefyw
ihtefyw previously approved these changes Feb 16, 2026
@LorenzSchueler
LorenzSchueler force-pushed the lorenz/dynamic-programming-specs branch from 4de136e to 52e74a6 Compare February 17, 2026 08:58

@b-scholz b-scholz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LorenzSchueler
LorenzSchueler merged commit 43d820e into main Feb 17, 2026
4 checks passed
@LorenzSchueler
LorenzSchueler deleted the lorenz/dynamic-programming-specs branch February 17, 2026 12:58
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.

3 participants