Skip to content

Release 0.12.0: Faster solver, NumPy input and output, and NPY files - #15

Merged
areenberg merged 12 commits into
masterfrom
speed_improvements
Nov 13, 2026
Merged

areenberg merged 12 commits into
masterfrom
speed_improvements

Conversation

@areenberg

Copy link
Copy Markdown
Owner

Speed and memory improvements, NumPy arrays in and out, and loading of large models from NumPy .npy files.

Changes

  • The transition matrix is stored in CSR form, read by direct loops with four partial sums per state-action pair. Large models given as arrays solve 9–12× faster end to end than in 0.11.0, with 3.4–4.6× less peak memory.
  • Every input format accepts NumPy arrays (lists still work). Transition probabilities given as float32 are kept as float32.
  • rewardsFromFile and tranMatFromFile read .npy files (recognised by the extension) straight into the C++ tables. A model with 1 billion non-zero transition probabilities loads in 19 s instead of 9 minutes from CSV, with the same peak memory. CSV files still work.
  • solve() releases the GIL, so other Python threads run while a model is solved.
  • Rewritten benchmark scripts; updated README performance table, benchmark figures and logos.

Breaking

  • getPolicy() and getValueVector() return NumPy arrays instead of lists.
  • NumPy is now a required dependency.

Testing

  • New test_arrays.py and test_threads.py; test_imports.py now covers .npy files.
  • All 12 tests pass locally on macOS with Python 3.14, both from the source tree and from the installed sdist.
  • This PR runs them on the Linux, Windows and macOS wheels.

@areenberg
areenberg merged commit 6c66cd3 into master Nov 13, 2026
5 checks passed
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