Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 1 — Defining the Problem as a State Space Search

Lesson 7 of 34 in the free Artificial Intelligence notes on Siksha Sarovar, written by Rohit Jangra.

Defining the Problem as a State Space Search

Before any search algorithm can run, a problem must be formally defined. AI formalises problem-solving as a search through a state space.

Components of a State Space Search Problem

ComponentMeaning
Initial stateThe state the problem starts in
State spaceThe set of all states reachable from the initial state through any sequence of actions
Operators / ActionsRules that move the system from one state to another
Goal testA test to decide whether a given state is a goal state
Path costA function assigning a cost to a path (sum of costs of individual actions), used to find the cheapest solution

A solution is a sequence of operators (actions) that transforms the initial state into a goal state; an optimal solution is the one with the lowest path cost among all solutions.

Worked Example: The 8-Puzzle

  • States: every possible arrangement of the 8 numbered tiles + blank on the 3×3 board
  • Initial state: the given scrambled arrangement
  • Operators: move blank Up / Down / Left / Right (swap blank with the adjacent tile)
  • Goal test: does the board match the target arrangement?
  • Path cost: each move costs 1, so path cost = number of moves

Worked Example: The Water Jug Problem

Given a 4-litre jug and a 3-litre jug, no measuring marks, an unlimited water supply — measure exactly 2 litres.

  • State: (x, y) = current litres in the 4-litre and 3-litre jug
  • Initial state: (0, 0)
  • Goal state: (2, y) for any y
  • Operators: fill a jug, empty a jug, pour one jug into the other (until full or empty)
StepActionState (4L, 3L)
0Start(0, 0)
1Fill 4L jug(4, 0)
2Pour 4L into 3L(1, 3)
3Empty 3L jug(1, 0)
4Pour 4L into 3L(0, 1)
5Fill 4L jug(4, 1)
6Pour 4L into 3L(2, 3) — Goal reached

The State Space as a Graph

The state space is naturally a directed graph: nodes are states, edges are operator applications. Searching for a solution is searching this graph for a path from the initial-state node to a goal-state node — which is exactly what BFS, DFS, and heuristic search algorithms do (covered next).