Equalize rendering for TSP and RL agents

This commit is contained in:
Julian Schönberger
2024-05-24 18:54:38 +02:00
parent c8336e8f78
commit 6e6ce9dc5d
4 changed files with 32 additions and 5 deletions

View File

@@ -80,11 +80,14 @@ def run_tsp_setting(config_name, emergent_phenomenon):
break
while not done:
a = [x.predict() for x in agents]
# Have this condition, to terminate as soon as all dirt piles are collected. This ensures that the implementation
# of the TSP agent is equivalent to that of the RL agent
if 'DirtPiles' in list(factory.state.entities.keys()) and factory.state.entities['DirtPiles'].global_amount == 0.0:
break
obs_type, _, _, done, info = factory.step(a)
if render:
factory.render()
if done:
print(f'Episode {episode} done...')
break