# Welcome back

## Find a book, put up your feet, stay awhile

Sign in with Facebook

Sorry, we are unable to log you in via Facebook at this time. Please try again later.

or

Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more

Download

Standard view

Full view

of .

Look up keyword

Like this

Share on social networks

3Activity

×

0 of .

Results for: No results containing your search query

P. 1

Lab 4 Best First Heuristic SearchRatings: (0)|Views: 252|Likes: 2

Published by chakravarthyashok

See more

See less

https://www.scribd.com/doc/30277066/Lab-4-Best-First-Heuristic-Search

07/02/2014

text

original

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCEPILANI-333031 (RAJASTHAN) INDIASecond Semester 2007-2008

Course:

EA C461 (ArtificialIntelligence)

Lab 4:

Best-First HeuristicSearch

Prepared By:

Dr. Mukesh Kumar Rohilrohil@bits-pilani.ac.inThis Lab is based on the book by Ivan Bratko, Prolog Programming for Artificial Intelligence, ThirdEdition, 2001, Pearson Education Ltd., Second Impression 2007 (in India).Given the heuristic function f(n) = g(n) + h(n), where g(n) is an estimate of the cost of an optimal pathfrom starting node, s, to current node, n, and h(n) is an estimate of the cost of an optimal path fromnode n to the goal node t.When node n is encountered by the search process we have following situation: a path from s to nmust have already been found and its cost can be computed as the sum of the arc-costs on the path. Itmay not be optimal cost but its cost can serve as an estimate g(n) of the minimal cost from s to n.Theother term, h(n), is more problematic because the ‘world’ between n and t has not been explored by thesearch until this point. Therefore, h(n) is typically is real heuristic guess, based on the algorithm’sgeneral knowledge about the particular problem.Starting with the start node, the search keeps generating new successor nodes, always expanding in themost promising direction according to the f-values. During this process, a search tree is generatedwhose root is the start node of the search. The best-first search program will thus kep expanding thissearch tree until a solution is found. This tree will be represented in the program by terms of twoforms:1.l(N, F/G) represents a single node tree (a leaf); N is a node in the state space, G is g(N) (cost of the path found from the start node to N); F is f(N) = G + h(N).2.t(N, F/G, Subs) represents a tree with non-empty subtree; N is the root of the tree, Subs is a listof its subtrees; G is g(N); F is updated f-value of N – that is, the f-value of the most promisingsuccessor of N; the list Subs is ordered according to increasing f-values of the sub-trees. The updating of the f-values is necessary to enable the program to recognize the most promisingsubtree at each level of the search tree. This modification of f-estimates lead, in fact, to a function f from nodes to tree. For a single node tree (a leaf), n, we have the original definition of f(n) i.e. f(n) =g(n) + h(n). For a tree, T, hose root is n, and n’s subtrees are S

1

, S

2

, etc., f(T) = min

i

f(S

i

).A best-first program along these lines is shown in Table 1. Some more explanation of this programfollows.The key procedure is expand, which has six arguments:expand(P, Tree, Bound, Tree1, Solved, Solution).It expands a current (sub)tree as long as the f-value of this tree remains less or equal to Bound. Thearguments of expand are given in Table 2.P, Tree and Bound are ‘input’ parameters to expand. Expand produces three kinds of results which isindicated by the value of the argument Solved as follows:

(1). Solved = yes.Solution = a solution path found by expanding Tree within Bound.Tree1 = uninstantiated.(2). Solved = no.Solution = Tree expanded so that its f-value exceeds Bound.Tree1 = uninstantiated.(3). Solved = never.Solution and Tree1 = uninstantiated.A Prolog program (based on the best first search) to solve 8-puzzle problem is given in Table 3.However, some predicates need more clauses to be added.

Do the following:

1.Apply the Best-first search (Table 2) tosolve the routing problem (as given inFig. 1) to find the shortest path fromnode s to node t.2.Find the time taken by the method tofind the shortest path for problem 1above. [Hint: Read and Use time/2 predicate given in the LPA Win-Prolog help]3.Comparing the program in Table 1and Table 3, make a table of predicatesof Table 1 and Table 3 by statingwhich predicate(s) in Table 3 does theanalogous or similar work of which predicate(s) in Table 1.4.The Table 3 (Best-first search appliedto 8-puzzle problem) does not have some clauses of some predicate. Completethose and run the program for five initial conditions to reach to the goal state.The goal state is given in Fig. 2.5.Name your files as L4_AI_YourID_pN and zip them as L4_AI_YourID.zip andtransmit to instructor’s email id. Replace the text YourID by your BITSIDNumber and N in pN by problem number 1, 2, 3, or 4 as the case may be.

Figure 1: A routing network [The numbers alongarcs are g(n) and numbers in square are h(n)]

12345678

Figure 2

- Read and print without ads
- Download to keep your version
- Edit, email or read offline

© Copyright 2015 Scribd Inc.

Language

Choose the language in which you want to experience Scribd:

Sign in with Facebook

Sorry, we are unable to log you in via Facebook at this time. Please try again later.

or

Password Reset Email Sent

Join with Facebook

Sorry, we are unable to log you in via Facebook at this time. Please try again later.

or

By joining, you agree to our

read free for two weeks

Personalized recommendationsbased on books you love

Syncing across all your devices

Join with Facebook

or Join with EmailSorry, we are unable to log you in via Facebook at this time. Please try again later.

Already a member? Sign in.

By joining, you agree to our

to download

Personalized recommendationsbased on books you love

Syncing across all your devices

Continue with Facebook

Sign inJoin with emailSorry, we are unable to log you in via Facebook at this time. Please try again later.

By joining, you agree to our

Are you sure?

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

CANCEL

OK

You've been reading!

NO, THANKS

OK

scribd