You are on page 1of 12

Luger book

Question: no: 1: A Hamiltonian path is a path that uses every node of the graph exactly once .what conditions are necessary for such a path to exit? Is there such a path in the Konigsberg map? Solution:In proving the walk was impossible, Euler focused on the degree of the nodes of graph, observing that a node could be of either even or odd degree. An even degree node has an even number of arcs. With the exception of its beginning and ending nodes, the desired walk could have to leave each node exactly as often as it entered it. Nodes of odd degree could be used only as the beginning or ending of the walk, because such nodes could be crossed only a certain number of times before they proved to be a dead end. The traveler could not exit the node without using a previously traveled arc. Euler noted that unless a graph contained either exactly zero or two nodes of odd degree, the walk was impossible. If there were no nodes of odd-degree nodes, the walk could begin and end at the same node. The walk is not possible for graphs containing any other number of nodes of odd degree, as is the case with the city of Konigsberg. This problem is now called finding an Euler path through a graph. Depth first and breath first search are two strategies for searching a state space. We compare these and make the added distribution between goal-driven and data –driven search. use a graph theory to analyze the complexity of a variety of problems .

Question: no: 2: Give the graph representation for the farmer, wolf, goat, and cabbage problem of section 14.3(see figure 14.1 and 14.2) /let the nodes represent states of the world; e.g., the farmer and the goat are one the west bank and the wolf and cabbage on the east. Discuss the advantages of breath first and depth first for searching this space? Solution:A farmer with his wolf, goat, and cabbage come to the edge of a river they wish to cross. There is a boat at the river's edge, but, of course, only the farmer can row. The boat also can carry only two things (including the rower) at a time. If the wolf is ever left alone with the goat, the wolf will eat the goat; similarly, if the goat is left alone with the cabbage, the goat will eat the cabbage. Devise a sequence of crossings of the river so that all four characters arrive safely on the other side of the river. Depth first and breadth first search both have some advantages. Which is best depends on properties of the problem you are solving. For tree search at least, depth first search tends to require less memory, as you only need to record nodes on the `current' path. If there are lots of solutions, but all at a comparable `depth' in the tree, then you may hit on a solution

Similarly. PR 1: (F. G. The second case demonstrates the presence of goat and cabbage in the left and the farmer and the wolf in the right bank. C | | W. G. C) Forward Reasoning: Given the starting state ( F. It may be more appropriate when exploring very large search spaces where there is an expected solution which takes a relatively small number of steps. G) where F. the goat. W | | G. | | W. C | | G) -> (C | | F. G) PR 2: (W. W | | C) PR 10: ( F.W). Breadth first search may use more memory. It may be less appropriate when there is only one solution. or if you want the shortest one. W. C | | G) -> ( W | | F. G. C | | Nil) and the goal state (Nil | | F. and the farmer and the cabbage are at the right bank of the river. by a boat from the left bank of a river to its right bank.G. W. W. W. So depth first is good when there are many possible solutions. (G. How should the farmer plan to transfer the items? Answer: The illegal states in the problem are (W. G) -> ( F. C | | Nil ) -> ( W. C) -> ( F. starting with (F. W.C) PR 12: ( F. G. W. (F. C | | G) PR 3: (F. C | | W) -> (G | | F. that may not be the best solution. G) PR 4: (C | | F. Also. C) -> ( F. but then it wouldn't be exhaustive. but will not get stuck in blind alleys. C) PR 6: ( G | | F. the wolf may eat up the goat and the goat may eat up the cabbage. C) PR 11: ( G | | F. C | | F. G. when there is in fact a solution path of only one or two steps. G) -> ( F. and will always find the shortest path first (or at least.C | | F. W. or when you are interested in all the solutions (perhaps up to some depth limit). the path that involves the least number of steps). C) PR 7: ( F. A part of the knowledge base for the system is given below. C | | F. G. The boat can carry at most two items including the farmer. a wolf. W. C) -> ( Nil | | F. W. Example 3. | |. C) PR 8 ( F. C | | W) PR5: (F. a goat and a cabbage. the other illegal states can be explained easily. C) and ( F. If unattended. G. (We could prevent this by setting a depth limit to our search. the river. W.). W. G | | W.G. and you only want one (and you don't care which one). A farmer wants to transfer his three belongings. W and C denote the farmer. G. W.W.having only explored a very small part of the tree. G. W. the wolf and the cabbage respectively.C | | Nil) by the supplied knowledge base.4: The problem may be stated as follows. depth first search may get stuck exploring long (and potentially infinite) blind alleys. W. C) PR 9: ( W | | F. one may expand the state-space. as follows . C). G. C) -> ( Nil | | F. G | | W. G.C) . G.G | | F. C) -> ( F. On the other hand. G | | W. In the first case the wolf and the goat are at the left bank. W | | C) -> ( G | | F.

.

Backward Reasoning: The backward reasoning scheme can also be invoked for the problem. The reasoning starts with the goal and identifies a .

.

D.F.D.27 .A] [F.G.Question: no: 4: “Hand run” the backtrack algorithm on the graph in figure 3.F.A] [F.A] [G.N.J] [N.A] [H.G.C.F.L.B.M.C.M.H.E. NSL = [A].D.E.J] [E.B.P.A] DE [] [] [] [] [J] [K.A] [E.D.G.P.F. DE= [ ].D.B. CS = [A] AFTER ITERATION 0 1 2 3 4 5 6 7 8 9 10 11 12 13 CS [A] [B] [E] [J] [K] [L] [F] [G] [M] [N] [H] [O] [P] [C] SL [A] [B.D.H.K.D.SL.J] [B.D.P.B.A] [O.LK.B.C.C.H.G.F.B.E.A] [O.C.G.G.LK.C.C.E.H.A] NSL [A] [B.D.B.C.E.D.A] [P.E.J] [F.A] [K.A] [P.L.G.D.O.LK.J] [B.A] [M.H.J] [M.A] [L.J] [N.LK.H.O.M.B.F.M.A] [G.H.A] [L.A] [H.N.G.B.A] [E.A] [J.B.E.CS.B.A] [N.B.D.N.C.D.B.LK.B.G. Begin from state A keep track of the successive of the successive values of NSL.J] [F.E.B.C.G.B.B.G.B.A] [M.A] [J.G.E.B.J] .A] [k.F.G.E.LK.B.G.A] [C.E.A] [N.C.F.G.E.H.etc Solution:- We Initialize: SL = [A].B.LK.G.B.C.A] [C.F.E.G.LK.

b.he does not know the common ancestor named but knows that it was no more than eight generations back. Another person claim to be your distant cousin .H.D.LK.A] [R.H.J] [A.N. you would like to verify her claim.H.N.I.F.P. That’s why this is goal driven search.there may be different ways to find out the path or exact existence.J] [C.N.P.D.M.LK.R. Justify your answer.I.M.F. Solution:Usually a goal-driven. You would like to either find this ancestor or determine that she did not exit.M.P.O. Solution:Data driven search Justification:Data driven search uses the knowledge and constraints found in the given data of a problem to guide search along lines known to be true.I.G.O. because there are very few goals to investigate.F. Diagnosing mechanical problems in an automobile. Solution:Goal-driven search possible. a. But may be data-drive. c.A] [R.E.A] [I.B.J] [A D I R C G H P O N M F E L K J] The algorithm returns FAIL.A] [] [D.LK. You have met a person who claims to be your distant cousin. d.A] [I. A theorem prover for plane geometry.P.D.B. Solution:To find there existence we use goal driven search.E.A] [] [C.E.J] [C.G..B.14 15 16 17 [D] [I] [R] [] [D.O. Justification:The search can be where the data is collected.C. Then each goal is checked.G.H. Justification:- .G.E.M.B.LK.D.F.O. Justification:It is difficult to form a goal or hypothesis .D. suggesting possible goals (causes of the symptoms). with a common ancestor named John Doe.N. Question: no: 6: Determine whether goal-driven or data driven search would be preferable for solving each of the following problems.

b .You have met a person who claims to be your distant cousin. unless there are very few goals to investigate f. Disgnosing mechanical problems in an automobile . e.you would like to verify her claim.Data-driven. Justification: There are too many possible goals in most interesting cases. Question: no:7: Choose and justify a choice of breath –or-depth –first search for examples of Exercise6 Solution:a .with a common ancestor named john Doe . Justification:- . A program for examining sonar readings and interpreting them . c. Solution:Usually data-driven. The alternative of developing all possible theorems that follow from the axioms of geometry hoping to find the theorem in question is both theoretically and computationally impossible for any interesting proof. Solution:Usually done depth-first. Justification:This allows the program to follow a reasoning goal or hypothesis when a previous one is confirmed or denied. Another person claim to be your distant cousin . etc. genus. such as telling a large submarine from a small submarine from a whale from a school of fish. You Would like to either find this ancestor or determine that she did not exit.Theorem provers are almost universally goal-driven. Justification:This type of problem is almost always data-driven. Solution:Usually done depth first search Justification:Depth first search uses the knowledge and constraints found in the given search of a problem to guide search along lines known to be true. An expert system that will help a human classify plants by species. Solution:Usually done depth-first. Solution:.he does not know the common ancestor named but knows that it was no more than eight generations back .

A program for examining sonar readings and interpreting them .A theorem prover for plane geometry. e.etc. d .This allows the program to follow a line of reasoning and only change to a new goal or hypothesis when a previous one is confirmed or denied.Y) master (fred.Z) Gooddog(X) Collie(X) Collie(fred) trained(X) trained(fred) master(X. as was the Unify algorithm. Solution:Theorem provers are almost universally breath first search.sam) location(Y. such as telling a large submarine from a small submarine from a whale from a school of fish.Z) day(Saturday) -(warm(Saturday)) . Question: no: 9: Trace the goal –driven good-dog problem of example 3. Justification:This type of problem is almost always depth-first search. An expert system that will help a human classify plants by species. unless there are very few goals to investigate f. This allows unification substitutions to be pushed forward through the remaining expression. Solution:Location(X. Solution:Use of depth first search Justification:Usually depth-first. Justification:The alternative of developing all possible theorems that follow from the axioms of geometry hoping to find the theorem in question is both theoretically and computationally impossible for any interesting proof. Solution:This type of problem is almost depth first search.genus.34 in a data driven fashion.

35 for the case of an individual with four dependents. Solution:- \Investment(x) Investment(savings) Savings_account(inadequate) Amount_saved(x) dependents(Y) dependents() -greater(X.musesum} Question: no: 11: Trace a data –driven execution of the financial advisor of example 3. and a steady income of $25.Subsituition={fred/X. Based on a comparison of the problem and example in the text.000 in bank.000.steady) Earings(25. suggest a generally “best” strategy for this problem.sam/Y.minsavings(Y)) Fail savings_account(adequate) amount_saved(X) dependents(Y) greater(X.000) dependents() Income(adequate) Earings(X.steady) dependents(Y) dependents(2) greater(X.minsavings(Y)) Investment(stocks) Amount_savined(18000) Amount_savined(25.minsavings(Y)) . $18.000 per year.

not every word ending in "ly" is an adverb: "friendly. is an adjective  An adjective is a word joined to a noun or other substantive word or expression. Answers the questions "how many. used to tell how many things are spoken of. Solution:Adjective A word that describes or modifies a noun. (3) Demonstrative adjectives." for example." etc. wisely.' which in turn an adjective is modifying 'she'.36. vp ↔verb.↔noun adjective is modification of noun noun↔Adjective adverb is modification of adjective Verb↔ adverb Question: no: 14: .) Adverbs usually. pointing out particular things. (4) Pronominal adjectives.  Adjectives are divided into four classes:(1) Descriptive adjectives. words primarily pronouns. (However." "what kind. subject. np ↔art and noun. but not always. but used adjectively sometimes in modifying nouns instead of standing for them. s ↔np and vp. to describe it or to limit its application. ex: carefully.The highlighted portion is the best strategy to solve this problem. Adverb A word that describes or modifies a verb. ex: happy. which describe by expressing qualities or attributes of a substantive. they include relative and interrogative words. Question: no: 12: Add rules for adjectives and adverbs to the English grammar of Example 3. (2) Adjectives of quantity. red." 'very' is an adverb modifying 'tall. quickly. end in "-ly". or how much of a thing. also sometimes modifies an adjective. ("She was very tall. and dangerous. suicidal.

Subject. verb ↔[likes]. art ↔[the]. Sentence.3. s ↔np and vp. art ↔[a]. verb ↔[jumps].↔sentence and sentence Solution:Sentence. np ↔art and noun. pronoun ↔I or we or you or they or she or he or her or his or him or your’s or us or me or them . vp ↔verb.↔”name of every thing” noun ↔[cat]. object ↔Subject or noun and pronoun Question: no: 13: Add rules for (multiple) prepositional phrases to the English grammar of Example 3. noun ↔[dog]. hverb↔is or am or are or was or were or has or have or had or will or shall .36 that allow comlex sentences such as .↔noun and pronoun noun.↔subject and hverb and verb and object. Solution:- . verb ↔[sings].6.Add grammar rules to the English grammar of example 3.