Exemplo n.º 1
0
 def step(self, actions: List[ActionInt]):
     for agent in self.agents:
         agent.starting_actual_phase = agent.actual_phase
     self.A.append(start_A())
     self._pass_actions_to_agents(actions)
     self._modify_A()
     Globals().time += 1
     self._execute_phase()
     self.save_motions()
     rewards = self.count_rewards()
     for agent in self.agents:
         agent.remember(densities=self.x[self.t], reward=rewards[agent.index])
     self.global_rewards.append(rewards)
     self._count_cars_out()
     self.remember_memory()
Exemplo n.º 2
0
 def step(self, actions: List[ActionInt]):
     for agent in self.agents:
         agent.starting_actual_phase = agent.actual_phase
     self.A.append(start_A())
     # self.x[0] = [i for i in range(40)] # w envie dodac!
     self._pass_actions_to_agents(actions)
     self._modify_A()
     # self.update_global_memory_lights()
     Globals().time += 1
     self._execute_phase()
     # self.x[self.t] = [i for i in range(40)] # w envie dodac!
     self.save_motions()
     # rewards = self.count_rewards_negative()
     rewards = self.count_rewards()
     for agent in self.agents:
         agent.remember(densities=self.x[self.t],
                        reward=rewards[agent.index])
     self.global_rewards.append(rewards)
     self._count_cars_out()
     self.remember_memory()