This commit is contained in:
Chanumask
2023-12-01 11:51:15 +01:00
parent ab9fb8cd08
commit 24221f90d1
5 changed files with 8 additions and 5 deletions

View File

@ -152,7 +152,7 @@ class SpawnDestinationOnAgent(Rule):
"""
super().__init__()
def on_reset(self, state: Gamestate):
def on_reset(self, state):
state.print("Spawn Desitnations")
for agent in state[c.AGENT]:
destination = Destination(agent.pos, bind_to=agent)

View File

@ -1,34 +0,0 @@
from pathlib import Path
from random import randint
from tqdm import trange
from marl_factory_grid.algorithms.static.TSP_dirt_agent import TSPDirtAgent
from marl_factory_grid.environment.factory import Factory
if __name__ == '__main__':
# Render at each step?
render = True
# Path to config File
path = Path('test_config.yaml')
# Env Init
factory = Factory(path)
for episode in trange(5):
_ = factory.reset()
done = False
if render:
factory.render()
action_spaces = factory.action_space
agents = [TSPDirtAgent(factory, 0)]
while not done:
a = [randint(0, x.n - 1) for x in action_spaces]
obs_type, _, _, done, info = factory.step(a)
if render:
factory.render()
if done:
print(f'Episode {episode} done...')
break

View File

@ -152,9 +152,12 @@ class FactoryConfigParser(object):
except AttributeError:
class_or_classes = locate_and_import_class(action, self.custom_modules_path)
try:
# print(action)
parsed_actions.extend(class_or_classes)
# print(parsed_actions)
for actions_class in class_or_classes:
conf_kwargs[actions_class.__name__] = conf_kwargs[action]
# break
conf_kwargs[actions_class.__name__] = conf_kwargs.get(action, {})
except TypeError:
parsed_actions.append(class_or_classes)