# Feng Zhiyong Tianjin University Fall 2008.  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.

## Presentation on theme: "Feng Zhiyong Tianjin University Fall 2008.  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving."— Presentation transcript:

Feng Zhiyong Tianjin University Fall 2008

 datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving performance ◦ The effectiveness of a search can be measured in at least three ways. First, does it rind a solution SEARCH COST at all? Second, is it a good solution (one with a low path cost)? Third, what is the search cost TOTAL COST associated with the time and memory required to find a solution? The total cost of the search is the sum of the path cost and the search cost.5

 The 8-puzzIe ◦ States: a state description specifies the location of each of the eight tiles in one of the nine squares. For efficiency, it is useful to include the location of the blank. ◦ Operators: blank moves left, right, up, or down. ◦ Goal test: state matches the goal configuration shown in Figure 3.4. ◦ Path cost: each step costs 1, so the path cost is just the length of the path.

 Goal test: 8 queens on board, none attacked.  Path cost: zero.  States: any arrangement of 0 to 8 queens on board.  Operators: add a queen to any square.  States: arrangements of 0 to 8 queens with none attacked.  Operators: place a queen in the left-most empty column such that it is not attacked by any other queen.  States: arrangements of 8 queens, one in each column.  Operators: move any attacked queen to another square in the same column.

 State sets: subsets of states 1-8 shown in Figure 3.2 (or Figure 3.6).  Operators: move left, move right, suck.  Goal test: all states in state set have no dirt.  Path cost: each action costs 1.

 States: a state consists of an ordered sequence of three numbers representing the number of missionaries, cannibals, and boats on the bank of the river from which they started. Thus, the start state is (3,3,1).  Operators: from each state the possible operators are to take either one missionary, one cannibal, two missionaries, two cannibals, or one of each across in the boat. Thus, there are at most five operators, although most states have fewer because it is necessary to avoid j illegal states. Note that if we had chosen to distinguish between individual people then j there would be 27 operators instead of just 5.  Goal test: reached state (0,0,0).  Path cost: number of crossings.

 Route finding  Touring and travelling salesperson problems  VLSI layout  Robot navigation  Assembly sequencing

 Generating action sequences

 the state in the state space to which the node corresponds;  the node in the search tree that generated this node (this is called the parent node);  the operator that was applied to generate the node;  the number of nodes on the path from the root to this node (the depth of the node);  the path cost of the path from the initial state to the node.

 MAKE-QUEUE(Elements) creates a queue with the given elements.  EMPTY?(Queue) returns true only if there are no more elements in the queue.  REMOVE-FRONT(Queue) removes the element at the front of the queue and returns it.  QUEUlNG-FN(Elements,Queue) inserts a set of elements into the queue. Different varieties of the queuing function produce different varieties of the search algorithm.

 Four criteria ◦ Completeness: is the strategy guaranteed to find a solution when there is one? ◦ Time complexity: how long does it take to find a solution? ◦ Space complexity: how much memory does it need to perform the search? ◦ Optimality: does the strategy find the highest-quality solution when there are several different solutions?7

 Breadth-first search ◦ The news about breadth-first search has been good. To see why it is not always the strategy of choice, we have to consider the amount of time and memory it takes to complete a search.

 Breadth-first search ◦ The memory requirements area bigger problem for breadth-first search than the execution time. ◦ The time requirements are still a major factor

 Uniform cost search: modifies the breadth-first strategy by always expanding the lowest-cost node on the fringe (as measured by the path cost g(n)), rather than the lowest-depth node.  g(SUCCESSOR(n)) > g(n)

 Depth-first search ◦ has very modest memory requirements.

 Depth-limited search

 Iterative deepening search: time complexity of iterative deepening is still O(b d ), and the space complexity is O(bd).

 Bidirectional search: Time and space complexity areO(b dl2 )

 Do not return to the state you just came from. Have the expand function (or the operator set) refuse to generate any successor that is the same state as the node's parent.  Do not create paths with cycles in them. Have the expand function (or the operator set) refuse to generate any successor of a node that is the same as any of the node's ancestors.  Do not generate any state that was ever generated before. This requires every state that is generated to be kept in memory, resulting in a space complexity of O(b d ), potentially. It is better to think of this as O(s), where s is the number of states in the entire state space.

Download ppt "Feng Zhiyong Tianjin University Fall 2008.  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving."

Similar presentations