Sei sulla pagina 1di 5

PROBLEM-SOLVING AGENTS

Goals and Goal Formulation - first step in problem solving Problem Formulation deciding on actions and states to consider, given a goal Search - for Sequences of Actions that Lead to the Goal (Solution) Execute carry out the actions recommended by the solution Hence, the formulate, search, execute cycle

AN EXAMPLE :

Problem-solving in a simple environment

The (agent design) assumes that the environment is


1. Static formulating & solving the problem is done without paying attention to any

changes in the environment 2. Observable initial state is known 3. Discrete because alternative courses of action can be enumerated 4. Deterministic solutions to problems are single sequences of actions, so they cant handle any unexpected events.

PROBLEM FORMULATION
- Well-defined problems can be defined by the following 4 components
1. 2.

3. 4.

Initial State the start state of the agent Operators possible actions available to agent. Example is the Successor function. State space = initial state + successor function. A path is a sequence of states connected by a sequence of actions. Goal Test determine whether a given state is a goal state; in general, there are many goal states. Path cost function that assigns a numeric cost to each path; the step cost is the cost of moving from a state to the next state.

Note: Our aim is to optimize the solutions to our problems that is, to minimize the path cost from the initial state to a goal state. We abstract as much as possible when we formulate a problem. Problems are solved by searching through the state space. The resulting search tree is evaluated as follows: 1. Start at root node of tree 2. Expand (by using the successor function) the current state to find other states, and check which of these are goal states. 3. The search strategy is used to determine which state to expand. Each node has the following 5 components: (a) (b) (c) (d) (e) STATE PARENT-NODE ACTION - action applied to the parent to generate the node PATH-COST : the cost, g(n), of the path from initial state to the node DEPTH number of steps along the path from initial state.

Note: The collection of nodes generated but not yet expanded is called the fringe. Note: We assume that the nodes used in a search form a queue.

Operations on a queue 1. 2. 3. 4. 5. 6. MAKE-QUEUE : create a queue with a set of elements EMPTY? - check if there are elements left in a queue FIRST returns the first element of a queue REMOVE-FIRST : returns first element and remove it from the queue INSERT - insert an element into the queue and return the resulting queue INSERT-ALL : insert a set of elements and return the queue.

Measuring Problem-Solving Performance Criteria for evaluating search strategies


Completeness will algorithm find solution if one exists? Time Complexity - how long it takes to find solution Note: Time is measured in terms of the number of nodes generated during search Space Complexity - memory required to perform search Note: Space is measured in terms of maximum number of nodes stored in memory Optimality - does algorithm find optimal solution?

Note: In AI, complexity is expressed in terms of 3 quantities:


-

b : the maximum number of successors of any node (that is, the branching factor) d : depth of the shallowest goal state m : maximum length of any path in the state space.

SEARCH STRATEGIES
1. Uninformed (blind) Search
This strategy has no additional information about states beyond what is provided in the problem definition. All it does is generate successors and distinguish a goal state from a nongoal state. There are 5 methods:

(a) Depth-first Search (DFS)


Expand the node deepest in the tree. Backtrack when you reach a non-goal node with no descendants Problems with DFS It can make a wrong choice and go down a long (possibly infinite) path, although there may be a solution close to the root of the tree. DFS is not optimal. If left subtree is of unbounded depth, but contained no solutions, DFS would never terminate. Hence, DFS is not complete. Time complexity of DFS is O(bm) Space complexity of DFS is O(bm)

(b) Breadth-first Search (BFS)

Expand all the nodes at depth d before expanding at depth d+1. (Sequence is: root node, then its children, its grandchildren, etc) Optimal? Yes, if path cost is a non-decreasing function of the depth of the goal node (in particular, if all step costs are equal). Complete? Yes. If the shallowest goal node is at depth d, BFS will find it after expanding all shallower nodes (if branching factor b is finite)
Note: BFS is not very popular because of its time and space complexities they are both exponential in nature!!

Space complexity of BFS is O(bd+1) Time complexity of BFS is O(bd+1)


Note: The memory requirements of BFS are a bigger problem than is the execution time.

(c) Depth-limited Search (DLS)

Solves problem of unbounded trees (the infinite-path problem) in DFS by using a predetermined depth limit l. DLS is still incomplete if l < d that is, the shallowest goal is beyond the limit. DLS is nonoptimal if l > d. Time complexity is O(bl); space complexity is O(bl).

(d) Iterative Deepening Search (IDS)


-

Finds the best depth limit. Gradually increase the limit 0, 1, 2, - until goal is found at depth limit d.

IDS combines the benefits of DFS and BFS. Like DFS space complexity is O(bd).

Like BFS it is complete when the branching factor is finite; and it is optimal if path cost is a non-decreasing function of the depth of the goal node. Time complexity is O(bd).

Note: IDS is the preferred uninformed search when search space is large and the depth of the solution is not known.

REVIEW: Compare the search algorithms discussed must know essential characteristics of each method.

Potrebbero piacerti anche