gymcts 1.0.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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.
- gymcts/colorful_console_utils.py +26 -3
- gymcts/{gymcts_deterministic_wrapper.py → gymcts_action_history_wrapper.py} +74 -4
- gymcts/gymcts_agent.py +29 -69
- gymcts/{gymcts_naive_wrapper.py → gymcts_deepcopy_wrapper.py} +60 -3
- gymcts/gymcts_distributed_agent.py +299 -0
- gymcts/gymcts_env_abc.py +61 -0
- gymcts/gymcts_node.py +107 -44
- gymcts/gymcts_tree_plotter.py +96 -0
- gymcts/logger.py +1 -4
- {gymcts-1.0.0.dist-info → gymcts-1.2.1.dist-info}/METADATA +54 -56
- gymcts-1.2.1.dist-info/RECORD +15 -0
- {gymcts-1.0.0.dist-info → gymcts-1.2.1.dist-info}/WHEEL +1 -1
- gymcts/gymcts_gym_env.py +0 -28
- gymcts-1.0.0.dist-info/RECORD +0 -13
- {gymcts-1.0.0.dist-info → gymcts-1.2.1.dist-info/licenses}/LICENSE +0 -0
- {gymcts-1.0.0.dist-info → gymcts-1.2.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
from typing import Any, Generator
|
|
2
|
+
|
|
3
|
+
from gymcts.gymcts_node import GymctsNode
|
|
4
|
+
|
|
5
|
+
from gymcts.logger import log
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _generate_mcts_tree(
|
|
9
|
+
start_node: GymctsNode = None,
|
|
10
|
+
prefix: str = None,
|
|
11
|
+
depth: int = None,
|
|
12
|
+
exclude_unvisited_nodes_from_render: bool = True,
|
|
13
|
+
action_space_n: int = None
|
|
14
|
+
) -> Generator[str, Any | None, None]:
|
|
15
|
+
"""
|
|
16
|
+
Generates a tree representation of the MCTS tree starting from the given node.
|
|
17
|
+
|
|
18
|
+
This is a recursive function that generates a tree representation of the MCTS tree starting from the given node. The
|
|
19
|
+
|
|
20
|
+
:param start_node: the node to start from
|
|
21
|
+
:param prefix: used to format the tree
|
|
22
|
+
:param depth: used to limit the depth of the tree
|
|
23
|
+
:param exclude_unvisited_nodes_from_render: used to exclude unvisited nodes from the render
|
|
24
|
+
:param action_space_n: the number of actions in the action space
|
|
25
|
+
:return: a list of strings representing the tree
|
|
26
|
+
"""
|
|
27
|
+
if prefix is None:
|
|
28
|
+
prefix = ""
|
|
29
|
+
import gymcts.colorful_console_utils as ccu
|
|
30
|
+
|
|
31
|
+
if start_node is None:
|
|
32
|
+
raise ValueError("start_node must not be None")
|
|
33
|
+
|
|
34
|
+
if action_space_n is None:
|
|
35
|
+
log.warning("action_space_n is None, defaulting to 100")
|
|
36
|
+
action_space_n = 100
|
|
37
|
+
|
|
38
|
+
# prefix components:
|
|
39
|
+
space = ' '
|
|
40
|
+
branch = '│ '
|
|
41
|
+
# pointers:
|
|
42
|
+
tee = '├── '
|
|
43
|
+
last = '└── '
|
|
44
|
+
|
|
45
|
+
contents = start_node.children.values() if start_node.children is not None else []
|
|
46
|
+
if exclude_unvisited_nodes_from_render:
|
|
47
|
+
contents = [node for node in contents if node.visit_count > 0]
|
|
48
|
+
# contents each get pointers that are ├── with a final └── :
|
|
49
|
+
# pointers = [tee] * (len(contents) - 1) + [last]
|
|
50
|
+
pointers = [tee for _ in range(len(contents) - 1)] + [last]
|
|
51
|
+
|
|
52
|
+
for pointer, current_node in zip(pointers, contents):
|
|
53
|
+
n_item = current_node.parent.action if current_node.parent is not None else 0
|
|
54
|
+
n_classes = action_space_n
|
|
55
|
+
|
|
56
|
+
pointer = ccu.wrap_evenly_spaced_color(
|
|
57
|
+
s=pointer,
|
|
58
|
+
n_of_item=n_item,
|
|
59
|
+
n_classes=n_classes,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
yield prefix + pointer + f"{current_node.__str__(colored=True, action_space_n=n_classes)}"
|
|
63
|
+
if current_node.children and len(current_node.children): # extend the prefix and recurse:
|
|
64
|
+
# extension = branch if pointer == tee else space
|
|
65
|
+
extension = branch if tee in pointer else space
|
|
66
|
+
# i.e. space because last, └── , above so no more |
|
|
67
|
+
extension = ccu.wrap_evenly_spaced_color(
|
|
68
|
+
s=extension,
|
|
69
|
+
n_of_item=n_item,
|
|
70
|
+
n_classes=n_classes,
|
|
71
|
+
)
|
|
72
|
+
if depth is not None and depth <= 0:
|
|
73
|
+
continue
|
|
74
|
+
yield from _generate_mcts_tree(
|
|
75
|
+
current_node,
|
|
76
|
+
prefix=prefix + extension,
|
|
77
|
+
action_space_n=action_space_n,
|
|
78
|
+
depth=depth - 1 if depth is not None else None
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def show_mcts_tree(
|
|
83
|
+
start_node: GymctsNode = None,
|
|
84
|
+
tree_max_depth: int = None,
|
|
85
|
+
action_space_n: int = None
|
|
86
|
+
) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Renders the MCTS tree starting from the given node.
|
|
89
|
+
|
|
90
|
+
:param start_node: the node to start from
|
|
91
|
+
:param tree_max_depth: the maximum depth of the tree to render
|
|
92
|
+
:param action_space_n: the number of actions in the action space
|
|
93
|
+
"""
|
|
94
|
+
print(start_node.__str__(colored=True, action_space_n=action_space_n))
|
|
95
|
+
for line in _generate_mcts_tree(start_node=start_node, depth=tree_max_depth):
|
|
96
|
+
print(line)
|
gymcts/logger.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: gymcts
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: A minimalistic implementation of the Monte Carlo Tree Search algorithm for planning problems fomulated as gymnaisum reinforcement learning environments.
|
|
5
5
|
Author: Alexander Nasuta
|
|
6
6
|
Author-email: Alexander Nasuta <alexander.nasuta@wzl-iqs.rwth-aachen.de>
|
|
@@ -25,7 +25,7 @@ License: MIT License
|
|
|
25
25
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
26
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
27
|
SOFTWARE.
|
|
28
|
-
Project-URL: Homepage, https://github.com/Alexander-Nasuta/
|
|
28
|
+
Project-URL: Homepage, https://github.com/Alexander-Nasuta/gymcts
|
|
29
29
|
Platform: unix
|
|
30
30
|
Platform: linux
|
|
31
31
|
Platform: osx
|
|
@@ -34,7 +34,7 @@ Platform: win32
|
|
|
34
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
35
35
|
Classifier: Programming Language :: Python
|
|
36
36
|
Classifier: Programming Language :: Python :: 3
|
|
37
|
-
Requires-Python: >=3.
|
|
37
|
+
Requires-Python: >=3.11
|
|
38
38
|
Description-Content-Type: text/markdown
|
|
39
39
|
License-File: LICENSE
|
|
40
40
|
Requires-Dist: rich
|
|
@@ -47,7 +47,7 @@ Requires-Dist: graph-matrix-jsp-env; extra == "examples"
|
|
|
47
47
|
Requires-Dist: graph-jsp-env; extra == "examples"
|
|
48
48
|
Provides-Extra: dev
|
|
49
49
|
Requires-Dist: jsp-instance-utils; extra == "dev"
|
|
50
|
-
Requires-Dist: graph-matrix-jsp-env; extra == "dev"
|
|
50
|
+
Requires-Dist: graph-matrix-jsp-env>=0.3.0; extra == "dev"
|
|
51
51
|
Requires-Dist: graph-jsp-env; extra == "dev"
|
|
52
52
|
Requires-Dist: JSSEnv; extra == "dev"
|
|
53
53
|
Requires-Dist: pip-tools; extra == "dev"
|
|
@@ -59,18 +59,24 @@ Requires-Dist: stable_baselines3; extra == "dev"
|
|
|
59
59
|
Requires-Dist: sphinx; extra == "dev"
|
|
60
60
|
Requires-Dist: myst-parser; extra == "dev"
|
|
61
61
|
Requires-Dist: sphinx-autobuild; extra == "dev"
|
|
62
|
+
Requires-Dist: sphinx-copybutton; extra == "dev"
|
|
62
63
|
Requires-Dist: furo; extra == "dev"
|
|
63
64
|
Requires-Dist: twine; extra == "dev"
|
|
64
65
|
Requires-Dist: sphinx-copybutton; extra == "dev"
|
|
65
66
|
Requires-Dist: nbsphinx; extra == "dev"
|
|
67
|
+
Requires-Dist: pandoc; extra == "dev"
|
|
68
|
+
Requires-Dist: jupytext; extra == "dev"
|
|
69
|
+
Requires-Dist: jupyter; extra == "dev"
|
|
70
|
+
Requires-Dist: typing_extensions>=4.12.0; extra == "dev"
|
|
71
|
+
Dynamic: license-file
|
|
66
72
|
|
|
67
73
|
# Graph Matrix Job Shop Env
|
|
68
74
|
|
|
69
75
|
A Monte Carlo Tree Search Implementation for Gymnasium-style Environments.
|
|
70
76
|
|
|
71
|
-
- Github: [GYMCTS on Github](https://github.com/Alexander-Nasuta/
|
|
72
|
-
- Pypi: [GYMCTS on PyPi](https://pypi.org/project/
|
|
73
|
-
- Documentation: [GYMCTS Docs](https://
|
|
77
|
+
- Github: [GYMCTS on Github](https://github.com/Alexander-Nasuta/gymcts)
|
|
78
|
+
- Pypi: [GYMCTS on PyPi](https://pypi.org/project/gymcts/)
|
|
79
|
+
- Documentation: [GYMCTS Docs](https://gymcts.readthedocs.io/en/latest/)
|
|
74
80
|
|
|
75
81
|
## Description
|
|
76
82
|
|
|
@@ -98,28 +104,32 @@ The usage of a MCTS agent can roughly organised into the following steps:
|
|
|
98
104
|
- Render the solution
|
|
99
105
|
|
|
100
106
|
The GYMCTS package provides a two types of wrappers for Gymnasium-style environments:
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
107
|
+
- `DeepCopyMCTSGymEnvWrapper`: A wrapper that uses deepcopies of the environment to save a snapshot of the environment state for each node in the MCTS tree.
|
|
108
|
+
- `ActionHistoryMCTSGymEnvWrapper`: A wrapper that saves the action sequence that lead to the current state in the MCTS node.
|
|
103
109
|
|
|
104
|
-
These wrappers can be used with the `
|
|
105
|
-
The wrapper implement methods that are required by the `
|
|
110
|
+
These wrappers can be used with the `GymctsAgent` to solve the environment.
|
|
111
|
+
The wrapper implement methods that are required by the `GymctsAgent` to interact with the environment.
|
|
106
112
|
GYMCTS is designed to use a single environment instance and reconstructing the environment state form a state snapshot, when needed.
|
|
107
113
|
|
|
108
114
|
NOTE: MCTS works best when the return of an episode is in the range of [-1, 1]. Please adjust the reward function of the environment accordingly (or change the ubc-scaling parameter of the MCTS agent).
|
|
109
115
|
Adjusting the reward function of the environment is easily done with a [NormalizeReward](https://gymnasium.farama.org/api/wrappers/reward_wrappers/#gymnasium.wrappers.NormalizeReward) or [TransformReward](https://gymnasium.farama.org/api/wrappers/reward_wrappers/#gymnasium.wrappers.TransformReward) Wrapper.
|
|
116
|
+
```python
|
|
117
|
+
env = NormalizeReward(env, gamma=0.99, epsilon=1e-8)
|
|
118
|
+
```
|
|
110
119
|
|
|
111
|
-
|
|
112
|
-
env = TransformReward(env, lambda r: r /
|
|
113
|
-
|
|
120
|
+
```python
|
|
121
|
+
env = TransformReward(env, lambda r: r / n_steps_per_episode)
|
|
122
|
+
```
|
|
123
|
+
### FrozenLake Example (DeepCopyMCTSGymEnvWrapper)
|
|
114
124
|
|
|
115
125
|
A minimal example of how to use the package with the FrozenLake environment and the NaiveSoloMCTSGymEnvWrapper is provided in the following code snippet below.
|
|
116
|
-
The
|
|
126
|
+
The DeepCopyMCTSGymEnvWrapper can be used with non-deterministic environments, such as the FrozenLake environment with slippery ice.
|
|
117
127
|
|
|
118
128
|
```python
|
|
119
129
|
import gymnasium as gym
|
|
120
130
|
|
|
121
|
-
from gymcts.gymcts_agent import
|
|
122
|
-
from gymcts.
|
|
131
|
+
from gymcts.gymcts_agent import GymctsAgent
|
|
132
|
+
from gymcts.gymcts_deepcopy_wrapper import DeepCopyMCTSGymEnvWrapper
|
|
123
133
|
|
|
124
134
|
from gymcts.logger import log
|
|
125
135
|
|
|
@@ -132,11 +142,11 @@ if __name__ == '__main__':
|
|
|
132
142
|
env = gym.make('FrozenLake-v1', desc=None, map_name="4x4", is_slippery=True, render_mode="ansi")
|
|
133
143
|
env.reset()
|
|
134
144
|
|
|
135
|
-
# 1. wrap the environment with the
|
|
136
|
-
env =
|
|
145
|
+
# 1. wrap the environment with the deep copy wrapper or a custom gymcts wrapper
|
|
146
|
+
env = DeepCopyMCTSGymEnvWrapper(env)
|
|
137
147
|
|
|
138
148
|
# 2. create the agent
|
|
139
|
-
agent =
|
|
149
|
+
agent = GymctsAgent(
|
|
140
150
|
env=env,
|
|
141
151
|
clear_mcts_tree_after_step=False,
|
|
142
152
|
render_tree_after_step=True,
|
|
@@ -155,7 +165,7 @@ if __name__ == '__main__':
|
|
|
155
165
|
|
|
156
166
|
# 5. print the solution
|
|
157
167
|
# read the solution from the info provided by the RecordEpisodeStatistics wrapper
|
|
158
|
-
# (that
|
|
168
|
+
# (that DeepCopyMCTSGymEnvWrapper uses internally)
|
|
159
169
|
episode_length = info["episode"]["l"]
|
|
160
170
|
episode_return = info["episode"]["r"]
|
|
161
171
|
|
|
@@ -170,13 +180,13 @@ if __name__ == '__main__':
|
|
|
170
180
|
A minimal example of how to use the package with the FrozenLake environment and the DeterministicSoloMCTSGymEnvWrapper is provided in the following code snippet below.
|
|
171
181
|
The DeterministicSoloMCTSGymEnvWrapper can be used with deterministic environments, such as the FrozenLake environment without slippery ice.
|
|
172
182
|
|
|
173
|
-
The DeterministicSoloMCTSGymEnvWrapper saves the action sequence that lead to the current state in the MCTS node.
|
|
183
|
+
The DeterministicSoloMCTSGymEnvWrapper saves the action sequence that lead to the current state in the MCTS node.
|
|
174
184
|
|
|
175
185
|
```python
|
|
176
186
|
import gymnasium as gym
|
|
177
187
|
|
|
178
|
-
from gymcts.gymcts_agent import
|
|
179
|
-
from gymcts.
|
|
188
|
+
from gymcts.gymcts_agent import GymctsAgent
|
|
189
|
+
from gymcts.gymcts_action_history_wrapper import ActionHistoryMCTSGymEnvWrapper
|
|
180
190
|
|
|
181
191
|
from gymcts.logger import log
|
|
182
192
|
|
|
@@ -190,10 +200,10 @@ if __name__ == '__main__':
|
|
|
190
200
|
env.reset()
|
|
191
201
|
|
|
192
202
|
# 1. wrap the environment with the wrapper
|
|
193
|
-
env =
|
|
203
|
+
env = ActionHistoryMCTSGymEnvWrapper(env)
|
|
194
204
|
|
|
195
205
|
# 2. create the agent
|
|
196
|
-
agent =
|
|
206
|
+
agent = GymctsAgent(
|
|
197
207
|
env=env,
|
|
198
208
|
clear_mcts_tree_after_step=False,
|
|
199
209
|
render_tree_after_step=True,
|
|
@@ -232,8 +242,8 @@ To create a video of the solution of the FrozenLake environment, you can use the
|
|
|
232
242
|
```python
|
|
233
243
|
import gymnasium as gym
|
|
234
244
|
|
|
235
|
-
from gymcts.gymcts_agent import
|
|
236
|
-
from gymcts.
|
|
245
|
+
from gymcts.gymcts_agent import GymctsAgent
|
|
246
|
+
from gymcts.gymcts_deepcopy_wrapper import DeepCopyMCTSGymEnvWrapper
|
|
237
247
|
|
|
238
248
|
from gymcts.logger import log
|
|
239
249
|
|
|
@@ -248,11 +258,11 @@ if __name__ == '__main__':
|
|
|
248
258
|
env = gym.make('FrozenLake-v1', desc=None, map_name="4x4", is_slippery=False, render_mode="rgb_array")
|
|
249
259
|
env.reset()
|
|
250
260
|
|
|
251
|
-
# 1. wrap the environment with the
|
|
252
|
-
env =
|
|
261
|
+
# 1. wrap the environment with the deep copy wrapper or a custom gymcts wrapper
|
|
262
|
+
env = DeepCopyMCTSGymEnvWrapper(env)
|
|
253
263
|
|
|
254
264
|
# 2. create the agent
|
|
255
|
-
agent =
|
|
265
|
+
agent = GymctsAgent(
|
|
256
266
|
env=env,
|
|
257
267
|
clear_mcts_tree_after_step=False,
|
|
258
268
|
render_tree_after_step=True,
|
|
@@ -277,7 +287,7 @@ if __name__ == '__main__':
|
|
|
277
287
|
env.close()
|
|
278
288
|
|
|
279
289
|
# 5. print the solution
|
|
280
|
-
# read the solution from the info provided by the RecordEpisodeStatistics wrapper (that
|
|
290
|
+
# read the solution from the info provided by the RecordEpisodeStatistics wrapper (that DeepCopyMCTSGymEnvWrapper wraps internally)
|
|
281
291
|
episode_length = info["episode"]["l"]
|
|
282
292
|
episode_return = info["episode"]["r"]
|
|
283
293
|
|
|
@@ -318,13 +328,13 @@ import gymnasium as gym
|
|
|
318
328
|
from graph_jsp_env.disjunctive_graph_jsp_env import DisjunctiveGraphJspEnv
|
|
319
329
|
from jsp_instance_utils.instances import ft06, ft06_makespan
|
|
320
330
|
|
|
321
|
-
from gymcts.gymcts_agent import
|
|
322
|
-
from gymcts.
|
|
331
|
+
from gymcts.gymcts_agent import GymctsAgent
|
|
332
|
+
from gymcts.gymcts_env_abc import GymctsABC
|
|
323
333
|
|
|
324
334
|
from gymcts.logger import log
|
|
325
335
|
|
|
326
336
|
|
|
327
|
-
class GraphJspGYMCTSWrapper(
|
|
337
|
+
class GraphJspGYMCTSWrapper(GymctsABC, gym.Wrapper):
|
|
328
338
|
|
|
329
339
|
def __init__(self, env: DisjunctiveGraphJspEnv):
|
|
330
340
|
gym.Wrapper.__init__(self, env)
|
|
@@ -375,7 +385,7 @@ if __name__ == '__main__':
|
|
|
375
385
|
|
|
376
386
|
env = GraphJspGYMCTSWrapper(env)
|
|
377
387
|
|
|
378
|
-
agent =
|
|
388
|
+
agent = GymctsAgent(
|
|
379
389
|
env=env,
|
|
380
390
|
clear_mcts_tree_after_step=True,
|
|
381
391
|
render_tree_after_step=True,
|
|
@@ -413,13 +423,11 @@ The color gradient is based on the minimum and maximum values of the respective
|
|
|
413
423
|
The visualisation is rendered in the terminal and can be limited to a certain depth of the tree.
|
|
414
424
|
The default depth is 2.
|
|
415
425
|
|
|
416
|
-
|
|
417
426
|
```python
|
|
418
427
|
import gymnasium as gym
|
|
419
428
|
|
|
420
|
-
from gymcts.gymcts_agent import
|
|
421
|
-
from gymcts.
|
|
422
|
-
from gymcts.gymcts_naive_wrapper import NaiveSoloMCTSGymEnvWrapper
|
|
429
|
+
from gymcts.gymcts_agent import GymctsAgent
|
|
430
|
+
from gymcts.gymcts_action_history_wrapper import ActionHistoryMCTSGymEnvWrapper
|
|
423
431
|
|
|
424
432
|
from gymcts.logger import log
|
|
425
433
|
|
|
@@ -432,11 +440,11 @@ if __name__ == '__main__':
|
|
|
432
440
|
env = gym.make('FrozenLake-v1', desc=None, map_name="4x4", is_slippery=False, render_mode="ansi")
|
|
433
441
|
env.reset()
|
|
434
442
|
|
|
435
|
-
# wrap the environment with the
|
|
436
|
-
env =
|
|
443
|
+
# wrap the environment with the wrapper or a custom gymcts wrapper
|
|
444
|
+
env = ActionHistoryMCTSGymEnvWrapper(env)
|
|
437
445
|
|
|
438
446
|
# create the agent
|
|
439
|
-
agent =
|
|
447
|
+
agent = GymctsAgent(
|
|
440
448
|
env=env,
|
|
441
449
|
clear_mcts_tree_after_step=False,
|
|
442
450
|
render_tree_after_step=False,
|
|
@@ -503,11 +511,11 @@ clone the repository in your favorite code editor (for example PyCharm, VSCode,
|
|
|
503
511
|
|
|
504
512
|
using https:
|
|
505
513
|
```shell
|
|
506
|
-
git clone https://github.com/Alexander-Nasuta/
|
|
514
|
+
git clone https://github.com/Alexander-Nasuta/gymcts.git
|
|
507
515
|
```
|
|
508
516
|
or by using the GitHub CLI:
|
|
509
517
|
```shell
|
|
510
|
-
gh repo clone Alexander-Nasuta/
|
|
518
|
+
gh repo clone Alexander-Nasuta/gymcts
|
|
511
519
|
```
|
|
512
520
|
|
|
513
521
|
if you are using PyCharm, I recommend doing the following additional steps:
|
|
@@ -516,9 +524,6 @@ if you are using PyCharm, I recommend doing the following additional steps:
|
|
|
516
524
|
- mark the `tests` folder as test root (by right-clicking on the folder and selecting `Mark Directory as` -> `Test Sources Root`)
|
|
517
525
|
- mark the `resources` folder as resources root (by right-clicking on the folder and selecting `Mark Directory as` -> `Resources Root`)
|
|
518
526
|
|
|
519
|
-
at the end your project structure should look like this:
|
|
520
|
-
|
|
521
|
-
todo
|
|
522
527
|
|
|
523
528
|
### Create a Virtual Environment (optional)
|
|
524
529
|
|
|
@@ -584,12 +589,6 @@ For testing with `tox` run the following command:
|
|
|
584
589
|
tox
|
|
585
590
|
```
|
|
586
591
|
|
|
587
|
-
Here is a screenshot of what the output might look like:
|
|
588
|
-
|
|
589
|
-

|
|
590
|
-
|
|
591
|
-
Tox will run the tests in a separate environment and will also check if the requirements are installed correctly.
|
|
592
|
-
|
|
593
592
|
### Builing and Publishing the Project to PyPi
|
|
594
593
|
|
|
595
594
|
In order to publish the project to PyPi, the project needs to be built and then uploaded to PyPi.
|
|
@@ -628,7 +627,6 @@ sphinx-autobuild ./docs/source/ ./docs/build/html/
|
|
|
628
627
|
This project features most of the extensions featured in this Tutorial: [Document Your Scientific Project With Markdown, Sphinx, and Read the Docs | PyData Global 2021](https://www.youtube.com/watch?v=qRSb299awB0).
|
|
629
628
|
|
|
630
629
|
|
|
631
|
-
|
|
632
630
|
## Contact
|
|
633
631
|
|
|
634
632
|
If you have any questions or feedback, feel free to contact me via [email](mailto:alexander.nasuta@wzl-iqs.rwth-aachen.de) or open an issue on repository.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
gymcts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
gymcts/colorful_console_utils.py,sha256=n7nymC8kKZnA_8nXcdn201NAzjZjgEHfKpbBcnl4oAE,5891
|
|
3
|
+
gymcts/gymcts_action_history_wrapper.py,sha256=7-p17Fgb80SRCBaCm6G8SJrEPsl2Y4aIO3InviuQP08,6993
|
|
4
|
+
gymcts/gymcts_agent.py,sha256=f2imP-Wv-E7EYE0-iWd86hY9cx-rqHZMlDusp-aE-ps,8698
|
|
5
|
+
gymcts/gymcts_deepcopy_wrapper.py,sha256=lCCT5-6JVCwUCP__4uPMMkT5HnO2JWm2ebzJ69zXp9c,6792
|
|
6
|
+
gymcts/gymcts_distributed_agent.py,sha256=Ha9UBQvFjoErfMWvPyN0JcTYz-JaiJ4eWjLMikp9Yhs,11569
|
|
7
|
+
gymcts/gymcts_env_abc.py,sha256=U1mPz0NWZZL1sdHX7oUP1UFKtmbHwyqHQOQidyh_Uck,2107
|
|
8
|
+
gymcts/gymcts_node.py,sha256=pxjY2Zb0kPuFQ5mWEs0ct3qXoyB47NZK7h2ZGbLJbRA,11052
|
|
9
|
+
gymcts/gymcts_tree_plotter.py,sha256=PR6C7q9Q4kuz1aLGyD7-aZsxk3RqlHZpOqmOiRpCyK0,3547
|
|
10
|
+
gymcts/logger.py,sha256=RI7B9cvbBGrj0_QIAI77wihzuu2tPG_-z9GM2Mw5aHE,926
|
|
11
|
+
gymcts-1.2.1.dist-info/licenses/LICENSE,sha256=UGe75WojDiw_77SEnK2aysEDlElRlkWie7U7NaAFx00,1072
|
|
12
|
+
gymcts-1.2.1.dist-info/METADATA,sha256=wUJEcWrAvdC42kl59qewCN5tK3DKMLxGWcCipnOX4pQ,23371
|
|
13
|
+
gymcts-1.2.1.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
14
|
+
gymcts-1.2.1.dist-info/top_level.txt,sha256=E8MoLsPimUPD0H1Y6lum4TVe-lhSDAyBAXGrkYIT52w,7
|
|
15
|
+
gymcts-1.2.1.dist-info/RECORD,,
|
gymcts/gymcts_gym_env.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
from typing import TypeVar, Any, SupportsFloat, Callable
|
|
2
|
-
from abc import ABC, abstractmethod
|
|
3
|
-
import gymnasium as gym
|
|
4
|
-
|
|
5
|
-
TSoloMCTSNode = TypeVar("TSoloMCTSNode", bound="SoloMCTSNode")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class SoloMCTSGymEnv(ABC, gym.Env):
|
|
9
|
-
|
|
10
|
-
@abstractmethod
|
|
11
|
-
def get_state(self) -> Any:
|
|
12
|
-
pass
|
|
13
|
-
|
|
14
|
-
@abstractmethod
|
|
15
|
-
def load_state(self, state: Any) -> None:
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
@abstractmethod
|
|
19
|
-
def is_terminal(self) -> bool:
|
|
20
|
-
pass
|
|
21
|
-
|
|
22
|
-
@abstractmethod
|
|
23
|
-
def get_valid_actions(self) -> list[int]:
|
|
24
|
-
pass
|
|
25
|
-
|
|
26
|
-
@abstractmethod
|
|
27
|
-
def rollout(self) -> float:
|
|
28
|
-
pass
|
gymcts-1.0.0.dist-info/RECORD
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
gymcts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
gymcts/colorful_console_utils.py,sha256=bbZzRFzimhsIhbT-nmz6v62WJLxFDgzFvqI_pmIsckE,4526
|
|
3
|
-
gymcts/gymcts_agent.py,sha256=TJXJH77T95EP3ZNtzWqlGw9iFF1R-nsItp7UA1ZlXUs,10537
|
|
4
|
-
gymcts/gymcts_deterministic_wrapper.py,sha256=PILGPaQnyG2u_2u48MEE3aeJCtdgjjO55ZFDxeIVeH0,3824
|
|
5
|
-
gymcts/gymcts_gym_env.py,sha256=R1Z1fhoywdXmPt_FYgrarIh0YFQvCifayAWnCcEiJKE,580
|
|
6
|
-
gymcts/gymcts_naive_wrapper.py,sha256=qeQ7rzBz7BFv2yCJj3GmdFt5UlTx5VHMw5ImZUl9H5k,4178
|
|
7
|
-
gymcts/gymcts_node.py,sha256=jxdtuC1iqeRtEA-Qfvq-mOuM8vdDl43iWe5hqItG90w,7185
|
|
8
|
-
gymcts/logger.py,sha256=nAkUa4djiuCR7hF0EUsplhqFHCp76QcOX1cV3lIPzOI,937
|
|
9
|
-
gymcts-1.0.0.dist-info/LICENSE,sha256=UGe75WojDiw_77SEnK2aysEDlElRlkWie7U7NaAFx00,1072
|
|
10
|
-
gymcts-1.0.0.dist-info/METADATA,sha256=sAXJQreADqEOviVL8nT8fmrx7hP-qM7C_-SC5FNw-94,23572
|
|
11
|
-
gymcts-1.0.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
12
|
-
gymcts-1.0.0.dist-info/top_level.txt,sha256=E8MoLsPimUPD0H1Y6lum4TVe-lhSDAyBAXGrkYIT52w,7
|
|
13
|
-
gymcts-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|