TypeError Traceback (most recent call last)
Cell In[9], line 12
10 path = dirname(path) + f'/Simulator/Scenarios/scenario_files/Scenario1.yaml'
11 sg = FileReaderScenarioGenerator(path)
---> 12 env = CybORG(scenario_generator=sg)
14 env = CybORG(sg)
16 results = env.reset(agent='Red')
File e:\jupyter notebook\cyborg\cyborg\CybORG\env.py:80, in CybORG.__init__(self, scenario_generator, environment, env_config, agents, seed)
78 else:
79 self.np_random = seed
---> 80 self.environment_controller = self._create_env_controller(env_config, agents)
File e:\jupyter notebook\cyborg\cyborg\CybORG\env.py:95, in CybORG._create_env_controller(self, env_config, agents)
93 if self.env == 'sim':
94 from CybORG.Simulator.SimulationController import SimulationController
---> 95 return SimulationController(self.scenario_generator, agents, self.np_random)
96 raise NotImplementedError(
97 f"Unsupported environment '{self.env}'. Currently supported "
98 f"environments are: {self.supported_envs}"
99 )
File e:\jupyter notebook\cyborg\cyborg\CybORG\Simulator\SimulationController.py:26, in SimulationController.__init__(self, scenario_generator, agents, np_random)
24 self.routeless_actions = []
25 self.blocked_actions = []
---> 26 super().__init__(scenario_generator, agents, np_random)
File e:\jupyter notebook\cyborg\cyborg\CybORG\Shared\EnvironmentController.py:49, in EnvironmentController.__init__(self, scenario_generator, agents, np_random)
47 self.scenario_generator = scenario_generator
48 self.np_random = np_random
---> 49 scenario = scenario_generator.create_scenario(np_random)
50 self._create_environment(scenario)
51 self.max_bandwidth = scenario.max_bandwidth
File e:\jupyter notebook\cyborg\cyborg\CybORG\Simulator\Scenarios\FileReaderScenarioGenerator.py:74, in FileReaderScenarioGenerator.create_scenario(self, np_random)
73 def create_scenario(self, np_random) -> Scenario:
---> 74 scenario = copy.deepcopy(self.scenario)
76 count = 0
77 # randomly generate subnets cidrs for all subnets in scenario and IP addresses for all hosts in those subnets and create Subnet objects
78 # using fixed size subnets (VLSM maybe viable alternative if required)
File e:\Anaconda3\envs\cyborg\lib\copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File e:\Anaconda3\envs\cyborg\lib\copy.py:270, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
268 if state is not None:
269 if deep:
--> 270 state = deepcopy(state, memo)
271 if hasattr(y, '__setstate__'):
272 y.__setstate__(state)
File e:\Anaconda3\envs\cyborg\lib\copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File e:\Anaconda3\envs\cyborg\lib\copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
File e:\Anaconda3\envs\cyborg\lib\copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File e:\Anaconda3\envs\cyborg\lib\copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
File e:\Anaconda3\envs\cyborg\lib\copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File e:\Anaconda3\envs\cyborg\lib\copy.py:270, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
268 if state is not None:
269 if deep:
--> 270 state = deepcopy(state, memo)
271 if hasattr(y, '__setstate__'):
272 y.__setstate__(state)
File e:\Anaconda3\envs\cyborg\lib\copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File e:\Anaconda3\envs\cyborg\lib\copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
File e:\Anaconda3\envs\cyborg\lib\copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File e:\Anaconda3\envs\cyborg\lib\copy.py:270, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
268 if state is not None:
269 if deep:
--> 270 state = deepcopy(state, memo)
271 if hasattr(y, '__setstate__'):
272 y.__setstate__(state)
File e:\Anaconda3\envs\cyborg\lib\copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File e:\Anaconda3\envs\cyborg\lib\copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
File e:\Anaconda3\envs\cyborg\lib\copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File e:\Anaconda3\envs\cyborg\lib\copy.py:264, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
262 if deep and args:
263 args = (deepcopy(arg, memo) for arg in args)
--> 264 y = func(*args)
265 if deep:
266 memo[id(x)] = y
TypeError: _generator_ctor() takes from 0 to 1 positional arguments but 2 were given
I tried to construct CybORG with DroneSwarmScenarioGenerator and it works correctly. I guess the way the environment is constructed using YAML files does not match the existing implementation. I would greatly appreciate if someone could tell me what is wrong with it.