## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

WOULD BE ACHIEVED BY RANDOM GUESSING.” OR “IT IS DEFINED AS A METHOD OR AS A RULE OR AS A TRICK. IT IS A PIECE OF INFORMATION THAT IS USED TO MAKE SEARCH OR ANOTHER PROBLEM SOLVING METHOD, MORE EFFECTIVE AND MORE EFFICIENT.”

**A heuristic is a method that
**

Direct techniques (blind search) are not always possible (they

require too much time or memory). Weak techniques can be effective if applied correctly on the right kinds of tasks. Might not always find the best solution. But is guaranteed to find a good solution in reasonable time. Heuristics are approximation used to minimize the search process Useful in solving tough problems which -- could not be solved any other way. -- solutions take an infinite time or very long time to compute.

Thus,

Blind search totally ignores where the goals are.

A heuristic function that gives us an estimate of how

far we are from a goal.

Heuristic function : a function that estimate the

**value of a state, It is an approximation used to minimize the search process .
**

Heuristic Knowledge : knowledge of approaches that

are likely to work or of properties that are likely to be true (but not guaranteed).

Example

**Some Possible 8-puzzle heuristics
**

Number of tiles in the correct position.

– The higher the number the better. – Easy to compute (fast and takes little memory). – Probably the simplest possible heuristic.

Number of tiles in the incorrect position.

– This can also be considered a lower bound on the number of moves from a solution! – The “best” move is the one with the lowest number returned by the heuristic.

Heuristic values based on 2nd

**Another 8 puzzle Heuristic
**

Count how far away (how many tile movements)

each tile is from it’s correct position. Sum up this count over all the tiles. This is another estimate on the number of moves away from a solution.

5 4 7 2 3 N 8 1 6 1 4 7 2 5 8 goal 3 6

h(N) = sum of the distances of every tile to its goal position =2+3+0+1+3+0+3+1 = 13

SEARCH TECHNIQUES

Generate-and-test: Very simple strategy - just keep guessing.

Algo: do while goal not accomplished generate a possible solution test solution to see if it is a goal

Heuristics may be used to determine the specific rules for solution generation.

Example - Traveling Salesman Problem (TSP)

Traveler needs to visit n cities. Know the distance between each pair of cities. Want to know the shortest route that visits all the

cities once.

TSP Example

14

A

1 5

6 2

B

3

D

4

C

**Generate-and-test Example
**

15

TSP - generation of possible

**solutions is done in order of cities: 1. A - B - C - D 2. A - B - D - C B 3. A - C - B - D 4. A - C - D - B C ...
**

D

A

B

C

D

C

D

D

B

D

C

B

C

D

B

B

C

Characteristics

Characteristics with generate-and-test: Requires that an entire possible solution is generated at each step,

which may be expensive. It is a depth first search procedure since complete solutions must be generated before they can be tested.

It may be difficult to develop a generation scheme that provides a

good order. If problem space is very large , may take very long time.

Assignment: TSP is a bad example because it is hard to see the state

space. Consider a problem like the water jug problem and describe how this algorithm would work in that domain.

Hill Climbing

Is a variant of generate-and test in which feedback

from the test procedure is used to help the generator decide which direction to move in search space. The test function is augmented with a heuristic function that provides an estimate of how close a given state is to the goal state. Computation of heuristic function can be done with negligible amount of computation. Hill climbing is often used when a good heuristic function is available for evaluating states but when no other useful knowledge is available.

**Simple Hill Climbing
**

Use heuristic to move only to states that are better

than the current state.

Always move to better state when possible. The process ends when all operators have been

applied and none of the resulting states are better than the current state.

1.

2.

a. b.

Algorithm: Evaluate the initial state. If it is also goal state, then return it and quit. Otherwise continue with the initial state as the current state. Loop until a solution is found or until there are no new operators left to be applied in the current state:

Select an operator that has not yet been applied to the current state and apply it to produce a new state Evaluate the new state

i. ii. iii.

If it is the goal state, then return it and quit. If it is not a goal state but it is better than the current state, then make it the current state. If it is not better than the current state, then continue in the loop.

The key difference between Simple Hill climbing and

Generate-and-test is the use of evaluation function as a way to inject task specific knowledge into the control process.

Steepest-Ascent Hill Climbing

This is a variation of simple hill climbing which

considers all the moves from the current state and selects the best one as the next state.

**Algorithm: Steepest-Ascent Hill Climbing
**

1.

2.

a. b.

Evaluate the initial state. If it is also a goal state, then return it and quit. Otherwise, continue with the initial state as the current state. Loop until a solution is found or until a complete iteration produces no change to current state:

Let SUCC be a state such that any possible successor of the current state will be better than SUCC For each operator that applies to the current state do:

i. ii.

Apply the operator and generate a new state Evaluate the new state. If is a goal state, then return it and quit. If not, compare it to SUCC. If it is better, then set SUCC to this state. If it is not better, leave SUCC alone.

c.

If the SUCC is better than the current state, then set current state to SUCC,

**Draw backs: Hill-climbing
**

This simple policy has three well-known drawbacks: 1. Local Maxima: a local maximum. all neighboring states are worse or the same. 2. Plateaus: An area of the search space where evaluation function is flat, thus all neighboring states are the same as the current state. 3. Ridge: local optimum that is caused by inability to apply 2 operators at once.

(b)

(a)

(c)

Assignment: Suggest some possible ways of dealing with this drawbacks.

Figure 5.9 Local maxima, Plateaus and ridge situation for Hill Climbing

**Best first search
**

A combination of DFS & BFS. DFS is good because a solution can be found without

computing all nodes and BFS is good because it doesn’t get trapped in dead ends. The best first search allows us to switch between paths going the benefit of both approaches.

One way of combining the tow is to follow a single path at a

time, but switch paths whenever some competing path looks more promising than the current one does.

D 9 E 3 S 5 C 6 A 8 F 12 B 14 7 H G 5 I 2 1 Q L J M K

6

**Step Node being Children expanded
**

1 2 S A (A:3)(B:6)(c:5) (D:9)(E:8)

Available Node

(A:3)(B:6)(c:5) (B:6)(c:5) (D:9)(E:8)

Node chosen

(A;3) (C:5)

3 4 5

C B H

(H:7) (E:12) (G:14) (I;5) (J:6)

(B:6) (D:9) (E:8) (H:7) (E:12) (G:14) (D:9) (E:8) (H:7)

(B:6) (H:7)

(E:12) (G:14) (D:9) (E:8) (I;5) (J:6) (I:5)

6

I

KLM

All

L

**Best First Search Vs Hill Climbing
**

At each step of the BFS search process, we select the most promising of

the nodes we have generated so far. This is done by applying an appropriate heuristic function to each of them. We then expand the chosen node by using the rules to generate its successors Similar to Steepest ascent hill climbing with two exceptions:

In hill climbing, one move is selected and all the others are rejected, never to be reconsidered. This produces the straightline behavior that is characteristic of hill climbing. In BFS, one move is selected, but the others are kept around so that they can be revisited later if the selected path becomes less promising. Further, the best available state is selected in the BFS, even if that state has a value that is lower than the value of the state that was just explored. This contrasts with hill climbing, which will stop if there are no successor states with better values than the current state.

OR-graph

It is sometimes important to search graphs so that duplicate paths will

not be pursued. An algorithm to do this will operate by searching a directed graph in which each node represents a point in problem space. Each node will contain:

Description of problem state it represents Indication of how promising it is Parent link that points back to the best node from which it came List of nodes that were generated from it

Parent link will make it possible to recover the path to the goal once the

goal is found. The list of successors will make it possible, if a better path is found to an already existing node, to propagate the improvement down to its successors. This is called OR-graph, since each of its branches represents an alternative problem solving path

Implementation of OR graphs

We need two lists of nodes:

OPEN – nodes that have been generated and have had the heuristic function applied to them but which have not yet been examined. OPEN is actually a priority queue in which the elements with the highest priority are those with the most promising value of the heuristic function. CLOSED- nodes that have already been examined. We need to keep these nodes in memory if we want to search a graph rather than a tree, since whenever a new node is generated, we need to check whether it has been generated before.

Algorithm: BFS

1. 2.

a. b. c.

i. ii.

Start with OPEN containing just the initial state Until a goal is found or there are no nodes left on OPEN do:

Pick the best node on OPEN Generate its successors For each successor do:

If it has not been generated before, evaluate it, add it to OPEN, and record its parent. If it has been generated before, change the parent if this new path is better than the previous one. In that case, update the cost of getting to this node and to any successors that this node may already have.

**BFS : simple explanation
**

It proceeds in steps, expanding one node at each step, until

it generates a node that corresponds to a goal state. At each step, it picks the most promising of the nodes that have so far been generated but not expanded. It generates the successors of the chosen node, applies the heuristic function to them, and adds them to the list of open nodes, after checking to see if any of them have been generated before. By doing this check, we can guarantee that each node only appears once in the graph, although many nodes may point to it as a successor.

BFS-Tree

Step 1 A B Step 4 A B C D B

3

Step 2 A C D

Step 3 A B 1 Step 5 A C D C D

3

3

5

5

1

E

4

F

6

3

5

1

5

1

G

6

H

5

E

4

F

6

G

6

H

5 A

E

4 2 A

F

6 1

- Chapter 3
- problem solving
- Harnessing the Lookaside Buffer Using Game-Theoretic Epistemologies
- The Relationship Between Mathematics and Science Process Skills
- Action Research Mathematics
- 1999 - Thinking skills is realistic mathematics
- FIVE PILLARS IN TEACHING AND LEARNING MATHEMATICS.docx
- Math Olympiads — There’s More to Math Than Numbers!
- math program of studies
- He Man a Than
- 10.1.1.105.8050
- Prezi Rubric
- let us define math 1
- Teaching Reflection
- sdfodsfddmspfkdsofsd
- brigidobrien-32q
- curriculum letter- sept to dec
- Verbs Reflecting Learning in 3 Domains
- physical science activity overview
- Math 30 Seminar in Problem Solving in Mathematics
- interview_tips_242
- Case Writing
- 1. Problem Solving Agents
- Studi Eksplorasi Asli
- Item 13 Formatted
- Project Report.ffff
- Verbs Reflecting Learning in 3 Domains
- ch01 sp
- Skills for Employment and Beyond
- Consumer Decision Making Process Study

- Chapter 7
- Lecture 4
- Chapter 2
- Problem Representation in Ai:
- Biomedical Department, NIT Raipur
- Chapter 3
- Chapter 6
- 8051 Microcontrollers
- Microcontroller 8051
- Chapter 1
- AI Agents Deal With Knowledge (Data)
- Lecture 6
- Normalization cont
- Chapter 1
- Biomedical Department, NIT Raipur
- Sockets Programming
- ReadMe
- JavaTM RMI Tutorial
- A. a Short Java RMI Tutorial
- Remote Method Invocation
- Socket Programming in C/C++
- Programming With Java RMI …an Introduction...
- Interactive Programming in Java
- Lab Samples
- Java Network Programming
- Sockets Notes
- lecture 1
- Socket Demo
- Add Number

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading