Consider the following design for a simple problem solving agent:
function PROBLEM-SOLVING-AGENT(percept) returns
action
static: s, an action sequence, initially empty
static: state, a description of the current world state
static: g, a goal, initially null
static: problem, a problem formulation
state <- UPDATE-STATE(state, percept)
if s is empty then
g <- FORMULATE-GOAL(state)
problem <- FORMULATE-PROBLEM(state)
s <- SEARCH(problem)
action <- RECOMMENDATION(s, state)
s <- REMAINDER(s)
return action
The agent will first formulate its goal, then it will formulate a problem whose solution is a path (sequence of actions) to the goal, and then it will solve the problem using search.
Formally, a "goal" is a set of desirable world-states.
"Goal formulation" means ignoring all other aspects of the current state and the performance measure, and choosing a goal.
Example: if you are in Arad (Romania) and your visa will expire tomorrow, your goal is to reach Bucharest airport.
Be sure to notice and understand the difference between a "goal" and a description OF a goal. Technically "reach Bucharest airport" is a description of a goal. You can apply this description to particular states and decide yes/no whether they belong to the set of goal states.
The relevant set of states should include the current state, which is the initial state, and (at least one!) goal state.
The operators correspond to "imaginary" actions that the agent might take.
The goal test function is a function which determines if a single state is a goal state.
The path cost is the sum of the cost of individual actions along a path from one state to another.
Consider the vacuum cleaner world.

Imagine that our intelligent agent is a robot vacuum cleaner.
Let's suppose that the world has just two rooms. The robot can be in either room and there can be dirt in zero, one, or two rooms.
Goal formulation: intuitively, we want all the dirt cleaned up. Formally, the goal is { state 7, state 8 }.
Note that the { } notation indicates a set.
Problem formulation: we already know what the set of all possible states is. The operators are "move left", "move right", and "vacuum".
Let's draw the state space:
Suppose that the robot has no sensor that can tell it which room it is in and it doesn't know where it is initially.
Then it must consider sets of possible states.
Notice that regardless of what the initial state is, the sequence of actions [right,vacuum,left,vacuum] ends up in a goal state.
Suppose that the "vacuum" action sometimes actually deposits dirt on the carpet--but only if the carpet is already clean!
Now [right,vacuum,left,vacuum] is NOT a correct plan, because one room might be clean originally, but them become dirty.
[right,vacuum,vacuum,left,vacuum,vacuum] doesn't work either, and so on.
There doesn't exist any FIXED plan that always works.
An agent for this environment MUST have a sensor and it must combine decision-making, sensing, and execution. This is called interleaving.
So far we have assumed that the robot is ignorant of which rooms are dirty today, but that the robot knows how many rooms there are and what the effect of each available action is.
Suppose the robot is completely ignorant. Then it must take actions for the purpose of acquiring knowledge about their effects, NOT just for their contribution towards achieving a goal.
This is called "exploration" and the agent must do learning about the environment.
The interesting quantities are, therefore,
Abstraction means leaving out details about the world which are irrelevant such as the scenery or how hungry the driver is in the case of driving from Arad to Bucharest to get a new passport.
Saving less information about the world makes it much simpler to calculate what effect actions will have so the agent can solve the problem more quickly.
Cleverly chosen actions can also make the search go much faster.
For example, consider the 8-puzzle.

It is much better to let the actions be "move the blank up, down, left or right" than specifying actions that move the individual tiles or the tiles in a particular location because the branching factor of the search will be much less.
Consider another example, the 8-queens problem.
The objective is to place eight queens on a chessboard such that no queen threatens another.
A queen threatens another queen in the same row, column or diagonal.

In this example, the two queens on the corners are the only queens threatening each other.
The states and operators for this problem could be:
This is a bad choice because there are 64^8 possible sequences to investigate.
A better formulation would be to choose a smarter operator: that
Now there are only 2057 possible sequences to investigate.