Merge branch 'main' into refactor_rename

# Conflicts:
#	marl_factory_grid/modules/clean_up/groups.py
#	marl_factory_grid/modules/clean_up/rules.py
#	marl_factory_grid/modules/destinations/rules.py
This commit is contained in:
Chanumask
2023-10-27 13:12:54 +02:00
31 changed files with 332 additions and 105 deletions

View File

@@ -1,4 +1,4 @@
from .actions import DoorUse
from .entitites import Door, DoorIndicator
from .groups import Doors
from .rules import DoorAutoClose, DoorIndicateArea
from .rules import DoDoorAutoClose, IndicateDoorAreaInObservation

View File

@@ -1,13 +1,19 @@
from marl_factory_grid.environment.rules import Rule
from marl_factory_grid.environment import constants as c
from marl_factory_grid.environment.rules import Rule
from marl_factory_grid.utils.results import TickResult
from . import constants as d
from .entitites import DoorIndicator
class DoorAutoClose(Rule):
class DoDoorAutoClose(Rule):
def __init__(self, close_frequency: int = 10):
"""
This rule closes doors, that have been opened automatically, when no entity is blocking the position.
:type close_frequency: int
:param close_frequency: How many ticks after opening, should the door close?
"""
super().__init__()
self.close_frequency = close_frequency
@@ -22,9 +28,16 @@ class DoorAutoClose(Rule):
return []
class DoorIndicateArea(Rule):
class IndicateDoorAreaInObservation(Rule):
def __init__(self):
"""
Whether to add an indicator aka place a value around doors (within the door tile), for agents to see.
This could improve learning.
"""
# Todo: Discuss if this rather be a single entity with a standalone observation.
# Could then be combined with the "Combine"-approach.
super().__init__()
def on_init(self, state, lvl_map):