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
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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mdpsolver-0.10.3.tar.gz | 41.1 kB | With provenance | Details for mdpsolver-0.10.3.tar.gz |
Built distributions (wheels)
Total release size: 6.4 MB
Release files / mdpsolver-0.10.3.tar.gz
| Download URL | mdpsolver-0.10.3.tar.gz |
|---|---|
| Size | 41.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1909a28878877acf2039fee273d87dd427db912f116a2c0b78011ff011d0d0f3
|
|
BLAKE2b-256 checksum How to use checksums |
368a9e499449f91afececaaf547adb99f7703551bbf0619fbe47732ff1780432
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp314-cp314-win_amd64.whl
| Download URL | mdpsolver-0.10.3-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 655.3 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
957fa5da06ff3785a0b98ec02a8769d72ed14aa209dbdd1b7f24d40287c5ff56
|
|
BLAKE2b-256 checksum How to use checksums |
dbb26e2f99df230ee8d3c3b9f7d4fe915134c2aac0d5803be96e0738246fe307
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 273.6 kB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
ec192e70faf0279909747b6085897cc2a8da17af5e138517356e9326d9b8c4eb
|
|
BLAKE2b-256 checksum How to use checksums |
976cb06ec2ad894a596598b31dfa366a6ec7f4a62be3397030fd787e98cd274b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp314-cp314-macosx_15_0_arm64.whl
| Download URL | mdpsolver-0.10.3-cp314-cp314-macosx_15_0_arm64.whl |
|---|---|
| Size | 368.0 kB |
| Tags | CPython 3.14 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3c7462b7b58fd98dbe234e5fc222edbce719af6ceed391e9ecaaeb679c9dab44
|
|
BLAKE2b-256 checksum How to use checksums |
597c806032751fc5f772777def8258d7ad2e626d72b561f30056e76c1d7a959b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp313-cp313-win_amd64.whl
| Download URL | mdpsolver-0.10.3-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 630.0 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
35a3653a31f1e103cd9968a861eb595ed7d1a2565441ade21b826d17d7f3a7e0
|
|
BLAKE2b-256 checksum How to use checksums |
c1b2facf195f20233723a9ae39314482df1c633880bd5c0ced8ee4603a90454f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 273.5 kB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
edba46dfcd04617e8de2a8dbd24bfcdc4cf68156bebd397005757a27b3388a61
|
|
BLAKE2b-256 checksum How to use checksums |
25643371e071ab658781f15286af1f506f6e716de2217a5664c450cb5f6dc5bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | mdpsolver-0.10.3-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 367.6 kB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0b438278ec39f50c73d1fdaf23b518ee6678d2879216202b32ea2350ebe86136
|
|
BLAKE2b-256 checksum How to use checksums |
cce8534d81aafe76a348d48430b31e53fcd3d911c444b090ea3eb2c30ad2b3a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp312-cp312-win_amd64.whl
| Download URL | mdpsolver-0.10.3-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 630.0 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a251d0131209fbf114cb0158ca83edafe4b13c3b3a0859eddd472ac18fd44998
|
|
BLAKE2b-256 checksum How to use checksums |
6f774c73fd545edeb85c82bea917c2d85be1c564b305f87c4e1be29bee33e5e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 273.5 kB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0dd31390c0eca58fd20ce8b7d89a9b718414015e3819fddde025190d33413a13
|
|
BLAKE2b-256 checksum How to use checksums |
7abd8db1be11e013dda5e7ff4e10154900855775bdd8f1606fd37930f74d871b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | mdpsolver-0.10.3-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 367.6 kB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
110af72dfbc855ba57f0ebd26ab73ee3442ac47e5f7c3ca0c69abaf209042752
|
|
BLAKE2b-256 checksum How to use checksums |
50653ed01aa428da27729a528ab9a2b725aaaaa9b081459cdd1523d039111fab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp311-cp311-win_amd64.whl
| Download URL | mdpsolver-0.10.3-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 627.2 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b81fc3580ffb1c84a3be73e4e031994cd03ec5a88afd437f56c57bda96cdedea
|
|
BLAKE2b-256 checksum How to use checksums |
cb7c7e256759760ae9944e7973c6c7d45281652fb94d67f94cf5ce4a9f037d98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 272.0 kB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
844ba167ab5d2e60ff963dd46782cf9020cc8782ac4cf8110a5f98ff29063bf3
|
|
BLAKE2b-256 checksum How to use checksums |
3fa8af5c173ada83260bcfa382a808ff29c3a800660d646a42eeb82e9d8673be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | mdpsolver-0.10.3-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 368.0 kB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d403d67648d70b733312b274303f0178ef8aefdae316848bf816512077f1d909
|
|
BLAKE2b-256 checksum How to use checksums |
0445ca81089288e085c06558e87b2d81e96d6e2a7acfe5f5cc8837302d884026
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp310-cp310-win_amd64.whl
| Download URL | mdpsolver-0.10.3-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 626.7 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c50a8de7cc58e8a22de02f1ff31487498ed370edaca2b481414dc4660ec584fa
|
|
BLAKE2b-256 checksum How to use checksums |
ff66c63ff0185529455f20cd0fdc780efbb403fe5d4a2fe5a458e49d0566b91d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdpsolver-0.10.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 270.7 kB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c2a8411784066140c06961d2ca8b958e3e5e5cc79f7d4a1bb45235252747d79d
|
|
BLAKE2b-256 checksum How to use checksums |
d24b11398a0586e06905f76590e394870cf261055580686d0d574731974184e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / mdpsolver-0.10.3-cp310-cp310-macosx_15_0_arm64.whl
| Download URL | mdpsolver-0.10.3-cp310-cp310-macosx_15_0_arm64.whl |
|---|---|
| Size | 366.9 kB |
| Tags | CPython 3.10 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a8f21ed3a1f2af4728619012c381b9b201525f6e87f17f3f27cd1d2d6663f7d9
|
|
BLAKE2b-256 checksum How to use checksums |
9f14e32facbdf33e06f60f1ecc886a33f996a931888764bb62c6f20a79bdbc7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logSecurity for mdpsolver 0.10.3
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.
Full provenance
All 16 files in this release have been uploaded with provenance metadata.
Attestation for mdpsolver-0.10.3.tar.gz
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 Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.