SlideShare a Scribd company logo
ARTIFICIAL INTELLIGENCE(AI)
Chapter Outlines
 Introduction to Problem Solving
 Problem Formulation
 Problem Solving Agents
 Search Strategies
 Constraint Satisfaction Search
 Search Problems
What are the problems in AI?
 A problem is a situation preventing something from being
achieved.
 The word comes from a Greek word meaning an "obstacle"
(something that is in your way).
 Someone who has a problem must find a way of solving it. The
means of solving a problem is called a "solution".
 We are not talking about drawbacks or bad things.
 But we are talking about obstacles refrain from achieving desired
goal.
What are the problems in AI?
 Current problems in AI include:
 Computer vision,
 Natural language understanding, and
 Dealing with any real-world problem.
 This problems cannot be solved with modern computer
technology alone, but would also require human
computation.
Problem solving in AI
 Problem solving is the act of
 Defining a problem;
 Determining the cause of the problem;
 Identifying,
 Prioritizing, selecting alternatives solution; and
 Implementing a solution.
 It is the process of finding solutions to difficult or complex
issues.
 your solutions may fail or they could even create
additional problems without suitable processes in place.
Problem solving in AI
 Problem Searching
 It is the most commonly used technique of problem solving in AI.
 In general, searching refers to as finding information one needs.
 The searching algorithm helps us to search for solution of particular
problem.
 Search in AI is the process of navigating from a starting state to a goal
state by transitioning through intermediate states.
Problem solving in AI
 Problem Searching
 Almost any AI problem can be defined in these terms.
 State — A potential outcome of a problem.
 Transition — The act of moving between states.
 Starting State — Where to start searching from.
Problem solving in AI
 A good problem-solving process in AI consists of 5 common steps:
1. Define the problem
 State what do we need to be find out
 Like I want create the self driving car
2. Analyze the problem
 Investigate different conditions what we are going to design
3. Identification of solutions
 Which solutions are best for my problem among multiple solutions
4. Choosing the solution
 Among several identified solutions select the best one
5. Implementation
 Solve the problem based on priory identified best solution.
Components of Problem Solving
 There are four components of Problem solving such as
 Problem Statement,
 Goal State,
 Solution Space, and
 Operators
Components of Problem Solving
 Problem Statement
 It is usually one or two sentences to explain the problem our project
process will address.
 It will outline the negative points of the current situation and explain
why this matters.
 The two major things that we get to know about the problem is the
Information about what is to be done and constraints to which our
solution should comply.
Components of Problem Solving
 Goal State
 The desired resulting condition in a given problem, and what search
algorithms are looking for.
 Some problems may have a unique goal state (arrive at a given
location) whereas others can have multiple goal states, all satisfying
a set of conditions.
Components of Problem Solving
 Solution Space
 In order to reach the solution we need to check various strategies. We
might or might not follow a systematic strategy in all the cases.
 Whatever we follow, we have to go through a certain amount of states
of nature to reach the solution.
 The set of the start state, the goal state and all the intermediate
states constitutes something which is called a solution space.
Components of Problem Solving
 Operators (Travelling in the Solution Space)
 We have to travel inside this solution space in order to find a solution
to our problem.
 The travelling inside a solution space requires something called as
“operators”.
 In short the action that takes us from one state to the other is referred
to as an operator.
 The sequence of these operators is actually the solution to our
problem.
Problem Solving Agents
 There are four general steps for problem solving which are
also referred as Goal based agents.
 Goal Formulation
 Problem Formulation
 Search
 Execute
Problem Solving Agents
 Goal Formulation
 Declaring the Goal.
 Ignoring the some actions.
 Limits the objective that agent is trying to achieve.
 Goal can be defined as set of world states.
 Problem Formulation
 What actions and states to consider given the goal.
 It can change the world states size, extremely.
 It depends on how the agent is connected to its environment.
Problem Solving Agents
 Search
 Now, our agent knows the goal and actions.
 Which action to choose (with map or without map)?
 What action should be chosen in a state with unknown value?
 Process of looking for such a sequence is called Search.
 Search Algorithm takes problem as input and returns a solution in
form of an action sequence.
 Execute
 After finding a suitable action sequence, the actions can be
carried out.
 To solve a problem: “Formulate, Search, and Execute”.
Defining the problem as State Space Search:
 The state space representation forms the basis of most of the
AI methods.
 Formulate a problem as a state space search by showing the
legal problem states, the legal operators, and the initial and
goal states.
 A state is defined by the specification of the values of all
attributes of interest in the world.
Defining the problem as State Space Search:
 An operator changes one state into the other; it has a
precondition which is the value of certain attributes prior
to the application of the operator, and a set of effects,
which are the attributes altered by the operator.
 The initial state is where you start.
 The goal state is the partial description of the solution
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) Specify a set of
rules that describe the actions (operations) available.
Properties of Search Algorithms
 Which search algorithm one should use will generally depend on the
problem domain.
 There are four important factors to consider:
 1. Completeness – Is a solution guaranteed to be found if at least one solution
exists?
 2. Optimality – Is the solution found guaranteed to be the best (or lowest
cost) solution if there exists more than one solution?
 3. Time Complexity – The upper bound on the time required to find a
solution, as a function of the complexity of the problem.
 4. Space Complexity – The upper bound on the storage space (memory)
required at any point during the search, as a function of the complexity of the
problem.
Search Algorithm Terminologies:
 Search: is a step by step procedure to solve a search
 Problem in a given search space.
 A search problem can have three main factors:
 Search Space: set of possible solutions, which a system may have.
 Start State: It is a state from where agent begins the search.
 Goal test: It is a function which observe the current state and returns
whether the goal state is achieved or not.
 Search tree: A tree like representation of search problem.
Search Algorithm Terminologies:
 Actions: It gives the description of all the available actions to
the agent.
 Transition model:
 It is a description what each action do.
 Path Cost:
 It is a function which assigns a numeric cost to each path.
 Solution:
 It is an action sequence which leads from the start node to the goal
node.
 Optimal Solution:
 If a solution has the lowest cost among all solutions.
Problem Solving by Searching
 Problem solving is a process of generating solutions from
observed data.
 Searching is the universal technique of problem solving in AI.
 A problem is characterized by
 A set of goals,
 A set of objects, and
 A set of operations
 These could be ill-defined and may evolve during problem
solving.
Problem Solving by Searching
 To build a system to solve a problem:
 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.
Search Strategies
 Search is the fundamental technique of AI problem
solving.
 Possible answers, decisions or courses of action are
structured into an abstract space, which we then search.
 We may want to search for the first answer that satisfies our
goal, or we may want to keep searching until we find the best
answer.
Types of AI Search algorithms
 Search is either "blind" or “Heuristic":
 Based on the search problems we can classify the search algorithms
into Uninformed (Blind search) search and Informed search
(Heuristic search) algorithms.
 Blind
 We move through the space without worrying about what is coming next, but
recognising the answer if we see it
 Heuristic
 We guess what is ahead, and use that information to decide where to look next.
Types of AI Search algorithms
AI Search Algorithms
 Uninformed/Blind Search:
 It does not contain any domain knowledge.
 In which search tree is search solution without any
information about the search space
 It does not have additional information about search space
other than how to traverse the tree.
 It examines each node of the tree until it achieves the goal
node.
AI Search Algorithms
 Uninformed/Blind Search:
 It can be divided into five main types:
 Breadth-first search
 Uniform cost search
 Depth-first search
 Iterative deepening depth-first search
 Bidirectional Search
AI Search Algorithms
 Breadth-first Search:
 It is the most common search algorithm for traversing a tree.
 It searches solutions breadthwise in a tree.
 It starts searching from the root node of the tree and expands
all successor node at the current level before moving to nodes
of next level.
 Breadth-first search implemented using FIFO queue data
structure.
AI Search Algorithms
 Example:
 Travers of the tree using BFS algorithm from the root node S to
goal node K.
 S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
AI Search Algorithms
Advantages:
 It will provide a solution if any
solution exists.
 If there are more than one
solutions for a given problem, it
will provide the minimal
solution which requires the
least number of steps.
Disadvantages:
 It requires lots of memory since
each level of the tree must be
saved into memory to expand
the next level.
 BFS needs lots of time if the
solution is far away from the
root node.
AI Search Algorithms
 Breadth-first Search:
 Time Complexity:
 Can be obtained by the number of nodes traversed in BFS until the
shallowest Node.
 T (b) = 1+b2+b3+.......+ bd= O (bd), Where d= depth of shallowest
solution and b is a branch node at every state.
 Space Complexity:
 Is given by the Memory size of set of paths from a start node to the end
paths which is given by O(b d ).
 Completeness:
 It is complete if the shallowest goal node is at some finite depth.
 Optimality:
 It is optimal if path cost is a non-decreasing function of the depth of the
node.
AI Search Algorithms
 Depth-first Search
 It is a recursive algorithm for traversing a tree data structure.
 It is called the depth-first search because it starts from the root
node and follows each path to its greatest depth node before
moving to the next path.
 It uses a stack data structure for its implementation.
 It is similar to the BFS algorithm. But it uses Backtracking
technique.
 Note: Backtracking is an algorithm technique for finding
all possible solutions using recursion.
AI Search Algorithms
 It requires very less memory as
it only needs to store a stack of
the nodes on the path from
root node to the current node.
 It takes less time to reach to
the goal node than BFS
algorithm.
Advantages
 It goes for deep down searching
and sometime it may go to the
infinite loop.
 Therefor no guarantee of
finding the solution.
Disadvantages
➢ DFS will follow the order as:
➢ Root node--->Left node ----> right node.
AI Search Algorithms
 Depth-first Search
 Completeness: it is complete within finite state space as it will expand
every node within a limited search tree.
 Time Complexity: Time complexity of DFS will be equivalent to the node
traversed by the algorithm.
T(n)= 1+ n2+ n3 +.........+ nm=O(nm) Where, m= maximum
depth of any node and is level or branches.
 Space Complexity: it store only single path from the root node, hence space
complexity of DFS is O(b*m).
 Optimal: it is non-optimal, as it may generate a large number of steps or
high cost to reach to the goal node.
AI Search Algorithms
 Depth-Limited Search
 It is similar to depth-first search with a predetermined limit. It can solve
the drawback of the infinite path in the Depth-first search.
AI Search Algorithms
Advantage
 Depth-limited search is Memory
efficient.
Disadvantage
 Depth-limited search also has a
disadvantage of incompleteness.
 It may not be optimal if the
problem has more than one
solution.
AI Search Algorithms
 Depth-Limited Search
 Completeness: it is complete if the solution is above the
depth-limit.
 Time Complexity: Time complexity of is O(bℓ).
 Space Complexity: Space complexity is O(b×ℓ).
 Optimal: it is not optimal even if ℓ>d, b/c it is special case
algorithm
AI Search Algorithms
 Bidirectional Search Algorithm:
 It runs two simultaneous searches, one form initial state
called as forward
 Search and other from goal node called as backward-search.
 It replaces one single search graph with two small sub graphs
in which one starts the search from an initial vertex and
other starts from goal vertex.
AI Search Algorithms
 Bidirectional Search Algorithm:
 The search stops when these two graphs are intersect each other.
 The algorithm terminates at node 9 where two searches meet.
AI Search Algorithms
Advantage
 Bidirectional search is fast.
 Bidirectional search requires
less memory
Disadvantage
 Implementation of the
bidirectional search tree is
difficult.
AI Search Algorithms
 Bidirectional Search Algorithm:
 Completeness: Bidirectional Search is complete if we use BFS in
both searches.
 Time Complexity: Time complexity of bidirectional search using
BFS is O(bd).
 Space Complexity: Space complexity of bidirectional search is
O(bd).
 Optimal: Bidirectional search is Optimal.
AI Search Algorithms
 Informed Search/ Heuristics search
 It use domain knowledge. In an informed search, problem
information is available which can guide the search.
 It can find a solution more efficiently than an uninformed
search strategy.
 A heuristic is a way which might not always be guaranteed
for best solutions but guaranteed to find a good solution in
reasonable time.
 It can solve much complex problem which could not be
solved in another way.
 There two main types of informed algorithms :
 Best First Search Algorithm(Greedy search)
 A* Search Algorithm
AI Search Algorithms
 Heuristics function:
 Heuristic is a function which is used in Informed Search, and
it finds the most promising path.
 It takes the current state of the agent as its input and
produces the estimation of how close agent is from the goal.
 The heuristic method, however, might not always give the
best solution, but it guaranteed to find a good solution in
reasonable time.
 It is represented by h(n), and it calculates the cost of an
optimal path between the pair of states.
 The value of the heuristic function is always positive
AI Search Algorithms
 Heuristics function:
 The heuristic function is given as:
h(n) <= h*(n)
h(n) is heuristic cost, and
h*(n) is the estimated cost.
 Hence heuristic cost should be less than or equal to the
estimated cost.
AI Search Algorithms
 Best-first Search Algorithm (Greedy Search):
 It always selects the path which appears best solution at
that moment.
 It is the combination of depth-first search and breadth-first
search algorithms. It uses the heuristic function and search.
 Best-first search allows us to take the advantages of both
algorithms.
 In the best first search algorithm, we expand the node which
is closest to the goal node.
AI Search Algorithms
Best-first Search Algorithm (Greedy Search):
AI Search Algorithms
 Example:
 Initialization: Open [A, B], Closed [S]
 Iteration 1: Open [A], Closed [S, B]
 Iteration 2: Open [E, F, A], Closed [S,
B] : Open [E, A], Closed [S, B, F]
 Iteration 3: Open [I, G, E, A], Closed
[S, B, F] : Open [I, E, A], Closed [S, B,
F, G]
 Hence the final solution path will be:
 S----> B----->F---> G
AI Search Algorithms
Advantage
 It can switch between BFS and
DFS by gaining the advantages
of both the algorithms.
 This algorithm is more efficient
than BFS and DFS algorithms.
Disadvantage
 It can behave as an unguided
depth-first search in the worst
case scenario.
 This algorithm is not optimal.
AI Search Algorithms
 Best-first Search Algorithm (Greedy Search):
 Time Complexity: The worst case time complexity is O(bm).
 Space Complexity: The worst case space complexity is O(bm).
Where, m is the maximum depth of the search space, b is branch of
tree
 Complete: it is incomplete, even if the given state space is
finite.
 Optimal: Greedy best first search algorithm is not optimal.
AI Search Algorithms
 A* Search Algorithm:
 It is the most commonly known form of best-first search.
 It uses heuristic function h(n), and cost to reach the node n from the
start state g(n).
 It has a features of greedy best-first search, by which it solve the
problem efficiently.
 It finds the shortest path through the search space using the heuristic
function.
AI Search Algorithms
 A* Search Algorithm:
AI Search Algorithms
Advantages:
 A* search algorithm is the best
algorithm than other search
algorithms.
 A* search algorithm is optimal
and complete.
 This algorithm can solve very
complex problems.
Disadvantage
 It does not always produce the
shortest path as it mostly based on
heuristics and approximation.
 It has some complexity issues.
 The main drawback of A* is memory
requirement as it keeps all generated
nodes in the memory, so it is not
practical for various large-scale
problems.
AI Search Algorithms
 Example:
 Initialization: {(S, 5)}
 Iteration1: {(S--> A, 4), (S-->G, 10)}
 Iteration2: {(S--> A-->C, 4), (S--> A-->B,
7), (S-->G, 10)}
 Iteration3: {(S--> A-->C--->G, 6), (S--> A-
- >C--->D, 11), (S--> A-->B, 7), (S-->G,
10)}
 Iteration 4 will give the final result, as
 S--->A--->C--->G it provides the optimal
path with cost 6.
 f(n)= g(n) + h(n),
 g(n) is the cost to reach any node from
start state.
 h(n) is the cost to reach node n to goal
node
AI Search Algorithms
 Algorithm of A* search:
 Complete: it is complete as long as:
 Branching factor is finite.
 Cost at every action is fixed.
 Optimality:
 It is optimal if it satisfy two conditions:
 Time complexity:
 Time complexity is o(b^d), where b is the branching factor and dis
the depth of solution
 Space complexity:
 The space complexity is o(b^d)
Control Strategies
 Control Strategies means how to decide which rule to apply
next during the process of searching for a solution to a problem.
 Requirement for a good Control Strategy
 It should cause motion
 If we apply a simple control strategy of starting each time from the
top of rule list and choose the first applicable one, then we will never
move towards solution.
Control Strategies
 Requirement for a good Control Strategy
 It should explore the solution space in a systematic manner
 If we choose another control strategy, let us say, choose a rule randomly
from the applicable rules then definitely it causes motion and eventually
will lead to a solution.
 But one may arrive to same state several times.
 This is because control strategy is not systematic.
Planning
Given a set of goals, construct a sequence of actions that
achieves those goals:
 Often very large search space
 But most parts of the world are independent of most other parts
 Often start with goals and connect them to actions
 No necessary connection between order of planning and order of
execution
 What happens if the world changes as we execute the plan and/or
our actions don’t produce the expected results?
Learning
 If a system is going to act truly appropriately, then it must
be able to change its actions in the light of experience:
 How do we generate new facts from old?
 How do we generate new concepts?
 How do we learn to distinguish different situations in new
environments?

More Related Content

PPTX
CHAPTER 5.pptx of the following of our discussion
PPTX
Learning (e.g., machine learning) Reasoning (solving problems, making decisi...
PPTX
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
PPTX
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
PPTX
Lecture 07 search techniques
PDF
AI Chapter Two Solving problems by searching.pdf
PPTX
AI-03 Problems State Space.pptx
PPTX
AI Unit-1 PPT.pptx https https plans to go
CHAPTER 5.pptx of the following of our discussion
Learning (e.g., machine learning) Reasoning (solving problems, making decisi...
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
Lecture 07 search techniques
AI Chapter Two Solving problems by searching.pdf
AI-03 Problems State Space.pptx
AI Unit-1 PPT.pptx https https plans to go

Similar to AI Chapter III for Computer Science Students (20)

PDF
ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING
PDF
CS3491_Artificial Intelligence and data science _ QB
PPTX
3. ArtificialSolving problems by searching.pptx
PDF
Automatic Problem Solving
DOCX
Unit 2
PDF
Introduction to Artificial Intelligence_ Lec 3
PPTX
study material for Artificial Intelligence
PPTX
problem characterstics.pptx
PDF
Chapter 3 - Searching and prPlanning.pdf
PPTX
LESSON-1-MIDTERM-Part-2.pptx
PPTX
search strategies in artificial intelligence
PPTX
effectivedecisionmaking-111214021741-phpapp02 (1).pptx
PPTX
Problem solving in Artificial Intelligence.pptx
PPTX
Introduction to Artificial intelligence.pptx
PPT
03 Analyzing The Problem
PPT
2.Problems Problem Spaces and Search.ppt
PPTX
Artificial Intelligence jejeiejj3iriejrjifirirjdjeie
PPTX
AI_Lecture2.pptx
PPTX
Assignment 6.1
PPTX
Artificial intelligence presentation for students
ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING
CS3491_Artificial Intelligence and data science _ QB
3. ArtificialSolving problems by searching.pptx
Automatic Problem Solving
Unit 2
Introduction to Artificial Intelligence_ Lec 3
study material for Artificial Intelligence
problem characterstics.pptx
Chapter 3 - Searching and prPlanning.pdf
LESSON-1-MIDTERM-Part-2.pptx
search strategies in artificial intelligence
effectivedecisionmaking-111214021741-phpapp02 (1).pptx
Problem solving in Artificial Intelligence.pptx
Introduction to Artificial intelligence.pptx
03 Analyzing The Problem
2.Problems Problem Spaces and Search.ppt
Artificial Intelligence jejeiejj3iriejrjifirirjdjeie
AI_Lecture2.pptx
Assignment 6.1
Artificial intelligence presentation for students
Ad

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
Programs and apps: productivity, graphics, security and other tools
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Ad

AI Chapter III for Computer Science Students

  • 2. Chapter Outlines  Introduction to Problem Solving  Problem Formulation  Problem Solving Agents  Search Strategies  Constraint Satisfaction Search  Search Problems
  • 3. What are the problems in AI?  A problem is a situation preventing something from being achieved.  The word comes from a Greek word meaning an "obstacle" (something that is in your way).  Someone who has a problem must find a way of solving it. The means of solving a problem is called a "solution".  We are not talking about drawbacks or bad things.  But we are talking about obstacles refrain from achieving desired goal.
  • 4. What are the problems in AI?  Current problems in AI include:  Computer vision,  Natural language understanding, and  Dealing with any real-world problem.  This problems cannot be solved with modern computer technology alone, but would also require human computation.
  • 5. Problem solving in AI  Problem solving is the act of  Defining a problem;  Determining the cause of the problem;  Identifying,  Prioritizing, selecting alternatives solution; and  Implementing a solution.  It is the process of finding solutions to difficult or complex issues.  your solutions may fail or they could even create additional problems without suitable processes in place.
  • 6. Problem solving in AI  Problem Searching  It is the most commonly used technique of problem solving in AI.  In general, searching refers to as finding information one needs.  The searching algorithm helps us to search for solution of particular problem.  Search in AI is the process of navigating from a starting state to a goal state by transitioning through intermediate states.
  • 7. Problem solving in AI  Problem Searching  Almost any AI problem can be defined in these terms.  State — A potential outcome of a problem.  Transition — The act of moving between states.  Starting State — Where to start searching from.
  • 8. Problem solving in AI  A good problem-solving process in AI consists of 5 common steps: 1. Define the problem  State what do we need to be find out  Like I want create the self driving car 2. Analyze the problem  Investigate different conditions what we are going to design 3. Identification of solutions  Which solutions are best for my problem among multiple solutions 4. Choosing the solution  Among several identified solutions select the best one 5. Implementation  Solve the problem based on priory identified best solution.
  • 9. Components of Problem Solving  There are four components of Problem solving such as  Problem Statement,  Goal State,  Solution Space, and  Operators
  • 10. Components of Problem Solving  Problem Statement  It is usually one or two sentences to explain the problem our project process will address.  It will outline the negative points of the current situation and explain why this matters.  The two major things that we get to know about the problem is the Information about what is to be done and constraints to which our solution should comply.
  • 11. Components of Problem Solving  Goal State  The desired resulting condition in a given problem, and what search algorithms are looking for.  Some problems may have a unique goal state (arrive at a given location) whereas others can have multiple goal states, all satisfying a set of conditions.
  • 12. Components of Problem Solving  Solution Space  In order to reach the solution we need to check various strategies. We might or might not follow a systematic strategy in all the cases.  Whatever we follow, we have to go through a certain amount of states of nature to reach the solution.  The set of the start state, the goal state and all the intermediate states constitutes something which is called a solution space.
  • 13. Components of Problem Solving  Operators (Travelling in the Solution Space)  We have to travel inside this solution space in order to find a solution to our problem.  The travelling inside a solution space requires something called as “operators”.  In short the action that takes us from one state to the other is referred to as an operator.  The sequence of these operators is actually the solution to our problem.
  • 14. Problem Solving Agents  There are four general steps for problem solving which are also referred as Goal based agents.  Goal Formulation  Problem Formulation  Search  Execute
  • 15. Problem Solving Agents  Goal Formulation  Declaring the Goal.  Ignoring the some actions.  Limits the objective that agent is trying to achieve.  Goal can be defined as set of world states.  Problem Formulation  What actions and states to consider given the goal.  It can change the world states size, extremely.  It depends on how the agent is connected to its environment.
  • 16. Problem Solving Agents  Search  Now, our agent knows the goal and actions.  Which action to choose (with map or without map)?  What action should be chosen in a state with unknown value?  Process of looking for such a sequence is called Search.  Search Algorithm takes problem as input and returns a solution in form of an action sequence.  Execute  After finding a suitable action sequence, the actions can be carried out.  To solve a problem: “Formulate, Search, and Execute”.
  • 17. Defining the problem as State Space Search:  The state space representation forms the basis of most of the AI methods.  Formulate a problem as a state space search by showing the legal problem states, the legal operators, and the initial and goal states.  A state is defined by the specification of the values of all attributes of interest in the world.
  • 18. Defining the problem as State Space Search:  An operator changes one state into the other; it has a precondition which is the value of certain attributes prior to the application of the operator, and a set of effects, which are the attributes altered by the operator.  The initial state is where you start.  The goal state is the partial description of the solution
  • 19. 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) Specify a set of rules that describe the actions (operations) available.
  • 20. Properties of Search Algorithms  Which search algorithm one should use will generally depend on the problem domain.  There are four important factors to consider:  1. Completeness – Is a solution guaranteed to be found if at least one solution exists?  2. Optimality – Is the solution found guaranteed to be the best (or lowest cost) solution if there exists more than one solution?  3. Time Complexity – The upper bound on the time required to find a solution, as a function of the complexity of the problem.  4. Space Complexity – The upper bound on the storage space (memory) required at any point during the search, as a function of the complexity of the problem.
  • 21. Search Algorithm Terminologies:  Search: is a step by step procedure to solve a search  Problem in a given search space.  A search problem can have three main factors:  Search Space: set of possible solutions, which a system may have.  Start State: It is a state from where agent begins the search.  Goal test: It is a function which observe the current state and returns whether the goal state is achieved or not.  Search tree: A tree like representation of search problem.
  • 22. Search Algorithm Terminologies:  Actions: It gives the description of all the available actions to the agent.  Transition model:  It is a description what each action do.  Path Cost:  It is a function which assigns a numeric cost to each path.  Solution:  It is an action sequence which leads from the start node to the goal node.  Optimal Solution:  If a solution has the lowest cost among all solutions.
  • 23. Problem Solving by Searching  Problem solving is a process of generating solutions from observed data.  Searching is the universal technique of problem solving in AI.  A problem is characterized by  A set of goals,  A set of objects, and  A set of operations  These could be ill-defined and may evolve during problem solving.
  • 24. Problem Solving by Searching  To build a system to solve a problem:  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.
  • 25. Search Strategies  Search is the fundamental technique of AI problem solving.  Possible answers, decisions or courses of action are structured into an abstract space, which we then search.  We may want to search for the first answer that satisfies our goal, or we may want to keep searching until we find the best answer.
  • 26. Types of AI Search algorithms  Search is either "blind" or “Heuristic":  Based on the search problems we can classify the search algorithms into Uninformed (Blind search) search and Informed search (Heuristic search) algorithms.  Blind  We move through the space without worrying about what is coming next, but recognising the answer if we see it  Heuristic  We guess what is ahead, and use that information to decide where to look next.
  • 27. Types of AI Search algorithms
  • 28. AI Search Algorithms  Uninformed/Blind Search:  It does not contain any domain knowledge.  In which search tree is search solution without any information about the search space  It does not have additional information about search space other than how to traverse the tree.  It examines each node of the tree until it achieves the goal node.
  • 29. AI Search Algorithms  Uninformed/Blind Search:  It can be divided into five main types:  Breadth-first search  Uniform cost search  Depth-first search  Iterative deepening depth-first search  Bidirectional Search
  • 30. AI Search Algorithms  Breadth-first Search:  It is the most common search algorithm for traversing a tree.  It searches solutions breadthwise in a tree.  It starts searching from the root node of the tree and expands all successor node at the current level before moving to nodes of next level.  Breadth-first search implemented using FIFO queue data structure.
  • 31. AI Search Algorithms  Example:  Travers of the tree using BFS algorithm from the root node S to goal node K.  S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
  • 32. AI Search Algorithms Advantages:  It will provide a solution if any solution exists.  If there are more than one solutions for a given problem, it will provide the minimal solution which requires the least number of steps. Disadvantages:  It requires lots of memory since each level of the tree must be saved into memory to expand the next level.  BFS needs lots of time if the solution is far away from the root node.
  • 33. AI Search Algorithms  Breadth-first Search:  Time Complexity:  Can be obtained by the number of nodes traversed in BFS until the shallowest Node.  T (b) = 1+b2+b3+.......+ bd= O (bd), Where d= depth of shallowest solution and b is a branch node at every state.  Space Complexity:  Is given by the Memory size of set of paths from a start node to the end paths which is given by O(b d ).  Completeness:  It is complete if the shallowest goal node is at some finite depth.  Optimality:  It is optimal if path cost is a non-decreasing function of the depth of the node.
  • 34. AI Search Algorithms  Depth-first Search  It is a recursive algorithm for traversing a tree data structure.  It is called the depth-first search because it starts from the root node and follows each path to its greatest depth node before moving to the next path.  It uses a stack data structure for its implementation.  It is similar to the BFS algorithm. But it uses Backtracking technique.  Note: Backtracking is an algorithm technique for finding all possible solutions using recursion.
  • 35. AI Search Algorithms  It requires very less memory as it only needs to store a stack of the nodes on the path from root node to the current node.  It takes less time to reach to the goal node than BFS algorithm. Advantages  It goes for deep down searching and sometime it may go to the infinite loop.  Therefor no guarantee of finding the solution. Disadvantages ➢ DFS will follow the order as: ➢ Root node--->Left node ----> right node.
  • 36. AI Search Algorithms  Depth-first Search  Completeness: it is complete within finite state space as it will expand every node within a limited search tree.  Time Complexity: Time complexity of DFS will be equivalent to the node traversed by the algorithm. T(n)= 1+ n2+ n3 +.........+ nm=O(nm) Where, m= maximum depth of any node and is level or branches.  Space Complexity: it store only single path from the root node, hence space complexity of DFS is O(b*m).  Optimal: it is non-optimal, as it may generate a large number of steps or high cost to reach to the goal node.
  • 37. AI Search Algorithms  Depth-Limited Search  It is similar to depth-first search with a predetermined limit. It can solve the drawback of the infinite path in the Depth-first search.
  • 38. AI Search Algorithms Advantage  Depth-limited search is Memory efficient. Disadvantage  Depth-limited search also has a disadvantage of incompleteness.  It may not be optimal if the problem has more than one solution.
  • 39. AI Search Algorithms  Depth-Limited Search  Completeness: it is complete if the solution is above the depth-limit.  Time Complexity: Time complexity of is O(bℓ).  Space Complexity: Space complexity is O(b×ℓ).  Optimal: it is not optimal even if ℓ>d, b/c it is special case algorithm
  • 40. AI Search Algorithms  Bidirectional Search Algorithm:  It runs two simultaneous searches, one form initial state called as forward  Search and other from goal node called as backward-search.  It replaces one single search graph with two small sub graphs in which one starts the search from an initial vertex and other starts from goal vertex.
  • 41. AI Search Algorithms  Bidirectional Search Algorithm:  The search stops when these two graphs are intersect each other.  The algorithm terminates at node 9 where two searches meet.
  • 42. AI Search Algorithms Advantage  Bidirectional search is fast.  Bidirectional search requires less memory Disadvantage  Implementation of the bidirectional search tree is difficult.
  • 43. AI Search Algorithms  Bidirectional Search Algorithm:  Completeness: Bidirectional Search is complete if we use BFS in both searches.  Time Complexity: Time complexity of bidirectional search using BFS is O(bd).  Space Complexity: Space complexity of bidirectional search is O(bd).  Optimal: Bidirectional search is Optimal.
  • 44. AI Search Algorithms  Informed Search/ Heuristics search  It use domain knowledge. In an informed search, problem information is available which can guide the search.  It can find a solution more efficiently than an uninformed search strategy.  A heuristic is a way which might not always be guaranteed for best solutions but guaranteed to find a good solution in reasonable time.  It can solve much complex problem which could not be solved in another way.  There two main types of informed algorithms :  Best First Search Algorithm(Greedy search)  A* Search Algorithm
  • 45. AI Search Algorithms  Heuristics function:  Heuristic is a function which is used in Informed Search, and it finds the most promising path.  It takes the current state of the agent as its input and produces the estimation of how close agent is from the goal.  The heuristic method, however, might not always give the best solution, but it guaranteed to find a good solution in reasonable time.  It is represented by h(n), and it calculates the cost of an optimal path between the pair of states.  The value of the heuristic function is always positive
  • 46. AI Search Algorithms  Heuristics function:  The heuristic function is given as: h(n) <= h*(n) h(n) is heuristic cost, and h*(n) is the estimated cost.  Hence heuristic cost should be less than or equal to the estimated cost.
  • 47. AI Search Algorithms  Best-first Search Algorithm (Greedy Search):  It always selects the path which appears best solution at that moment.  It is the combination of depth-first search and breadth-first search algorithms. It uses the heuristic function and search.  Best-first search allows us to take the advantages of both algorithms.  In the best first search algorithm, we expand the node which is closest to the goal node.
  • 48. AI Search Algorithms Best-first Search Algorithm (Greedy Search):
  • 49. AI Search Algorithms  Example:  Initialization: Open [A, B], Closed [S]  Iteration 1: Open [A], Closed [S, B]  Iteration 2: Open [E, F, A], Closed [S, B] : Open [E, A], Closed [S, B, F]  Iteration 3: Open [I, G, E, A], Closed [S, B, F] : Open [I, E, A], Closed [S, B, F, G]  Hence the final solution path will be:  S----> B----->F---> G
  • 50. AI Search Algorithms Advantage  It can switch between BFS and DFS by gaining the advantages of both the algorithms.  This algorithm is more efficient than BFS and DFS algorithms. Disadvantage  It can behave as an unguided depth-first search in the worst case scenario.  This algorithm is not optimal.
  • 51. AI Search Algorithms  Best-first Search Algorithm (Greedy Search):  Time Complexity: The worst case time complexity is O(bm).  Space Complexity: The worst case space complexity is O(bm). Where, m is the maximum depth of the search space, b is branch of tree  Complete: it is incomplete, even if the given state space is finite.  Optimal: Greedy best first search algorithm is not optimal.
  • 52. AI Search Algorithms  A* Search Algorithm:  It is the most commonly known form of best-first search.  It uses heuristic function h(n), and cost to reach the node n from the start state g(n).  It has a features of greedy best-first search, by which it solve the problem efficiently.  It finds the shortest path through the search space using the heuristic function.
  • 53. AI Search Algorithms  A* Search Algorithm:
  • 54. AI Search Algorithms Advantages:  A* search algorithm is the best algorithm than other search algorithms.  A* search algorithm is optimal and complete.  This algorithm can solve very complex problems. Disadvantage  It does not always produce the shortest path as it mostly based on heuristics and approximation.  It has some complexity issues.  The main drawback of A* is memory requirement as it keeps all generated nodes in the memory, so it is not practical for various large-scale problems.
  • 55. AI Search Algorithms  Example:  Initialization: {(S, 5)}  Iteration1: {(S--> A, 4), (S-->G, 10)}  Iteration2: {(S--> A-->C, 4), (S--> A-->B, 7), (S-->G, 10)}  Iteration3: {(S--> A-->C--->G, 6), (S--> A- - >C--->D, 11), (S--> A-->B, 7), (S-->G, 10)}  Iteration 4 will give the final result, as  S--->A--->C--->G it provides the optimal path with cost 6.  f(n)= g(n) + h(n),  g(n) is the cost to reach any node from start state.  h(n) is the cost to reach node n to goal node
  • 56. AI Search Algorithms  Algorithm of A* search:  Complete: it is complete as long as:  Branching factor is finite.  Cost at every action is fixed.  Optimality:  It is optimal if it satisfy two conditions:  Time complexity:  Time complexity is o(b^d), where b is the branching factor and dis the depth of solution  Space complexity:  The space complexity is o(b^d)
  • 57. Control Strategies  Control Strategies means how to decide which rule to apply next during the process of searching for a solution to a problem.  Requirement for a good Control Strategy  It should cause motion  If we apply a simple control strategy of starting each time from the top of rule list and choose the first applicable one, then we will never move towards solution.
  • 58. Control Strategies  Requirement for a good Control Strategy  It should explore the solution space in a systematic manner  If we choose another control strategy, let us say, choose a rule randomly from the applicable rules then definitely it causes motion and eventually will lead to a solution.  But one may arrive to same state several times.  This is because control strategy is not systematic.
  • 59. Planning Given a set of goals, construct a sequence of actions that achieves those goals:  Often very large search space  But most parts of the world are independent of most other parts  Often start with goals and connect them to actions  No necessary connection between order of planning and order of execution  What happens if the world changes as we execute the plan and/or our actions don’t produce the expected results?
  • 60. Learning  If a system is going to act truly appropriately, then it must be able to change its actions in the light of experience:  How do we generate new facts from old?  How do we generate new concepts?  How do we learn to distinguish different situations in new environments?