mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-05 17:11:35 +02:00
fixes
This commit is contained in:
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user