Skip to content

Commit

Permalink
feat: full lbf implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
WiemKhlifi committed Jan 18, 2024
1 parent bd490e6 commit d7a78ea
Show file tree
Hide file tree
Showing 30 changed files with 2,311 additions and 1,450 deletions.
3 changes: 2 additions & 1 deletion jumanji/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@
# TSP with 20 randomly generated cities and a dense reward function.
register(id="TSP-v1", entry_point="jumanji.environments:TSP")

# LevelBasedForaging on 10x10 grid with 3 agents and 3 foods
# LevelBasedForaging with a random generator with 8 grid size,
# 2 agents and 2 foods and maximum agent's level is 2.
register(
id="LevelBasedForaging-v0", entry_point="jumanji.environments:LevelBasedForaging"
)
3 changes: 2 additions & 1 deletion jumanji/environments/routing/lbf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
# limitations under the License.

from jumanji.environments.routing.lbf.env import LevelBasedForaging
from jumanji.environments.routing.lbf.types import Observation, State
from jumanji.environments.routing.lbf.observer import GridObserver, VectorObserver
from jumanji.environments.routing.lbf.types import Agent, Food, Observation, State
141 changes: 0 additions & 141 deletions jumanji/environments/routing/lbf/conftest.py

This file was deleted.

24 changes: 11 additions & 13 deletions jumanji/environments/routing/lbf/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@
# limitations under the License.
import jax.numpy as jnp

# Observations
EMPTY = 0
FOOD = 1
AGENT = 2

# Actions
NOOP = 0
UP = 1
RIGHT = 2
DOWN = 3
LEFT = 4
DOWN = 2
LEFT = 3
RIGHT = 4
LOAD = 5

# No-op, Up, Right, Down, Left, Load
MOVES = jnp.array([[0, 0], [-1, 0], [0, 1], [1, 0], [0, -1], [0, 0]])
# NOOP, UP, DOWN, LEFT, RIGHT, LOAD
MOVES = jnp.array([[0, 0], [-1, 0], [1, 0], [0, -1], [0, 1], [0, 0]])

# viewer constants
_FIGURE_SIZE = (5, 5)

# Rendering
VIEWER_WIDTH = 1000
VIEWER_HEIGHT = 1000
# Define some colors for visualization.
_GRID_COLOR = (0, 0, 0) # black
_LINE_COLOR = (1, 1, 1) # white
Loading

0 comments on commit d7a78ea

Please sign in to comment.