Problem Solving Using Search - (Single Agent Search) : Version 2 CSE IIT, Kharagpur
Problem Solving Using Search - (Single Agent Search) : Version 2 CSE IIT, Kharagpur
Problem Solving Using Search - (Single Agent Search) : Version 2 CSE IIT, Kharagpur
2
Problem Solving
using Search-
(Single agent search)
Version 2 CSE IIT, Kharagpur
Lesson
6
Informed Search
Strategies-II
Version 2 CSE IIT, Kharagpur
3.3 Iterative-Deepening A*
3.3.1 IDA* Algorithm
Iterative deepening A* or IDA* is similar to iterative-deepening depth-first, but with the
following modifications:
The depth bound modified to be an f-limit
1. Start with limit = h(start)
2. Prune any node if f(node) > f-limit
3. Next f-limit=minimum cost of any node pruned
The cut-off for nodes expanded in an iteration is decided by the f-value of the nodes.
e d
a f
c
Figure 1
Consider the graph in Figure 3. In the first iteration, only node a is expanded. When a is
expanded b and e are generated. The f value of both are found to be 15.
For the next iteration, a f-limit of 15 is selected, and in this iteration, a, b and c are
expanded. This is illustrated in Figure 4.
e d
a f
c
Figure 2: f-limit = 15
c
Figure 3: f-limit = 21
• In problems like 8 puzzle using the Manhattan distance heuristic, there are few
possible f values (f values are only integral in this case.). Therefore the number of
node expansions in this case is close to the number of nodes A* expands.
• But in problems like traveling salesman (TSP) using real valued costs, : each f value
may be unique, and many more nodes may need to be expanded. In the worst case, if
all f values are distinct, the algorithm will expand only one new node per iteration,
and thus if A* expands N nodes, the maximum number of nodes expanded by IDA*
is 1+2+…+ N = O(N2)
Why do we use IDA*? In the case of A*, it I usually the case that for slightly larger
problems, the algorithm runs out of main memory much earlier than the algorithm runs
out of time. IDA* can be used in such cases as the space requirement is linear. In fact 15-
puzzle problems can be easily solved by IDA*, and may run out of space on A*.
IDA* is not thus suitable for TSP type of problems. Also IDA* generates duplicate nodes
in cyclic graphs. Depth first search strategies are not very suitable for graphs containing
too many cycles.
• Hill climbing
• Gradient descent
• Simulated annealing
• For some problems the state description contains all of the information relevant
for a solution. Path to the solution is unimportant.
• Examples:
o map coloring
o 8-queens
o cryptarithmetic
Algorithm:
– Start with a solution
– Improve it towards a good solution
Example:
Iteratively maximize “value” of current state, by replacing it by successor state that has
highest value, as long as possible.
Note: minimizing a “value” function v(n) is equivalent to maximizing –v(n), thus both
notions are used interchangeably.
• Algorithm:
1. determine successors of current state
2. choose successor of maximum goodness (break ties randomly)
3. if goodness of best successor is less than current state's goodness, stop
4. otherwise make best successor the current state and go to step 1
• No search tree is maintained, only the current state.
• Like greedy search, but only states directly reachable from the current state are
considered.
• Problems:
Plateaux
If the landscape is flat, meaning many states have the same goodness, algorithm
degenerates to a random walk.
Ridges
If the landscape contains ridges, local improvements may follow a zigzag path up
the ridge, slowing down the search.
• Shape of state space landscape strongly influences the success of the search
process. A very spiky surface which is flat in between the spikes will be very
difficult to solve.
• Can be combined with nondeterministic search to recover from local maxima.
• Random-restart hill-climbing is a variant in which reaching a local maximum
causes the current state to be saved and the search restarted from a random point.
After several restarts, return the best state found. With enough restarts, this
method will find the optimal solution.
• Gradient descent is an inverted version of hill-climbing in which better states are
represented by lower cost values. Local minima cause problems instead of local
maxima.
Global maximum
Local maximum
value
states
Basin of
Attraction for C
A
B
D
E
We stress that there may be different such states — they are local minima. Global
minimization is not guaranteed.
descend
direction
• Instead of restarting from a random point, we can allow the search to take some
downhill steps to try to escape local maxima.
• Probability of downward steps is controlled by temperature parameter.
• High temperature implies high chance of trying locally "bad" moves, allowing
nondeterministic exploration.
• Low temperature makes search more deterministic (like hill-climbing).
• Temperature begins high and gradually decreases according to a predetermined
annealing schedule.
• Initially we are willing to try out lots of possible paths, but over time we gradually
settle in on the most promising path.
• If temperature is lowered slowly enough, an optimal solution will be found.
• In practice, this schedule is often too slow and we have to accept suboptimal
solutions.
Algorithm: