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):
|
if maintainer._closed_door_in_path(state):
|
||||||
self.assertEqual(maintainer.get_move_action(state).name, 'use_door')
|
self.assertEqual(maintainer.get_move_action(state).name, 'use_door')
|
||||||
|
|
||||||
if maintainer._path:
|
elif maintainer._path:
|
||||||
# can move
|
# can move
|
||||||
print(maintainer.move(maintainer._path[1], state)) # 0 immer false ausser schritt 1, 1 meistens true nicht immer
|
# print(maintainer.move(maintainer._path[1], state))
|
||||||
# self.assertTrue(maintainer.move(maintainer._path[1], state))
|
self.assertTrue(maintainer.move(maintainer._path[1], state))
|
||||||
|
|
||||||
else:
|
if not maintainer._path:
|
||||||
# finds valid targets oder hier?
|
# finds valid targets when at target location
|
||||||
route = maintainer.calculate_route(maintainer._last[-1], state.flootile_graph)
|
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])]:
|
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))
|
self.assertTrue(any(isinstance(e, Machine) for e in entities_at_target_location))
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def tick_post_step(self, state) -> List[TickResult]:
|
def tick_post_step(self, state) -> List[TickResult]:
|
||||||
@ -73,12 +72,11 @@ class MaintainerTest(Test):
|
|||||||
if maintainer._path:
|
if maintainer._path:
|
||||||
# if action was door use: was door opened successfully?
|
# if action was door use: was door opened successfully?
|
||||||
if maintainer._closed_door_in_path(state):
|
if maintainer._closed_door_in_path(state):
|
||||||
# print(maintainer.get_move_action(state))
|
|
||||||
door = next(
|
door = next(
|
||||||
(entity for entity in state.entities.by_pos(maintainer._path[0]) if isinstance(entity, Door)),
|
(entity for entity in state.entities.by_pos(maintainer._path[0]) if isinstance(entity, Door)),
|
||||||
None)
|
None)
|
||||||
self.assertEqual(door.is_open, True)
|
self.assertEqual(door.is_open, True)
|
||||||
|
# when stepping off machine, did maintain action work?
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Agents:
|
|||||||
Wolfgang:
|
Wolfgang:
|
||||||
Actions:
|
Actions:
|
||||||
- Noop
|
- Noop
|
||||||
- BtryCharge
|
- Charge
|
||||||
- CleanUp
|
- CleanUp
|
||||||
- DestAction
|
- DestAction
|
||||||
- DoorUse
|
- DoorUse
|
||||||
@ -58,7 +58,7 @@ General:
|
|||||||
level_name: large
|
level_name: large
|
||||||
pomdp_r: 3
|
pomdp_r: 3
|
||||||
verbose: false
|
verbose: false
|
||||||
tests: false
|
tests: true
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
# Environment Dynamics
|
# Environment Dynamics
|
||||||
|
Loading…
x
Reference in New Issue
Block a user