Press Ctrl+D to draw

Drawing Tools

Log in for saved annotations

1px

2.1  Problem Formulation and Task Models

In Chapter 1, we defined agents using the PEAS framework (Performance, Environment, Actuators, Sensors) and classified task environments by their properties. These abstractions help us think about what an agent should do. This chapter focuses on how to find good actions: problem-solving through search, planning, and constraint satisfaction.

The bridge from agent design to problem-solving is problem formulation: converting a task environment into a mathematical model that algorithms can operate on. Done well, formulation clarifies the problem and enables efficient solutions. Done poorly, it leads to intractable computation or incorrect behavior.

2.1.1 From PEAS to State-Space Models

Recall from Chapter 1 that a task environment is specified by PEAS. The environment component describes the world the agent operates in, but at a high levelβ€”"a warehouse with racks, robots, and charging stations." To solve problems algorithmically, we need a more precise representation.

First, we define states.

Definition 2.1  State

A state is a complete description of the world at a given moment, capturing all relevant information for decision-making and from which future states can be derived.

For example, in the warehouse environment, a state might include:

  • The robot's position and orientation
  • The locations of all items and racks
  • The battery level of the robot
  • The status of charging stations (occupied/free)

Next, we distinguish the state space from the search problem that operates over it.

Definition 2.2  State Space

The state space \(S\) is the set of all possible states the world can be in. A solution is a sequence of actions that transitions from an initial state to a goal state.

Definition 2.3  Search Problem

A search problem over a state space specifies:

  • An initial state \(s_0 \in S\)
  • A set of actions \(A(s)\) available in each state \(s\)
  • A transition model (successor function) \(T(s, a) \to s'\)
  • A goal test \(G(s)\) indicating whether \(s\) satisfies the objective
  • An optional path cost function \(c(s, a, s')\) to compare solutions

Depending on the transitioin model, this formulation can be deterministic or nondeterministic. However, full observability is assumed (i.e., the agent knows the current state). Later chapters relax these assumptions.

2.1.1.1 Example: Warehouse Navigation

Consider the warehouse robot from Chapter 1. A simple state-space model for navigation:

  • State space \(S\): each state is the robot's position \((x, y)\) on a grid, whether it carries an item, battery level, and locations of obstacles, pickup, and dropoff points.
  • Initial state \(s_0\): robot at some position, no item
  • Actions \(A(s) = \{\text{North}, \text{South}, \text{East}, \text{West}, \text{Pick}, \text{Drop}\}\) (subset available depending on \(s\))
  • Transition model:
    • Moving changes \((x, y)\) by 1 in the chosen direction if not blocked
    • Picking sets "carrying item" to true if at pickup location
    • Dropping sets "carrying item" to false if at dropoff location
  • Goal test: robot at dropoff location with item
  • Path cost: each action costs 1 time unit

This model abstracts away low-level control (motor commands, localization uncertainty) and focuses on discrete decisions. The abstraction is justified if the robot can reliably execute these actions.

2.1.1.2 Connecting PEAS and State-Space Models

The state-space model operationalizes components of PEAS:

  • Performance measure (PEAS) \(\to\) path cost function (state-space): e.g., minimize delivery time translates to cost = time per action
  • Environment (PEAS) \(\to\) state space + transition model (state-space): the grid layout and physics become states and transitions
  • Actuators/Sensors (PEAS) \(\to\) actions and observability (state-space): what the robot can do and perceive defines available actions and whether states are fully known

The state-space model is a design artifact derived from the PEAS specification. Different state-space formulations of the same task environment can lead to dramatically different computational complexity.

2.1.2 Levels of Abstraction: Paths, Plans, and Schedules

Not all problems require the same granularity. Engineers use different abstractions depending on the task:

2.1.2.1 Paths

Definition 2.4  Path

A path is a sequence of states connected by actions: \(s_0 \xrightarrow{a_0} s_1 \xrightarrow{a_1} \cdots \xrightarrow{a_{n-1}} s_n\). The path cost is \[\sum_{i=0}^{n-1} c(s_i, a_i, s_{i+1}).\]

Paths are appropriate when:

  • The goal is to reach a specific state or set of states
  • The sequence of states matters (e.g., navigating around obstacles)
  • Costs accumulate along the trajectory

Example: Finding the shortest route from the charging station to a pickup location in the warehouse is a path-finding problem. Algorithms like \(A^*\) and Dijkstra's operate on paths.

2.1.2.2 Plans

Definition 2.5  Plan

A plan is a sequence of actions (sometimes with partial ordering) that achieves a goal, possibly abstracting away the exact states visited. Plans often include preconditions and effects for each action.

Plans are appropriate when:

  • The state space is too large to enumerate explicitly
  • Actions have symbolic descriptions (e.g., "move item X to location Y")
  • You need flexible execution or can tolerate different state trajectories

Example: A high-level plan for the warehouse robot might be:

  1. Move to pickup location
  2. Pick item
  3. Move to dropoff location
  4. Drop item

This plan doesn't specify exact grid positions, leaving room for different paths depending on runtime conditions (e.g., obstacle avoidance).

2.1.2.3 Schedules

Definition 2.6  Schedule

A schedule is an assignment of tasks to resources (agents, machines) with temporal or resource constraints. Schedules typically optimize objectives like makespan (total time) or resource utilization.

Schedules are appropriate when:

  • Multiple agents or resources must be coordinated
  • Temporal constraints and deadlines matter
  • The problem is naturally an assignment task (who does what, when)

Example: Assigning five delivery jobs to three warehouse robots, respecting battery limits and time windows, is a scheduling problem. Constraint Satisfaction Problems (CSPs) are a common tool for scheduling.

2.1.2.4 Choosing the Right Abstraction

Abstraction Focus Typical Algorithms Example
Path State-to-state trajectories \(A^*\), Dijkstra, BFS Grid navigation
Plan Action sequences with logic STRIPS, GraphPlan Pick-and-place tasks
Schedule Resource allocation over time CSP, optimization Multi-robot coordination

Many engineering problems combine these: use scheduling to assign jobs, planning to decompose tasks, and path-finding for low-level execution.

2.1.3 Goal Tests, Constraints, and Performance Measures

Problem formulation requires clarity on what counts as success and what makes one solution better than another.

2.1.3.1 Goal Tests

A goal test defines when the problem is solved. It can be:

  • Explicit state: the robot must be at position \((10, 15)\) with an item
  • State properties: the robot has delivered all items and battery \(\geq 20\%\) (state not fully specified)
  • Trajectory properties: the robot visited checkpoints A, B, C in order

In the warehouse, the goal might be "all packages delivered" rather than a single state, since different end positions are acceptable.

2.1.3.2 Constraints

Constraints are hard requirements that solutions must satisfy:

  • Physical: the robot cannot pass through walls
  • Safety: battery must remain above 10%
  • Temporal: package P must be delivered before 3 PM

Constraints can be encoded in the transition model (e.g., blocking illegal transitions), in the goal test (reject solutions violating constraints), or as penalties in the cost function (soft constraints).

2.1.3.3 Performance Measures and Cost Functions

The performance measure (from PEAS) quantifies solution quality. The path cost function operationalizes this for search algorithms. Key considerations:

  1. Units and dimensions: costs must be additive and comparable; mixing time (seconds) and energy (joules) requires conversion or weighting
  2. Tradeoffs: minimizing time may increase energy use; a single cost function encodes tradeoffs via weights
  3. Domain knowledge: costs should reflect real system behavior; uniform step costs ignore that turning or climbing stairs is more expensive

Comment 2.1  Designing Cost Functions

Cost function design is an engineering decision with system-level consequences. A poorly chosen cost leads to brittle or unsafe behavior. Always validate cost models against real system performance.

2.1.4 Warehouse Variants: Cost Models

The warehouse navigation problem admits different cost models depending on objectives. Let's compare three formulations.

2.1.4.1 Variant 1: Minimize Time

Cost function: \(c(s, a, s') = t(a)\), where \(t(a)\) is the time to execute action \(a\).

  • Move actions: 1 time unit
  • Pick/drop: 2 time units
  • Turn: 0.5 time units (if modeling orientation)

Optimal solution: Shortest path in terms of time. Ignores energy use and wear-and-tear.

2.1.4.2 Variant 2: Minimize Energy

Cost function: \(c(s, a, s') = E(a, s)\), where \(E(a, s)\) is the energy consumed by action \(a\) in state \(s\).

  • Move with load: 3 energy units
  • Move without load: 1 energy unit
  • Pick/drop: 2 energy units

Optimal solution: May take longer paths to avoid carrying loads far. Useful for battery-limited systems.

2.1.4.3 Variant 3: Weighted Safety and Time

Cost function: \(c(s, a, s') = w_t \cdot t(a) + w_s \cdot \text{risk}(s')\), where \(w_t, w_s\) are weights and \(\text{risk}(s')\) is a safety penalty.

  • High-traffic areas: \(\text{risk} = 5\)
  • Near humans: \(\text{risk} = 10\)
  • Other areas: \(\text{risk} = 0\)

Optimal solution: Balances speed and safety. Tuning weights \(w_t, w_s\) reflects design priorities (e.g., \(w_s \gg w_t\) for safety-critical systems).

2.1.4.4 Path Cost Composition

For a path \(\pi = (s_0, a_0, s_1, a_1, \ldots, s_n)\), the total cost is:

\[ C(\pi) = \sum_{i=0}^{n-1} c(s_i, a_i, s_{i+1}) \] (2.1)

Key properties:

  • Additivity: costs must sum meaningfully; non-additive objectives (e.g., a hard constraint on battery level) require different formulations
  • Non-negativity: most search algorithms assume \(c \geq 0\); negative costs can cause infinite loops
  • Units: ensure consistent units throughout; mixing meters and seconds without conversion leads to nonsensical optima

Example calculation: A path with 10 moves (1 unit each), 1 pick (2 units), 1 drop (2 units), and 2 high-traffic penalties (5 units each) has total cost:

\[ C = 10 \cdot 1 + 1 \cdot 2 + 1 \cdot 2 + 2 \cdot 5 = 24 \text{ units} \]

2.1.5 Scaling and Abstraction Hierarchies

Real warehouse systems have thousands of states. Solving problems at full fidelity is often intractable. Engineers use hierarchical abstraction:

  1. High-level planning: assign jobs to robots (schedule abstraction)
  2. Mid-level routing: plan paths between locations (path abstraction)
  3. Low-level control: execute trajectories with feedback (control abstraction, covered in later chapters)

Each level uses a different state-space model with appropriate granularity. Solutions at one level constrain or guide the next.

For example:

  • High-level: "Robot 1 delivers package A, Robot 2 delivers package B"
  • Mid-level: "Robot 1 follows path \((0,0) \to (5,3) \to (7,8)\)"
  • Low-level: "At time \(t\), apply motor torques \(\tau_L, \tau_R\)"

Decomposition reduces complexity but requires careful interface design to ensure consistency across levels.

2.1.6 Summary

Problem formulation bridges abstract task environments and concrete algorithms:

  • State-space models are specific choices of environment representation that algorithms can operate on
  • Problem formulations operationalize PEAS into state-space models, actions, transitions, goals, and costs
  • Abstraction levels (paths, plans, schedules) match problem structure; choose the right one to avoid unnecessary complexity
  • Goal tests and constraints define success; cost functions encode soft performance measures and tradeoffs; hard constraints must be respected
  • Hierarchical decomposition scales to large systems by solving coarse problems first and refining

With a well-formulated problem, we can now apply search algorithms to find solutions. The next section introduces uninformed and informed search, starting with uniform-cost search and progressing to \(A^*\).