from collections import defaultdict
from shasta.base_experiment import BaseExperiment
from .actions import SimpleActionDecoder
from .custom_primitive import FormationWithPlanning
from .states import StatesExtractor
def group_actors_by_type(actor_groups):
actor_type = defaultdict(list)
for key, value in sorted(actor_groups.items()):
actor_type[value[0].type].extend(value)
return actor_type
class SearchingExperiment(BaseExperiment):
def init(self, config, core, experiment_config=None, *args, *kargs):
super().init(config, core, experiment_config, args, **kargs)
self.state_extractor = StatesExtractor(experiment_config, core)
self.actions_decoder = SimpleActionDecoder(experiment_config)
self.actions = {}
env_map = core.get_map()
for i in range(6):
self.actions[i] = FormationWithPlanning(env_map)
Description
I was going through the tutorials from the website "https://ub-nsf-hsi.github.io/shasta-ub/html/tutorials/custom_experiments.html but while trying to run the code of custom experiment, I kept getting errors.
What I Did
from collections import defaultdict from shasta.base_experiment import BaseExperiment from .actions import SimpleActionDecoder from .custom_primitive import FormationWithPlanning from .states import StatesExtractor
def group_actors_by_type(actor_groups): actor_type = defaultdict(list) for key, value in sorted(actor_groups.items()): actor_type[value[0].type].extend(value) return actor_type
class SearchingExperiment(BaseExperiment): def init(self, config, core, experiment_config=None, *args, *kargs): super().init(config, core, experiment_config, args, **kargs) self.state_extractor = StatesExtractor(experiment_config, core) self.actions_decoder = SimpleActionDecoder(experiment_config) self.actions = {} env_map = core.get_map() for i in range(6): self.actions[i] = FormationWithPlanning(env_map)
Here is the error below:
ModuleNotFoundError Traceback (most recent call last) in <cell line: 2>()
1 from collections import defaultdict
----> 2 from shasta.base_experiment import BaseExperiment
3 from .actions import SimpleActionDecoder
4 from .custom_primitive import FormationWithPlanning
5 from .states import StatesExtractor
ModuleNotFoundError: No module named 'shasta.base_experiment'