MASA-Safe-RL 0.1.0__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.
- masa_safe_rl-0.1.0/LICENSE +201 -0
- masa_safe_rl-0.1.0/MASA_Safe_RL.egg-info/PKG-INFO +151 -0
- masa_safe_rl-0.1.0/MASA_Safe_RL.egg-info/SOURCES.txt +128 -0
- masa_safe_rl-0.1.0/MASA_Safe_RL.egg-info/dependency_links.txt +1 -0
- masa_safe_rl-0.1.0/MASA_Safe_RL.egg-info/entry_points.txt +2 -0
- masa_safe_rl-0.1.0/MASA_Safe_RL.egg-info/requires.txt +20 -0
- masa_safe_rl-0.1.0/MASA_Safe_RL.egg-info/top_level.txt +1 -0
- masa_safe_rl-0.1.0/PKG-INFO +151 -0
- masa_safe_rl-0.1.0/README.md +119 -0
- masa_safe_rl-0.1.0/masa/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/algorithms/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/algorithms/a2c/__init__.py +1 -0
- masa_safe_rl-0.1.0/masa/algorithms/a2c/a2c.py +163 -0
- masa_safe_rl-0.1.0/masa/algorithms/ppo/__init__.py +1 -0
- masa_safe_rl-0.1.0/masa/algorithms/ppo/ppo.py +197 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/__init__.py +6 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/base.py +37 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/lcrl.py +81 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/q_learning.py +207 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/q_learning_lambda.py +84 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/recovery_rl.py +227 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/recreg.py +559 -0
- masa_safe_rl-0.1.0/masa/algorithms/tabular/sem.py +150 -0
- masa_safe_rl-0.1.0/masa/cli/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/cli/cli_app.py +262 -0
- masa_safe_rl-0.1.0/masa/common/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/common/base_class.py +241 -0
- masa_safe_rl-0.1.0/masa/common/buffers.py +139 -0
- masa_safe_rl-0.1.0/masa/common/configs.py +516 -0
- masa_safe_rl-0.1.0/masa/common/constraints/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/common/constraints/base.py +275 -0
- masa_safe_rl-0.1.0/masa/common/constraints/cmdp.py +133 -0
- masa_safe_rl-0.1.0/masa/common/constraints/ltl_safety.py +648 -0
- masa_safe_rl-0.1.0/masa/common/constraints/multi_agent/__init__.py +3 -0
- masa_safe_rl-0.1.0/masa/common/constraints/multi_agent/cmg.py +257 -0
- masa_safe_rl-0.1.0/masa/common/constraints/pctl.py +112 -0
- masa_safe_rl-0.1.0/masa/common/constraints/prob.py +131 -0
- masa_safe_rl-0.1.0/masa/common/constraints/reach_avoid.py +132 -0
- masa_safe_rl-0.1.0/masa/common/dummy.py +6 -0
- masa_safe_rl-0.1.0/masa/common/label_fn.py +16 -0
- masa_safe_rl-0.1.0/masa/common/labelled_env.py +118 -0
- masa_safe_rl-0.1.0/masa/common/labelled_pz_env.py +67 -0
- masa_safe_rl-0.1.0/masa/common/layers.py +42 -0
- masa_safe_rl-0.1.0/masa/common/ltl.py +572 -0
- masa_safe_rl-0.1.0/masa/common/metrics.py +934 -0
- masa_safe_rl-0.1.0/masa/common/on_policy_algorithm.py +314 -0
- masa_safe_rl-0.1.0/masa/common/pctl.py +1774 -0
- masa_safe_rl-0.1.0/masa/common/pettingzoo_record_video.py +353 -0
- masa_safe_rl-0.1.0/masa/common/policies.py +286 -0
- masa_safe_rl-0.1.0/masa/common/registry.py +38 -0
- masa_safe_rl-0.1.0/masa/common/running_mean_std.py +40 -0
- masa_safe_rl-0.1.0/masa/common/schedule.py +28 -0
- masa_safe_rl-0.1.0/masa/common/utils.py +227 -0
- masa_safe_rl-0.1.0/masa/common/wrappers.py +1480 -0
- masa_safe_rl-0.1.0/masa/configs/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/configs/algorithms/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/configs/envs/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/envs/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/envs/continuous/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/envs/continuous/base.py +8 -0
- masa_safe_rl-0.1.0/masa/envs/continuous/cartpole.py +145 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/base.py +8 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/cartpole.py +146 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/conveyor_belt.py +333 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/island_navigation.py +291 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/mini_pacman_with_coins.py +208 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/pacman_with_coins.py +217 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/renderers/__init__.py +2 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/renderers/cartpole.py +295 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/renderers/pacman.py +92 -0
- masa_safe_rl-0.1.0/masa/envs/discrete/sokoban.py +320 -0
- masa_safe_rl-0.1.0/masa/envs/multiagent/matrix/_label_utils.py +22 -0
- masa_safe_rl-0.1.0/masa/envs/multiagent/matrix/bertrand.py +402 -0
- masa_safe_rl-0.1.0/masa/envs/multiagent/matrix/chicken.py +403 -0
- masa_safe_rl-0.1.0/masa/envs/multiagent/matrix/congestion.py +496 -0
- masa_safe_rl-0.1.0/masa/envs/multiagent/matrix/dpgg.py +448 -0
- masa_safe_rl-0.1.0/masa/envs/multiagent/matrix/inspection.py +401 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/base.py +36 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/bridge_crossing.py +107 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/bridge_crossing_v2.py +107 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/colour_bomb_grid_world.py +121 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/colour_bomb_grid_world_v2.py +142 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/colour_bomb_grid_world_v3.py +168 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/colour_grid_world.py +106 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/media_streaming.py +115 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/mini_pacman.py +161 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/pacman.py +170 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/renderers/__init__.py +2 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/renderers/bridge_crossing.py +277 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/renderers/colour_bomb_grid_world.py +407 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/renderers/colour_grid_world.py +300 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/renderers/media_streaming.py +282 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/renderers/pacman.py +489 -0
- masa_safe_rl-0.1.0/masa/envs/tabular/utils.py +414 -0
- masa_safe_rl-0.1.0/masa/examples/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/examples/colour_bomb_grid_world/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/examples/colour_bomb_grid_world/property_1.py +23 -0
- masa_safe_rl-0.1.0/masa/examples/colour_bomb_grid_world/property_2.py +30 -0
- masa_safe_rl-0.1.0/masa/examples/colour_bomb_grid_world/property_3.py +89 -0
- masa_safe_rl-0.1.0/masa/examples/norm_obs_example.py +116 -0
- masa_safe_rl-0.1.0/masa/examples/prob_shield_cont_example.py +100 -0
- masa_safe_rl-0.1.0/masa/examples/prob_shield_cont_ltl_example.py +144 -0
- masa_safe_rl-0.1.0/masa/examples/prob_shield_example.py +107 -0
- masa_safe_rl-0.1.0/masa/examples/prob_shield_ltl_example.py +105 -0
- masa_safe_rl-0.1.0/masa/examples/prob_shield_safety_abstraction_example.py +109 -0
- masa_safe_rl-0.1.0/masa/examples/prob_shield_vec_ltl_example.py +142 -0
- masa_safe_rl-0.1.0/masa/examples/reward_shaping_example.py +103 -0
- masa_safe_rl-0.1.0/masa/plugins/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/plugins/helpers.py +12 -0
- masa_safe_rl-0.1.0/masa/plugins/supported.py +52 -0
- masa_safe_rl-0.1.0/masa/prob_shield/__init__.py +0 -0
- masa_safe_rl-0.1.0/masa/prob_shield/eventual_discounted_vi.py +105 -0
- masa_safe_rl-0.1.0/masa/prob_shield/helpers.py +177 -0
- masa_safe_rl-0.1.0/masa/prob_shield/interval_bound_vi.py +127 -0
- masa_safe_rl-0.1.0/masa/prob_shield/parameterized_policy.py +418 -0
- masa_safe_rl-0.1.0/masa/prob_shield/parameterized_policy_v2.py +424 -0
- masa_safe_rl-0.1.0/masa/prob_shield/parameterized_ppo.py +381 -0
- masa_safe_rl-0.1.0/masa/prob_shield/parameterized_ppo_v2.py +267 -0
- masa_safe_rl-0.1.0/masa/prob_shield/prob_shield_wrapper_v1.py +487 -0
- masa_safe_rl-0.1.0/masa/prob_shield/prob_shield_wrapper_v2.py +443 -0
- masa_safe_rl-0.1.0/masa/run.py +122 -0
- masa_safe_rl-0.1.0/pyproject.toml +65 -0
- masa_safe_rl-0.1.0/setup.cfg +4 -0
- masa_safe_rl-0.1.0/tests/test_cmg.py +113 -0
- masa_safe_rl-0.1.0/tests/test_reach_avoid.py +56 -0
- masa_safe_rl-0.1.0/tests/test_record_video.py +184 -0
- masa_safe_rl-0.1.0/tests/test_sample.py +481 -0
- masa_safe_rl-0.1.0/tests/test_tutorial_notebooks.py +427 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MASA-Safe-RL
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A safe reinforcement library for providing a common interface for different constraints and environments
|
|
5
|
+
Project-URL: Homepage, https://github.com/sacktock/MASA-Safe-RL
|
|
6
|
+
Project-URL: Repository, https://github.com/sacktock/MASA-Safe-RL
|
|
7
|
+
Project-URL: Documentation, https://sacktock.github.io/MASA-Safe-RL/
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: gymnasium>=1.3.0
|
|
12
|
+
Requires-Dist: pettingzoo>=1.26.1
|
|
13
|
+
Requires-Dist: tensorflow>=2.20.0
|
|
14
|
+
Requires-Dist: tensorflow-probability==0.25.0
|
|
15
|
+
Requires-Dist: tensorstore>=0.1.65
|
|
16
|
+
Requires-Dist: tf-keras>=2.17.0
|
|
17
|
+
Requires-Dist: numpy>=1.26.4
|
|
18
|
+
Requires-Dist: tensorboard>=2.17.1
|
|
19
|
+
Requires-Dist: tqdm>=4.66.5
|
|
20
|
+
Requires-Dist: jax>=0.4.30
|
|
21
|
+
Requires-Dist: optax>=0.1.9
|
|
22
|
+
Requires-Dist: flax>=0.9.0
|
|
23
|
+
Requires-Dist: ml-dtypes>=0.4.1
|
|
24
|
+
Requires-Dist: ruamel.yaml<0.20.0
|
|
25
|
+
Requires-Dist: ipykernel>=7.2.0
|
|
26
|
+
Requires-Dist: moviepy<3.0.0,>=2.2.1
|
|
27
|
+
Requires-Dist: pillow<12.0.0,>=11.3.0
|
|
28
|
+
Requires-Dist: pygame>=2.6.1
|
|
29
|
+
Requires-Dist: ipywidgets>=8.1.5
|
|
30
|
+
Requires-Dist: typer>=0.25.1
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# MASA-Safe-RL
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
--------------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Welcome to MASA-Safe-RL, the Multi and Single Agent (MASA) Safe Reinforcement Learning library. The primary goal of this library is to develop a set of common constraints and environments for safe reinforcement learning research, built on top of the popular [gymnasium](https://gymnasium.farama.org/) interface. We span, CMPDs, probabilistic constraints, Reach-Avoid and LTL-Safety (DFA) properties.
|
|
41
|
+
|
|
42
|
+
The library is in very early stage development and we greatly appreciate and encourage feedback from the community about what they would like to see implemented. Currently we provide a set of basic tabular algroithms for safe RL, but we provide a modular and resuable framework for developing more complex algorithms and constraints.
|
|
43
|
+
|
|
44
|
+
If you use MASA-Safe-RL in your research please cite it in your publications.
|
|
45
|
+
|
|
46
|
+
```bibtex
|
|
47
|
+
@misc{Goodall2025MASASafeRL,
|
|
48
|
+
title = {{MASA-Safe-RL}: Multi and Single Agent Safe Reinforcement Learning},
|
|
49
|
+
author = {Goodall, Alexander W. and Adalat, Omar and Hamel De-le Court, Edwin and Belardinelli, Francesco},
|
|
50
|
+
year = {2025},
|
|
51
|
+
howpublished = {\url{https://github.com/sacktock/MASA-Safe-RL/}},
|
|
52
|
+
note = {GitHub repository}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
|
|
60
|
+
#### Prequisites
|
|
61
|
+
|
|
62
|
+
Python 3.10+ is required, although later Python versions may not be supported.
|
|
63
|
+
|
|
64
|
+
#### Installation with conda
|
|
65
|
+
- Install conda, e.g., via [anaconda](https://anaconda.org/channels/anaconda/packages/conda/overview).
|
|
66
|
+
- Clone the repo:
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/sacktock/MASA-Safe-RL.git
|
|
69
|
+
cd MASA-Safe-RL
|
|
70
|
+
```
|
|
71
|
+
- Create a conda virtual environment:
|
|
72
|
+
```bash
|
|
73
|
+
conda env create --name masa --file conda-environment.yaml
|
|
74
|
+
conda activate masa
|
|
75
|
+
```
|
|
76
|
+
- Install dependencies:
|
|
77
|
+
```bash
|
|
78
|
+
pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### Installation with uv
|
|
82
|
+
`uv sync` installs the base package from the repository root.
|
|
83
|
+
|
|
84
|
+
* For building docs, use `uv sync --group docs` from the repository root.
|
|
85
|
+
* Adding GPU support for Jax: `uv sync --group cuda12` (or `cuda13` if supported by your device)
|
|
86
|
+
* All groups (docs and GPU support): `uv sync --all-groups`.
|
|
87
|
+
|
|
88
|
+
#### Installation with PyPI
|
|
89
|
+
|
|
90
|
+
Coming soon!
|
|
91
|
+
|
|
92
|
+
### Enabling GPU Acceleration with JAX (Optional)
|
|
93
|
+
|
|
94
|
+
MASA-Safe-RL relies on [JAX](https://docs.jax.dev/) for GPU acceleration. If you are only interested in the gymnasium wrappers and constraints API then you do not need to complete the following steps.
|
|
95
|
+
|
|
96
|
+
## Mac and Windows
|
|
97
|
+
**MAC** and **Windows**: we recommend JAX with CPU. No further action is required if you correctly followed the earlier steps.
|
|
98
|
+
|
|
99
|
+
#### pip
|
|
100
|
+
- **Linux x86_64/aarch64** and **Windows WSL2 x86_64**: W+we strongly recommend using [Ubuntu 22.04](https://apps.microsoft.com/detail/9pn20msr04dw?hl=en-GB&gl=BE) or similar, jax and jaxlib should already be installed via the `requirements.txt`. You need to reinstall [JAX](https://docs.jax.dev/) based on your cuda driver compatibility. Do not use the ```-U``` option here as it may break earlier dependencies!
|
|
101
|
+
```bash
|
|
102
|
+
pip install "jax[cuda13]"
|
|
103
|
+
```
|
|
104
|
+
```bash
|
|
105
|
+
pip install "jax[cuda12]"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### uv
|
|
109
|
+
Alternatively with `uv`,
|
|
110
|
+
```bash
|
|
111
|
+
uv sync --group cuda12
|
|
112
|
+
```
|
|
113
|
+
```bash
|
|
114
|
+
uv sync --group cuda13
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## How to run MASA
|
|
118
|
+
- You can run masa with the prebuilt CLI:
|
|
119
|
+
```bash
|
|
120
|
+
masa run --env-id bridge_crossing --algo ppo --seed 0
|
|
121
|
+
```
|
|
122
|
+
- You can run examples from the ```\examples``` folder via:
|
|
123
|
+
```bash
|
|
124
|
+
masa examples prob_shield_example
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Editing documentation
|
|
128
|
+
|
|
129
|
+
Documentation uses the root `pyproject.toml` and `uv.lock`, so you can build and serve it directly from the repository root.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
uv sync --group docs
|
|
133
|
+
uv run --locked --group docs sphinx-build -b html docs docs/_build/html
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The built site will be available at `docs/_build/html/index.html`.
|
|
137
|
+
|
|
138
|
+
For live reload while editing, run:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
uv run --locked --group docs sphinx-autobuild docs docs/_build/html
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## Getting in Touch
|
|
146
|
+
|
|
147
|
+
MASA-Safe-RL is primarliy managed by [Alex Goodall](https://github.com/sacktock) and [Omar Adalat](https://github.com/nightly). For correspondence in the early stages of the library we prefer you contact us directly via email (a.goodall22@imperial.ac.uk), rather than raising issues on GitHub directly.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MASA-Safe-RL is released under Apache License 2.0.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
MASA_Safe_RL.egg-info/PKG-INFO
|
|
5
|
+
MASA_Safe_RL.egg-info/SOURCES.txt
|
|
6
|
+
MASA_Safe_RL.egg-info/dependency_links.txt
|
|
7
|
+
MASA_Safe_RL.egg-info/entry_points.txt
|
|
8
|
+
MASA_Safe_RL.egg-info/requires.txt
|
|
9
|
+
MASA_Safe_RL.egg-info/top_level.txt
|
|
10
|
+
masa/__init__.py
|
|
11
|
+
masa/run.py
|
|
12
|
+
masa/algorithms/__init__.py
|
|
13
|
+
masa/algorithms/a2c/__init__.py
|
|
14
|
+
masa/algorithms/a2c/a2c.py
|
|
15
|
+
masa/algorithms/ppo/__init__.py
|
|
16
|
+
masa/algorithms/ppo/ppo.py
|
|
17
|
+
masa/algorithms/tabular/__init__.py
|
|
18
|
+
masa/algorithms/tabular/base.py
|
|
19
|
+
masa/algorithms/tabular/lcrl.py
|
|
20
|
+
masa/algorithms/tabular/q_learning.py
|
|
21
|
+
masa/algorithms/tabular/q_learning_lambda.py
|
|
22
|
+
masa/algorithms/tabular/recovery_rl.py
|
|
23
|
+
masa/algorithms/tabular/recreg.py
|
|
24
|
+
masa/algorithms/tabular/sem.py
|
|
25
|
+
masa/cli/__init__.py
|
|
26
|
+
masa/cli/cli_app.py
|
|
27
|
+
masa/common/__init__.py
|
|
28
|
+
masa/common/base_class.py
|
|
29
|
+
masa/common/buffers.py
|
|
30
|
+
masa/common/configs.py
|
|
31
|
+
masa/common/dummy.py
|
|
32
|
+
masa/common/label_fn.py
|
|
33
|
+
masa/common/labelled_env.py
|
|
34
|
+
masa/common/labelled_pz_env.py
|
|
35
|
+
masa/common/layers.py
|
|
36
|
+
masa/common/ltl.py
|
|
37
|
+
masa/common/metrics.py
|
|
38
|
+
masa/common/on_policy_algorithm.py
|
|
39
|
+
masa/common/pctl.py
|
|
40
|
+
masa/common/pettingzoo_record_video.py
|
|
41
|
+
masa/common/policies.py
|
|
42
|
+
masa/common/registry.py
|
|
43
|
+
masa/common/running_mean_std.py
|
|
44
|
+
masa/common/schedule.py
|
|
45
|
+
masa/common/utils.py
|
|
46
|
+
masa/common/wrappers.py
|
|
47
|
+
masa/common/constraints/__init__.py
|
|
48
|
+
masa/common/constraints/base.py
|
|
49
|
+
masa/common/constraints/cmdp.py
|
|
50
|
+
masa/common/constraints/ltl_safety.py
|
|
51
|
+
masa/common/constraints/pctl.py
|
|
52
|
+
masa/common/constraints/prob.py
|
|
53
|
+
masa/common/constraints/reach_avoid.py
|
|
54
|
+
masa/common/constraints/multi_agent/__init__.py
|
|
55
|
+
masa/common/constraints/multi_agent/cmg.py
|
|
56
|
+
masa/configs/__init__.py
|
|
57
|
+
masa/configs/algorithms/__init__.py
|
|
58
|
+
masa/configs/envs/__init__.py
|
|
59
|
+
masa/envs/__init__.py
|
|
60
|
+
masa/envs/continuous/__init__.py
|
|
61
|
+
masa/envs/continuous/base.py
|
|
62
|
+
masa/envs/continuous/cartpole.py
|
|
63
|
+
masa/envs/discrete/__init__.py
|
|
64
|
+
masa/envs/discrete/base.py
|
|
65
|
+
masa/envs/discrete/cartpole.py
|
|
66
|
+
masa/envs/discrete/conveyor_belt.py
|
|
67
|
+
masa/envs/discrete/island_navigation.py
|
|
68
|
+
masa/envs/discrete/mini_pacman_with_coins.py
|
|
69
|
+
masa/envs/discrete/pacman_with_coins.py
|
|
70
|
+
masa/envs/discrete/sokoban.py
|
|
71
|
+
masa/envs/discrete/renderers/__init__.py
|
|
72
|
+
masa/envs/discrete/renderers/cartpole.py
|
|
73
|
+
masa/envs/discrete/renderers/pacman.py
|
|
74
|
+
masa/envs/multiagent/matrix/_label_utils.py
|
|
75
|
+
masa/envs/multiagent/matrix/bertrand.py
|
|
76
|
+
masa/envs/multiagent/matrix/chicken.py
|
|
77
|
+
masa/envs/multiagent/matrix/congestion.py
|
|
78
|
+
masa/envs/multiagent/matrix/dpgg.py
|
|
79
|
+
masa/envs/multiagent/matrix/inspection.py
|
|
80
|
+
masa/envs/tabular/__init__.py
|
|
81
|
+
masa/envs/tabular/base.py
|
|
82
|
+
masa/envs/tabular/bridge_crossing.py
|
|
83
|
+
masa/envs/tabular/bridge_crossing_v2.py
|
|
84
|
+
masa/envs/tabular/colour_bomb_grid_world.py
|
|
85
|
+
masa/envs/tabular/colour_bomb_grid_world_v2.py
|
|
86
|
+
masa/envs/tabular/colour_bomb_grid_world_v3.py
|
|
87
|
+
masa/envs/tabular/colour_grid_world.py
|
|
88
|
+
masa/envs/tabular/media_streaming.py
|
|
89
|
+
masa/envs/tabular/mini_pacman.py
|
|
90
|
+
masa/envs/tabular/pacman.py
|
|
91
|
+
masa/envs/tabular/utils.py
|
|
92
|
+
masa/envs/tabular/renderers/__init__.py
|
|
93
|
+
masa/envs/tabular/renderers/bridge_crossing.py
|
|
94
|
+
masa/envs/tabular/renderers/colour_bomb_grid_world.py
|
|
95
|
+
masa/envs/tabular/renderers/colour_grid_world.py
|
|
96
|
+
masa/envs/tabular/renderers/media_streaming.py
|
|
97
|
+
masa/envs/tabular/renderers/pacman.py
|
|
98
|
+
masa/examples/__init__.py
|
|
99
|
+
masa/examples/norm_obs_example.py
|
|
100
|
+
masa/examples/prob_shield_cont_example.py
|
|
101
|
+
masa/examples/prob_shield_cont_ltl_example.py
|
|
102
|
+
masa/examples/prob_shield_example.py
|
|
103
|
+
masa/examples/prob_shield_ltl_example.py
|
|
104
|
+
masa/examples/prob_shield_safety_abstraction_example.py
|
|
105
|
+
masa/examples/prob_shield_vec_ltl_example.py
|
|
106
|
+
masa/examples/reward_shaping_example.py
|
|
107
|
+
masa/examples/colour_bomb_grid_world/__init__.py
|
|
108
|
+
masa/examples/colour_bomb_grid_world/property_1.py
|
|
109
|
+
masa/examples/colour_bomb_grid_world/property_2.py
|
|
110
|
+
masa/examples/colour_bomb_grid_world/property_3.py
|
|
111
|
+
masa/plugins/__init__.py
|
|
112
|
+
masa/plugins/helpers.py
|
|
113
|
+
masa/plugins/supported.py
|
|
114
|
+
masa/prob_shield/__init__.py
|
|
115
|
+
masa/prob_shield/eventual_discounted_vi.py
|
|
116
|
+
masa/prob_shield/helpers.py
|
|
117
|
+
masa/prob_shield/interval_bound_vi.py
|
|
118
|
+
masa/prob_shield/parameterized_policy.py
|
|
119
|
+
masa/prob_shield/parameterized_policy_v2.py
|
|
120
|
+
masa/prob_shield/parameterized_ppo.py
|
|
121
|
+
masa/prob_shield/parameterized_ppo_v2.py
|
|
122
|
+
masa/prob_shield/prob_shield_wrapper_v1.py
|
|
123
|
+
masa/prob_shield/prob_shield_wrapper_v2.py
|
|
124
|
+
tests/test_cmg.py
|
|
125
|
+
tests/test_reach_avoid.py
|
|
126
|
+
tests/test_record_video.py
|
|
127
|
+
tests/test_sample.py
|
|
128
|
+
tests/test_tutorial_notebooks.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
gymnasium>=1.3.0
|
|
2
|
+
pettingzoo>=1.26.1
|
|
3
|
+
tensorflow>=2.20.0
|
|
4
|
+
tensorflow-probability==0.25.0
|
|
5
|
+
tensorstore>=0.1.65
|
|
6
|
+
tf-keras>=2.17.0
|
|
7
|
+
numpy>=1.26.4
|
|
8
|
+
tensorboard>=2.17.1
|
|
9
|
+
tqdm>=4.66.5
|
|
10
|
+
jax>=0.4.30
|
|
11
|
+
optax>=0.1.9
|
|
12
|
+
flax>=0.9.0
|
|
13
|
+
ml-dtypes>=0.4.1
|
|
14
|
+
ruamel.yaml<0.20.0
|
|
15
|
+
ipykernel>=7.2.0
|
|
16
|
+
moviepy<3.0.0,>=2.2.1
|
|
17
|
+
pillow<12.0.0,>=11.3.0
|
|
18
|
+
pygame>=2.6.1
|
|
19
|
+
ipywidgets>=8.1.5
|
|
20
|
+
typer>=0.25.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
masa
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MASA-Safe-RL
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A safe reinforcement library for providing a common interface for different constraints and environments
|
|
5
|
+
Project-URL: Homepage, https://github.com/sacktock/MASA-Safe-RL
|
|
6
|
+
Project-URL: Repository, https://github.com/sacktock/MASA-Safe-RL
|
|
7
|
+
Project-URL: Documentation, https://sacktock.github.io/MASA-Safe-RL/
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: gymnasium>=1.3.0
|
|
12
|
+
Requires-Dist: pettingzoo>=1.26.1
|
|
13
|
+
Requires-Dist: tensorflow>=2.20.0
|
|
14
|
+
Requires-Dist: tensorflow-probability==0.25.0
|
|
15
|
+
Requires-Dist: tensorstore>=0.1.65
|
|
16
|
+
Requires-Dist: tf-keras>=2.17.0
|
|
17
|
+
Requires-Dist: numpy>=1.26.4
|
|
18
|
+
Requires-Dist: tensorboard>=2.17.1
|
|
19
|
+
Requires-Dist: tqdm>=4.66.5
|
|
20
|
+
Requires-Dist: jax>=0.4.30
|
|
21
|
+
Requires-Dist: optax>=0.1.9
|
|
22
|
+
Requires-Dist: flax>=0.9.0
|
|
23
|
+
Requires-Dist: ml-dtypes>=0.4.1
|
|
24
|
+
Requires-Dist: ruamel.yaml<0.20.0
|
|
25
|
+
Requires-Dist: ipykernel>=7.2.0
|
|
26
|
+
Requires-Dist: moviepy<3.0.0,>=2.2.1
|
|
27
|
+
Requires-Dist: pillow<12.0.0,>=11.3.0
|
|
28
|
+
Requires-Dist: pygame>=2.6.1
|
|
29
|
+
Requires-Dist: ipywidgets>=8.1.5
|
|
30
|
+
Requires-Dist: typer>=0.25.1
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# MASA-Safe-RL
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
--------------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Welcome to MASA-Safe-RL, the Multi and Single Agent (MASA) Safe Reinforcement Learning library. The primary goal of this library is to develop a set of common constraints and environments for safe reinforcement learning research, built on top of the popular [gymnasium](https://gymnasium.farama.org/) interface. We span, CMPDs, probabilistic constraints, Reach-Avoid and LTL-Safety (DFA) properties.
|
|
41
|
+
|
|
42
|
+
The library is in very early stage development and we greatly appreciate and encourage feedback from the community about what they would like to see implemented. Currently we provide a set of basic tabular algroithms for safe RL, but we provide a modular and resuable framework for developing more complex algorithms and constraints.
|
|
43
|
+
|
|
44
|
+
If you use MASA-Safe-RL in your research please cite it in your publications.
|
|
45
|
+
|
|
46
|
+
```bibtex
|
|
47
|
+
@misc{Goodall2025MASASafeRL,
|
|
48
|
+
title = {{MASA-Safe-RL}: Multi and Single Agent Safe Reinforcement Learning},
|
|
49
|
+
author = {Goodall, Alexander W. and Adalat, Omar and Hamel De-le Court, Edwin and Belardinelli, Francesco},
|
|
50
|
+
year = {2025},
|
|
51
|
+
howpublished = {\url{https://github.com/sacktock/MASA-Safe-RL/}},
|
|
52
|
+
note = {GitHub repository}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
|
|
60
|
+
#### Prequisites
|
|
61
|
+
|
|
62
|
+
Python 3.10+ is required, although later Python versions may not be supported.
|
|
63
|
+
|
|
64
|
+
#### Installation with conda
|
|
65
|
+
- Install conda, e.g., via [anaconda](https://anaconda.org/channels/anaconda/packages/conda/overview).
|
|
66
|
+
- Clone the repo:
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/sacktock/MASA-Safe-RL.git
|
|
69
|
+
cd MASA-Safe-RL
|
|
70
|
+
```
|
|
71
|
+
- Create a conda virtual environment:
|
|
72
|
+
```bash
|
|
73
|
+
conda env create --name masa --file conda-environment.yaml
|
|
74
|
+
conda activate masa
|
|
75
|
+
```
|
|
76
|
+
- Install dependencies:
|
|
77
|
+
```bash
|
|
78
|
+
pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### Installation with uv
|
|
82
|
+
`uv sync` installs the base package from the repository root.
|
|
83
|
+
|
|
84
|
+
* For building docs, use `uv sync --group docs` from the repository root.
|
|
85
|
+
* Adding GPU support for Jax: `uv sync --group cuda12` (or `cuda13` if supported by your device)
|
|
86
|
+
* All groups (docs and GPU support): `uv sync --all-groups`.
|
|
87
|
+
|
|
88
|
+
#### Installation with PyPI
|
|
89
|
+
|
|
90
|
+
Coming soon!
|
|
91
|
+
|
|
92
|
+
### Enabling GPU Acceleration with JAX (Optional)
|
|
93
|
+
|
|
94
|
+
MASA-Safe-RL relies on [JAX](https://docs.jax.dev/) for GPU acceleration. If you are only interested in the gymnasium wrappers and constraints API then you do not need to complete the following steps.
|
|
95
|
+
|
|
96
|
+
## Mac and Windows
|
|
97
|
+
**MAC** and **Windows**: we recommend JAX with CPU. No further action is required if you correctly followed the earlier steps.
|
|
98
|
+
|
|
99
|
+
#### pip
|
|
100
|
+
- **Linux x86_64/aarch64** and **Windows WSL2 x86_64**: W+we strongly recommend using [Ubuntu 22.04](https://apps.microsoft.com/detail/9pn20msr04dw?hl=en-GB&gl=BE) or similar, jax and jaxlib should already be installed via the `requirements.txt`. You need to reinstall [JAX](https://docs.jax.dev/) based on your cuda driver compatibility. Do not use the ```-U``` option here as it may break earlier dependencies!
|
|
101
|
+
```bash
|
|
102
|
+
pip install "jax[cuda13]"
|
|
103
|
+
```
|
|
104
|
+
```bash
|
|
105
|
+
pip install "jax[cuda12]"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### uv
|
|
109
|
+
Alternatively with `uv`,
|
|
110
|
+
```bash
|
|
111
|
+
uv sync --group cuda12
|
|
112
|
+
```
|
|
113
|
+
```bash
|
|
114
|
+
uv sync --group cuda13
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## How to run MASA
|
|
118
|
+
- You can run masa with the prebuilt CLI:
|
|
119
|
+
```bash
|
|
120
|
+
masa run --env-id bridge_crossing --algo ppo --seed 0
|
|
121
|
+
```
|
|
122
|
+
- You can run examples from the ```\examples``` folder via:
|
|
123
|
+
```bash
|
|
124
|
+
masa examples prob_shield_example
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Editing documentation
|
|
128
|
+
|
|
129
|
+
Documentation uses the root `pyproject.toml` and `uv.lock`, so you can build and serve it directly from the repository root.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
uv sync --group docs
|
|
133
|
+
uv run --locked --group docs sphinx-build -b html docs docs/_build/html
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The built site will be available at `docs/_build/html/index.html`.
|
|
137
|
+
|
|
138
|
+
For live reload while editing, run:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
uv run --locked --group docs sphinx-autobuild docs docs/_build/html
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## Getting in Touch
|
|
146
|
+
|
|
147
|
+
MASA-Safe-RL is primarliy managed by [Alex Goodall](https://github.com/sacktock) and [Omar Adalat](https://github.com/nightly). For correspondence in the early stages of the library we prefer you contact us directly via email (a.goodall22@imperial.ac.uk), rather than raising issues on GitHub directly.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MASA-Safe-RL is released under Apache License 2.0.
|