liveBook · Manning

Trajectory

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

A sequence of states and actions generated during an agent's interaction with an environment.

A trajectory is the ordered record of an agent’s interaction with an environment: τ = (s0, a0, s1, a1, ...). Each step pairs the current state with an action and leads to another state. Trajectories, also called episodes or rollouts, provide the experience used to judge a policy through cumulative reward. section 12.1.2

From treasure hunting to CartPole

In Reach the Treasure, an agent starts in state 2 and chooses left or right until it reaches treasure, falls into a fire pit, or exits. A resulting trajectory records each visited state and selected action, while rewards of +10, −10, or +4 indicate the outcome. In CartPole, the same idea becomes a longer interaction: each trajectory contains observations, sampled actions, rewards, and termination information while the agent tries to keep the pole upright. section 12.1.2 section 12.3

A practical rollout loop records experience step by step:

  • Reset the environment and obtain the initial state or observation. section 12.3
  • Use the policy to produce action probabilities, sample an action, and advance the environment. section 12.3
  • Store the reward and next state, update learning statistics, and stop when the episode ends. section 12.3
Figure 12.3 An agent learns through interaction with the environment.

Use the interaction diagram to connect states, actions, rewards, and environment transitions into a complete rollout. section 12.1.2

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines the state-action sequence and demonstrates collection through reset, action selection, stepping, reward accumulation, and termination.
Examples
Uses Reach the Treasure and CartPole episodes to illustrate discrete outcomes, observations, rewards, actions, and termination.
What it assumes
Assumes basic familiarity with reinforcement learning environments, policies, states, actions, and rewards.
What you can do after
Apply it by collecting environment transitions, tracking episode rewards, and inspecting rollout statistics during A2C or PPO training.
How it connects
Links trajectories to reinforcement learning, Markov decision processes, policies, states, actions, rewards, episodes, rollouts, and expected return.

Also explained in

Compare how 19 books explain trajectory →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.