MDPSolver
MDPSolver is a Python package for large Markov Decision Processes (MDPs) with infinite-horizons.
Features
- Fast solver: Our C++-based solver is substantially faster than other CPU-based MDP packages available for Python. See details in the documentation.
- Two optimality criteria: Discounted and Average reward.
- Three optimization algorithms: Value iteration, Policy iteration, and Modified policy iteration.
- Three value-update methods: Standard, Gauss–Seidel, and Successive over-relaxation.
- Supports sparse matrices.
- Employs parallel computing.
Installation
Prebuilt wheels are available for Linux, Windows, and macOS (14+) across Python 3.10–3.14. Install directly from PyPI with:
pip install mdpsolver
Quick start guide
The following shows how to get quickly started with mdpsolver.
Usage
Start by specifying the reward function and transition probabilities as lists. The following is an example of a simple MDP containing three states and two actions in each state.
#Import packages
import mdpsolver
#Rewards (3 states x 2 actions)
#e.g. choosing second action in first state gives reward=-1
rewards = [[5,-1],
[1,-2],
[50,0]]
#Transition probabilities (3 from_states x 2 actions x 3 to_states)
#e.g. choosing first action in third state gives a probability of 0.6 of staying in third state
tranMatWithZeros = [[[0.9,0.1,0.0],[0.1,0.9,0.0]],
[[0.4,0.5,0.1],[0.3,0.5,0.2]],
[[0.2,0.2,0.6],[0.5,0.5,0.0]]]
Now, create the model object and insert the problem parameters.
#Create model object
mdl = mdpsolver.model()
#Insert the problem parameters
mdl.mdp(discount=0.8,
rewards=rewards,
tranMatWithZeros=tranMatWithZeros)
We can now optimize the policy.
mdl.solve()
The optimized policy can be returned in a variety of ways. Here, we return the policy as a list and print directly in the terminal.
print(mdl.getPolicy())
#[1, 1, 0]
Sparse transition matrix?
mdpsolver has three alternative formats for large and highly sparse transition probability matrices.
(1) Elementwise representation (excluding elements containing zeros):
#[from_state,action,to_state,probability]
tranMatElementwise = [[0,0,0,0.9],
[0,0,1,0.1],
[0,1,0,0.1],
[0,1,1,0.9],
[1,0,0,0.4],
[1,0,1,0.5],
[1,0,2,0.1],
[1,1,0,0.3],
[1,1,1,0.5],
[1,1,2,0.2],
[2,0,0,0.2],
[2,0,1,0.2],
[2,0,2,0.6],
[2,1,0,0.5],
[2,1,1,0.5]]
mdl.mdp(discount=0.8,
rewards=rewards,
tranMatElementwise=tranMatElementwise)
(2) Probabilities and column (to_state) indices in separate lists:
tranMatProbs = [[[0.9,0.1],[0.1,0.9]],
[[0.4,0.5,0.1],[0.3,0.5,0.2]],
[[0.2,0.2,0.6],[0.5,0.5]]]
tranMatColumns = [[[0,1],[0,1]],
[[0,1,2],[0,1,2]],
[[0,1,2],[0,1]]]
mdl.mdp(discount=0.8,
rewards=rewards,
tranMatProbs=tranMatProbs,
tranMatColumns=tranMatColumns)
(3) Load the elementwise representation from a file:
mdl.mdp(discount=0.8,
rewards=rewards,
tranMatFromFile="transitions.csv")
Documentation
The documentation can be found in the wiki for MDPSolver.
How to cite
Metadata
Release files for mdpsolver 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mdpsolver-0.10.0.tar.gz | 226.2 kB | Details |
Built distributions (wheels)
Total release size: 6.6 MB
Release files / mdpsolver-0.10.0.tar.gz
| Download URL | mdpsolver-0.10.0.tar.gz |
|---|---|
| Size | 226.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
338703e00fc62400719826a0104ec6e6521e9011b65b704ba7f0b88583bb4078
|
|
BLAKE2b-256 checksum How to use checksums |
8853ba0c7c2df3f4e4cdbd8d6ed6fba5d3c19243212446aa1004e6eed787f09c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp314-cp314-win_amd64.whl
| Download URL | mdpsolver-0.10.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 653.5 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
900bec8dca872f2b363dec388b485d1ab6fd318a4e8eb017471d2f0626d29e88
|
|
BLAKE2b-256 checksum How to use checksums |
6ce901871e41d05edab3a61a1a5b3a1e26fa934169c58e1418078ab905626ae6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 271.5 kB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
afc3439726d7e92a07b7ba6b26c869afe3150060665f96cb3f22cb15a6e8debc
|
|
BLAKE2b-256 checksum How to use checksums |
37ea8d8c975f8411721640409a09d37167aae9dd3bc909ceb146443957f3c563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp314-cp314-macosx_14_0_arm64.whl
| Download URL | mdpsolver-0.10.0-cp314-cp314-macosx_14_0_arm64.whl |
|---|---|
| Size | 373.5 kB |
| Tags | CPython 3.14 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
37ae001e8adbdc10d9492d2845f5e5171e230d89ccad04bd02ef839e00f43128
|
|
BLAKE2b-256 checksum How to use checksums |
9ad457d3ae72e7e81be443eac9ef6bf989d57082093eb572fef7f7b9f1cd7a9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp313-cp313-win_amd64.whl
| Download URL | mdpsolver-0.10.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 628.3 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b6c374b54a823212a5b56f84458b7c43c76ce9900d7aec148aed499aa5731d27
|
|
BLAKE2b-256 checksum How to use checksums |
2a046d0f43ad3474ede807e2776eb8812fe2614916e9ad7c35ae44a989426e0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 271.4 kB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2d107cda37b3c781015c5e063bdafb8166b3f3ed30456c4eee128e4255d0e63c
|
|
BLAKE2b-256 checksum How to use checksums |
ce65b5f61c9b7dc44257cd4efa550aa4b8901e0e16103bee25db2280a79e205c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | mdpsolver-0.10.0-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 373.3 kB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
96c8de4bcc0f7cdcae973f2102a47348bdb423907e047aad1d5b7e1ebb0945c8
|
|
BLAKE2b-256 checksum How to use checksums |
ff1e6911a0321c25391e8e95bcc806e1f6ee4b2c5fca62d34ebccf721d041a15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp312-cp312-win_amd64.whl
| Download URL | mdpsolver-0.10.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 628.3 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8e68aa42cabe6941a0975ed4dee35e61154b0388ecb474e52d72faf6a0ea5068
|
|
BLAKE2b-256 checksum How to use checksums |
4685c38f4766fda4e24d0d8420fa005a24aabddd5d39188a9f5dacdacc40f385
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 271.3 kB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
cafb67d2e04b7ed993fb8b059e1bc0023fdbc5da19bc72b16d477356900f79ea
|
|
BLAKE2b-256 checksum How to use checksums |
3952a9c523af6b6c82478d0a428a7b22f4b2b78ae38d9ee0731826544bf2a478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | mdpsolver-0.10.0-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 373.3 kB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b9d3d5a193727fce27aa2ea19bb7d8ab2ab7a0e0c4f96108bf82f4713ea6ccfb
|
|
BLAKE2b-256 checksum How to use checksums |
fd11d8b43aafc9cc73d574b5627a18f54aba9b40bbae246501f4971c89ed8968
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp311-cp311-win_amd64.whl
| Download URL | mdpsolver-0.10.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 625.7 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a41689bf07b3987b496951b9846d2dadc29372725319ea105f69076ca175b5c6
|
|
BLAKE2b-256 checksum How to use checksums |
2f94b520ccc3979418d90e33a5c17bc4d0bf1ab2760bcb4a8164cac57a63600c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 270.4 kB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
3398e40a4e4f908befba226e1128b80b3f1bd353fcc264111c1967a634f53f48
|
|
BLAKE2b-256 checksum How to use checksums |
a6dfb4cadd1b8dbf10b1d250a0932e937368dfb1bee913955affb5298e413aa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | mdpsolver-0.10.0-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 372.9 kB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
39911e3013b78a04c35593474c79436cafd017b24bd9c8094b8472f35c2b0da7
|
|
BLAKE2b-256 checksum How to use checksums |
19967b7a9b446e526780e35253a27f6b202d33094010414c22fad67fa60e7f66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp310-cp310-win_amd64.whl
| Download URL | mdpsolver-0.10.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 625.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
057216565217ead5b7711678b307494d6c0bd418c801342cdca5ba0d325f6436
|
|
BLAKE2b-256 checksum How to use checksums |
f7fee7af7f86630e1ca99d33ab0e5a37514d3158950aceaa1aa59d1ada89bb81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 269.1 kB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6527ab9c5ce7d57cb88383a820fd047ef9c7037d621d21f3ccfd7a105817d8a2
|
|
BLAKE2b-256 checksum How to use checksums |
4d5e9eae9566b953b56caba8c04d211ee0a9cc273fe3d0acfc3c0e93f4878062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / mdpsolver-0.10.0-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | mdpsolver-0.10.0-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 371.3 kB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d789cebd4eb92d06d9f0279343fa6998d2efa9d0cfbf0fcf1eab7d5e18d6d857
|
|
BLAKE2b-256 checksum How to use checksums |
fc8c8c41f9ba893f99ed75f93c6b8112d0e49561ed9ef9ab3d54baa3a7c06741
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency log