Anda di halaman 1dari 6

Coursework AI Method COB107

1. There are two main search techniques: uninformed search and heuristic search. With the help of examples, explain in detail, the differences between these techniques. (5 marks) (The answer should be around two pages long.) There are two main search techniques, uninformed search and heuristic search. Uninformed search has no knowledge about the distance or the cost to reach the goal state. A description of the goal state needs to be given so the search can detect when a goal state has been found. Other requirements needed for uninformed search is a state description, a set of operators and an initial state. Uninformed search can only generate successors of the parent node and distinguish a goal from a non-goal state. The order in which the nodes are expanded determines the search strategy used. Breadth-first search, uniform-cost search, depth-first search, depth-limited search, iterative deepening search and bidirectional search are basic uninformed search algorithms. Uninformed search is also known as blind search or brute-force search. Breadth-first search involves expansion of the shallowest nodes first. This search is complete and optimal for unit costs. Uniform-cost search will expand the node with the lowest path cost g(n). This is optimal for general step costs. Depth-first search expands the deepest node unexpanded nodes first. Depth-first search is not complete or optimal. Depthlimited search is similar to depth-first search however, a depth bound is added. Iterativedeepening search gradually increases the limit until a goal is found. It is optimal and complete. Finally, bidirectional search involves running two searches simultaneously, one forward from the initial state and the other backwards from the goal state. The search will meet in the middle. These searches are often complete and optimal however, they are less effective strategies compared to heuristic search. Heuristic search strategy uses problem-specific knowledge. This is extra information other than the problem defined. This can find a solution more efficiently compared to an uninformed strategy. Heuristic is selective at each node point. At a node, the heuristic search will consider all the possible neighbouring nodes and chooses the most promising node as the successor and continue searching for the goal state. As well as uninformed search, heuristic also has many search strategies within it such as best-first search. Best-first will select nodes for expansion according to the evaluation function. The evaluation function is cost estimate. This means the node with the lowest cost is expanded first. Another search strategy is greedy-first search which expands nodes closest to the goal. Heuristic function h(n) is the estimate cost of the cheapest path from the state of the node to the goal state. Therefore, h(n) needs to be minimal for a quicker solution to be obtained. A* search combines g(n), which is the cost to reach the node, with the heuristic function h(n) to get f(n)=g(n)+h(n). When using A* search, the cheapest solution is trying to be found so the node that is expanded first will be the node with the lowest value of f(n)=g(n)+h(n). Using comparing these two main techniques, it is hard to see which technique is more efficient. For instance comparing breadth-first search to best-first search shows the best-first can lead to a cheaper solution. For example, if we have two intermediate nodes N1 and N2 and the cost function of N1 is less than the cost function of N2 then breadth-first search will expand N1. However, if we have more knowledge about the cost required to reach the goal state from N1 or N2, a cheaper solution can be generated. If the sum cost of

going from the start node to N1 and from N1 to the goal state is more than the sum cost of the start node to N2 and from N2 to the goal state, then N2 will be expanded as a cheaper solution has been generate. This is known at best-first search. Is illustrates that having more knowledge about the problem, other than the problem definition, and cheaper solution can be generated, making heuristic search more efficient. The main difference between the two main techniques is that uninformed search is a method that has access to only the problem definition. On the other hand, heuristic search may have access to a heuristic function h(n), which will estimate the cost of a solution from n. As heuristic search is problem-specific, it improves efficiency when compared to uninformed search. 2. With the help of examples, explain the advantages and disadvantages of the two search techniques mentioned in Question 1. (5 marks) (The answer should be around two pages long.) A disadvantage of using uninformed search techniques is that solution may take longer to find. Breadth-first search searches for a solution breadth-wise, meaning all the states will be searched first before moving to the next level. Only once the solution has been found will the search stop. Using breadth-first search will you be guaranteed to find a solution if one exists. However, if the solution exists is will be on level 6, for example, each node will need to be explored on each level before moving to the next level. This increasing the time complexity and the space complexity as more memory will be need to space the store the nodes. Depth-first search can be similar to breadth-first search. If the solution exists in the first branch, a solution can found quickly. However, if the solution exists in another branch further away, then there is not much difference between breadth-first search and depth-first search. This can trap depth-first search in an infinite loop. However, by using a heuristic search over uninformed search can be an advantage. This is because the problem can be solved more efficiently as relevant information is given. Using the given heuristic information, the search can decide whether or not to explore current state further. Best-first search will store nodes that have been explored allowing the search to backtrack if it realises the present path proves unworthy. Using heuristic search techniques in this way reduces the time complexity and space complexity making heuristic search techniques more efficient. 3. Consider the 3-puzzle problem, where the board is a 2X2 matrix. There are three tiles numbered 1, 2, and 3, and there is one blank tile. There are four operators that move the blank up, down, left, or right. The start and goal states are given in the following figure. With the help of search trees, show how a path to the goal can be found using: a. depth first search (3 marks) b. breadth first search (3 marks) c. A* search with the heuristic being the sum of the number of moves and the number of misplaced tiles. (3 marks)

If a search method does not find a solution, explain why it does not. (2 marks) START state
2 1 3

GOAL state
1 3 2

a)
A

This diagram is a representation of using depth-first search to solve the 3-puzzle problem. Only the START state and GOAL state have been stated. To generate a successor in a particular state, possible moves are applied using the operators. When using depth-first search, the deepest node of the search is expand. In the tree search above, state A is the initial state and can generate state B and C. B is selected and generates states D and E. B has been selected because of the predetermined condition stated above. As state E is a duplicate of the START state, it can be discarded. Therefore state D is selected to be expanded further to generate states F and G. state G is a duplication of state B, therefore it can be discarded leaving state F to be expanded and generate state H and I. Once state H has been generated, the search will stop as state H is the GOAL state.

b)

For the breadth-first search, the root nodes are expanded first then the successors will be expended next. The tree graph for the 3-puzzle problem, the left side will be expanded first followed by the right side. The START state A is expanded into two further states to generate states B and C. According to breadth-first search, the left side is expanded first, followed by the right side before the search generates any further levels. Therefore, state B will be expanded to generate D and E, followed by the expansion of C to generate F and G. Once states B and C have been expended, the search will move to the next expansion where state D generates state H and I, state F generates states J and K. Both states E and G are duplications of state A, therefore they have been discarded. Finally, state H has been expanded and generates states L and M. The search will go no further as the GOAL state has been reached at state L. c)

4. Write the following English language statements in logic: a. Every student who likes COB107 is smart. (2 marks) b. There is a barber who shaves all men who do not shave themselves. (2 marks) a) x, Student(x) Likes(x, COB107) Smart(x) b) x Barber(x) y Man(y) Shaves(y, y) Shaves(x, y) 5. There is a farmer, a fox, a goose, and a bag of corn. The farmers goal is to move all of this stuff across a river. His boat will only hold himself, and one of the other three items. The fox will eat the goose if the farmer is not present, and the goose will eat the corn if the farmer is not present. Show a representation of the problem state, and a plan that will allow the farmer to achieve his goal with the minimum number of moves. [5 marks] f=farmer, F=fox, G=goose, C=corn Solution 1

Steps From f FGC 1 f FC 2 f FC 3 F 4 f FG 5 G 6 fG 7


Solution 2

River > < > < > < > River > < > < > < >

To fG G f GC C f FC FC f FGC To fG G f GF F f FC FC f FGC

Steps From f FGC 1 f FC 2 f FC 3 C 4 f CG 5 G 6 fG 7

This is the first way to move from the start state to the goal state. First the farmer will take himself on the goose across to river, leave the goose there and return to the other side of the river where the fox and corn are. Next the farmer can either take the fox across the river or the corn across the river. Solution 1 shows the corn being taken across the river and solution 2 shows the fox being taken across the river. After the corn or the fox has been taken to the other side where the goose is, the corn/fox will be dropped and the goose will return with the farmer. The farmer will then dropped the goose off and take the corn/fox to the other side and drop it off. Finally, the farmer returns to pick the goose up, cross the river and drop the goose off. The goal state has been reached here. The farmer, fox, goose and corn have crossed the river successfully.

This is the farmer, fox, goose and corn problem in the form of graph. From the graph, the farmer, fox, goose and corn are on the left side of the bank. The farmer first takes the goose to the right side of the bank. He then returns to the left bank and can take either the fox or the corn, this is represented in the graph where it splits. Whichever item is taken across the next, the fox or the corn, the farmer has to return to the left bank with the goose. Once the farmer has returned with the goose, either the fox or the corn will cross to the right bank, this will depend on which the farmer took first. Once done, the farmer will return and the take goose to the right bank. Thus there are seven crossing, four forwards and three backwards.

Anda mungkin juga menyukai