CV Courseversity

AI Problem Formulation and Solution Design

Teaches the discipline of turning an ambiguous real-world challenge into a formally specified problem — states, actions, objectives, constraints, and evaluation criteria — before any algorithm is chosen.

“A hospital administrator says, "I want an AI system that reduces emergency-room wait times." That sentence names a hope, not a problem an algorithm can solve. This module asks: what has to happen between a stakeholder's plain-language wish and a formal specification precise enough to search, optimize, or learn over — and what goes wrong when a team skips straight from the wish to writing code?”

From Real-World Challenge to Formal Problem · 15 min

Artificial intelligence research settled early on a shared vocabulary for turning a vague task into something an algorithm can actually operate on. Russell and Norvig's widely used textbook organizes its third chapter around exactly this question, under the heading 'Solving Problems by Searching', formalizing a problem with five components: an initial state describing where the agent starts; a set of possible actions available at each state; a transition model specifying which state results from taking an action in a given state; a goal test that decides whether a given state counts as success; and a path cost function that assigns a numeric cost to a sequence of actions, so that candidate solutions can be compared and the cheapest preferred. This vocabulary generalizes far beyond puzzle-solving. A route-planning app's 'states' are intersections, its 'actions' are turns, and its 'path cost' is travel time; a robotic arm's 'states' are joint angles, and its 'goal test' checks whether the gripper has reached a target pose. Problem formulation is precisely the exercise of naming these five components explicitly, in writing, before selecting a search, optimization, or learning algorithm — because the algorithm can only ever be as good as the state space and cost function it is handed.

Skipping straight from a stakeholder's plain-language request to code is one of the most common and expensive mistakes in applied AI work, because a badly chosen state representation can make an easy problem look intractable or, worse, silently exclude the actual solution from the search space entirely. Consider the hospital wait-time example: if 'state' is defined only as the number of patients currently waiting, the representation throws away information about triage severity, staff availability, and time of day that any workable solution must condition on — no algorithm, however sophisticated, can recover decisions that the state representation makes invisible. Conversely, including too much irrelevant detail in the state (exact patient names, room lighting levels) inflates the search space without adding decision-relevant information, slowing every downstream algorithm for no benefit. Good problem formulation is therefore an act of deliberate abstraction: keep only the distinctions that make a difference to which action is best, and test that abstraction against concrete cases before committing engineering effort to a solver. A change in formulation, not a smarter algorithm, is often what turns an unsolved problem into a solved one.

Objectives, Constraints, and Evaluation Criteria · 15 min

Formulating states and actions answers 'what can the system do,' but a complete specification must also answer 'what is the system trying to achieve, and within what limits.' The agent-design framework associated with Russell and Norvig's treatment of rational agents supplies a compact checklist for this, often abbreviated PEAS: Performance measure (how success is scored), Environment (what the agent must operate within and cannot control), Actuators (the actions actually available to change the world), and Sensors (the information actually available to perceive it). Naming the performance measure explicitly is the objectives step — the number, or vector of numbers, the system is ultimately trying to optimize, which must be specified before any algorithm can be judged. Naming the environment surfaces constraints: a warehouse robot's environment constrains it to legal, collision-free moves; a loan-approval system's environment constrains it to decisions consistent with fair-lending law regardless of what a purely predictive objective would prefer. Treating constraints and objectives as the same thing is a common formulation error — an objective is something to be maximized or minimized, while a constraint is a condition that must hold regardless of how much it costs the objective, and confusing the two produces systems that violate the constraint whenever the objective term dominates the trade-off.

Reinforcement learning gives problem formulation its most explicit mathematical form: a task is cast as a Markov decision process defined by states, actions, a transition function, and a reward signal, and the agent's objective is to choose actions that maximize the cumulative reward it receives over time. Sutton and Barto's foundational treatment makes reward design a first-class part of problem formulation, not an afterthought: because the reward function is what the agent actually optimizes, a reward that only loosely approximates the real-world goal will be optimized faithfully and still produce behavior nobody wanted — a failure mode practitioners often call reward hacking. The final formulation component, evaluation criteria, is what lets a team check after the fact whether a deployed solution is actually achieving the intended objective, as distinct from merely scoring well on the metric it was trained against; this typically means holding out test cases, scenarios, or time periods not used to build or tune the system, and checking performance on those separately. A solution design is not complete until this evaluation plan is written down alongside the state, action, objective, and constraint definitions — otherwise there is no way to know, after deployment, whether the formulation chosen at the start was the right one.

Practice

From Wish to Formal Problem

Real-World Wish ("reduce ER wait times") State, Actions, Transition Model, Goal Test, Path Cost Objectives & Constraints (PEAS) Evaluation Criteria — Formal Problem Ready to Solve

A vague wish becomes a solvable problem only after states, actions, objectives, constraints, and evaluation criteria are all written down explicitly.

  • An algorithm can never be better than the state space and cost function it is handed — formulation errors cannot be fixed by a smarter algorithm.
  • Objectives and constraints are not interchangeable: an objective trades off, a constraint must hold regardless of what the objective would prefer.
  • A reward or metric that only loosely approximates the real goal will still be optimized faithfully — and can produce behavior nobody actually wanted.

Recall Practice

Five componentsClick to reveal
A routing app needs a formal problem definition. What plays the role of "path cost" in this setting?
Travel time (or distance) accumulated along the sequence of turns taken, since path cost is the numeric quantity used to compare candidate routes and prefer the cheapest one.
AbstractionClick to reveal
Why can including too much detail in a state representation hurt a solution, even if that detail is accurate?
Because irrelevant detail inflates the size of the search space without adding any information that changes which action is best, slowing every algorithm that has to search over that space for no benefit.
PEASClick to reveal
A team defines only a performance measure for a hospital triage system but never writes down its environment, actuators, or sensors. What is missing?
The constraints and operating context the system must respect (environment), the actions it can actually take (actuators), and the information it can actually perceive (sensors) — without these, the objective alone cannot fully specify the problem.
Reward hackingClick to reveal
A delivery-routing RL agent is rewarded purely for minimizing delivery time and starts running red lights. What formulation mistake likely caused this?
The reward function only loosely approximated the real objective (safe, timely delivery) and omitted a constraint or penalty for traffic-law violations, so the agent faithfully maximized the reward it was actually given rather than the outcome the designers intended.

Glossary

Initial state
The starting configuration from which an agent begins solving a formally specified problem.
Transition model
A function specifying which state results from taking a given action in a given state.
Goal test
A check that determines whether a given state counts as a successful solution to the problem.
Path cost
A numeric function assigning a cost to a sequence of actions, used to compare and rank candidate solutions.
PEAS
A framework for specifying an agent's task environment: Performance measure, Environment, Actuators, Sensors.
Reward hacking
A failure mode in which an agent maximizes a poorly designed reward signal while failing to achieve the real-world goal the reward was meant to represent.
Practical Activity

Formulate a Formal Problem from a Case Study

This is a virtual, text-based worksheet exercise — no real system is built or deployed. You are given a short supplied case study (a fictional food-delivery startup wants an AI system to assign drivers to orders) and a formulation template. Working from the case study text alone, write out the initial state, actions, transition model, goal test, and path cost; then complete a PEAS table and list at least two constraints and one held-out evaluation plan, entirely on paper or in a text document.

Ready to test yourself?

5 questions on this module.

Start Quiz