Skip to content

Commit

Permalink
changed defaults for xland
Browse files Browse the repository at this point in the history
  • Loading branch information
Howuhh committed Dec 22, 2023
1 parent 7ade354 commit d1a4e36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/xminigrid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .registration import make, register, registered_environments

# TODO: add __all__
__version__ = "0.3.0"
__version__ = "0.4.0"

# ---------- XLand-MiniGrid environments ----------
# TODO: reconsider grid sizes and time limits after the benchmarks are generated.
Expand Down
10 changes: 7 additions & 3 deletions src/xminigrid/envs/xland.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ class XLandMiniGridEnvOptions(EnvParams):

class XLandMiniGrid(Environment):
def default_params(self, **kwargs) -> XLandMiniGridEnvOptions:
return XLandMiniGridEnvOptions().replace(**kwargs)
default_params = XLandMiniGridEnvOptions(view_size=5)
return default_params.replace(**kwargs)

def time_limit(self, params: XLandMiniGridEnvOptions) -> int:
# TODO: seems like it is too much for simple problems.
return len(params.ruleset.init_tiles) * (params.height * params.width)
# this is just a heuristic to prevent brute force in one episode,
# agent need to remember what he tried in previous episodes.
# If this is too small, just increase number of trials.
coef = len(params.ruleset.init_tiles) // 3
return coef * (params.height * params.width)

def _generate_problem(self, params: XLandMiniGridEnvOptions, key: jax.Array) -> State:
# WARN: we can make this compatible with jit (to vmap on different layouts during training),
Expand Down

0 comments on commit d1a4e36

Please sign in to comment.