liveBook · Manning

Reset function

As explained in Applied Reinforcement Learning

An environment method that initializes a new episode and returns its initial observation or state.

A reset function starts a new reinforcement-learning episode by restoring the environment’s initial state and returning the first state for the agent to observe. section 3.1

For warehouse picking, reset places the robot at the depot, marks every item uncollected, clears the collection phase, and sets the step counter to zero. section 3.2

Listing 3.3 State Representation and Reset Logic
    def _get_state(self): #A
        return { #A
            "robot_pos": tuple(self.robot_pos), #A
            "items_picked": tuple(self.items_picked_status), #A
            "all_items_collected_phase": self.all_items_collected_phase 
        } #A
 
    def reset(self): #B
        self.robot_pos = np.array(self.depot_pos) #C
        self.items_picked_status = [False] * self.num_items #D
        self.all_items_collected_phase = False #E
        self.current_step = 0 #F
        return self._get_state() #G

See the warehouse state representation and reset implementation. section 3.2

How Applied Reinforcement Learning covers it

How deep it goes
Shows reset logic that clears episode variables and returns state, without detailing lower-level implementation internals.
Examples
Resets a warehouse robot to the depot with items uncollected and the step counter cleared.
What you can do after
Build a reset method that restores an environment’s initial state and returns it to the agent.
How it connects
Connects environment reset to episodes, states, and observations in reinforcement learning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Applied Reinforcement Learning. The section links point to the parts of the book it draws on.