mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-05 17:11:35 +02:00
Results resolved. Small ADjustments
This commit is contained in:
@ -12,15 +12,12 @@ from marl_factory_grid.utils import helpers as h
|
||||
class MachineAction(Action):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(m.MACHINE_ACTION)
|
||||
super().__init__(m.MACHINE_ACTION, m.MAINTAIN_VALID, m.MAINTAIN_FAIL)
|
||||
|
||||
def do(self, entity, state) -> Union[None, ActionResult]:
|
||||
if machine := h.get_first(state[m.MACHINES].by_pos(entity.pos)):
|
||||
if valid := machine.maintain():
|
||||
return ActionResult(entity=entity, identifier=self._identifier, validity=valid, reward=marl_factory_grid.modules.machines.constants.MAINTAIN_VALID)
|
||||
else:
|
||||
return ActionResult(entity=entity, identifier=self._identifier, validity=valid, reward=marl_factory_grid.modules.machines.constants.MAINTAIN_FAIL)
|
||||
valid = machine.maintain()
|
||||
return self.get_result(valid, entity)
|
||||
|
||||
else:
|
||||
return ActionResult(entity=entity, identifier=self._identifier,
|
||||
validity=c.NOT_VALID, reward=marl_factory_grid.modules.machines.constants.MAINTAIN_FAIL
|
||||
)
|
||||
return self.get_result(c.NOT_VALID, entity)
|
||||
|
Reference in New Issue
Block a user