The simplest agents discussed were the reflex agents, which base their actions on a direct mapping from states to actions. Such agents cannot operate well in environments for which this mapping would be too large to store and would take too long to learn. Goal-based agents, on the other hand, consider future actions and the desirability of their outcomes. In this chapter we will discuss a type of goal based agent called as “Problem Solving Agent”. e.g. Finding a path from Pune to Mumbai Goal formulation, based on the current situation and the agent’s performance measure, is the first step in problem solving. Problem formulation is the process of deciding what actions and states to consider, given a goal. The process of looking for a sequence of actions that reaches the goal is called search. A search algorithm takes a problem as input and returns a solution in the form of an action sequence. Once a solution is found, the actions it recommends can be carried out. This is called the execution phase. Solving Problems by Searching Well-defined problems and solutions A problem can be defined formally by five components: The initial state that the agent starts in. A description of the possible actions available to the agent. A description of what each action does; the formal name for this is the transition model, specified by a function RESULT (s, a) that returns the state that results from doing action a in state s. Together, the initial state, actions, and transition model implicitly define the state space of the problem the set of all states reachable from the initial state by any sequence of actions. The state space forms a directed network or graph in which the nodes are states and the links between nodes are actions. A path in the state space is a sequence of states connected by a sequence of actions. The goal test, which determines whether a given state is a goal state. Solving Problems by Searching A path cost function that assigns a numeric cost to each path. The step cost of taking action a in state s to reach state s’ is denoted by c(s, a, s’). A solution to a problem is an action sequence that leads from the initial state to a goal state. Solution quality is measured by the path cost function, and an optimal solution has the lowest path cost among all solutions. EXAMPLE PROBLEMS A toy problem is intended to illustrate or exercise various problem-solving methods. It can be given a concise, exact description and hence is usable by different researchers to compare the performance of algorithms. A real-world problem is one whose solutions people actually care about. Such problems tend not to have a single agreed-upon description, but we can give the general flavor of their formulations. Solving Problems by Searching A Toy Problem e.g. Vaccum Cleaner States: The state is determined by both the agent location and the dirt locations. The agent is in one of two locations, each of which might or might not contain dirt. Thus, there are 2 × 2^2 = 8 possible world states. A larger environment with n locations has n · 2^n states. Initial state: Any state can be designated as the initial state. Actions: In this simple environment, each state has just three actions: Left, Right, and Suck. Larger environments might also include Up and Down. Transition model: The actions have their expected effects, except that moving Left in the leftmost square, moving Right in the rightmost square, and Sucking in a clean square have no effect. Goal test: This checks whether all the squares are clean. Path cost: Each step costs 1, so the path cost is the number of steps in the path. Solving Problems by Searching The 8-puzzle States: A state description specifies the location of each of the eight tiles and the blank in one of the nine squares. Initial state: Any state can be designated as the initial state. Note that any given goal can be reached from exactly half of the possible initial states. Actions: The simplest formulation defines the actions as movements of the blank space Left, Right, Up, or Down. Different subsets of these are possible depending on where the blank is. Transition model: Given a state and action, this returns the resulting state; for example, if we apply Left to the start state in Figure 3.4, the resulting state has the 5 and the blank switched. Goal test: This checks whether the state matches the goal configuration. Path cost: Each step costs 1, so the path cost is the number of steps in the path. Solving Problems by Searching 8-queens problem States: Any arrangement of 0 to 8 queens on the board is a state. Initial state: No queens on the board. Actions: Add a queen to any empty square. Transition model: Returns the board with a queen added to the specified square. Goal test: 8 queens are on the board, none attacked. States: All possible arrangements of n queens (0 ≤ n ≤ 8), one per column in the leftmost n columns, with no queen attacking another. Actions: Add a queen to any square in the leftmost empty column such that it is not attacked by any other queen. Solving Problems by Searching Real-world problems Route-finding algorithms are used in a variety of applications. Some, such as Web sites and in-car systems that provide driving direction. Consider the airline travel problems that must be solved by a travel-planning Web site. States: Each state obviously includes a location (e.g., an airport) and the current time. Furthermore, because the cost of an action (a flight segment) may depend on previous segments, their fare bases, and their status as domestic or international, the state must record extra information about these “historical” aspects. Initial state: This is specified by the user’s query. Actions: Take any flight from the current location, in any seat class, leaving after the current time, leaving enough time for within-airport transfer if needed. Transition model: The state resulting from taking a flight will have the flight’s destination as the current location and the flight’s arrival time as the current time. Goal test: Are we at the final destination specified by the user? Path cost: This depends on monetary cost, waiting time, flight time, customs and immigration procedures, seat quality, time of day, type of airplane, frequent-flyer mileage awards, and so on. Solving Problems by Searching Real-world problems : Touring problems Traveling salesperson problem VLSI layout Robot navigation Can you list some problems...? Searching For Solutions A solution is an action sequence, so search algorithms work by considering various possible action sequences. The possible action sequences starting at the initial state form a search tree with the initial state at the root; the branches are actions and the nodes correspond to states in the state space of the problem. Searching For Solutions Searching For Solutions A solution is an action sequence, so search algorithms work by considering various possible action sequences. The possible action sequences starting at the initial state form a search tree with the initial state at the root; the branches are actions and the nodes correspond to states in the state space of the problem. Searching For Solutions A solution is an action sequence, so search algorithms work by considering various possible action sequences. The possible action sequences starting at the initial state form a search tree with the initial state at the root; the branches are actions and the nodes correspond to states in the state space of the problem.