xenoverse 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.
Files changed (141) hide show
  1. xenoverse-0.1.0/LICENSE +201 -0
  2. xenoverse-0.1.0/PKG-INFO +52 -0
  3. xenoverse-0.1.0/README.md +34 -0
  4. xenoverse-0.1.0/setup.cfg +4 -0
  5. xenoverse-0.1.0/setup.py +51 -0
  6. xenoverse-0.1.0/xenoverse/__init__.py +15 -0
  7. xenoverse-0.1.0/xenoverse/anymdp/__init__.py +34 -0
  8. xenoverse-0.1.0/xenoverse/anymdp/anymdp_env.py +123 -0
  9. xenoverse-0.1.0/xenoverse/anymdp/anymdp_solver_opt.py +38 -0
  10. xenoverse-0.1.0/xenoverse/anymdp/anymdp_solver_ots.py +73 -0
  11. xenoverse-0.1.0/xenoverse/anymdp/anymdp_solver_q.py +43 -0
  12. xenoverse-0.1.0/xenoverse/anymdp/solver.py +160 -0
  13. xenoverse-0.1.0/xenoverse/anymdp/task_sampler.py +310 -0
  14. xenoverse-0.1.0/xenoverse/anymdp/test.py +127 -0
  15. xenoverse-0.1.0/xenoverse/anymdp/visualizer.py +78 -0
  16. xenoverse-0.1.0/xenoverse/anymdpv2/__init__.py +30 -0
  17. xenoverse-0.1.0/xenoverse/anymdpv2/anymdp_env.py +105 -0
  18. xenoverse-0.1.0/xenoverse/anymdpv2/task_sampler.py +162 -0
  19. xenoverse-0.1.0/xenoverse/anymdpv2/test.py +42 -0
  20. xenoverse-0.1.0/xenoverse/anymdpv2/test_ppo.py +79 -0
  21. xenoverse-0.1.0/xenoverse/anymdpv2/visualizer.py +79 -0
  22. xenoverse-0.1.0/xenoverse/mazeworld/__init__.py +31 -0
  23. xenoverse-0.1.0/xenoverse/mazeworld/agents/__init__.py +2 -0
  24. xenoverse-0.1.0/xenoverse/mazeworld/agents/agent_base.py +108 -0
  25. xenoverse-0.1.0/xenoverse/mazeworld/agents/oracle_agent.py +9 -0
  26. xenoverse-0.1.0/xenoverse/mazeworld/agents/smart_slam_agent.py +231 -0
  27. xenoverse-0.1.0/xenoverse/mazeworld/demo/__init__.py +0 -0
  28. xenoverse-0.1.0/xenoverse/mazeworld/demo/agent_play_demo.py +51 -0
  29. xenoverse-0.1.0/xenoverse/mazeworld/demo/keyboard_play_demo.py +41 -0
  30. xenoverse-0.1.0/xenoverse/mazeworld/envs/__init__.py +4 -0
  31. xenoverse-0.1.0/xenoverse/mazeworld/envs/dynamics.py +187 -0
  32. xenoverse-0.1.0/xenoverse/mazeworld/envs/grid_ops.py +165 -0
  33. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_asphalt_03_diff_1k.jpg +0 -0
  34. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_concrete_floor_01_diff_1k.jpg +0 -0
  35. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_concrete_floor_01_rough_1k.jpg +0 -0
  36. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_concrete_floor_02_diff_1k.jpg +0 -0
  37. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_concrete_floor_02_rough_1k.jpg +0 -0
  38. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_concrete_floor_worn_001_diff_1k.jpg +0 -0
  39. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_concrete_floor_worn_001_rough_1k.jpg +0 -0
  40. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_factory_wall_diff_1k.jpg +0 -0
  41. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_factory_wall_rough_1k.jpg +0 -0
  42. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_grey_plaster_02_diff_1k.jpg +0 -0
  43. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_grey_plaster_02_rough_1k.jpg +0 -0
  44. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_grey_plaster_03_diff_1k.jpg +0 -0
  45. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_grey_plaster_03_rough_1k.jpg +0 -0
  46. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_grey_plaster_diff_1k.jpg +0 -0
  47. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_grey_plaster_rough_1k.jpg +0 -0
  48. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_metal_plate_02_diff_1k.jpg +0 -0
  49. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_painted_concrete_diff_1k.jpg +0 -0
  50. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_scuffed_cement_diff_1k.jpg +0 -0
  51. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_white_plaster_02_diff_1k.jpg +0 -0
  52. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_white_plaster_02_rough_1k.jpg +0 -0
  53. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ceiling_worn_corrugated_iron_diff_1k.jpg +0 -0
  54. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_asphalt_02_diff_1k.jpg +0 -0
  55. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_asphalt_02_rough_1k.jpg +0 -0
  56. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_asphalt_pit_lane_diff_1k.jpg +0 -0
  57. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_concrete_floor_painted_diff_1k.jpg +0 -0
  58. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_concrete_floor_painted_rough_1k.jpg +0 -0
  59. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_concrete_pavers_diff_1k.jpg +0 -0
  60. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_cracked_concrete_diff_1k.jpg +0 -0
  61. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_dark_wooden_planks_diff_1k.jpg +0 -0
  62. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_dry_riverbed_rock_diff_1k.jpg +0 -0
  63. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_floor_tiles_06_diff_1k.jpg +0 -0
  64. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_floor_tiles_06_rough_1k.jpg +0 -0
  65. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_grey_cartago_02_ao_1k.jpg +0 -0
  66. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_grey_cartago_02_diff_1k.jpg +0 -0
  67. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_laminate_floor_02_diff_1k.jpg +0 -0
  68. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_leafy_grass_diff_1k.jpg +0 -0
  69. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_long_white_tiles_ao_1k.jpg +0 -0
  70. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_long_white_tiles_diff_1k.jpg +0 -0
  71. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_old_wood_floor_diff_1k.jpg +0 -0
  72. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_painted_concrete_diff_1k.jpg +0 -0
  73. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_patterned_cobblestone_02_diff_1k.jpg +0 -0
  74. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_rock_tile_floor_02_diff_1k.jpg +0 -0
  75. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_rubber_tiles_diff_1k.jpg +0 -0
  76. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_slate_floor_02_diff_1k.jpg +0 -0
  77. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_stone_tiles_03_diff_1k.jpg +0 -0
  78. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_stone_tiles_diff_1k.jpg +0 -0
  79. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_t_brick_floor_002_diffuse_1k.jpg +0 -0
  80. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_t_brick_floor_002_rough_1k.jpg +0 -0
  81. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_weathered_planks_diff_1k.jpg +0 -0
  82. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/ground_winter_leaves_diff_1k.jpg +0 -0
  83. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_aerial_mud_1_diff_1k.jpg +0 -0
  84. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_aerial_mud_1_rough_1k.jpg +0 -0
  85. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_aerial_rocks_02_diff_1k.jpg +0 -0
  86. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_aerial_rocks_02_rough_1k.jpg +0 -0
  87. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_brick_4_diff_1k.jpg +0 -0
  88. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_brick_4_rough_1k.jpg +0 -0
  89. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_brick_pavement_02_diff_1k.jpg +0 -0
  90. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_brick_wall_005_diff_1k.jpg +0 -0
  91. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_brick_wall_09_ao_1k.jpg +0 -0
  92. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_brick_wall_09_diff_1k.jpg +0 -0
  93. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_castle_wall_varriation_diff_1k.jpg +0 -0
  94. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_castle_wall_varriation_rough_1k.jpg +0 -0
  95. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_concrete_brick_wall_001_diffuse_1k.jpg +0 -0
  96. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_concrete_brick_wall_001_rough_1k.jpg +0 -0
  97. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_cracked_concrete_wall_diff_1k.jpg +0 -0
  98. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_denmin_fabric_02_diff_1k.jpg +0 -0
  99. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_green_metal_rust_diff_1k.jpg +0 -0
  100. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_green_metal_rust_rough_1k.jpg +0 -0
  101. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_metal_grate_rusty_diff_1k.jpg +0 -0
  102. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_painted_brick_diff_1k.jpg +0 -0
  103. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_patterned_brick_wall_03_diff_1k.jpg +0 -0
  104. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_pavement_02_diff_1k.jpg +0 -0
  105. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_preconcrete_wall_001_diff_1k.jpg +0 -0
  106. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_preconcrete_wall_001_rough_1k.jpg +0 -0
  107. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_recycled_brick_floor_diff_1k.jpg +0 -0
  108. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rock_pitted_mossy_diff_1k.jpg +0 -0
  109. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rocky_terrain_diff_1k.jpg +0 -0
  110. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rough_block_wall_diff_1k.jpg +0 -0
  111. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rough_block_wall_rough_1k.jpg +0 -0
  112. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rough_plaster_brick_02_diff_1k.jpg +0 -0
  113. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rough_plaster_brick_02_rough_1k.jpg +0 -0
  114. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rough_plaster_brick_diff_1k.jpg +0 -0
  115. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_rough_plaster_brick_rough_1k.jpg +0 -0
  116. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_slab_tiles_diff_1k.jpg +0 -0
  117. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_stone_brick_wall_001_diff_1k.jpg +0 -0
  118. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_stone_brick_wall_001_rough_1k.jpg +0 -0
  119. xenoverse-0.1.0/xenoverse/mazeworld/envs/img/wall_stone_wall_04_diff_1k.jpg +0 -0
  120. xenoverse-0.1.0/xenoverse/mazeworld/envs/maze_base.py +328 -0
  121. xenoverse-0.1.0/xenoverse/mazeworld/envs/maze_continuous_3d.py +116 -0
  122. xenoverse-0.1.0/xenoverse/mazeworld/envs/maze_env.py +166 -0
  123. xenoverse-0.1.0/xenoverse/mazeworld/envs/ray_caster_utils.py +330 -0
  124. xenoverse-0.1.0/xenoverse/mazeworld/envs/task_sampler.py +239 -0
  125. xenoverse-0.1.0/xenoverse/mazeworld/envs/utils.py +30 -0
  126. xenoverse-0.1.0/xenoverse/mazeworld/tests/__init__.py +0 -0
  127. xenoverse-0.1.0/xenoverse/mazeworld/tests/test.py +30 -0
  128. xenoverse-0.1.0/xenoverse/mazeworld/tests/test_agent.py +35 -0
  129. xenoverse-0.1.0/xenoverse/metalang/__init__.py +31 -0
  130. xenoverse-0.1.0/xenoverse/metalang/generator.py +148 -0
  131. xenoverse-0.1.0/xenoverse/metalang/metalangv1.py +119 -0
  132. xenoverse-0.1.0/xenoverse/metalang/metalangv2.py +112 -0
  133. xenoverse-0.1.0/xenoverse/metalang/task_sampler.py +74 -0
  134. xenoverse-0.1.0/xenoverse/utils/__init__.py +1 -0
  135. xenoverse-0.1.0/xenoverse/utils/random_nn.py +257 -0
  136. xenoverse-0.1.0/xenoverse.egg-info/PKG-INFO +52 -0
  137. xenoverse-0.1.0/xenoverse.egg-info/SOURCES.txt +139 -0
  138. xenoverse-0.1.0/xenoverse.egg-info/dependency_links.txt +1 -0
  139. xenoverse-0.1.0/xenoverse.egg-info/not-zip-safe +1 -0
  140. xenoverse-0.1.0/xenoverse.egg-info/requires.txt +6 -0
  141. xenoverse-0.1.0/xenoverse.egg-info/top_level.txt +1 -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,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: xenoverse
3
+ Version: 0.1.0
4
+ Summary: Collection of xeno-world environments for meta-training of general-purpose learning agents (GLAs)
5
+ Home-page: https://github.com/FutureAGI/xenoverse
6
+ Author: WorldEditors
7
+ Author-email:
8
+ License: Apache
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: gym>=0.18.0
13
+ Requires-Dist: numpy>=1.24.4
14
+ Requires-Dist: Pillow>=6.2.2
15
+ Requires-Dist: six>=1.12.0
16
+ Requires-Dist: pygame>=2.6.0
17
+ Requires-Dist: numba>=0.58.1
18
+
19
+ # L3C
20
+
21
+ L3C provides variant environments facilitating In-Context Learning, featured in the following assets:
22
+ - Vast amounts of diversified tasks with minimal inductive bias
23
+ - Lifelong In-Context Learning
24
+ - Generative and Interactive
25
+
26
+ # Environments Updating
27
+
28
+ - [AnyMDP](l3c/anymdp): Procedurally generated unlimited general-purpose Markov Decision Processes (MDP)
29
+
30
+ - [MetaLanguage](l3c/metalang): Pseudo-language generated from randomized neural networks
31
+
32
+ - [MazeWorld](l3c/mazeworld): Procedurally generated mazes with diverse maze structures, navigation goals to benchmark object navigation
33
+
34
+ - [L3C_Baselines](https://github.com/FutureAGI/L3C_Baselines): An implementation of the baseline solutions to the above tasks
35
+
36
+ # Installation
37
+
38
+ ```bash
39
+ pip install l3c
40
+ ```
41
+
42
+ # Reference
43
+ Cite this work with
44
+
45
+ ```bibtex
46
+ @article{wang2024benchmarking,
47
+ title={Benchmarking General Purpose In-Context Learning},
48
+ author={Wang, Fan and Lin, Chuan and Cao, Yang and Kang, Yu},
49
+ journal={arXiv preprint arXiv:2405.17234},
50
+ year={2024}
51
+ }
52
+ ```
@@ -0,0 +1,34 @@
1
+ # L3C
2
+
3
+ L3C provides variant environments facilitating In-Context Learning, featured in the following assets:
4
+ - Vast amounts of diversified tasks with minimal inductive bias
5
+ - Lifelong In-Context Learning
6
+ - Generative and Interactive
7
+
8
+ # Environments Updating
9
+
10
+ - [AnyMDP](l3c/anymdp): Procedurally generated unlimited general-purpose Markov Decision Processes (MDP)
11
+
12
+ - [MetaLanguage](l3c/metalang): Pseudo-language generated from randomized neural networks
13
+
14
+ - [MazeWorld](l3c/mazeworld): Procedurally generated mazes with diverse maze structures, navigation goals to benchmark object navigation
15
+
16
+ - [L3C_Baselines](https://github.com/FutureAGI/L3C_Baselines): An implementation of the baseline solutions to the above tasks
17
+
18
+ # Installation
19
+
20
+ ```bash
21
+ pip install l3c
22
+ ```
23
+
24
+ # Reference
25
+ Cite this work with
26
+
27
+ ```bibtex
28
+ @article{wang2024benchmarking,
29
+ title={Benchmarking General Purpose In-Context Learning},
30
+ author={Wang, Fan and Lin, Chuan and Cao, Yang and Kang, Yu},
31
+ journal={arXiv preprint arXiv:2405.17234},
32
+ year={2024}
33
+ }
34
+ ```
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,51 @@
1
+ # Copyright (c) 2022 DeepEvolution Authors. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import io
16
+ from xenoverse import __version__
17
+ from setuptools import setup, find_packages
18
+
19
+ with io.open('README.md', 'r', encoding='utf-8') as fh:
20
+ long_description = fh.read()
21
+
22
+ setup(
23
+ name='xenoverse',
24
+ version=__version__,
25
+ author='WorldEditors',
26
+ author_email='',
27
+ description=('Collection of xeno-world environments for meta-training of general-purpose learning agents (GLAs)'),
28
+ long_description=long_description,
29
+ long_description_content_type='text/markdown',
30
+ url='https://github.com/FutureAGI/xenoverse',
31
+ license="Apache",
32
+ packages=[package for package in find_packages()
33
+ if package.startswith('xenoverse')],
34
+ package_data={'xenoverse': [
35
+ './mazeworld/envs/img/*',
36
+ ]
37
+ },
38
+ python_requires='>=3.8',
39
+ tests_require=['pytest', 'mock'],
40
+ include_package_data=True,
41
+ install_requires=[
42
+ 'gym>=0.18.0',
43
+ 'numpy>=1.24.4',
44
+ 'Pillow>=6.2.2',
45
+ 'six>=1.12.0',
46
+ 'pygame>=2.6.0',
47
+ 'numba>=0.58.1'
48
+ ],
49
+ extras_require={},
50
+ zip_safe=False,
51
+ )
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ __version__ = '0.1.0'
@@ -0,0 +1,34 @@
1
+ # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from gym.envs.registration import register
16
+ from l3c.anymdp.anymdp_env import AnyMDPEnv, AnyMDPEnvD2C
17
+ from l3c.anymdp.anymdp_solver_opt import AnyMDPSolverOpt
18
+ from l3c.anymdp.anymdp_solver_ots import AnyMDPSolverOTS
19
+ from l3c.anymdp.anymdp_solver_q import AnyMDPSolverQ
20
+ from l3c.anymdp.task_sampler import AnyMDPTaskSampler
21
+ from l3c.anymdp.visualizer import task_visualizer
22
+
23
+ register(
24
+ id='anymdp-v0',
25
+ entry_point='l3c.anymdp:AnyMDPEnv',
26
+ kwargs={"max_steps": 5000},
27
+ )
28
+
29
+ register(
30
+ id='anymdp-d2c-v0',
31
+ entry_point='l3c.anymdp:AnyMDPEnvD2C',
32
+ kwargs={"max_steps": 5000,
33
+ "state_dim": 16},
34
+ )
@@ -0,0 +1,123 @@
1
+ """
2
+ Gym Environment For Any MDP
3
+ """
4
+ import numpy
5
+ import gym
6
+ import pygame
7
+ from numpy import random
8
+
9
+ from gym import error, spaces, utils
10
+ from gym.utils import seeding
11
+ from l3c.utils import pseudo_random_seed
12
+
13
+ class AnyMDPEnv(gym.Env):
14
+ def __init__(self, max_steps):
15
+ """
16
+ Pay Attention max_steps might be reseted by task settings
17
+ """
18
+ self.observation_space = spaces.Discrete(2)
19
+ self.action_space = spaces.Discrete(2)
20
+ self.max_steps = max_steps
21
+ self.task_set = False
22
+
23
+ def set_task(self, task_config):
24
+ self.transition_matrix = task_config["transition"]
25
+ self.reward_matrix = task_config["reward"]
26
+ self.reward_noise = task_config["reward_noise"]
27
+ self.reward_noise_type = task_config["reward_noise_type"]
28
+ self.state_mapping = task_config["state_mapping"]
29
+ self.reset_triggers = task_config["reset_triggers"]
30
+ self.reset_states = task_config["reset_states"]
31
+ self.n_states = task_config["state_space"]
32
+ self.n_actions = task_config["action_space"]
33
+
34
+ if("max_steps" in task_config):
35
+ self.max_steps = task_config["max_steps"]
36
+
37
+ ns1, na1, ns2 = self.transition_matrix.shape
38
+ ns3, na2, ns4 = self.reward_matrix.shape
39
+
40
+ assert ns1 == ns2 and ns2 == ns3 and ns3==ns4, \
41
+ "Transition matrix and reward matrix must have the same number of states"
42
+ assert na1 == na2, \
43
+ "Transition matrix and reward matrix must have the same number of actions"
44
+ assert ns1 > 0, "State space must be at least 1"
45
+ assert na1 > 1, "Action space must be at least 2"
46
+
47
+ self.observation_space = spaces.Discrete(self.n_states)
48
+ self.action_space = spaces.Discrete(self.n_actions)
49
+
50
+ self.task_set = True
51
+ self.need_reset = True
52
+
53
+ def reset(self):
54
+ if(not self.task_set):
55
+ raise Exception("Must call \"set_task\" first")
56
+
57
+ self.steps = 0
58
+ self.need_reset = False
59
+ random.seed(pseudo_random_seed())
60
+
61
+ self._state = numpy.random.choice(len(self.reset_states),
62
+ replace=True,
63
+ p=self.reset_states)
64
+ return self.state_mapping[self._state], {"steps": self.steps}
65
+
66
+ def step(self, action):
67
+ if(self.need_reset or not self.task_set):
68
+ raise Exception("Must \"set_task\" and \"reset\" before doing any actions")
69
+ assert action < self.n_actions, "Action must be less than the number of actions"
70
+ transition_gt = self.transition_matrix[self._state, action]
71
+
72
+ next_state = random.choice(len(self.state_mapping), p=transition_gt)
73
+
74
+ reward_gt = self.reward_matrix[self._state, action, next_state]
75
+ reward_gt_noise = self.reward_noise[self._state, action, next_state]
76
+
77
+ if(self.reward_noise_type == 'normal'):
78
+ reward = random.normal(reward_gt, reward_gt_noise)
79
+ elif(self.reward_noise_type == 'binomial'):
80
+ if(reward_gt > 0):
81
+ reward = float(random.binomial(1, reward_gt))
82
+ else:
83
+ reward = - float(random.binomial(1, abs(reward_gt)))
84
+
85
+ info = {"steps": self.steps, "reward_gt": reward_gt}
86
+
87
+ if(self.state_mapping.ndim == 1):
88
+ transition_ext_gt = numpy.zeros((self.n_states,))
89
+ for i,s in enumerate(self.state_mapping):
90
+ transition_ext_gt[s] = transition_gt[i]
91
+ info["transition_gt"] = transition_ext_gt
92
+
93
+ self.steps += 1
94
+ self._state = next_state
95
+ #print("inner", next_state, "outer", self.state_mapping[next_state], self.max_steps,
96
+ # "triggers", self.reset_triggers, "starts", self.reset_states)
97
+ done = (self.steps >= self.max_steps or self.reset_triggers[self._state])
98
+ if(done):
99
+ self.need_reset = True
100
+ return self.state_mapping[next_state], reward, done, info
101
+
102
+ @property
103
+ def state(self):
104
+ return self.state_mapping[self._state]
105
+
106
+ @property
107
+ def inner_state(self):
108
+ return self._state
109
+
110
+ class AnyMDPEnvD2C(AnyMDPEnv):
111
+ """
112
+ Transfer a AnyMDPEnv to Continuous State Space without resampling a task
113
+ """
114
+ def __init__(self, max_steps, state_dim):
115
+ super().__init__(max_steps)
116
+ self.observation_space = spaces.Box(0., 1., shape=(state_dim,))
117
+ self.state_dim = state_dim
118
+
119
+ def set_task(self, task_config):
120
+ super().set_task(task_config)
121
+ n_inner_states = self.state_mapping.shape[0]
122
+ self.state_mapping = numpy.random.normal(size=(n_inner_states, self.state_dim))
123
+ self.observation_space = spaces.Box(0., 1., shape=(self.state_dim,))
@@ -0,0 +1,38 @@
1
+ import gym
2
+ import numpy
3
+ from numpy import random
4
+ from numba import njit
5
+ from l3c.anymdp.solver import update_value_matrix, get_final_transition, get_final_reward
6
+
7
+
8
+ class AnyMDPSolverOpt(object):
9
+ """
10
+ Solver for AnyMDPEnv with Bellman Equation and Value Iteration
11
+ Suppose to know the ground truth of the environment
12
+ """
13
+ def __init__(self, env, gamma=0.99):
14
+ if(not env.task_set):
15
+ raise Exception("AnyMDPEnv is not initialized by 'set_task', must call set_task first")
16
+ self.n_actions = env.action_space.n
17
+ self.n_states = env.observation_space.n
18
+ self.transition_matrix = get_final_transition(
19
+ transition=env.transition_matrix,
20
+ reset_states=env.reset_states,
21
+ reset_triggers=env.reset_triggers)
22
+ self.reward_matrix = get_final_reward(
23
+ reward=env.reward_matrix,
24
+ reset_triggers=env.reset_triggers,
25
+ )
26
+ self.state_mapping = env.state_mapping
27
+ self.value_matrix = numpy.zeros((self.n_states, self.n_actions))
28
+ self.gamma = gamma
29
+ self.inverse_state_mapping = dict()
30
+ for i,state in enumerate(self.state_mapping):
31
+ self.inverse_state_mapping[state] = i
32
+ self.q_solver()
33
+
34
+ def q_solver(self, gamma=0.99):
35
+ self.value_matrix = update_value_matrix(self.transition_matrix, self.reward_matrix, gamma, self.value_matrix)
36
+
37
+ def policy(self, state):
38
+ return numpy.argmax(self.value_matrix[self.inverse_state_mapping[state]])
@@ -0,0 +1,73 @@
1
+ import gym
2
+ import numpy
3
+ from numpy import random
4
+
5
+
6
+ class AnyMDPSolverOTS(object):
7
+ """
8
+ Implementing the RL Solver of the paper
9
+ Hu, Bingshan, et al. "Optimistic Thompson sampling-based algorithms for
10
+ episodic reinforcement learning."
11
+ Uncertainty in Artificial Intelligence. PMLR, 2023.
12
+ """
13
+ def __init__(self, env, gamma=0.99, c=0.01, alpha=0.10, max_steps=4000):
14
+ """
15
+ The constructor for the class AnyMDPSolverQ
16
+ The exploration strategy is controlled by UCB-H with c as its hyperparameter. Increasing c will encourage exploration
17
+ Simulation of the ideal policy when the ground truth is not known
18
+ """
19
+ if(not env.task_set):
20
+ raise Exception("AnyMDPEnv is not initialized by 'set_task', must call set_task first")
21
+ self.n_actions = env.action_space.n
22
+ self.n_states = env.observation_space.n
23
+
24
+ self.est_r = numpy.zeros((self.n_states, self.n_actions))
25
+ self.est_r_cnt = numpy.zeros((self.n_states, self.n_actions))
26
+ self.est_t = 0.1 * numpy.ones((self.n_states, self.n_actions, self.n_states))
27
+ self.gamma = gamma
28
+ self.lr = 1.0 - alpha
29
+ self._c = c / (1.0 - self.gamma)
30
+ self.max_steps = max_steps
31
+ self.reset_states = numpy.zeros(self.n_states)
32
+ for i,s in enumerate(env.state_mapping):
33
+ self.reset_states[s] = env.reset_states[i]
34
+
35
+ self.value_matrix = numpy.zeros((self.n_states, self.n_actions))
36
+ self.est_r_global_avg = 0
37
+ self.est_r_global_cnt = 0
38
+ self.alpha = alpha
39
+
40
+
41
+ def learner(self, s, a, ns, r, done):
42
+ # Update the environment model estimation
43
+ if(self.est_r_cnt[s,a] > 0):
44
+ self.est_r[s,a] += (r - self.est_r[s,a])/self.est_r_cnt[s,a]
45
+ else:
46
+ self.est_r[s,a] = r
47
+
48
+ if(self.est_r_global_cnt > 0):
49
+ self.est_r_global_avg += (r - self.est_r_global_avg) * self.alpha
50
+ else:
51
+ self.est_r_global_avg = r
52
+
53
+ self.est_r_cnt[s,a]+= 1
54
+ self.est_t[s,a,ns] += 1
55
+ self.est_r_global_cnt += 1
56
+
57
+ est_t = self.est_t / numpy.sum(self.est_t, axis=-1, keepdims=True)
58
+
59
+ if(not done):
60
+ est_target = numpy.sum(est_t[s, a] * numpy.max(self.value_matrix, axis=-1))
61
+ est_value = self.est_r[s,a] + self.gamma * est_target
62
+ else:
63
+ est_target = numpy.sum(self.reset_states * numpy.max(self.value_matrix, axis=-1))
64
+ est_value = self.est_r[s,a] + self.gamma * est_target
65
+ self.value_matrix[s,a] += self.alpha * (est_value - self.value_matrix[s,a])
66
+
67
+
68
+ def policy(self, state):
69
+ # Apply UCB with dynamic noise (Thompson Sampling)
70
+ values = self._c * numpy.sqrt(numpy.log(self.max_steps + 1) / numpy.clip(self.est_r_cnt[state], 1.0, None)) * \
71
+ numpy.maximum(numpy.random.randn(self.n_actions), 0) + \
72
+ self.value_matrix[state]
73
+ return numpy.argmax(values)
@@ -0,0 +1,43 @@
1
+ import gym
2
+ import numpy
3
+ from numpy import random
4
+
5
+ class AnyMDPSolverQ(object):
6
+ """
7
+ Solver for AnyMDPEnv with Q-Learning
8
+ """
9
+ def __init__(self, env, gamma=0.99, c=0.01, alpha=0.01, max_steps=4000):
10
+ """
11
+ The constructor for the class AnyMDPSolverQ
12
+ The exploration strategy is controlled by UCB-H with c as its hyperparameter. Increasing c will encourage exploration
13
+ Simulation of the ideal policy when the ground truth is not known
14
+ """
15
+ if(not env.task_set):
16
+ raise Exception("AnyMDPEnv is not initialized by 'set_task', must call set_task first")
17
+ self.n_actions = env.action_space.n
18
+ self.n_states = env.observation_space.n
19
+ self.transition_matrix = env.transition_matrix
20
+ self.reward_matrix = env.reward_matrix
21
+ self.value_matrix = numpy.zeros((self.n_states, self.n_actions))
22
+ self.sa_vistied = numpy.zeros((self.n_states, self.n_actions))
23
+ self.gamma = gamma
24
+ self.alpha = alpha
25
+ self.max_steps = max_steps
26
+ self._c = c / (1.0 - self.gamma)
27
+
28
+
29
+ def learner(self, s, a, ns, r, done):
30
+ if(done):
31
+ target = r
32
+ else:
33
+ target = r + self.gamma * max(self.value_matrix[ns])
34
+ error = target - self.value_matrix[s][a]
35
+ self.value_matrix[s][a] += self.alpha * error
36
+ self.sa_vistied[s][a] += 1
37
+
38
+ def policy(self, state):
39
+ # Apply UCB with dynamic noise (Thompson Sampling)
40
+ values = self._c * numpy.sqrt(numpy.log(self.max_steps + 1) / numpy.clip(self.sa_vistied[state], 1.0, None)) * \
41
+ numpy.maximum(numpy.random.randn(self.n_actions), 0) + \
42
+ self.value_matrix[state]
43
+ return numpy.argmax(values)