- By
**ula** - Follow User

- 142 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Chapter 3' - ula

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

### Chapter 3

College of Computer and Information Sciences

Information Technology Department

IT422 - Intelligent systems

PROBLEM SOLVING BY SEARCHING (2)

Informed Search

- One that uses problem specific knowledge beyond the definition of the problem itself to guide the search.
- Why?
- Without incorporating knowledge into searching, one is forced to look everywhere to find the answer. Hence, the complexity of uninformed search is intractable.
- With knowledge, one can search the state space as if he was given “hints” when exploring a maze.
- Heuristic information in search = Hints

- Leads to dramatic speed up in efficiency.

L

K

J

I

H

F

N

E

C

B

A

M

D

O

Informed Search- Best-First Search
- Greedy Best First Search
- A* Search

- Local search algorithms
- Stochastic Search algorithms

Search only in this subtree!!

Best first search

- Key idea:
- Use an evaluation function f(n) for each node:
- estimate of “distance” to the goal.

- Node with the lowest evaluation is chosen for expansion.

- Use an evaluation function f(n) for each node:
- Implementation:
- frontier: maintain the frontier in ascending order of f-values

- Special cases:
- Greedy best-first search
- A* search

Formal description of Best-First Search algorithm

Function Best-First Graph-Search(problem,frontier,f) returns a solution or a failure

// f: evaluation function

children an empty set;

explored← an empty set;

frontier← Insert (Make-Node(Initial-state[problem],NULL,NULL,d,c),frontier)

Loop do

If Empty?(frontier) then return failure

node ← POP(frontier)

If Goal-Test[ problem] applied to State[node] succeeds thenreturn Solution(node)

add State[node] to explored

childrenExpand (node,problem)

for each child in children

If state [child] is not in explored or frontierthen

frontierinsert(State [child], frontier) // sort frontier in ascending order of f-values

else if child[state] is in frontier with higher f-values then

replace that frontier node with child

End Loop

Greedy best-first search

- Let evaluation function f(n) be an estimate of cost from node n to goal
- This function is often called a heuristic and is denoted by h(n).
- f(n) = h(n)
- e.g. hSLD(n) = straight-line distance from n to Bucharest

- Greedy best-first search expands the node that appears to be closest to goal.
- Contrast with uniform-cost search in which lowest cost path from start is expanded.
- Heuristic function is the way knowledge about the problem is used to guide the search process.

Greedy best-first search Properties

- Finds solution without ever expanding a node that is not on the solution path.
- It is not optimal: the optimal path goes through Ptesti.
- Minimizing h(n) is susceptible to false starts.
- e.g. getting from Iasi to Fagaras: according to h(n), we take Neamt node to expand but it is a dead end.

- If repeated states are not detected, the solution will never be found. Search gets stuck in loops:
- Iasi →Neamet → Iasi → Neamet

- The graph search version is Complete in finite spaces with repeated state checking but not in infinite ones.

A* search

- Most widely known form of best-first search.
- Key idea:avoid expanding paths that are already expensive.
- Evaluation function:f(n) = g(n) + h(n)
- g(n) = path cost so far to reach n. (used in Uniform Cost Search).
- h(n) = estimated path cost to goal from n. (used in Greedy Best-First Search).
- f(n) = estimated total cost of path through n to goal.

A* search example

A* search example

A* search example

A* search example

A* search example

A* search example

A* search

- Definition: a heuristic h(n) is said to be admissible if it never overestimates the cost to reach the goal.
h(n) h*(n)

- where h*(n) is the TRUE cost from n to the goal.
- e.g: hsld straight line can not be an overestimate.
- Consequently: if h(n) is an admissible heuristic, then f(n) never overestimates the true cost of a solution through n. WHY?
- It is true because g(n) gives the exact cost to reach n.

h*(n): true minimum cost to goal

A* searchroot

g(n):cost of path

n

h(n): Heuristic (expected) minimum cost to goal. (estimation)

Goal

A* search

- Theorem: When Tree-Search is used, A* is optimal if h(n) is an admissible heuristic.
- Proof:
- Let G be the optimal goal state reached by a path with cost :
C* =f(G) = g(G).

- Let G2 be some other goal state or the same state, but reached by a more costly path.

- Let G be the optimal goal state reached by a path with cost :

A* search

f(G2) = g(G2)+h(G2) = g(G2) since h(G2) = 0

g(G2) > C* since G2 is suboptimal

- Let n be any unexpanded node on the shortest path to the optimal goal G.
f(n) = g(n) + h(n) ≤ C* since h is admissible

Therefore, f(n) ≤ C* ≤ f(G2)

- As a consequence, G2 will not be expanded and A* must return an optimal solution.
- Example: the previous search: f(Bucharest)=450 was not chosen for expansion, even though Bucharest is the goal.

A* search

- For Graph-Search, A* is optimal if h(n) is consistent.
- Consistency (= Monotonicity): A heuristic is said to be consistent when for any node n, successor n’ of n, we have h(n) ≤ c(n,n’) + h(n’), where c(n,n’) is the (minimum) cost of a step from n to n’.
- This is a form of triangular inequality:
- Consistent heuristics are admissible. Not all admissible heuristics are consistent.
- When a heuristic is consistent, the values of f(n) along any path are non decreasing.

h(n)

n

c(n,n’)

g

h(n’)

n’

A* search properties

- Completeness: Yes, with f ≤ f(G).
- Optimality: Yes. The tree-search version is optimal if h(n) is admissible, while the graph-search version is optimal if h(n) is consistent.
- Time complexity: Exponential.
- Space complexity: Keeps all nodes in memory.

Some admissible heuristics

- 8-Puzzle:
- g(n):the path cost can be measured by the total number of horizontal and vertical moves.
- h(n): two different heuristics
- h1 (n): number of misplaced tiles.
- h2 (n): the sum of the distances of the tiles from their goal positions.

Local Search algorithms

- Blind search and informed search strategies addressed a single category of problems: observable, deterministic, known environments where the solution is a sequence of actions.
- The search algorithms we have seen so far keep track of the current state, the “frontier” of the search space, and the path to the final state.
- In some problems, one doesn’t care about a solution path but only the final goal state. The solution is the goal state.
- Example: 8-queen problem.

- Local search algorithms are also useful for optimization problems where the goal is to find a state such that an objective function is optimized.
- For the 8-queen algorithm, the objective function may be the number of attacks.

Local Search algorithms

- Basic idea:
- Local search algorithms operate on a single state – current state – and move to one of its neighboring states.
- Therefore: Solution path does not need to be maintained.
- Hence, the search is “local”.

- Two advantages:
- Use little memory.
- More applicable in searching large/infinite search space. They find reasonable solutions in this case.

Local Search algorithms

- A state space landscape is a graph of states associated with their costs
- Problem: local search can get stuck on a local maximum and not find the optimal solution

Hill Climbing

- Hill climbing search algorithm (also known as greedy local search) uses a loop that continually moves in the direction of increasing values (that is uphill).
- Hill-climbing search modifies the current state to try to improve it, as shown by the arrow in figure on slide 28.
- It terminates when it reaches a peak where no neighbor has a higher value.
- A complete local search algorithm always find a goal if one exists.
- An optimal algorithm always finds a global maximum/minimum.

Steepest ascent version

Function Hill climbing (problem) return state that is a local maximum

Inputs: problem, a problem

Local variables: current, a node

neighbor, a node

Current ← Make-Node (initial-state [problem])

Loop do

neighbor ← a highest-valued successor of current

IfValue[neighbor] ≤ Value[current] then return state [current]

Current ← neighbor

Simulated Annealing

- Basic inspiration: What is annealing?
- In metallurgy, annealing is the physical process used to temper or harden metals or glass by heating them to a high temperature and then gradually cooling them, thus allowing the material to coalesce into a low energy crystalline state.
- Heating then slowly cooling a substance to obtain a strong crystalline structure.
- Key idea: Simulated Annealing combines Hill Climbing with a random walk in some way that yields both efficiency and completeness.
- Used to solve VLSI layout problems in the early 1980.

Local Beam Search

- Unlike Hill Climbing, Local Beam Search keeps track of k states rather than just one.
- It starts with k randomly generated states.
- At each step, all the successors of all the states are generated.
- If any one is a goal, the algorithm halts, otherwise it selects the k best successors from the complete list and repeats.
- LBS≠ running k random restarts in parallel instead of sequence.
- Drawback: less diversity → Stochastic Beam Search

Stochastic search: Genetic algorithms

- Formally introduced in the US in the 70s by John Holland.
- GAs emulate ideas from genetics and natural selection and can search potentially large spaces.
- Before we can apply Genetic Algorithm to a problem, we need to answer:
- How is an individual represented?
- What is the fitness function?
- How are individuals selected?
- How do individuals reproduce?

Stochastic search: Genetic algorithms

- Genetic algorithms is a variant of local beam search.
- Successors in this case are generated by combining two parent states rather than modifying a single state.
- Like local beam search, genetic algorithms starts with a set of k randomly generated states called Population.
- Each state or individual is represented as a string over a finite alphabet. It is also called chromosome.

Stochastic search: Genetic algorithms

- Each state is rated by the evaluation function called fitness function.
- Fitness function should return higher values for better states.
- For reproduction, individuals are selected with a probability which is directly proportional to the fitness score.
- For each pair to be mated, a crossover point is randomly chosen from the positions in the string.
- The offspring themselves are created by crossing over the parent strings at the crossover point.
- Mutation is performed randomly with a small independent probability.

Summary

- Informed search uses knowledge about the problem to reduce search costs.
- This knowledge is expressed in terms of heuristics.
- Best first search is a class of methods that use a variant of graph-search where the minimum-cost unexpanded nodes are chosen for expansion.
- Best first search methods use a heuristic function h(n) that estimates the cost of a solution from a node.
- Greedy best-first search is a best first search that expands nodes with minimal h(n). It is not optimal but often efficient.
- A* search is a best first search that takes into account the total cost from the root node to goal node. It expands node with minimal f(n) = g(n) + h(n). It is complete and optimal provided that h(n) is admissible (for tree search) or consistent (for graph search). The space complexity is prohibitive.

Summary

- Construction of heuristics can be done by relaxing the problem definition (in a sense simplifying the problem), by precomputing solution costs for subproblems or learning from experience with the problem class.
- Local search methods keep small number of nodes in memory. They are suitable for problems where the solution is the goal state itself and not the path.
- Hill climbing, simulated annealing and local beam search are examples of local search algorithms.
- Stochastic algorithms represent another class of methods for informed search. Genetic algorithms are a kind of stochastic hill-climbing search in which a large population of states is maintained. New states are generated by mutation and by crossover which combines pairs of states from the population.

Download Presentation

Connecting to Server..