mdpsolver 0.9.2__tar.gz → 0.9.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {mdpsolver-0.9.2/src/mdpsolver.egg-info → mdpsolver-0.9.4}/PKG-INFO +9 -8
  2. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/README.md +131 -130
  3. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/pyproject.toml +2 -2
  4. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver/model.py +6 -2
  5. mdpsolver-0.9.4/src/mdpsolver/solvermodule.cp310-win_amd64.pyd +0 -0
  6. mdpsolver-0.9.4/src/mdpsolver/solvermodule.cp311-win_amd64.pyd +0 -0
  7. mdpsolver-0.9.4/src/mdpsolver/solvermodule.cp312-win_amd64.pyd +0 -0
  8. mdpsolver-0.9.4/src/mdpsolver/solvermodule.cpython-310-x86_64-linux-gnu.so +0 -0
  9. {mdpsolver-0.9.2 → mdpsolver-0.9.4/src/mdpsolver.egg-info}/PKG-INFO +9 -8
  10. mdpsolver-0.9.2/src/mdpsolver/solvermodule.cp310-win_amd64.pyd +0 -0
  11. mdpsolver-0.9.2/src/mdpsolver/solvermodule.cp311-win_amd64.pyd +0 -0
  12. mdpsolver-0.9.2/src/mdpsolver/solvermodule.cp312-win_amd64.pyd +0 -0
  13. mdpsolver-0.9.2/src/mdpsolver/solvermodule.cpython-310-x86_64-linux-gnu.so +0 -0
  14. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/LICENSE +0 -0
  15. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/MANIFEST.in +0 -0
  16. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/setup.cfg +0 -0
  17. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver/__init__.py +0 -0
  18. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver/problems/cbmaux.py +0 -0
  19. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver/problems/tbmaux.py +0 -0
  20. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver.egg-info/SOURCES.txt +0 -0
  21. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver.egg-info/dependency_links.txt +0 -0
  22. {mdpsolver-0.9.2 → mdpsolver-0.9.4}/src/mdpsolver.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdpsolver
3
- Version: 0.9.2
4
- Summary: An efficient solver for Markov Decision Processes
3
+ Version: 0.9.4
4
+ Summary: A fast solver for Markov Decision Processes
5
5
  Author-email: Anders Reenberg Andersen <andersra@live.dk>, Jesper Fink Andersen <jfan@dtu.dk>
6
6
  Project-URL: Homepage, https://github.com/areenberg/MDPSolver
7
7
  Project-URL: Issues, https://github.com/areenberg/MDPSolver/issues
@@ -13,15 +13,16 @@ Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
 
16
- # `mdpsolver`: An efficient solver for Markov Decision Processes
16
+ # `mdpsolver`: A fast solver for Markov Decision Processes
17
17
 
18
- `mdpsolver` is the Python package for deriving the policies of Markov Decision Processes (MDPs) with infinite-horizon and the expected total discounted reward optimality criterion.
18
+ `mdpsolver` is the Python package for Markov Decision Processes (MDPs) with discounted rewards and infinite-horizon.
19
19
 
20
20
  ## Features
21
21
 
22
+ * Fast solver-engine: Up-to **30x faster** than other Python-based solvers (see details in the documentation).
22
23
  * Available on PyPI.
23
- * Solver-engine developed in C++.
24
- * Available optimization algorithms: *Value iteration*, *Policy iteration*, and *Modified policy iteration*.
24
+ * Three optimization algorithms: *Value iteration*, *Policy iteration*, and *Modified policy iteration*.
25
+ * Three value-update methods: *Standard*, *Gauss–Seidel*, *Successive over-relaxation*.
25
26
  * Includes support for sparse matrices.
26
27
 
27
28
  # Quick start guide
@@ -137,9 +138,9 @@ mdl.mdp(discount=0.8,
137
138
  tranMatFromFile="transitions.csv")
138
139
  ```
139
140
 
140
- # User manual
141
+ # Documentation
141
142
 
142
- Further information can be found in the wiki for `mdpsolver` on Github.
143
+ Documentation can be found in the wiki for `mdpsolver` on Github.
143
144
 
144
145
  # How to cite
145
146
 
@@ -1,131 +1,132 @@
1
- # `mdpsolver`: An efficient solver for Markov Decision Processes
2
-
3
- `mdpsolver` is the Python package for deriving the policies of Markov Decision Processes (MDPs) with infinite-horizon and the expected total discounted reward optimality criterion.
4
-
5
- ## Features
6
-
7
- * Available on PyPI.
8
- * Solver-engine developed in C++.
9
- * Available optimization algorithms: *Value iteration*, *Policy iteration*, and *Modified policy iteration*.
10
- * Includes support for sparse matrices.
11
-
12
- # Quick start guide
13
-
14
- The following shows how to get quickly started with `mdpsolver`.
15
-
16
- ## Installation
17
-
18
- Download and install `mdpsolver` directly from PyPI.
19
-
20
- ```
21
- pip install mdpsolver
22
- ```
23
-
24
- ## Usage
25
-
26
- 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**.
27
-
28
- ```python
29
- #Import packages
30
- import mdpsolver
31
-
32
- #Rewards (3 states x 2 actions)
33
- #e.g. choosing second action in first state gives reward=-1
34
- rewards = [[5,-1],
35
- [1,-2],
36
- [50,0]]
37
-
38
- #Transition probabilities (3 from_states x 2 actions x 3 to_states)
39
- #e.g. choosing first action in third state gives a probability of 0.6 of staying in third state
40
- tranMatWithZeros = [[[0.9,0.1,0.0],[0.1,0.9,0.0]],
41
- [[0.4,0.5,0.1],[0.3,0.5,0.2]],
42
- [[0.2,0.2,0.6],[0.5,0.5,0.0]]]
43
- ```
44
-
45
- Now, create the model object and insert the problem parameters.
46
-
47
- ```python
48
- #Create model object
49
- mdl = mdpsolver.model()
50
-
51
- #Insert the problem parameters
52
- mdl.mdp(discount=0.8,
53
- rewards=rewards,
54
- tranMatWithZeros=tranMatWithZeros)
55
- ```
56
-
57
- We can now optimize the policy.
58
-
59
- ```python
60
- mdl.solve()
61
- ```
62
-
63
- 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.
64
-
65
- ```python
66
- print(mdl.getPolicy())
67
- #[1, 1, 0]
68
- ```
69
-
70
- ## Sparse transition matrix?
71
-
72
- `mdpsolver` has three alternative formats for large and highly sparse transition probability matrices.
73
-
74
- **(1) Elementwise representation (excluding elements containing zeros):**
75
-
76
- ```python
77
- #[from_state,action,to_state,probability]
78
- tranMatElementwise = [[0,0,0,0.9],
79
- [0,0,1,0.1],
80
- [0,1,0,0.1],
81
- [0,1,1,0.9],
82
- [1,0,0,0.4],
83
- [1,0,1,0.5],
84
- [1,0,2,0.1],
85
- [1,1,0,0.3],
86
- [1,1,1,0.5],
87
- [1,1,2,0.2],
88
- [2,0,0,0.2],
89
- [2,0,1,0.2],
90
- [2,0,2,0.6],
91
- [2,1,0,0.5],
92
- [2,1,1,0.5]]
93
-
94
- mdl.mdp(discount=0.8,
95
- rewards=rewards,
96
- tranMatElementwise=tranMatElementwise)
97
- ```
98
-
99
- **(2) Probabilities and column (to_state) indices in separate lists:**
100
-
101
- ```python
102
- tranMatProbs = [[[0.9,0.1],[0.1,0.9]],
103
- [[0.4,0.5,0.1],[0.3,0.5,0.2]],
104
- [[0.2,0.2,0.6],[0.5,0.5]]]
105
-
106
- tranMatColumns = [[[0,1],[0,1]],
107
- [[0,1,2],[0,1,2]],
108
- [[0,1,2],[0,1]]]
109
-
110
- mdl.mdp(discount=0.8,
111
- rewards=rewards,
112
- tranMatProbs=tranMatProbs,
113
- tranMatColumns=tranMatColumns)
114
-
115
- ```
116
-
117
- **(3) Load the elementwise representation from a file:**
118
-
119
- ```python
120
- mdl.mdp(discount=0.8,
121
- rewards=rewards,
122
- tranMatFromFile="transitions.csv")
123
- ```
124
-
125
- # User manual
126
-
127
- Further information can be found in the wiki for `mdpsolver` on Github.
128
-
129
- # How to cite
130
-
1
+ # `mdpsolver`: A fast solver for Markov Decision Processes
2
+
3
+ `mdpsolver` is the Python package for Markov Decision Processes (MDPs) with discounted rewards and infinite-horizon.
4
+
5
+ ## Features
6
+
7
+ * Fast solver-engine: Up-to **30x faster** than other Python-based solvers (see details in the documentation).
8
+ * Available on PyPI.
9
+ * Three optimization algorithms: *Value iteration*, *Policy iteration*, and *Modified policy iteration*.
10
+ * Three value-update methods: *Standard*, *Gauss–Seidel*, *Successive over-relaxation*.
11
+ * Includes support for sparse matrices.
12
+
13
+ # Quick start guide
14
+
15
+ The following shows how to get quickly started with `mdpsolver`.
16
+
17
+ ## Installation
18
+
19
+ Download and install `mdpsolver` directly from PyPI.
20
+
21
+ ```
22
+ pip install mdpsolver
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ 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**.
28
+
29
+ ```python
30
+ #Import packages
31
+ import mdpsolver
32
+
33
+ #Rewards (3 states x 2 actions)
34
+ #e.g. choosing second action in first state gives reward=-1
35
+ rewards = [[5,-1],
36
+ [1,-2],
37
+ [50,0]]
38
+
39
+ #Transition probabilities (3 from_states x 2 actions x 3 to_states)
40
+ #e.g. choosing first action in third state gives a probability of 0.6 of staying in third state
41
+ tranMatWithZeros = [[[0.9,0.1,0.0],[0.1,0.9,0.0]],
42
+ [[0.4,0.5,0.1],[0.3,0.5,0.2]],
43
+ [[0.2,0.2,0.6],[0.5,0.5,0.0]]]
44
+ ```
45
+
46
+ Now, create the model object and insert the problem parameters.
47
+
48
+ ```python
49
+ #Create model object
50
+ mdl = mdpsolver.model()
51
+
52
+ #Insert the problem parameters
53
+ mdl.mdp(discount=0.8,
54
+ rewards=rewards,
55
+ tranMatWithZeros=tranMatWithZeros)
56
+ ```
57
+
58
+ We can now optimize the policy.
59
+
60
+ ```python
61
+ mdl.solve()
62
+ ```
63
+
64
+ 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.
65
+
66
+ ```python
67
+ print(mdl.getPolicy())
68
+ #[1, 1, 0]
69
+ ```
70
+
71
+ ## Sparse transition matrix?
72
+
73
+ `mdpsolver` has three alternative formats for large and highly sparse transition probability matrices.
74
+
75
+ **(1) Elementwise representation (excluding elements containing zeros):**
76
+
77
+ ```python
78
+ #[from_state,action,to_state,probability]
79
+ tranMatElementwise = [[0,0,0,0.9],
80
+ [0,0,1,0.1],
81
+ [0,1,0,0.1],
82
+ [0,1,1,0.9],
83
+ [1,0,0,0.4],
84
+ [1,0,1,0.5],
85
+ [1,0,2,0.1],
86
+ [1,1,0,0.3],
87
+ [1,1,1,0.5],
88
+ [1,1,2,0.2],
89
+ [2,0,0,0.2],
90
+ [2,0,1,0.2],
91
+ [2,0,2,0.6],
92
+ [2,1,0,0.5],
93
+ [2,1,1,0.5]]
94
+
95
+ mdl.mdp(discount=0.8,
96
+ rewards=rewards,
97
+ tranMatElementwise=tranMatElementwise)
98
+ ```
99
+
100
+ **(2) Probabilities and column (to_state) indices in separate lists:**
101
+
102
+ ```python
103
+ tranMatProbs = [[[0.9,0.1],[0.1,0.9]],
104
+ [[0.4,0.5,0.1],[0.3,0.5,0.2]],
105
+ [[0.2,0.2,0.6],[0.5,0.5]]]
106
+
107
+ tranMatColumns = [[[0,1],[0,1]],
108
+ [[0,1,2],[0,1,2]],
109
+ [[0,1,2],[0,1]]]
110
+
111
+ mdl.mdp(discount=0.8,
112
+ rewards=rewards,
113
+ tranMatProbs=tranMatProbs,
114
+ tranMatColumns=tranMatColumns)
115
+
116
+ ```
117
+
118
+ **(3) Load the elementwise representation from a file:**
119
+
120
+ ```python
121
+ mdl.mdp(discount=0.8,
122
+ rewards=rewards,
123
+ tranMatFromFile="transitions.csv")
124
+ ```
125
+
126
+ # Documentation
127
+
128
+ Documentation can be found in the wiki for `mdpsolver` on Github.
129
+
130
+ # How to cite
131
+
131
132
  [![DOI](https://zenodo.org/badge/294063917.svg)](https://zenodo.org/badge/latestdoi/294063917)
@@ -10,12 +10,12 @@ where = ["src"]
10
10
 
11
11
  [project]
12
12
  name = "mdpsolver"
13
- version = "0.9.2"
13
+ version = "0.9.4"
14
14
  authors = [
15
15
  { name="Anders Reenberg Andersen", email="andersra@live.dk" },
16
16
  { name="Jesper Fink Andersen", email="jfan@dtu.dk" },
17
17
  ]
18
- description = "An efficient solver for Markov Decision Processes"
18
+ description = "A fast solver for Markov Decision Processes"
19
19
  readme = "README.md"
20
20
  requires-python = ">=3.10"
21
21
  classifiers = [
@@ -21,7 +21,9 @@ class model:
21
21
  SORrelaxation=1.0,
22
22
  initPolicy=list(),
23
23
  initValueVector=list(),
24
- verbose=False):
24
+ verbose=False,
25
+ postProcessing=True,
26
+ makeFinalCheck=True):
25
27
  #solves the problem employing the specified algorithm
26
28
  self.mdl.solve(algorithm=algorithm,
27
29
  tolerance=tolerance,
@@ -30,7 +32,9 @@ class model:
30
32
  SORrelaxation=SORrelaxation,
31
33
  initPolicy=initPolicy,
32
34
  initValueVector=initValueVector,
33
- verbose=verbose)
35
+ verbose=verbose,
36
+ postProcessing=postProcessing,
37
+ makeFinalCheck=makeFinalCheck)
34
38
 
35
39
  def getRuntime(self):
36
40
  #returns the runtime in milliseconds
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdpsolver
3
- Version: 0.9.2
4
- Summary: An efficient solver for Markov Decision Processes
3
+ Version: 0.9.4
4
+ Summary: A fast solver for Markov Decision Processes
5
5
  Author-email: Anders Reenberg Andersen <andersra@live.dk>, Jesper Fink Andersen <jfan@dtu.dk>
6
6
  Project-URL: Homepage, https://github.com/areenberg/MDPSolver
7
7
  Project-URL: Issues, https://github.com/areenberg/MDPSolver/issues
@@ -13,15 +13,16 @@ Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
 
16
- # `mdpsolver`: An efficient solver for Markov Decision Processes
16
+ # `mdpsolver`: A fast solver for Markov Decision Processes
17
17
 
18
- `mdpsolver` is the Python package for deriving the policies of Markov Decision Processes (MDPs) with infinite-horizon and the expected total discounted reward optimality criterion.
18
+ `mdpsolver` is the Python package for Markov Decision Processes (MDPs) with discounted rewards and infinite-horizon.
19
19
 
20
20
  ## Features
21
21
 
22
+ * Fast solver-engine: Up-to **30x faster** than other Python-based solvers (see details in the documentation).
22
23
  * Available on PyPI.
23
- * Solver-engine developed in C++.
24
- * Available optimization algorithms: *Value iteration*, *Policy iteration*, and *Modified policy iteration*.
24
+ * Three optimization algorithms: *Value iteration*, *Policy iteration*, and *Modified policy iteration*.
25
+ * Three value-update methods: *Standard*, *Gauss–Seidel*, *Successive over-relaxation*.
25
26
  * Includes support for sparse matrices.
26
27
 
27
28
  # Quick start guide
@@ -137,9 +138,9 @@ mdl.mdp(discount=0.8,
137
138
  tranMatFromFile="transitions.csv")
138
139
  ```
139
140
 
140
- # User manual
141
+ # Documentation
141
142
 
142
- Further information can be found in the wiki for `mdpsolver` on Github.
143
+ Documentation can be found in the wiki for `mdpsolver` on Github.
143
144
 
144
145
  # How to cite
145
146
 
File without changes
File without changes
File without changes