Docsity

Heuristic Search Techniques: A Comprehensive Guide to Informed Search Algorithms, Lecture notes of Communication

Toggle sidebar
bg1
Heuristic search techniques
SEARCH ALGORITHMS
Important Points:
All the previous search control strategies [BFS and DFS] have been blind searches
They make no use of any knowledge of the problem
If we know something more about the problem, we can usually do much, much better
Example: 15-puzzle
For each piece/position, figure out how many moves away it is from its goal position,
if no other piece were in the way
The total of these gives a measure of distance from goal
Heuristic
A heuristic is a rule of thumb for deciding which path choice might be the best
There is no general theory for finding heuristics, because every problem is different
Choice of heuristics depends on knowledge of the problem space
Many traditional search algorithms are used in AI applications. For complex problems,
the 'traditional algorithms' are unable to find the solution within some practical time and
space limits. Consequently, many special techniques are developed, using heuristic functions.
The algorithms that use heuristic functions are called heuristic algorithms.
Heuristic algorithms are
not really intelligent
; they appear to be intelligent because
they achieve better performance.
Heuristic algorithms are
more efficient
because they take advantage of feedback from
the data to direct the search path.
Uninformed search algorithms or Brute-force algorithms search,
through the search space, all possible candidates for the solution
checking whether each candidate satisfies the problem's statement.
Informed search algorithms use heuristic functions, that are specific
to the problem, apply them to guide the search through the search
space to try to reduce the amount of time spent in searching.
A good heuristic can make an informed search dramatically out-perform any uninformed search.
For example, the Traveling Salesman Problem (TSP) where the goal is to find a
good solution
instead of
finding the
best solution
.
In TPS like problems, the search proceeds using current information about the problem to predict
which path is closer to the goal and follow it, although it does not always guarantee to find the best
possible solution. Such techniques help in finding a solution within reasonable time and space.
Some prominent intelligent search algorithms are stated below.
This is a 'heuristic measure'
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Heuristic Search Techniques: A Comprehensive Guide to Informed Search Algorithms and more Lecture notes Communication in PDF only on Docsity!

Heuristic search techniques

SEARCH ALGORITHMS

Important Points:  (^) All the previous search control strategies [BFS and DFS] have been blind searches  (^) They make no use of any knowledge of the problem  (^) If we know something more about the problem, we can usually do much, much better  Example: 15-puzzleFor each piece/position, figure out how many moves away it is from its goal position , if no other piece were in the wayThe total of these gives a measure of distance from goal

Heuristic

A heuristic is a rule of thumb for deciding which path choice might be the best  There is no general theory for finding heuristics, because every problem is different  Choice of heuristics depends on knowledge of the problem space Many traditional search algorithms are used in AI applications. For complex problems, the 'traditional algorithms' are unable to find the solution within some practical time and space limits. Consequently, many special techniques are developed, using heuristic functions. The algorithms that use heuristic functions are called heuristic algorithms.

 Heuristic algorithms are not really intelligent ; they appear to be intelligent because they achieve better performance.  Heuristic algorithms are more efficient because they take advantage of feedback from the data to direct the search path.  (^) Uninformed search algorithms or Brute-force algorithms search,

through the search space, all possible candidates for the solution checking whether each candidate satisfies the problem's statement.  Informed search algorithms use heuristic functions, that are specific to the problem, apply them to guide the search through the search space to try to reduce the amount of time spent in searching.

A good heuristic can make an informed search dramatically out-perform any uninformed search.

For example, the Traveling Salesman Problem (TSP) where the goal is to find a good solution instead of

finding the best solution.

In TPS like problems, the search proceeds using current information about the problem to predict

which path is closer to the goal and follow it, although it does not always guarantee to find the best

possible solution. Such techniques help in finding a solution within reasonable time and space.

Some prominent intelligent search algorithms are stated below.

This is a ' heuristic measure'

Informed Search

User heuristics h(n)

Search Algorithms G (State, Operator, Cost)

Uninformed Search

Generate -and- test

Hill Climbing

Best first search

Problem Reduction

Constraint satisfaction

Mean-end- analysis

  1. Generate and Test Search 4. A Search*
  2. Best-first Search 5. Constraint Satisfication Search
  3. Greedy Search 6. Means-ends analysis There are more algorithms, either an improvement or combinations of these.

Hierarchical^ Representation^ of Search Algorithms A representation of most search algorithms is illustrated below. It begins with two types of search - Uninformed and Informed.

Uninformed Search :^ Also called^ blind, exhaustive or brute-force^ search, uses no information about the problem to guide the search and therefore may not be very efficient.

Informed Search :^ Also called^ heuristic^ or^ intelligent^ search, uses information about the problem to guide the search, usually guesses the distance to a goal state and therefore efficient, but the search may not be always possible.

No heuristics

Priority Queue: h

Priority Queue: f(n)=h(n)+g(n)

Fig 4.1. Different Search Algorithms

A* Search

AO* Search

Example 1: Colored blocks

Arrange four 6-sided cubes in a row, with each side of each cube painted one of four colours, such that on all four sides of the row one block face of each colour is showing.”

Hill Climbing 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 the search space. Searching for a goal state = Climbing to the top of a hill Hill climbing = Generate-and-Test + Direction to move.

Heuristic function to estimate how close a given state is to a goal state.

Hill climbing is often used when a good heuristic function is available

for evaluating states but when no other useful knowledge is available.

For example, suppose you are in an unfamiliar city without a map and

you want to get down town. You simply aim for the tall buildings.

The heuristic function is just distance between the current location

and the location of the tall buildings and the desirable states are those

in which this distance is minimized.

Algorithm

1: 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. 2: Loop (repeat) until a solution is found or until there are no new operators left to be applied in the current state : (a) Select an operator that has not yet been applied to the current state and apply it to produce a new state. (b) Evaluate the new state. (i) If it is a goal state, then return it and quit. (ii) If it is not a goal state but it is better than the current state, then make it the current state. (iii) If it is not better than the current state, then continue in the loop.

The key difference between this algorithm and the one we gave for generate-and-Test is the use of an evaluation function as a way to inject task·specific knowledge into the control process.

Problems/Limitations of Hill Climbing

LOCAL MAXIMA:

If Local Maxima "L" is achieved; then

Global Maxima "G" is ignored, so exact or

current solution is not obtained.

G

L

PLATEAU:

When the program encounters flat area

(same values for all states), then it will

not find a better position as compared to

the preceding ones and stops working

(halts/get-trapped) and will not go

searching for a maxima so solution is

never obtained.

RIDGE:

A situation in which all successor nodes

have the same value (same high point) so

the program's computation procedure

fails to conclude the final goal point.

These problems encountered with the hill-climbing or

Cipher Hill algorithm can be avioded using the

BEST FIRST SEARCH APPROACH

How to apply Best-First-Search to nodes/tree to digging out the solution (goal node):

**- Two lists are to be maintained: CLOSED & OPEN

  • BFS will search the nodes having least heuristic value. Means this BFS algorithm guarantees that most promising or best path will be chosen.
  • Starting from root node A and its child nodes B, C, D all having varied goal-reaching heuristic values [3, 5, 1 respectively], are kept in an OPEN list e.g., B, C, D. A is in the Closed List.
  • D has a least heuritic value, so put select D and put this in a CLOSED list (implies D has been evaluated for path).
  • Expanding D, you end-up with 4 and 6 heuristic values of nodes E and F.
  • Since B has less heuristic value than this, so put B in the CLOSED list. Expanding B will give you heuritic values 7 and 5 of its child nodes G and H.
  • Now the algorithm will compare these values with the exisitng ones and finds out that these are not better than the previously encountered values of E, so the control goes to E for expansion after rendering E into the CLOSED list.
  • Let's suppose J is marked as the goal node. Whenever a new node is traversed accroding to the least heuristic value, the path is formed; such as, A, D, E, J.**

Numbers by the nodes are regarded as estimates of the distance or cost to reach the goal node

Best-First-Search

Best First Search Algorithm:

1: Place the starting node S on the queue.

2. If the queue is empty, return failure and quit.

3. If the first element on the queue is a goal node G, return success and stop.

OTHERWISE;

4. Remove the first element from the queue, expand it and compute the

estimated goal distances for each child node.

5. Place the children on the queue (at either end) and arrange all queue

elements in ascending order (corresponding to the goal distance from the

front of queue)

6. Return to Step 2.

Greedy BestFS

Using a greedy algorithm, expand the first successor of the parent. After a successor is

generated:

IF the successor's heuristic is better than its parent, the successor is set at the front of

the queue (with the parent reinserted directly behind it), and the loop restarts.

Else, the successor is inserted into the queue (in a location determined by its heuristic

value). The procedure will evaluate the remaining successors (if any) of the parent.

Let's start from S (Starting-node) and go to G (Goal-node)

Note: Always take the heuristic value of pointing child)

An example of A algorithm:*

Here graph-nodes are given along with the pre-defined heuristic values; and we have to find out the shortest (minimum cost) path while traversing this graph. h(n) i.e., the heuristic function is provided in the table; g(n) is provided along with the directed paths.

SELECTION OF AVAILABLE PATHS:

S-->A = (0+1)+ 6 = 7

S-->B = (0+4)+2 = 6

S-->A-->B = (1+2)+2 = 5

S-->A-->C = (1+5)+1 = 7

S-->A-->B-->C = (3+2)+1 = 6

S-->B-->C = (4+2)+1 = 7

S-->A-->C-->G = (6+3)+0 = 9

S-->A-->B-->C-->G = (5+3)+0 = 8

S-->A-->G = (1+12)+0 = 13

The best way to goal solution is:

S-->A-->B-->C-->G = (5+3)+0 = 8

 Heuristic Search compared with other search

The Heuristic search is compared with Brute force or Blind search techniques

Comparison among the Informed ~ Uninformed Algorithms

Brute force / Blind search (^) Heuristic search

◊ (^) Only have knowledge

about already

explored nodes

◊ (^) No knowledge about

how far a node is from

goal state

◊ (^) Estimates “distance” to goal state

◊ Guides search process toward goal state

◊ (^) Prefers states (nodes)

that lead close to and not

away from goal state

 Characteristics of Heuristic Search

◊ Heuristics, are knowledge about domain which helps searching and reasoning in its domain.

◊ Heuristic search incorporates domain knowledge to improve efficiency over blind search methodologies.

◊ Heuristic is a function that when applied to a state, returns a value as estimated merit of state, with respect to goal.

◊ Heuristic search function estimates cost from current state to goal, presuming function is efficient.

Heuristic Control Strategies

Search for a solution in a problem space, requires "Control Strategies " to control the search processes. The search control strategies are of different types, and are realized by some specific type of "Control Structures".

- Strategies for search Some widely used control strategies for search are stated below.

◊ Forward search:^ Here, the control strategies for exploring search proceeds forward from initial state towards a solution; The methods are called data-directed.

◊ Backward search:^ Here, the control strategies for exploring search proceeds backward from a goal or final state towards either a solvable sub problem or the initial state; the methods are called goal-directed.

◊ (^) Both forward and backward search : Here, the control strategies for exploring search is a mixture of both forward and backward strategies.

◊ Systematic search:^ Where search space is small, a systematic (but blind) method can be used to explore the whole search space. One such search method is Depth-First Search and the other is Breath-First Search.

 Drawbacks:

The drawback of local search techniques is that they can get “stuck” in:  Local maxima:^ The algorithm only finds the first solution that is locally available. This may not be the best overall solution.  Plateaux: If a neighboring value is equal to the current value, the algorithm will not explore that direction, even if better values lie just beyond it.

Constraint Satisfaction Problems (CSPs) and Models

Constraints arise in most areas of human endeavor. Constraints are a natural medium for people to express problems in many fields. Many real problems in AI can be modeled as Constraint Satisfaction Problems (CSPs) and are solved through search.

Examples of constraints:

 The sum of three angles of a triangle is 180 degrees,

 The sum of the currents flowing into a node must equal zero.

◊ (^) Constraint is a logical relation among variables.

 The constraints relate objects without precisely specifying their positions; moving any one, the relation is still maintained.  (^) For instance; “A circle is inside the square”.

◊ Constraint Satisfaction:

The Constrain t Satisfaction is a process of finding a solution to a set of constraints.  The constraints articulate allowed values for variables and finding solution is the evaluation of these variables that satisfies all constraints.

◊ (^) Constraint Satisfaction Problems (CSPs)

The CSPs are all around us while managing work, home life, budgeting expenses and so on;

 (^) We need to find solution to such problems satisfying all constraints.

 (^) The Constraint Satisfaction Problems (CSPs) are solved through search mechanisms.

Constraint: A limitation or restriction. " Time constraints make it impossible to do everything "

A constraint satisfaction problem (CSP) is characterized by a set of variables. Each variable has a possibly infinite domain of values and a set of domain constraints. A solution to a CSP assigns a value consistent with the domain constraints to each variable. A constraint is a related condition, (or predicate), that must hold among a set of variables.

Search related terms

The Search strategies are evaluated in the following dimensions :

" Completeness, Time complexity, Space complexity, Optimality "

-

◊ (^) Performance of an algorithm depends on the internal and external factors.

External Factors

‡ Size of input

‡ Speed

‡ Quality of the compiler

Internal Factors

‡ Time required, to run the algorithm

‡ Space (memory) required to run computer

◊ Complexity^ is a measure of the performance of an algorithm.

It measures the internal factors, usually in time than space.

- (^) Big-O ” notation

The "Big-O" is a theoretical measure/indicator of the

execution of an algorithm , usually indicates the time or the

memory needed, given the problem size n , which is usually the

number of items.

The Big-O notation is used to give an approximation to the

run-time efficiency of an algorithm; the letter “O” is for Order

of magnitude of operations or space at run-time.

Algorithm’s Performance and Complexity: Ideally we want a common measure so that we can compare approaches in order to select the most appropriate algorithm for a given situation.