If this is not the course you expected to find in this room, stick around anyhow: this will probably be more interesting than the course you were looking for.
Some points to note:
Formally, a goal is a set of desirable states of the world and a plan is a sequence of actions. An action takes the agent from one state to another state.
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.
Problem formulation means choosing a relevant set of states to consider, and a feasible set of operators for moving from one state to another.
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 actions that the agent might take.
Search is the process of imagining sequences of operators applied to the initial state, and checking which sequence reaches a goal state.
A standard example of a planning problem formulated as a search problem is the so-called 8-puzzle.
The agent searches over the state space for a sequence of actions that lead to a goal state.
Important: typically the agent does not "know" the entire search space, where "know" means "has available an explicit representation of". What is called a "representation" in AI is often called a data structure elsewhere in computer science.
Instead of "knowing" the full search space, the agent knows the initial state, and it knows operators. An operator is a function which "expands" a node. "Expanding" a node means computing the node(s) (zero, one, or many) that the agent could move to using all applicable operators.
With this available knowledge, the general search algorithm that the agent can use is:
The algorithm above assumes that when a node is chosen, all available operators are also chosen. Alternatively expansion could be viewed as a process with two inputs: the node to start from, and the operator to be used.input: a well-formulated search problem
a function "insert" to place new nodes into a queuefringe := make-queue(initial-node)
loop
if empty?(fringe) then return FAIL
else
X := remove-front(fringe)
if isa-goal?(state(X)) then return X
else
fringe := insert(fringe,expand(X))
end loop
When a node is expanded, it may prove to have no children.
Expanding a leaf node may lead to another node that has already been visited. In general the search algorithm does not "know" this. (Remember that "know" means "has available a directly usable explicit representation".) In some domains it is easy to test whether multiple nodes correspond to the same state in the "real world". In other domains it is impossible.
The general search algorithm explores a tree of states, not the
search space directly: compare the pictures on pages 62 and 71.
DFS goes down a path until it reaches a node that has no children. Then DFS "backtracks" and expands a sibling of the node that had no children. If this node has no siblings, then DFS looks for a sibling of the grandparent, and so on.
See the picture on page 77 for an illustration of DFS.
BFS first considers all paths of length 1, then all paths of length 2, and so on. This is why it is called "breadth-first".
The picture on page 74 shows intuitively how BFS works.
The search algorithm needs an efficient representation of the fringe.
We shall use a queue, i.e. a special list where you
can remove elements from the front and you can insert new elements
into the middle.