continual-foragax 0.18.0__py3-none-any.whl → 0.20.0__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.
- {continual_foragax-0.18.0.dist-info → continual_foragax-0.20.0.dist-info}/METADATA +1 -1
- {continual_foragax-0.18.0.dist-info → continual_foragax-0.20.0.dist-info}/RECORD +7 -7
- foragax/env.py +25 -11
- foragax/registry.py +55 -2
- {continual_foragax-0.18.0.dist-info → continual_foragax-0.20.0.dist-info}/WHEEL +0 -0
- {continual_foragax-0.18.0.dist-info → continual_foragax-0.20.0.dist-info}/entry_points.txt +0 -0
- {continual_foragax-0.18.0.dist-info → continual_foragax-0.20.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
foragax/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
foragax/colors.py,sha256=rqNPiywP4Nvr0POhsGpasRk-nMMTS3DOwFRUgperlUk,2065
|
3
|
-
foragax/env.py,sha256=
|
3
|
+
foragax/env.py,sha256=APPu0r31A9SlvmJYkoZzsrh59YFVoLW3Rmyb3JT-dHw,20613
|
4
4
|
foragax/objects.py,sha256=iDFo_2CjpgErAm3QdQt5ixmQ8jdIvl7siIPqzGwVcGk,7665
|
5
|
-
foragax/registry.py,sha256=
|
5
|
+
foragax/registry.py,sha256=5Ik61gIzTHc5A1_aOVbRXbVooRXz3GjmL7KdGsZTOTE,8642
|
6
6
|
foragax/rendering.py,sha256=bms7wvBZTofoR-K-2QD2Ggeed7Viw8uwAEiEpEM3eSo,2768
|
7
7
|
foragax/weather.py,sha256=KNAiwuFz8V__6G75vZIWQKPocLzXqxXn-Vt4TbHIpcA,1258
|
8
8
|
foragax/data/ECA_non-blended_custom/TG_SOUID100897.txt,sha256=N7URbX6VlCZvCboUogYjMzy1I-0cfNPOn0QTLSHHfQ0,1776751
|
@@ -128,8 +128,8 @@ foragax/data/ECA_non-blended_custom/TG_SOUID156887.txt,sha256=juzTPgJoJxfqmZkorL
|
|
128
128
|
foragax/data/ECA_non-blended_custom/elements.txt,sha256=OtcUBoDAHxuln79BPKGu0tsQxG_5G2BfAX3Ck130kEA,4507
|
129
129
|
foragax/data/ECA_non-blended_custom/metadata.txt,sha256=nudnmOCy5cPJfSXt_IjyX0S5-T7NkCZREICZSimqeqc,48260
|
130
130
|
foragax/data/ECA_non-blended_custom/sources.txt,sha256=1j3lSmINAoCMqPqFrHfZJriOz6sTYZNOhXzUwvTLas0,20857
|
131
|
-
continual_foragax-0.
|
132
|
-
continual_foragax-0.
|
133
|
-
continual_foragax-0.
|
134
|
-
continual_foragax-0.
|
135
|
-
continual_foragax-0.
|
131
|
+
continual_foragax-0.20.0.dist-info/METADATA,sha256=oTXP1c7cRZSnoUWUV6HvQb0FomwCpWnOtNrDp0M4u8I,4897
|
132
|
+
continual_foragax-0.20.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
133
|
+
continual_foragax-0.20.0.dist-info/entry_points.txt,sha256=Qiu6iE_XudrDO_bVAMeA435h4PO9ourt8huvSHiuMPc,41
|
134
|
+
continual_foragax-0.20.0.dist-info/top_level.txt,sha256=-z3SDK6RfLIcLI24n8rdbeFzlVY3hunChzlu-v1Fncs,8
|
135
|
+
continual_foragax-0.20.0.dist-info/RECORD,,
|
foragax/env.py
CHANGED
@@ -355,17 +355,31 @@ class ForagaxEnv(environment.Environment):
|
|
355
355
|
# Create indices for the aperture
|
356
356
|
y_offsets = jnp.arange(ap_h)
|
357
357
|
x_offsets = jnp.arange(ap_w)
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
358
|
+
y_coords_original = start_y + y_offsets[:, None]
|
359
|
+
x_coords_original = start_x + x_offsets
|
360
|
+
|
361
|
+
if self.nowrap:
|
362
|
+
y_coords = jnp.clip(y_coords_original, 0, self.size[1] - 1)
|
363
|
+
x_coords = jnp.clip(x_coords_original, 0, self.size[0] - 1)
|
364
|
+
in_bounds = (
|
365
|
+
(y_coords_original >= 0)
|
366
|
+
& (y_coords_original < self.size[1])
|
367
|
+
& (x_coords_original >= 0)
|
368
|
+
& (x_coords_original < self.size[0])
|
369
|
+
)
|
370
|
+
original_colors = img[y_coords, x_coords]
|
371
|
+
tinted_colors = (1 - alpha) * original_colors + alpha * agent_color
|
372
|
+
img = img.at[y_coords, x_coords].set(
|
373
|
+
jnp.where(
|
374
|
+
in_bounds[..., None], tinted_colors, img[y_coords, x_coords]
|
375
|
+
)
|
376
|
+
)
|
377
|
+
else:
|
378
|
+
y_coords = jnp.mod(y_coords_original, self.size[1])
|
379
|
+
x_coords = jnp.mod(x_coords_original, self.size[0])
|
380
|
+
original_colors = img[y_coords, x_coords]
|
381
|
+
tinted_colors = (1 - alpha) * original_colors + alpha * agent_color
|
382
|
+
img = img.at[y_coords, x_coords].set(tinted_colors)
|
369
383
|
|
370
384
|
# Agent color
|
371
385
|
img = img.at[state.pos[1], state.pos[0]].set(jnp.array(AGENT.color))
|
foragax/registry.py
CHANGED
@@ -49,6 +49,13 @@ ENV_CONFIGS: Dict[str, Dict[str, Any]] = {
|
|
49
49
|
),
|
50
50
|
"nowrap": True,
|
51
51
|
},
|
52
|
+
"ForagaxWeather-v3": {
|
53
|
+
"size": None,
|
54
|
+
"aperture_size": None,
|
55
|
+
"objects": None,
|
56
|
+
"biomes": None,
|
57
|
+
"nowrap": True,
|
58
|
+
},
|
52
59
|
"ForagaxTwoBiome-v1": {
|
53
60
|
"size": (15, 15),
|
54
61
|
"aperture_size": None,
|
@@ -133,6 +140,13 @@ ENV_CONFIGS: Dict[str, Dict[str, Any]] = {
|
|
133
140
|
),
|
134
141
|
"nowrap": True,
|
135
142
|
},
|
143
|
+
"ForagaxTwoBiome-v7": {
|
144
|
+
"size": None,
|
145
|
+
"aperture_size": None,
|
146
|
+
"objects": (BROWN_MOREL_2, BROWN_OYSTER, GREEN_DEATHCAP_3, GREEN_FAKE_2),
|
147
|
+
"biomes": None,
|
148
|
+
"nowrap": True,
|
149
|
+
},
|
136
150
|
"ForagaxTwoBiomeSmall-v1": {
|
137
151
|
"size": (16, 8),
|
138
152
|
"aperture_size": None,
|
@@ -197,13 +211,52 @@ def make(
|
|
197
211
|
raise ValueError(f"Unknown env_id: {env_id}")
|
198
212
|
|
199
213
|
config = ENV_CONFIGS[env_id].copy()
|
200
|
-
|
214
|
+
if isinstance(aperture_size, int):
|
215
|
+
aperture_size = (aperture_size, aperture_size)
|
201
216
|
config["aperture_size"] = aperture_size
|
202
217
|
if nowrap is not None:
|
203
218
|
config["nowrap"] = nowrap
|
204
219
|
|
220
|
+
if env_id == "ForagaxTwoBiome-v7":
|
221
|
+
margin = aperture_size[1] // 2 + 1
|
222
|
+
width = 2 * margin + 9
|
223
|
+
config["size"] = (width, 15)
|
224
|
+
config["biomes"] = (
|
225
|
+
# Morel biome
|
226
|
+
Biome(
|
227
|
+
start=(margin, 0),
|
228
|
+
stop=(margin + 2, 15),
|
229
|
+
object_frequencies=(0.25, 0.0, 0.5, 0.0),
|
230
|
+
),
|
231
|
+
# Oyster biome
|
232
|
+
Biome(
|
233
|
+
start=(margin + 7, 0),
|
234
|
+
stop=(margin + 9, 15),
|
235
|
+
object_frequencies=(0.0, 0.25, 0.0, 0.5),
|
236
|
+
),
|
237
|
+
)
|
238
|
+
|
239
|
+
if env_id == "ForagaxWeather-v3":
|
240
|
+
margin = aperture_size[1] // 2 + 1
|
241
|
+
width = 2 * margin + 9
|
242
|
+
config["size"] = (15, width)
|
243
|
+
config["biomes"] = (
|
244
|
+
# Hot biome
|
245
|
+
Biome(
|
246
|
+
start=(0, margin),
|
247
|
+
stop=(15, margin + 2),
|
248
|
+
object_frequencies=(0.5, 0.0),
|
249
|
+
),
|
250
|
+
# Cold biome
|
251
|
+
Biome(
|
252
|
+
start=(0, margin + 7),
|
253
|
+
stop=(15, margin + 9),
|
254
|
+
object_frequencies=(0.0, 0.5),
|
255
|
+
),
|
256
|
+
)
|
257
|
+
|
205
258
|
if env_id.startswith("ForagaxWeather"):
|
206
|
-
same_color = env_id
|
259
|
+
same_color = env_id in ("ForagaxWeather-v2", "ForagaxWeather-v3")
|
207
260
|
hot, cold = create_weather_objects(file_index=file_index, same_color=same_color)
|
208
261
|
config["objects"] = (hot, cold)
|
209
262
|
|
File without changes
|
File without changes
|
File without changes
|