code: def _oneInteraction(self):
          
          self.stepid += 1
  
          logger.info("Entering simulation period %d." % self.stepid)
  
          # Apply branches outages.
          if self.branchOutages is not None:
              self.doOutages()
  
          # Initialise the market.
          self.market.reset()
  
          # Get an action from each agent and perform it.
          for task, agent in zip(self.tasks, self.agents):
  #            if self.do_optimisation[agent]:
  #                raise Exception("When using a black-box learning algorithm, "
  #                                "only full episodes can be done.")
  
  #            if not task.isFinished():
              observation = task.getObservation()
              agent.integrateObservation(observation)
  
              action = agent.getAction()
              task.performAction(action)
  
          # Clear the market.
          self.market.run()
  
          # Reward each agent appropriately.
          for task, agent in zip(self.tasks, self.agents):
  #            if not task.isFinished():
              reward = task.getReward()
              agent.giveReward(reward)
  
          # Scale loads.
          c = self._pcycle.next()
          for bus in self.market.case.buses:
              bus.p_demand = self.pdemand[bus] * c
  
          logger.info("")
docs: Coordinates one interaction between each agent and its environment.