You are on page 1of 25

Session 9

Intelligent search

1
SEARCHING FOR SOLUTIONS

• Having formulated some problems, we now need to solve them.

• A solution is an action sequence, so search algorithms work by


considering various action sequences. This can be implemented
using search tree.

• SEARCH TREE: 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.

• The following figure shows the few steps in constructing the search
tree for finding a route from Arad to Bucharest in the Romania
map.
Partial search trees for finding a route from Arad to Bucharest. Nodes that have
been expanded are shaded; nodes that have been generated but not yet
expanded are outlined in bold; nodes that have not yet been generated are
shown in faint dashed lines.
Terminology:

• FRONTIER: A set of all the leaf nodes available for expansion at


any given point. Generally, it is considered as open list.

• EXPLORED SET: A set of nodes that are already explored.


Generally the data structure is known as Close List.

• GRAPH-SEARCH Algorithm: An algorithm used to find the


solution.

• TREE-SEARCH Algorithm: Uses a particular search strategy to


choose which state to explore next.
Infrastructure for search algorithms
Search algorithms require a data structure to keep track of the search
tree that is being constructed. For each node n of the tree, we have a
structure that contains four Components:

• n.STATE: The state in the state space to which the node


corresponds.

• n.PARENT: The node in the search tree that generated this node.

• n.Action: The action that was applied to the parent to generate the
node.

• n.PATH-COST: The cost, traditionally denoted by g(n), of the path


from the initial state to the node, as indicated by the parent pointers.
Nodes are the data structures from which the search tree is constructed. Each has
a parent, a state, and various bookkeeping fields_ Arrows point from child to
parent.
Measuring problem-solving performance

We can evaluate an algorithm's performance in four ways:

• Completeness: Is the algorithm guaranteed to find a solution


when there is one?
• Optimality: Does the strategy find the optimal solution
• Time complexity: How long does it take to find a solution?
• Space complexity: How much memory is needed to perform the
search?

End of Session
Intelligent Systems
1. Define the problem precisely
2. Analyze the problem
3. Isolate and represent the task knowledge that
is necessary to solve the problem
4. Choose the best problem-solving techniques
and apply it to the particular problem.
5. The state space representation forms the basis
of most of the AI methods.
Formal Description of the
problem
1. Define a state space that contains all the
possible configurations of the relevant objects.
2. Specify one or more states within that space
that describe possible situations from which the
problem solving process may start ( initial
state)
3. Specify one or more states that would be
acceptable as solutions to the problem( goal
states)
4. Specify a set of rules that describe the actions
(operations) available.

9
Production Systems
A production system consists of:
• A set of rules, each consisting of a left side
that determines the applicability of the rule and a
right side that describes the operation to be
performed if that rule is applied.
• One or more knowledge/databases that
contain whatever information is appropriate for
the particular task. Some parts of the database
may be permanent, while other parts of it may
pertain only to the solution of the current
problem.
• A control strategy that specifies the order in
which the rules will be compared to the database
and a way of resolving the conflicts that arise
when several rules match at once. 10
• A rule applier
Well-defined problems and
solutions PROBLEM
A problem can be defined formally by five
components:
• INITIAL STATE : The initial state that the
agent starts in

• ACTIONS: A description of the possible


actions available to the agent Given a
particular state s, ACTIONS(s) returns the set
of actions that can be executed in s.
• Transition Model: That represents a description
of what each action does.
• Successor : Any state reachable from a given
state by a single action.
• State Space : Initial State + Actions + Transition
Model.
• Graph : A directed Graph in which the nodes are
states and the links between nodes are actions.
• Goal Test : Determines whether a given state is a
goal state or not.
Search Techniques

The process of the solution of AI problem


searches the path from start sate to goal
state
Search techniques help in finding the most
viable path to reach the goal state
Search techniques make the entire search
process efficient and economical

13
State Space Search

• Two main approaches to searching a state space


– Data-driven search which starts from an initial state and uses actions that are
allowed to move forward until a goal is reached. Also known as forward
chaining
– Goal-driven search which starts at the goal and work back toward a start state,
by seeing what moves could have led to the goal state. Also known as
backward chaining
• Both search the same state space and produce the same result,
however the order and actual number of states searched can be
different

14

State
Goal-driven search
Space Search
– Goal can be clearly and easily formulated, e.g. theorem prover; finding an exit
path from a maze; medical diagnosis where the condition to be diagnosed is
known; problem data are not given but must be acquired by the problem solver
• Data-driven search
– Not clear what the goal is; interpretation problems where all or most of the data
are given in the initial problem statement; large number of potential goals

15
Search Strategies

Two Categories of Strategies

 Uninformed/Blind Search  Informed/Heuristic Search


No additional information about Uses strategies that know whether
states beyond that provided in one state is more promising than
the problem definition the others in reaching the goal

16
Categories of Search
• Blind (or unguided or uninformed) search
• Heuristic (or guided or informed ) search

17
Blind Search
• The uninformed or blind search is the
search methodology having no additional
information about search states beyond
that provided in the problem definitions. In
this search total search space is looked for
solution
• Having no information about the number of
steps from the current state to the goal.

18
Blind Search
– Breadth-First search (BFS)
– Depth-First Search (DFS)

19
PATH COST AND STEP COST

Path Cost : Its a function that assigns a numeric cost to each


path. The problem solving agent chooses a cost function that
reflects its own performance measure.
Step Cost : Taking step ‘a’ in state ‘s’ to reach state ‘s1’. The
function can be denoted by C(s, a, s1).
PROBLEM EXAMPLES (CASE STUDY)

1. TOY PROBLEM
2. 8-PUZZLE PROBLEM
3. N-QUEENS PROBLEM
4. ROUTE FINDING PROBLEM
SEARCHING FOR SOLUTIONS
A solution is an action sequence, so search
algorithms work by considering various action
sequences. It can be implemented using search
tree.
• SEARCH TREE: 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
Infrastructure for search algorithms

Search algorithms require a data structure to keep track of the


search tree that is being constructed. For each node n of the
tree, we have a structure that contains four Components:
• n.STATE: the state in the state space to which the node
corresponds
• n.PARENT: the node in the search tree that generated this
node
• n. Action: the action that was applied to the parent to generate
the node
• n.PATH-COST: the cost, traditionally denoted by g(n), of the
path from the initial state to the node, as indicated by the parent
pointers.
Measuring problem-solving performance

We can evaluate an algorithm's performance in


four ways:
• Completeness: Is the algorithm guaranteed to
find a solution when there is one?
• Optimality: Does the strategy find the optimal
solution
• Time complexity: How long does it take to find
a solution?
• Space complexity: How much memory is
needed to perform the search?

You might also like