Taxi#

_static/videos/toy_text/taxi.gif

This environment is part of the Toy Text environments. Please read that page first for general information.

Action Space

Discrete(6)

Observation Space

Discrete(500)

Import

gym.make("Taxi-v3")

The Taxi Problem from “Hierarchical Reinforcement Learning with the MAXQ Value Function Decomposition” by Tom Dietterich

Description#

There are four designated locations in the grid world indicated by R(ed), G(reen), Y(ellow), and B(lue). When the episode starts, the taxi starts off at a random square and the passenger is at a random location. The taxi drives to the passenger’s location, picks up the passenger, drives to the passenger’s destination (another one of the four specified locations), and then drops off the passenger. Once the passenger is dropped off, the episode ends.

Map:

+---------+
|R: | : :G|
| : | : : |
| : : : : |
| | : | : |
|Y| : |B: |
+---------+

Actions#

There are 6 discrete deterministic actions:

  • 0: move south

  • 1: move north

  • 2: move east

  • 3: move west

  • 4: pickup passenger

  • 5: drop off passenger

Observations#

There are 500 discrete states since there are 25 taxi positions, 5 possible locations of the passenger (including the case when the passenger is in the taxi), and 4 destination locations.

Note that there are 400 states that can actually be reached during an episode. The missing states correspond to situations in which the passenger is at the same location as their destination, as this typically signals the end of an episode. Four additional states can be observed right after a successful episodes, when both the passenger and the taxi are at the destination. This gives a total of 404 reachable discrete states.

Passenger locations:

  • 0: R(ed)

  • 1: G(reen)

  • 2: Y(ellow)

  • 3: B(lue)

  • 4: in taxi

Destinations:

  • 0: R(ed)

  • 1: G(reen)

  • 2: Y(ellow)

  • 3: B(lue)

Rewards#

  • -1 per step unless other reward is triggered.

  • +20 delivering passenger.

  • -10 executing “pickup” and “drop-off” actions illegally.

Rendering#

  • blue: passenger

  • magenta: destination

  • yellow: empty taxi

  • green: full taxi

  • other letters (R, G, Y and B): locations for passengers and destinations state space is represented by: (taxi_row, taxi_col, passenger_location, destination)

Arguments#

gym.make('Taxi-v3')

Version History#

  • v3: Map Correction + Cleaner Domain Description

  • v2: Disallow Taxi start location = goal location, Update Taxi observations in the rollout, Update Taxi reward threshold.

  • v1: Remove (3,2) from locs, add passidx<4 check

  • v0: Initial versions release