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 — Hill Climbing

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

Hill Climbing

Hill climbing is generate-and-test augmented with a heuristic: at each step, move to the neighbouring state that most improves the heuristic value — like climbing a hill by always stepping uphill.

Algorithm (Simple Hill Climbing)

1. Evaluate the initial state. If it is the goal, stop.
   Otherwise, let current = initial state.
2. Loop:
   a. Generate a successor of current that has not yet been tested.
   b. Evaluate the successor's heuristic value.
   c. If successor is the goal, stop and return it.
   d. If successor is better than current, set current = successor.
   e. If no new successor remains to try and current isn't the goal, fail.

Steepest-Ascent Hill Climbing

Instead of moving to the first better neighbour, generate all neighbours, evaluate each, and move to the best one.

The Problems With Hill Climbing

ProblemDescriptionIllustration
Local maximumA state better than all its neighbours, but not the best overall — climbing stops here even though a higher peak exists elsewhereSmall hill next to a mountain
PlateauA flat region where all neighbouring states have the same heuristic value — no direction looks betterA flat area with no slope
RidgeA sequence of local maxima that requires moving sideways or even downhill briefly to cross, but the algorithm only evaluates single moves at a timeDiagonal ridge, direct single-step moves fall off it

Fixes / Escapes

TechniqueHow it helps
Random restartOn getting stuck, restart from a new random state; repeat and keep the best result found
Sideways movesAllow a bounded number of moves to states with equal heuristic value, to escape plateaus
BacktrackingKeep more than one path so the algorithm can retreat and try a different branch
Simulated annealingOccasionally accept a worse move (with a probability that decreases over time), allowing escape from local maxima while still generally climbing

Strengths and Weaknesses

StrengthsWeaknesses
Low memory (only needs to track the current state)Not complete — can get stuck and never find a solution that exists
Fast when the landscape is "smooth" toward the goalNot optimal — the local maximum found may not be the best solution
Simple to implementHighly sensitive to the choice of heuristic function