mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-05-23 07:16:44 +02:00
maintainer test continued
This commit is contained in:
parent
0f6ede3f1f
commit
3a7b727ec6
@ -55,17 +55,16 @@ class MaintainerTest(Test):
|
||||
if maintainer._closed_door_in_path(state):
|
||||
self.assertEqual(maintainer.get_move_action(state).name, 'use_door')
|
||||
|
||||
if maintainer._path:
|
||||
elif maintainer._path:
|
||||
# can move
|
||||
print(maintainer.move(maintainer._path[1], state)) # 0 immer false ausser schritt 1, 1 meistens true nicht immer
|
||||
# self.assertTrue(maintainer.move(maintainer._path[1], state))
|
||||
# print(maintainer.move(maintainer._path[1], state))
|
||||
self.assertTrue(maintainer.move(maintainer._path[1], state))
|
||||
|
||||
else:
|
||||
# finds valid targets oder hier?
|
||||
route = maintainer.calculate_route(maintainer._last[-1], state.flootile_graph)
|
||||
if not maintainer._path:
|
||||
# finds valid targets when at target location
|
||||
route = maintainer.calculate_route(maintainer._last[-1], state.floortile_graph)
|
||||
if entities_at_target_location := [entity for entity in state.entities.by_pos(route[-1])]:
|
||||
self.assertTrue(any(isinstance(e, Machine) for e in entities_at_target_location))
|
||||
|
||||
return []
|
||||
|
||||
def tick_post_step(self, state) -> List[TickResult]:
|
||||
@ -73,12 +72,11 @@ class MaintainerTest(Test):
|
||||
if maintainer._path:
|
||||
# if action was door use: was door opened successfully?
|
||||
if maintainer._closed_door_in_path(state):
|
||||
# print(maintainer.get_move_action(state))
|
||||
door = next(
|
||||
(entity for entity in state.entities.by_pos(maintainer._path[0]) if isinstance(entity, Door)),
|
||||
None)
|
||||
self.assertEqual(door.is_open, True)
|
||||
|
||||
# when stepping off machine, did maintain action work?
|
||||
return []
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ Agents:
|
||||
Wolfgang:
|
||||
Actions:
|
||||
- Noop
|
||||
- BtryCharge
|
||||
- Charge
|
||||
- CleanUp
|
||||
- DestAction
|
||||
- DoorUse
|
||||
@ -58,7 +58,7 @@ General:
|
||||
level_name: large
|
||||
pomdp_r: 3
|
||||
verbose: false
|
||||
tests: false
|
||||
tests: true
|
||||
|
||||
Rules:
|
||||
# Environment Dynamics
|
||||
|
Loading…
x
Reference in New Issue
Block a user