0% found this document useful (0 votes)
20 views

Unit 1 (A, B, C, D)

notes

Uploaded by

Sonu Kushwaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
20 views

Unit 1 (A, B, C, D)

notes

Uploaded by

Sonu Kushwaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
vs® | to ible sof e © > GATE ACADEMY PUBLICATIONS® 7 Overview & Search Techniques S.No. Informed Search Uninformed Search i Informed strategies use agent's background information about the Problem map, costs of actions, approximation of solutions. Uninformed strategies use only the information available in the problem definition. In informed search, a heuristicis used as a guide that leads to better overall performance in getting to the goal state. Uninformed search (blind search) has no information about the number of steps or the path costs from the current state to the goal. Instead of exploring the search tree blindly, one node at a time, the nodes that we could go to are ordered according to —_ some evaluation function A(n) that determines which node is probably the "best" to go to next. They can only distinguish a goal state from a non-goal state. There is no bias to go towards the desired goal. Also known as "heuristic search,” informed search strategies use information about the domain to (try to) (usually) head in the general direction of the goal node(s). Also known as "blind search,” uninformed search strategies use no information about the _ likely “direction” of the goal nodes). 5. Using specific knowledge this method gives solution efficiently. Uninformed search methods are very inefficient in most cases Use comparatively much lesser time and memory. It leads to higher time and memory time complexity. Informed search methods: Hill climbing, best-first, greedy search, beam search, A* algorithm, AO* algorithm. Uninformed search methods: Breadth-first, depth-first, depth- limited, uniform-cost, depth-first iterative deepening, bidirectional. Question 19 Describe the water-jug problem. Give a solution Strategy. ICSVTU, IT : May 2011, 2012, 2013, Dec 2015, CSE : Dec 20111 Ans. Water jug problem : We are given two jugs, a 4-gallon one and a 3-gallon one. Neither hhas any measuring marks on it. There is a pump that can be used to fill the jugs with water. How can we get exactly 2 litres of water into 4litre jug. States : amount of water in both jugs. Actions : empty large/small, pour from large/small. Goal : specified amount of water in both jug. Path cost : total no of actions applied. EEE ESTES TUNCTHION. Best First Search Explain best first search with algorithm, Or When best first search algorithm, will be applicable? With a suitable algorithm and example explain the best first search. ICSVTU, IT : May 2010, Best-first search is explained using a search graph given in figure ; 1. First, the start node S is expanded. It has three children A, Band C with values 3, 6 and 5 respectively. These values approximately indicate hove far they are from the goal node, 2 The child with minimum value namely A is chosen. The children of A’ are Benerated. They are D and E with values 9 and 8, 3: The search process has now four nodes to search for. ie, node D with value 9, node E with value 8, node B with value 6 and node C with value 5. Of them, node Chas got the minimal value which is expanded to give node H with value 7, 4 At this point, the nodes available for search are (D : 9), (E: 8), (B: 6) and (1:7) where (1:B) indicates that (a) is the node and B is its evaluation value. Of these, Bis minimal and hence B is expanded to give (F :12), (G: 14), 5. At this juncture, the nodes available for search are (D : 9), (E: 8), (H: 7), (F: 12) GATE ACADEMY PUBLICATIONS® 6. Nodes now available for expansion are (D : 9), (E:8), Of these, the node with minimal value is (I: 5) which node, 1-39 Overview & Search Techniques (F:12),(G: 14), :5), is expanded to give the goal ). Evaluation function value Start. Node Lal Fig. A sample tree for best-first search The entire steps of the search process are given in table. Table : Search process of best-first search Step | Node being Children Available nodes Node expanded chosen 1 s (A:3), (B: 6), (C:5) (A:3), (B: 6), (C:5) (A:3) 2 A (D:9), (E:8) (B: 6), (C:5), (D:9), (E:8) (C:5) 3 G (i: (8:6), (D:9) E:8), (H:7) (B:6) 4 B (F :12), (G:14) (D:9), (B:8), (4:7) (7) (F:12), (G:14) 5, H :5), 0:6) (D:9), ©:8),(F: 12) (5) (G:14), 1:5), 0:6) 6. I (K:1),(L:0) (D:9), (E:8), (F:12) Search stops (M:2) (G:14), 0:6), (K:1) as goal is (L:0), (M:2) reached As you can see, best-first search “jumps all around” in the search graph to identify the node with minimal evaluation function value. There is only a minor variation between former, we sorted the children of the firs the entire list to identify the next node to Algorithm for best-first search: Step 1: Put the initial node ona list START. Step 2: If (START is empty) or (START = GOAL), then terminate search, hill-climbing and best-first search. In the t node being generated. Here, we have to sort be expanded. Artificial Intelligence & Expert Systems 1-40 GATE ACADEMY PUBLICATIONS® Step 3: Remove the first node from START. Call this as node a. Step 4: If (a= GOAL), then terminate search with success. Step 5: Else if node a has successors, generate all of them. Find out how far they are from the goal node. Sort them by the remaining distance from the goal. Step 6: Name this list as START 1. Step 7: Replace START with START 1. Step 8 : Goto Step 2. The paths found by best-first search are likely to give solutions faster because it expands a node that seems closer to the goal. However, there is no guarantee on this. ERP A* and AO* Search * 3. The structure of the constraint graph can be used to simplify the solution process in some cases giving exponential reduction in complexity. Question 44 Ans. Solve the given crypt-arithmetic problem : ICSVTU, IT : May 2010, 2011, 2013, 2014, Dec 2011, 2015, CSE : May 2010, 2016, Dec 2013, 2011] SEND () _+MoRE MONEY 1. These problems are typically constraint satisfaction problem which aim to find Subsequent set of digit for letters. So that the resulting s-is arithmetically correct. No two letters can have the same value. The sum of digits must be shown in the resultant. Carry should always be 1 or 0. . The digit limit is from 0 and 9. ‘The first step, propagation, arises from the fact that there are usually dependencies among the constraints. These dependencies occur because many constraints involve more than one object and many objects participate in more than one constraint. So, if we start with one constraint, N= E + 1. Then if we added the constraint N = 5, we could propagate that to geta stronger constraint on E, namely that E = 2. Constraint propagation also arises from the presence of inference rules that allow additional constraints to be inferred from the ones that are given. Finally, termination of constraint propagation takes place because of one of following two reasons : 1. A contradiction may be detected. If this happens then there is no solution consistent with all the known constraints, If the contradiction involves only those constraints that were given as part of the problem specification, then no solution exists, 2. If propagation has run out of steam and there are no further changes that can be made on the basis of current knowledge. If this happens and a solution has not yet been adequately specified, then search is necessary to get the process moving again, This is the point where, second step begins. Some hypothesis about a way to strengthen the constraints must be made. In cryptarithmetic problem, this usually means guessing a particular value for some letter. (ii) CROSS + ROADS = DANGER. se eN GATE ACADEMY PUBLICATIONS® 4 47 Overview & Search Techniques Once this has been done, constraint propagation can begin again from this new state, ifsotution is found, it can be reported. If still more guesses are required, they can be made. If a contradiction is detected, then backtracking can be used to try a different guess and proceed with it. Algorithm for this procedure is given as follows : Algorithm : Constraint satisfaction algorithm : 1. Propagate available constraints. To do this, first set OPEN to the set of all objects that must have values assigned to them in a complete solution. Then do until an inconsistency is detected or until OPEN is empty. () Select an object OB from OPEN. Strengthen as much as possible the set of constraints that apply to OB. i) If this set is different from the set that was assigned the last time OB was examined or if this is the first time OB has been examined, then add to OPEN all objects that share any constraints with OB. (iii) Remove OB from OPEN. 2. If the union of the constraints discovered above defines a solution, then quit and report the solution. 3. If the union of the constraints discovered above defines a contradiction, then return failure. 4. Ifneither of the above occurs, then it is necessary to make a guess at something in order to proceed. To do this, loop until a solution is found or all possible solutions have been eliminated : (i) Select an object whose value is not yet determined and select a way of strengthening the constraints on that object. (i) Recursively invoke constraint satisfaction with the current set of constraints augmented by the strengthening constraint just selected. 9567 1085 10652 Rules for propagating constraints generates the following constraints : + M=1,since two single-digit numbers plus a carry cannot total more than 19. * S=8or9, since S+M+C3 >9 (to generate the carry) and M = 1, S414#C3 >9, so S + C3>8 and C3 is at most 1. + O=0, since S + M(1) + C3(<=1) must be at least 10 to generate a carry and it can be most 11. But M is already 1, so O must be 0. * N-=EorE+l, depending on the value of C2. But N cannot have the same value as E. So N= E+] and C2is 1. * In order for C2 to be 1, the sum of N+R+C1 must be greater than 9, so N +R must be greater than 8. + _N+R cannot be greater than 18, even with a carry in so E cannot be 9. (4 Egd: Artificial Intelligence & Expert Systems 1-48 GATE ACADEMY PUBLICATIONS® ; * Suppose E is assigned the value 2, * The constraint propagator now observes that : N-=3since N=E+1. R~8 or9, since R+N @) +Cl (1 or 0) =2 or 12. But since N is already 3, the sum of these nonnegative numbers cannot be less than 3. Thus R +3 +(0 or D= 12 and R=8 or 9. * 2+D=Yor2+D=10+Y, fro the sum in rithmost column. M=1,S=80r9 Initial state : SEND No two letters have * MORE the same value. MONEY ©The sum of the digits must be as shown I M=1 R=9 S=8 E=2 N=3 O=0 D=4 Y=6 Fg2 Conflict Conflict us 85 +45 +15 “ALL 0 Fg3: SHE 634 atHE +834 BEST 1468 Eg: EAT 819 THAT +9219 APPLE 10038 Egs: CROSS 96233 +ROADS +62513 DANGER 158746 GATE ACADEMY PUBLICATIONS® 1-49 Overview & Search Techniques D =1 is obvious. From $ +5 =R we know Ris even. Assume different letters stand for different numbers, then pick choices for R, S and O in that order. Question 45 ' Solve the following crypto-arithmetic problem. [CSVTU, CSE : Dec 2006] i) P)CUP\UPS ii) IT*IT ? oo a XU ITX U DDT xP the tree with the ceo eS Value 0 oF less than 0 only. Thus the tree with the Toot K will be pruned, which would save a lot of time in searching. EREA, Alpha Beta Pruning Question 51 Explain Alpha-beta pruning. ICSVTU, IT: May 2010, 2016, CSE: Dec 2010, 2014] Ans. Alpha beta pruning: Alpha values : Ata Max node we will store an alpha value A lower bound on the exact minimax score The true value might be > a If we know Min can choose moves with score B. * Then Max will Never choose to | less, Alpha beta in action : Why can we cut off search? B=2 the beta of any min ancestor. This is beta cutoff 2 Oritis a min node and the beta value is < the alpha of any max ancestor. This is alpha cutoff. Calculating alpha-beta values : * Alpha-Beta calculations similar to Minimax, but the Pruning rule cuts down search. Final backed up value of node. 1. Might be the maximum value, 2. Ormight be an approximation where search cut off. Less than the minimax value at aMax node. More than the minimax value at a Mid node. We don't need to know the true value. Calculating alpha values at a max node : * After we obtain the final backed up value of the first child. 1. We set ex of the node to this value When we get the final backed up value of the second child, 1. We increase ix if the new value is larger. When we have the final child, or if fb cutoff. 1. a value becomes the final backed up value. 2. Only then can we set the B of the parent Min node. Calculating beta values at Min : * After we obtain the final backed up value of the first child, we set Bof the node to this value When we get the final backed up value of the second child 1. we decrease f if the new value is smaller ‘When we have the final child, or if a ~cutoff 1. B value becomes the final backed up value SLICATIONS® & Expert Systems _1-60 GATE ACADEMY PUBI Artificial Intelligence ; Alpha-beta pruning example : efh kl Poor Min © MINIMAX (n, alpha, beta) TF nis at the search depth, RETURN V(n) FOR each child m of n value= MAXIMIN (m, alpha, beta) IF value < beta , beta = value TF beta < alpha, retum alpha RETURN beta Performance of Alpha-Beta % Pruning : -Pends on the order in which the nodes are encountered at the search, frontier. 2. Optimal - b!- if the Node is generated first, and the IN node is generated first. 3. Worst-b, 4 Average b™ - random ordering, FREY Game of Chance uM =.

You might also like