parameters: (self)
docstring: Start a new episode.
docstring_summary: Start a new episode.
docstring_tokens: Start a new episode .
function: def reset(self):
      """Start a new episode."""
      reset_time = time.time()
      logging.info('reset: seed %d, previous episode (%d frames) lasted %f sec',
                   self._seed, self._frame_count, reset_time - self._prev_reset)
      self._prev_reset = reset_time
      self._prev_reward = 0
      self._prev_action = self._action_set[0]
      self._frame_count = 0
      self._episode_id += 1
      if self._sample_graph_depth:
        max_depth = np.random.randint(self._min_graph_depth,
                                      self._max_graph_depth + 1)
        self._engine.SetGraphDepth(self._min_graph_depth, max_depth)
  
      self._engine.InitEpisode(self._episode_id, self._seed)
  
      # Build a new graph if we don't have one yet.
      if not self._current_pano_id:
        if self._full_graph:
          self._current_pano_id = self._engine.BuildEntireGraph()
        elif self._start_pano_id:
          self._current_pano_id = self._engine.BuildGraphWithRoot(
              self._start_pano_id)
        else:
          self._current_pano_id = self._engine.BuildRandomGraph()
        logging.info('seed %d: built new graph with root %s',
                     self._seed, self._current_pano_id)
      # else respawn in current graph.
      elif not self._start_pano_id:
        self._current_pano_id = np.random.choice(
            list(self._engine.GetGraph().keys()))
        self._engine.SetPosition(self._current_pano_id)
        logging.info('seed %d: reusing existing graph and respawning at %s',
                     self._seed, self._current_pano_id)
  
      self._graph = self._engine.GetGraph()
      highlighted_panos = self._game.on_reset(self)
      self._engine.InitGraphRenderer(self._color_for_observer, highlighted_panos,
                                     self._black_on_white)
      self._engine.SetZoom(_MAX_ZOOM)
function_tokens: def reset ( self ) : reset_time = time . time ( ) logging . info ( 'reset: seed %d, previous episode (%d frames) lasted %f sec' , self . _seed , self . _frame_count , reset_time - self . _prev_reset ) self . _prev_reset = reset_time self . _prev_reward = 0 self . _prev_action = self . _action_set [ 0 ] self . _frame_count = 0 self . _episode_id += 1 if self . _sample_graph_depth : max_depth = np . random . randint ( self . _min_graph_depth , self . _max_graph_depth + 1 ) self . _engine . SetGraphDepth ( self . _min_graph_depth , max_depth ) self . _engine . InitEpisode ( self . _episode_id , self . _seed ) # Build a new graph if we don't have one yet. if not self . _current_pano_id : if self . _full_graph : self . _current_pano_id = self . _engine . BuildEntireGraph ( ) elif self . _start_pano_id : self . _current_pano_id = self . _engine . BuildGraphWithRoot ( self . _start_pano_id ) else : self . _current_pano_id = self . _engine . BuildRandomGraph ( ) logging . info ( 'seed %d: built new graph with root %s' , self . _seed , self . _current_pano_id ) # else respawn in current graph. elif not self . _start_pano_id : self . _current_pano_id = np . random . choice ( list ( self . _engine . GetGraph ( ) . keys ( ) ) ) self . _engine . SetPosition ( self . _current_pano_id ) logging . info ( 'seed %d: reusing existing graph and respawning at %s' , self . _seed , self . _current_pano_id ) self . _graph = self . _engine . GetGraph ( ) highlighted_panos = self . _game . on_reset ( self ) self . _engine . InitGraphRenderer ( self . _color_for_observer , highlighted_panos , self . _black_on_white ) self . _engine . SetZoom ( _MAX_ZOOM )