SlideShare a Scribd company logo
1 of 85
ARTIFICIAL
INTELLIGENCE
Unit –I
INTRODUCTION
5/15/2023
AI -VI BCA D
1
Introduction
 Artificial Intelligence is an approach to make a computer, a robot, or a product to
think how smart human think.
 AI is a study of how human brain think, learn, decide and work, when it tries to
solve problems.
 The aim of AI is to improve computer functions which are related to human
knowledge
 example, reasoning, learning, and problem-solving.
5/15/2023
AI -VI BCA D
2
AI Made by
 The intelligence is intangible. It is composed of
 Reasoning
 Learning
 Problem Solving
 Perception
 Linguistic Intelligence
5/15/2023
AI -VI BCA D
3
Objective of AI Research
 1. Knowledge - to represent knowledge about the world
 Understand the entities and properties
 Relationship to one another
 2. Reasoning – to solve problems through logical reasoning
 Logic - related ideas and conclusions from information
 Deductive - derive specific conclusions from general premises believed to be true
 Inductive -infer general conclusions from specific premises (or)
 Abductive - seek the simplest and most likely explanation for an observation
 3. Planning – to set and achieve goals
 sequence of actions enabling progress towards it.
 Communication - to understand written and spoken language
 to communicate with people, software must have the ability to identify, understand and synthesize written
or spoken human language.
 Perception - to make deductions about the world based on input
 software must be able to organize, identify and interpret visual images, sounds and other sensory inputs.
5/15/2023
AI -VI BCA D
4
Artificial Intelligence
 AI composed in two words
 Artificial – man-made
 Intelligence – thinking power
 AI – Machines /systems thinks like human being
 AI – booming technology, fascinating and universal fields of Computer science
 creates computers or machines as intelligent as human beings
5/15/2023
AI -VI BCA D
5
Definition
 Definition:
 According to the father of Artificial Intelligence, John McCarthy, it is “The
science and engineering of making intelligent machines, especially intelligent
computer programs”.
 Definition from Rich & Knight : a program that
 – Acts like human (Turing test)
 – Thinks like human (human-like patterns of thinking steps)
 – Acts or thinks rationally (logically, correctly)
5/15/2023
AI -VI BCA D
6
5/15/2023
AI -VI BCA D
7
5/15/2023
AI -VI BCA D
8
5/15/2023
AI -VI BCA D
9
5/15/2023
AI -VI BCA D
10
Why AI?
 With the help of AI,
 you can create such software or devices which can solve real-world problems very easily
and with accuracy such as health issues, marketing, traffic issues, etc.
 you can create your personal virtual Assistant, such as Cortana ( MS own bing search
engine), Google Assistant (google), Siri (will prompt you to call or make a
reservation),alexa, etc.
 you can build such Robots which can work in an environment where survival of humans
can be at risk.
 AI opens a path for other new technologies, new devices, and new Opportunities.
5/15/2023
AI -VI BCA D
11
Categories of Artificial Intelligence
 Weak AI - pre-planned moves
 make the humans feel that the machines are acting intelligently (but they are not).
 Strong AI - machine is almost capable of solving a complex problem like an
intelligent man
 think and function very similar to humans
 making the humans feel that the machines are intelligent.
5/15/2023
AI -VI BCA D
12
5/15/2023
AI -VI BCA D
13
Thinks like Human – human like patterns of
thinking steps
Sophia is a social humanoid robot developed by Hong
Kong based company Hanson Robotics. Sophia was
activated on February 14, 2016, and made her first
public appearance at South by Southwest
Festival (SXSW) in mid-March 2016 in Austin, Texas,
United States.
She is able to display more than 50 facial expressions.
Robot Sophia was given Saudia citizenship in 2017
'Sophia' the robot tells UN_ 'I am here to help humanity
create the future' - YouTube (720p).mp4
5/15/2023
AI -VI BCA D
14
5/15/2023
AI -VI BCA D
15
GOALS
 develop intelligent machines that could learn on their own. No more human
intervention for feeding data to machines.
 To Create Expert Systems −systems which exhibit intelligent behavior, learn,
demonstrate, explain, and advice its users.
 To Implement Human Intelligence in Machines - Creating systems that understand,
think, learn, and behave like humans.
 to develop reasoning and problem – solving skills
 Knowledge representation is representing information that machine or computer
can understand.
 Natural learning processing -With artificial intelligence one can develop machines
that can read and understand human languages
5/15/2023
AI -VI BCA D
16
AI discipline
5/15/2023
AI -VI BCA D
17
Advantages of Artificial Intelligence
 1) Reduction in Human Error
 decisions are taken from the previously gathered information applying certain set of algorithms.
 2) Takes risks instead of Humans
 overcome many risky limitations of human by developing an AI Robot
 3) Available 24×7
 machines work 24×7 without any breaks
 4) Helping in Repetitive Jobs
 repetitive works like sending a thanking mail, verifying certain documents for errors
 5) Digital Assistance
 used in many websites to provide things that user want.
 6) Faster Decisions
 machines take decisions faster than a human
 7) Daily Applications
 Apple’s Siri, Window’s Cortana, Google’s OK Google
 8) New Inventions
 many inventions - solve the majority of complex problems
5/15/2023
AI -VI BCA D
18
Disadvantages of Artificial Intelligence
 1) High Costs of Creation
 hardware and software need to get updated
 repairing and maintenance
 2) Making Humans Lazy
 applications automating the majority of the work.
 3) Unemployment
 replacing the majority of the repetitive tasks and other works with robots
 4) No Emotions
 cannot develop a bond with humans
 5) Lacking Out of Box Thinking
 perform only those tasks which they are designed or programmed to do
5/15/2023
AI -VI BCA D
19
Few Branches of AI
 Logical AI
 specific situation – how to take
decision
 Search
 examine large numbers of
possibilities – ex. Moves in chess
 Pattern Recognition
 program makes observations of
some kind,
 Representation
 Usually languages of
mathematical logic are used to
represent the facts
 Inference
 conclusion can be withdrawn if
there is evidence to the divergent
 Common sense knowledge and
Reasoning
 non-monotonic reasoning and
theories of action
 Learning from experience
 abilities to represent
information.
 Planning
 sequence of actions.
 Epistemology
 study of the kinds of knowledge
that are required for solving
problems
 Ontology
 study of the kinds of things that
exist
5/15/2023
AI -VI BCA D
20
Applications of AI
5/15/2023
AI -VI BCA D
21
Best 10 examples of AI in day to day life
1. Open Your Phone With Face ID- uses neural engine and face recognition
2. Email -Google gave us a smarter inbox, categorizing all the emails on its own, into folders such
as Primary, Social, Promotions, Updates and more.
3. Entertainment and Social Apps-identifying friends from photos, newsfeed personalization. ,Netflix
- recommendations
4. Google Navigation- Maps uses Machine Learning
5. Banking & Finance- AI & ML provides security features (Fraud preventions E-payments, Mobile
Banking)
6. Google predictive search algorithms-Google Auto complete forms- RankBrain is the algorithm
name
7. E-commerce – pattern matching , product recommendations
8. Mobile use- Speech recognition with Natural Language Processing (voice to text, chatbot)
9. Video games-AI controlled Non-playable characters (NPC), ML for BGM
10. Smart Personal Assistant- Google Assistant , Alexa, SIRI (Online shopping, Controlling lights
and other internet-enabled equipment ,Setting reminders and alarms , Booking cabs, flights and
trains, Playing music and videos ) 5/15/2023
AI -VI BCA D
22
Internal Representation
In order to act intelligently, a computer must have the
knowledge about the domain of interest.
Knowledge is the body of facts and principles gathered or the
act, fact, or state of knowing.
This knowledge needs to be presented in a form, which is
understood by the machine.
This unique format is called internal representation.
Thus plain English sentences could be translated into an
internal representation and they could be used to answer
based on the given sentences.
5/15/2023
AI -VI BCA D
23
Properties of Internal Representation
 avoid Ambiguity in words
 remove all referential ambiguity
 explicitly mention functional structure to express an idea
 Internal representation should avoid word sense ambiguity
 Word sense ambiguity arise because of multiple meaning of words.
Example
‘Raj caught a pen .
Raj caught a train.
Raj caught fever’
 Internal representation must remove all referential ambiguity.
 Referential ambiguity is the ambiguity about what the sentence refers to
Example: Raj said that Ram was not well. He must by lying”
Who does he refers to..?
5/15/2023
AI -VI BCA D
24
Internal representation must explicitly mention functional
structure
Functional structure is the word order used in the language
to express an idea.
Example: Ram killed Ravan. Ravan was killed by Ram.
Thus internal representation may not use the order of the
original sentence
Internal representation should be handle complex sentence
without losing meaning attached with it.
5/15/2023
AI -VI BCA D
25
Problem representation in AI
Define the problem precisely -initial solution & final
solution.
Analyze the problem - important features
Isolated and represent - features into knowledge
representation
Choose (problem solving techniques) – choose best technique
State space representation: set of all possible states for a given
problem.
5/15/2023
AI -VI BCA D
26
Example of problem space
to make a cup of coffee.
• Analyze the problem
• Check necessary ingrediants are
available or not
• If they are available, apply procedure
for making coffee.
5/15/2023
AI -VI BCA D
27
• Ingrediants (initial state)
• Sequence of steps(states)
• Cup of coffee (goal)
• Coffee powder, milk powder, sugar
(operators)
5/15/2023
AI -VI BCA D
28
5/15/2023
AI -VI BCA D
29
We started with Ingredients i.e the Initial state.
 Followed by sequence of Steps.
 We added only needed amount of coffee
powder, milk & sugar. These are Operators/
Actions.
At last had a cup of coffee –Goal state.
5/15/2023
AI -VI BCA D
30
SEARCH TECHNIQUES
 Search algorithms are one of the most important areas of Artificial
Intelligence.
Problem-solving agents:
 In Artificial Intelligence, Search techniques are universal problem-
solving methods.
 Rational agents or Problem-solving agents in AI mostly used
these search strategies or algorithms to solve a specific problem and
provide the best result.
 Problem-solving agents are the goal-based agents and use atomic
representation.
 Searching algorithms can be of various types. When any type of
searching is performed, there may be some information provided
about the searching or may not be. Also, it is possible that the
searching procedure may depend upon some constraints or rules.
5/15/2023
AI -VI BCA D
31
Search Algorithm Terminologies:
• Search: Searching 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: Search space represents a 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 representation of search problem is called Search tree. The root of
the search tree is the root node which is corresponding to the initial state.
• Actions: It gives the description of all the available actions to the agent.
• Transition model: A description of what each action do, can be represented as a
transition model.
• 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.
5/15/2023
AI -VI BCA D
32
Properties of Search Algorithms:
 Following are the four essential properties of search algorithms to compare the efficiency of these
algorithms:
 Completeness: A search algorithm is said to be complete if it guarantees to return a solution if at least
any solution exists for any random input.
 Optimality: If a solution found for an algorithm is guaranteed to be the best solution (lowest path cost)
among all other solutions, then such a solution for is said to be an optimal solution.
 Time Complexity: Time complexity is a measure of time for an algorithm to complete its task.
 Space Complexity: It is the maximum storage space required at any point during the search, as the
complexity of the problem.
5/15/2023
AI -VI BCA D
33
Two categories
Direct heuristic Search techniques / Uninformed (Blind Search)
Week Heuristic Search techniques /informed (Heuristic Search)
5/15/2023
AI -VI BCA D
34
An uninformed search is a searching technique that
has no additional information about the distance from
the current state to the goal.
 Informed Search is another technique that has
additional information about the estimate distance from
the current state to the goal.
5/15/2023
AI -VI BCA D
35
Best first, A+,mean Depth first, breath first
5/15/2023
AI -VI BCA D
36
Informed (Heuristic) Search Strategies
 Heuristic - a “rule of thumb” used to help guide search
 The purpose of heuristic function is to guide the search process in the most profitable
path among all that are available.
 To solve large problems with large number of possible states, problem-specific
knowledge needs to be added to increase the efficiency of search algorithms.
 Heuristic Function - function applied to a state in a search space to indicate a
likelihood of success if that state is selected
 Heuristic Search –
 given a search space, a current state and a goal state
 generate all successor states and evaluate each with our heuristic function
 select the move that yields the best heuristic value
 At each branching step, it evaluates the available information and makes a decision on
which branch to follow.
Heuristic Evaluation Functions
 It calculate the cost of optimal path between two states. A heuristic function for sliding-
tiles games is computed by counting number of moves that each tile makes from its goal
state and adding these number of moves for all tiles. 5/15/2023
AI -VI BCA D
37
Pure Heuristic Search
It expands nodes in the order of their heuristic
values.
It creates two lists, a closed list for the already
expanded nodes and an open list for the created
but unexpanded nodes.
In each iteration, a node with a minimum heuristic
value is expanded, all its child nodes are created and
placed in the closed list.
 Then, the heuristic function is applied to the child
nodes and they are placed in the open list according
to their heuristic value. The shorter paths are saved
and the longer ones are disposed.
5/15/2023
AI -VI BCA D
38
8 Tile Puzzle
Puzzle which will have square with 9 slots
numbered from 1 t0 8 and empty slot.
Objective is to get the square in numerical order.
By using empty slot.
Operators UP – Move up
Down – move down
Left – move left
Right – move right
5/15/2023
AI -VI BCA D
39
5/15/2023
AI -VI BCA D
40
 TRY YOURSELF
 Example Heuristics: 8 Puzzle
5/15/2023
AI -VI BCA D
41
5/15/2023
AI -VI BCA D
42
5/15/2023
AI -VI BCA D
43
Example 2 –Try urself
5/15/2023
AI -VI BCA D
44
Best First Search (Informed Search)
Best-first search is depends on the heuristic
function and the structure of the problem.
In the best first search algorithm, we expand
the node which is closest to the goal node and
the closest cost is estimated by heuristic
function,
Performance of the algorithm depends on
how well the cost or evaluation function is
designed.
5/15/2023
AI -VI BCA D
45
Best First Search Algorithm
Create two list: open[ ] and close[ ] list
Open – node that has been generated and had heuristic applied
but not yet examined
Close-nodes that has already been examined.
Step 1: Place the starting node into the OPEN list.
Step 2: If the OPEN list is empty, Stop and return failure.
Step 3: Remove the node n, from the OPEN list which has
the lowest value of h(n), and places it in the CLOSED list.
Step 4: Expand the node n, and generate the successors of
node n.
Step 5: Check each successor of node n, and find whether
5/15/2023
AI -VI BCA D
46
Step 6: For each successor node, algorithm checks for
evaluation function f(n), and then check if the node has
been in either OPEN or CLOSED list. If the node has not
been in both list, then add it to the OPEN list.
Step 7: Return to Step 2.
5/15/2023
AI -VI BCA D
47
Best first search
SBFG
We start from source "S" and search for goal “G" using given costs and Best First
search. Open =[] ,closed=[]
Open=[S], closed=[]
5/15/2023
AI -VI BCA D
48
In BFS(Breadth first search) and DFS(Depth first search), when
we are at a node, we can consider any of the adjacent as next
node. So both BFS and DFS blindly explore paths without
considering any cost function.
The idea of Best First Search is to use an evaluation function to
decide which adjacent is most promising and then explore. Best
First Search falls under the category of Heuristic Search or
Informed Search.
5/15/2023
AI -VI BCA D
49
Analysis : The worst case time complexity for Best First Search is
O(n * Log n) where n is the number of nodes. In worst case, we may
have to visit all nodes before we reach the goal.
Advantage.
 It is more efficient than that of BFS and DFS.
 Time complexity of Best first search is much less than Breadth first
search.
 The Best first search allows us to switch between paths by gaining
the benefits of both breadth first and depth first search.
Disadvantage
 Sometimes, it covers more distance than our consideration.
5/15/2023
AI -VI BCA D
50
Means-Ends Analysis - 1961 by Allen Newell, and Herbert A. Simon
Means-Ends Analysis is problem-solving techniques used in Artificial
intelligence for limiting search in AI programs.
It is a mixture of Backward and forward search technique.
Means-ends analysis Works:
The means-ends analysis process can be applied recursively for a problem. It is
a strategy to control search in problem-solving.
working of MEA technique for solving a problem.
First, evaluate the difference between Initial State and final State.
Select the various operators which can be applied for each difference.
Apply the operator at each difference, which reduces the difference between
the current state and goal state.
5/15/2023
AI -VI BCA D
51
Algorithm
 Let's take the Current state as CURRENT and Goal State as GOAL, then the following are the
steps for the MEA algorithm.
 Step 1: Compare CURRENT to GOAL, if there are no differences between both then return
Success and Exit.
 Step 2: Else, select the most significant difference and reduce it by doing the following steps
until the success or failure occurs.
 Select a new operator O which is applicable for the current difference, and if there is no such operator,
then signal failure.
 Attempt to apply operator O to CURRENT. Make a description of two states.
i) O-Start, a state in which O’s preconditions are satisfied.
ii) O-Result, the state that would result if O were applied In O-start.
 If
(First-Part <------ MEA (CURRENT, O-START)
And
(LAST-Part <----- MEA (O-Result, GOAL), are successful, then signal Success and return the result
of combining FIRST-PART, O, and LAST-PART.
5/15/2023
AI -VI BCA D
52
5/15/2023
AI -VI BCA D
53
Operator Subgoaling
 create the sub-problem of the current state, in which operator can be applied, such type of
backward chaining in which operators are selected, and then sub goals are set up to
establish the preconditions of the operator is called Operator Subgoaling.
5/15/2023
AI -VI BCA D
54
5/15/2023
AI -VI BCA D
55
5/15/2023
AI -VI BCA D
56
5/15/2023
AI -VI BCA D
57
 To reach the goal state using MEA,
 1. Apply move operator to pull out circle from the rectangle
 2. Apply shrink operator to reduce the size of the rectangle.
5/15/2023
AI -VI BCA D
58
Example 2 :Toy problem: chicken crossing
5/15/2023
AI -VI BCA D
59
5/15/2023
AI -VI BCA D
60
5/15/2023
AI -VI BCA D
61
5/15/2023
AI -VI BCA D
62
5/15/2023
AI -VI BCA D
63
5/15/2023
AI -VI BCA D
64
Game Playing Algorithms
 Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making and
game theory. It provides an optimal move for the player assuming that opponent is also playing
optimally.
 Mini-Max algorithm uses recursion to search through the game-tree.
 Min-Max algorithm is mostly used for game playing in AI. Such as Chess, Checkers, tic-tac-toe, go,
and various tow-players game. This Algorithm computes the min-max decision for the current state.
 In this algorithm two players play the game, one is called MAX and other is called MIN.
 Both the players fight it as the opponent player gets the minimum benefit while they get the maximum
benefit.
 Both Players of the game are opponent of each other, where MAX will select the maximized value
and MIN will select the minimized value.
 The minimax algorithm performs a depth-first search algorithm for the exploration of the complete
game tree.
 The minimax algorithm proceeds all the way down to the terminal node of the tree, then backtrack
the tree as the recursion.
5/15/2023
AI -VI BCA D
65
5/15/2023
AI -VI BCA D
66
Working of Min-Max Algorithm
 The working of the minimax algorithm can be easily described using an example. Below we
have taken an example of game-tree which is representing the two-player game.
 In this example, there are two players one is called Maximizer and other is called Minimizer.
 Maximizer will try to get the Maximum possible score, and Minimizer will try to get the
minimum possible score.
 This algorithm applies DFS, so in this game-tree, we have to go all the way through the
leaves to reach the terminal nodes.
 At the terminal node, the terminal values are given so we will compare those value and
backtrack the tree until the initial state occurs. Following are the main steps involved in
solving the two-player game tree:
5/15/2023
AI -VI BCA D
67
 Step-1: In the first step, the algorithm generates the entire game-tree and
apply the utility function to get the utility values for the terminal states. In the
below tree diagram, let's take A is the initial state of the tree. Suppose
maximizer takes first turn which has worst-case initial value =- infinity, and
minimizer will take next turn which has worst-case initial value = +infinity.
5/15/2023
AI -VI BCA D
68
 Step 2: Now, first we find the utilities value for the Maximizer, its initial value is -∞, so we will
compare each value in terminal state with initial value of Maximizer and determines the
higher nodes values. It will find the maximum among the all.
 For node D max(-1,- -∞) => max(-1,4)= 4
 For Node E max(2, -∞) => max(2, 6)= 6
 For Node F max(-3, -∞) => max(-3,-5) = -3
 For node G max(0, -∞) = max(0, 7) = 7
5/15/2023
AI -VI BCA D
69
 Step 3: In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞, and
will find the 3rd layer node values.
 For node B= min(4,6) = 4
 For node C= min (-3, 7) = -3
5/15/2023
AI -VI BCA D
70
 Step 4: Now it's a turn for Maximizer, and it will again choose the maximum of all nodes
value and find the maximum value for the root node. In this game tree, there are only 4
layers, hence we reach immediately to the root node, but in real games, there will be more
than 4 layers.
 For node A max(4, -3)= 4
5/15/2023
AI -VI BCA D
71
Properties of Mini-Max algorithm:
 Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in the
finite search tree.
 Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.
 Time complexity- As it performs DFS for the game-tree, so the time complexity of Min-Max
algorithm is O(bm), where b is branching factor of the game-tree, and m is the maximum
depth of the tree.
 Space Complexity- Space complexity of Mini-max algorithm is also similar to DFS which
is O(bm).
Limitation of the minimax Algorithm:
 The main drawback of the minimax algorithm is that it gets really slow for complex games
such as Chess, go, etc. This type of games has a huge branching factor, and the player has
lots of choices to decide. This limitation of the minimax algorithm can be improved
from alpha-beta pruning
5/15/2023
AI -VI BCA D
72
Alpha-Beta Pruning
 Alpha-beta pruning is a modified version of the minimax algorithm. It is an optimization technique for the
minimax algorithm.
 in the minimax search algorithm that the number of game states it has to examine are exponential in depth of the
tree. Since we cannot eliminate the exponent, but we can cut it to half. Hence there is a technique by which
without checking each node of the game tree we can compute the correct minimax decision, and this technique is
called pruning.
 Pruning involves two threshold parameter Alpha and beta for future expansion, so it is called alpha-beta
pruning. It is also called as Alpha-Beta Algorithm.
 Alpha-beta pruning can be applied at any depth of a tree, and sometimes it not only prune the tree leaves but
also entire sub-tree.
 The two-parameter can be defined as:
 Alpha: The best (highest-value) choice we have found so far at any point along the path of Maximizer. The initial value
of alpha is -∞.
 Beta: The best (lowest-value) choice we have found so far at any point along the path of Minimizer. The initial value of
beta is +∞.
 The Alpha-beta pruning to a standard minimax algorithm returns the same move as the standard algorithm does,
but it removes all the nodes which are not really affecting the final decision but making algorithm slow. Hence
by pruning these nodes, it makes the algorithm fast. 5/15/2023
AI -VI BCA D
73
Condition for Alpha-beta pruning:
 Condition for Alpha-beta pruning:
 α>=β
 Key points about alpha-beta pruning:
 The Max player will only update the value of alpha.
 The Min player will only update the value of beta.
 While backtracking the tree, the node values will be passed to upper nodes instead of
values of alpha and beta.
 We will only pass the alpha, beta values to the child nodes.
5/15/2023
AI -VI BCA D
74
Working of Alpha-Beta Pruning:
 Step 1: At the first step the, Max player will start first move from node A where α= -
∞ and β= +∞, these value of alpha and beta passed down to node B where again
α= -∞ and β= +∞, and Node B passes the same value to its child D.
5/15/2023
AI -VI BCA D
75
 Step 2: At Node D, the value of α will be calculated as its turn for Max. The value
of α is compared with firstly 2 and then 3, and the max (2, 3) = 3 will be the value
of α at node D and node value will also 3.
5/15/2023
AI -VI BCA D
76
 Step 3: Now algorithm backtrack to node B, where the value of β will change as this is a turn of
Min, Now β= +∞, will compare with the available subsequent nodes value, i.e. min (∞, 3) = 3,
hence at node B now α= -∞, and β= 3.
 In the next step, algorithm traverse the next successor of Node B which is node E, and the values
of α= -∞, and β= 3 will also be passed. 5/15/2023
AI -VI BCA D
77
 Step 4: At node E, Max will take its turn, and the value of alpha will change. The
current value of alpha will be compared with 5, so max (-∞, 5) = 5, hence at node E
α= 5 and β= 3, where α>=β, so the right successor of E will be pruned, and
algorithm will not traverse it, and the value at node E will be 5.
5/15/2023
AI -VI BCA D
78
 Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At
node A, the value of alpha will be changed the maximum available value is 3 as
max (-∞, 3)= 3, and β= +∞, these two values now passes to right successor of A
which is Node C.
 At node C, α=3 and β= +∞, and the same values will be passed on to node F.
5/15/2023
AI -VI BCA D
79
 Step 6: At node F, again the value of α will be compared with left child which is 0,
and max(3,0)= 3, and then compared with right child which is 1, and max(3,1)= 3
still α remains 3, but the node value of F will become 1.
5/15/2023
AI -VI BCA D
80
 Step 7: Node F returns the node value 1 to node C, at C α= 3 and β= +∞, here the
value of beta will be changed, it will compare with 1 so min (∞, 1) = 1. Now at C,
α=3 and β= 1, and again it satisfies the condition α>=β, so the next child of C
which is G will be pruned, and the algorithm will not compute the entire sub-tree G.
5/15/2023
AI -VI BCA D
81
 Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1) =
3. Following is the final game tree which is the showing the nodes which are
computed and nodes which has never computed. Hence the optimal value for the
maximizer is 3 for this example.
5/15/2023
AI -VI BCA D
82
Move Ordering in Alpha-Beta pruning:
 The effectiveness of alpha-beta pruning is highly dependent on the order in which each
node is examined. Move order is an important aspect of alpha-beta pruning.
It can be of two types:
 Worst ordering: In some cases, alpha-beta pruning algorithm does not prune any of
the leaves of the tree, and works exactly as minimax algorithm. In this case, it also
consumes more time because of alpha-beta factors, such a move of pruning is called
worst ordering. In this case, the best move occurs on the right side of the tree. The
time complexity for such an order is O(bm).
 Ideal ordering: The ideal ordering for alpha-beta pruning occurs when lots of pruning
happens in the tree, and best moves occur at the left side of the tree. We apply DFS
hence it first search left of the tree and go deep twice as minimax algorithm in the
same amount of time. Complexity in ideal ordering is O(bm/2).
5/15/2023
AI -VI BCA D
83
Rules to find good ordering:
 Following are some rules to find good ordering in alpha-beta pruning:
 Occur the best move from the shallowest node.
 Order the nodes in the tree such that the best nodes are checked first.
 Use domain knowledge while finding the best move. Ex: for Chess, try order: captures
first, then threats, then forward moves, backward moves.
 We can bookkeep the states, as there is a possibility that states may repeat.
5/15/2023
AI -VI BCA D
84
Thank you..
Dr.Thenmozhi K
THANK YOU..
thenmithu@gmail.com
5/15/2023
AI -VI BCA D
85

More Related Content

Similar to AI-UNIT 1 FINAL PPT (2).pptx

Author Francesca Rossi EN Policy Department C Citizens.docx
Author Francesca Rossi  EN Policy Department C Citizens.docxAuthor Francesca Rossi  EN Policy Department C Citizens.docx
Author Francesca Rossi EN Policy Department C Citizens.docx
rock73
 

Similar to AI-UNIT 1 FINAL PPT (2).pptx (20)

unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptxunleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
 
ARTIFICIAL INTELLLLIGENCEE modul11_AI.pptx
ARTIFICIAL INTELLLLIGENCEE modul11_AI.pptxARTIFICIAL INTELLLLIGENCEE modul11_AI.pptx
ARTIFICIAL INTELLLLIGENCEE modul11_AI.pptx
 
Aritificial intelligence
Aritificial intelligenceAritificial intelligence
Aritificial intelligence
 
Artificial Intelligence and Machine Learning
Artificial Intelligence and Machine LearningArtificial Intelligence and Machine Learning
Artificial Intelligence and Machine Learning
 
When artificial intelligence meets user experience
When artificial intelligence meets user experienceWhen artificial intelligence meets user experience
When artificial intelligence meets user experience
 
AI101 guide
AI101 guideAI101 guide
AI101 guide
 
AI101 Guide
AI101 GuideAI101 Guide
AI101 Guide
 
A Case Study of Artificial Intelligence is being used to Reshape Business
A Case Study of Artificial Intelligence is being used to Reshape BusinessA Case Study of Artificial Intelligence is being used to Reshape Business
A Case Study of Artificial Intelligence is being used to Reshape Business
 
Author Francesca Rossi EN Policy Department C Citizens.docx
Author Francesca Rossi  EN Policy Department C Citizens.docxAuthor Francesca Rossi  EN Policy Department C Citizens.docx
Author Francesca Rossi EN Policy Department C Citizens.docx
 
Lecture 1- Artificial Intelligence - Introduction
Lecture 1- Artificial Intelligence - IntroductionLecture 1- Artificial Intelligence - Introduction
Lecture 1- Artificial Intelligence - Introduction
 
Action Transformer - The next frontier in AI development.pdf
Action Transformer - The next frontier in AI development.pdfAction Transformer - The next frontier in AI development.pdf
Action Transformer - The next frontier in AI development.pdf
 
Action Transformer The next frontier in AI development.pdf
Action Transformer The next frontier in AI development.pdfAction Transformer The next frontier in AI development.pdf
Action Transformer The next frontier in AI development.pdf
 
Verisavo- Introduction to Artificial Intelligence and Machine Learning
Verisavo- Introduction to Artificial Intelligence and Machine LearningVerisavo- Introduction to Artificial Intelligence and Machine Learning
Verisavo- Introduction to Artificial Intelligence and Machine Learning
 
Unit 1 introduction
Unit 1 introductionUnit 1 introduction
Unit 1 introduction
 
AI basic.pptx
AI basic.pptxAI basic.pptx
AI basic.pptx
 
AI.pptx
AI.pptxAI.pptx
AI.pptx
 
Area's of Artificial Inteligence .pptx
Area's of Artificial Inteligence .pptxArea's of Artificial Inteligence .pptx
Area's of Artificial Inteligence .pptx
 
Artificial Intelligence Vs Machine Learning Vs Deep Learning
Artificial Intelligence Vs Machine Learning Vs Deep LearningArtificial Intelligence Vs Machine Learning Vs Deep Learning
Artificial Intelligence Vs Machine Learning Vs Deep Learning
 
aman presentation 2.pptx
aman presentation 2.pptxaman presentation 2.pptx
aman presentation 2.pptx
 
Artificial Intelligence fundamentals | Machine Learning | Deep Learning
Artificial Intelligence fundamentals | Machine Learning | Deep LearningArtificial Intelligence fundamentals | Machine Learning | Deep Learning
Artificial Intelligence fundamentals | Machine Learning | Deep Learning
 

More from prakashvs7 (15)

Python lambda.pptx
Python lambda.pptxPython lambda.pptx
Python lambda.pptx
 
Unit 3_Numpy_Vsp.pptx
Unit 3_Numpy_Vsp.pptxUnit 3_Numpy_Vsp.pptx
Unit 3_Numpy_Vsp.pptx
 
Unit 4_Working with Graphs _python (2).pptx
Unit 4_Working with Graphs _python (2).pptxUnit 4_Working with Graphs _python (2).pptx
Unit 4_Working with Graphs _python (2).pptx
 
unit 5_Real time Data Analysis vsp.pptx
unit 5_Real time Data Analysis  vsp.pptxunit 5_Real time Data Analysis  vsp.pptx
unit 5_Real time Data Analysis vsp.pptx
 
unit 4-1.pptx
unit 4-1.pptxunit 4-1.pptx
unit 4-1.pptx
 
unit 3.ppt
unit 3.pptunit 3.ppt
unit 3.ppt
 
final Unit 1-1.pdf
final Unit 1-1.pdffinal Unit 1-1.pdf
final Unit 1-1.pdf
 
PCCF-UNIT 2-1 new.docx
PCCF-UNIT 2-1 new.docxPCCF-UNIT 2-1 new.docx
PCCF-UNIT 2-1 new.docx
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
 
AI UNIT-3 FINAL (1).pptx
AI UNIT-3 FINAL (1).pptxAI UNIT-3 FINAL (1).pptx
AI UNIT-3 FINAL (1).pptx
 
DS-UNIT 3 FINAL.pptx
DS-UNIT 3 FINAL.pptxDS-UNIT 3 FINAL.pptx
DS-UNIT 3 FINAL.pptx
 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptx
 
DS-UNIT 1 FINAL (2).pptx
DS-UNIT 1 FINAL (2).pptxDS-UNIT 1 FINAL (2).pptx
DS-UNIT 1 FINAL (2).pptx
 
Php unit i
Php unit i Php unit i
Php unit i
 
The process
The processThe process
The process
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

AI-UNIT 1 FINAL PPT (2).pptx

  • 2. Introduction  Artificial Intelligence is an approach to make a computer, a robot, or a product to think how smart human think.  AI is a study of how human brain think, learn, decide and work, when it tries to solve problems.  The aim of AI is to improve computer functions which are related to human knowledge  example, reasoning, learning, and problem-solving. 5/15/2023 AI -VI BCA D 2
  • 3. AI Made by  The intelligence is intangible. It is composed of  Reasoning  Learning  Problem Solving  Perception  Linguistic Intelligence 5/15/2023 AI -VI BCA D 3
  • 4. Objective of AI Research  1. Knowledge - to represent knowledge about the world  Understand the entities and properties  Relationship to one another  2. Reasoning – to solve problems through logical reasoning  Logic - related ideas and conclusions from information  Deductive - derive specific conclusions from general premises believed to be true  Inductive -infer general conclusions from specific premises (or)  Abductive - seek the simplest and most likely explanation for an observation  3. Planning – to set and achieve goals  sequence of actions enabling progress towards it.  Communication - to understand written and spoken language  to communicate with people, software must have the ability to identify, understand and synthesize written or spoken human language.  Perception - to make deductions about the world based on input  software must be able to organize, identify and interpret visual images, sounds and other sensory inputs. 5/15/2023 AI -VI BCA D 4
  • 5. Artificial Intelligence  AI composed in two words  Artificial – man-made  Intelligence – thinking power  AI – Machines /systems thinks like human being  AI – booming technology, fascinating and universal fields of Computer science  creates computers or machines as intelligent as human beings 5/15/2023 AI -VI BCA D 5
  • 6. Definition  Definition:  According to the father of Artificial Intelligence, John McCarthy, it is “The science and engineering of making intelligent machines, especially intelligent computer programs”.  Definition from Rich & Knight : a program that  – Acts like human (Turing test)  – Thinks like human (human-like patterns of thinking steps)  – Acts or thinks rationally (logically, correctly) 5/15/2023 AI -VI BCA D 6
  • 11. Why AI?  With the help of AI,  you can create such software or devices which can solve real-world problems very easily and with accuracy such as health issues, marketing, traffic issues, etc.  you can create your personal virtual Assistant, such as Cortana ( MS own bing search engine), Google Assistant (google), Siri (will prompt you to call or make a reservation),alexa, etc.  you can build such Robots which can work in an environment where survival of humans can be at risk.  AI opens a path for other new technologies, new devices, and new Opportunities. 5/15/2023 AI -VI BCA D 11
  • 12. Categories of Artificial Intelligence  Weak AI - pre-planned moves  make the humans feel that the machines are acting intelligently (but they are not).  Strong AI - machine is almost capable of solving a complex problem like an intelligent man  think and function very similar to humans  making the humans feel that the machines are intelligent. 5/15/2023 AI -VI BCA D 12
  • 14. Thinks like Human – human like patterns of thinking steps Sophia is a social humanoid robot developed by Hong Kong based company Hanson Robotics. Sophia was activated on February 14, 2016, and made her first public appearance at South by Southwest Festival (SXSW) in mid-March 2016 in Austin, Texas, United States. She is able to display more than 50 facial expressions. Robot Sophia was given Saudia citizenship in 2017 'Sophia' the robot tells UN_ 'I am here to help humanity create the future' - YouTube (720p).mp4 5/15/2023 AI -VI BCA D 14
  • 16. GOALS  develop intelligent machines that could learn on their own. No more human intervention for feeding data to machines.  To Create Expert Systems −systems which exhibit intelligent behavior, learn, demonstrate, explain, and advice its users.  To Implement Human Intelligence in Machines - Creating systems that understand, think, learn, and behave like humans.  to develop reasoning and problem – solving skills  Knowledge representation is representing information that machine or computer can understand.  Natural learning processing -With artificial intelligence one can develop machines that can read and understand human languages 5/15/2023 AI -VI BCA D 16
  • 18. Advantages of Artificial Intelligence  1) Reduction in Human Error  decisions are taken from the previously gathered information applying certain set of algorithms.  2) Takes risks instead of Humans  overcome many risky limitations of human by developing an AI Robot  3) Available 24×7  machines work 24×7 without any breaks  4) Helping in Repetitive Jobs  repetitive works like sending a thanking mail, verifying certain documents for errors  5) Digital Assistance  used in many websites to provide things that user want.  6) Faster Decisions  machines take decisions faster than a human  7) Daily Applications  Apple’s Siri, Window’s Cortana, Google’s OK Google  8) New Inventions  many inventions - solve the majority of complex problems 5/15/2023 AI -VI BCA D 18
  • 19. Disadvantages of Artificial Intelligence  1) High Costs of Creation  hardware and software need to get updated  repairing and maintenance  2) Making Humans Lazy  applications automating the majority of the work.  3) Unemployment  replacing the majority of the repetitive tasks and other works with robots  4) No Emotions  cannot develop a bond with humans  5) Lacking Out of Box Thinking  perform only those tasks which they are designed or programmed to do 5/15/2023 AI -VI BCA D 19
  • 20. Few Branches of AI  Logical AI  specific situation – how to take decision  Search  examine large numbers of possibilities – ex. Moves in chess  Pattern Recognition  program makes observations of some kind,  Representation  Usually languages of mathematical logic are used to represent the facts  Inference  conclusion can be withdrawn if there is evidence to the divergent  Common sense knowledge and Reasoning  non-monotonic reasoning and theories of action  Learning from experience  abilities to represent information.  Planning  sequence of actions.  Epistemology  study of the kinds of knowledge that are required for solving problems  Ontology  study of the kinds of things that exist 5/15/2023 AI -VI BCA D 20
  • 22. Best 10 examples of AI in day to day life 1. Open Your Phone With Face ID- uses neural engine and face recognition 2. Email -Google gave us a smarter inbox, categorizing all the emails on its own, into folders such as Primary, Social, Promotions, Updates and more. 3. Entertainment and Social Apps-identifying friends from photos, newsfeed personalization. ,Netflix - recommendations 4. Google Navigation- Maps uses Machine Learning 5. Banking & Finance- AI & ML provides security features (Fraud preventions E-payments, Mobile Banking) 6. Google predictive search algorithms-Google Auto complete forms- RankBrain is the algorithm name 7. E-commerce – pattern matching , product recommendations 8. Mobile use- Speech recognition with Natural Language Processing (voice to text, chatbot) 9. Video games-AI controlled Non-playable characters (NPC), ML for BGM 10. Smart Personal Assistant- Google Assistant , Alexa, SIRI (Online shopping, Controlling lights and other internet-enabled equipment ,Setting reminders and alarms , Booking cabs, flights and trains, Playing music and videos ) 5/15/2023 AI -VI BCA D 22
  • 23. Internal Representation In order to act intelligently, a computer must have the knowledge about the domain of interest. Knowledge is the body of facts and principles gathered or the act, fact, or state of knowing. This knowledge needs to be presented in a form, which is understood by the machine. This unique format is called internal representation. Thus plain English sentences could be translated into an internal representation and they could be used to answer based on the given sentences. 5/15/2023 AI -VI BCA D 23
  • 24. Properties of Internal Representation  avoid Ambiguity in words  remove all referential ambiguity  explicitly mention functional structure to express an idea  Internal representation should avoid word sense ambiguity  Word sense ambiguity arise because of multiple meaning of words. Example ‘Raj caught a pen . Raj caught a train. Raj caught fever’  Internal representation must remove all referential ambiguity.  Referential ambiguity is the ambiguity about what the sentence refers to Example: Raj said that Ram was not well. He must by lying” Who does he refers to..? 5/15/2023 AI -VI BCA D 24
  • 25. Internal representation must explicitly mention functional structure Functional structure is the word order used in the language to express an idea. Example: Ram killed Ravan. Ravan was killed by Ram. Thus internal representation may not use the order of the original sentence Internal representation should be handle complex sentence without losing meaning attached with it. 5/15/2023 AI -VI BCA D 25
  • 26. Problem representation in AI Define the problem precisely -initial solution & final solution. Analyze the problem - important features Isolated and represent - features into knowledge representation Choose (problem solving techniques) – choose best technique State space representation: set of all possible states for a given problem. 5/15/2023 AI -VI BCA D 26
  • 27. Example of problem space to make a cup of coffee. • Analyze the problem • Check necessary ingrediants are available or not • If they are available, apply procedure for making coffee. 5/15/2023 AI -VI BCA D 27
  • 28. • Ingrediants (initial state) • Sequence of steps(states) • Cup of coffee (goal) • Coffee powder, milk powder, sugar (operators) 5/15/2023 AI -VI BCA D 28
  • 30. We started with Ingredients i.e the Initial state.  Followed by sequence of Steps.  We added only needed amount of coffee powder, milk & sugar. These are Operators/ Actions. At last had a cup of coffee –Goal state. 5/15/2023 AI -VI BCA D 30
  • 31. SEARCH TECHNIQUES  Search algorithms are one of the most important areas of Artificial Intelligence. Problem-solving agents:  In Artificial Intelligence, Search techniques are universal problem- solving methods.  Rational agents or Problem-solving agents in AI mostly used these search strategies or algorithms to solve a specific problem and provide the best result.  Problem-solving agents are the goal-based agents and use atomic representation.  Searching algorithms can be of various types. When any type of searching is performed, there may be some information provided about the searching or may not be. Also, it is possible that the searching procedure may depend upon some constraints or rules. 5/15/2023 AI -VI BCA D 31
  • 32. Search Algorithm Terminologies: • Search: Searching 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: Search space represents a 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 representation of search problem is called Search tree. The root of the search tree is the root node which is corresponding to the initial state. • Actions: It gives the description of all the available actions to the agent. • Transition model: A description of what each action do, can be represented as a transition model. • 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. 5/15/2023 AI -VI BCA D 32
  • 33. Properties of Search Algorithms:  Following are the four essential properties of search algorithms to compare the efficiency of these algorithms:  Completeness: A search algorithm is said to be complete if it guarantees to return a solution if at least any solution exists for any random input.  Optimality: If a solution found for an algorithm is guaranteed to be the best solution (lowest path cost) among all other solutions, then such a solution for is said to be an optimal solution.  Time Complexity: Time complexity is a measure of time for an algorithm to complete its task.  Space Complexity: It is the maximum storage space required at any point during the search, as the complexity of the problem. 5/15/2023 AI -VI BCA D 33
  • 34. Two categories Direct heuristic Search techniques / Uninformed (Blind Search) Week Heuristic Search techniques /informed (Heuristic Search) 5/15/2023 AI -VI BCA D 34
  • 35. An uninformed search is a searching technique that has no additional information about the distance from the current state to the goal.  Informed Search is another technique that has additional information about the estimate distance from the current state to the goal. 5/15/2023 AI -VI BCA D 35
  • 36. Best first, A+,mean Depth first, breath first 5/15/2023 AI -VI BCA D 36
  • 37. Informed (Heuristic) Search Strategies  Heuristic - a “rule of thumb” used to help guide search  The purpose of heuristic function is to guide the search process in the most profitable path among all that are available.  To solve large problems with large number of possible states, problem-specific knowledge needs to be added to increase the efficiency of search algorithms.  Heuristic Function - function applied to a state in a search space to indicate a likelihood of success if that state is selected  Heuristic Search –  given a search space, a current state and a goal state  generate all successor states and evaluate each with our heuristic function  select the move that yields the best heuristic value  At each branching step, it evaluates the available information and makes a decision on which branch to follow. Heuristic Evaluation Functions  It calculate the cost of optimal path between two states. A heuristic function for sliding- tiles games is computed by counting number of moves that each tile makes from its goal state and adding these number of moves for all tiles. 5/15/2023 AI -VI BCA D 37
  • 38. Pure Heuristic Search It expands nodes in the order of their heuristic values. It creates two lists, a closed list for the already expanded nodes and an open list for the created but unexpanded nodes. In each iteration, a node with a minimum heuristic value is expanded, all its child nodes are created and placed in the closed list.  Then, the heuristic function is applied to the child nodes and they are placed in the open list according to their heuristic value. The shorter paths are saved and the longer ones are disposed. 5/15/2023 AI -VI BCA D 38
  • 39. 8 Tile Puzzle Puzzle which will have square with 9 slots numbered from 1 t0 8 and empty slot. Objective is to get the square in numerical order. By using empty slot. Operators UP – Move up Down – move down Left – move left Right – move right 5/15/2023 AI -VI BCA D 39
  • 41.  TRY YOURSELF  Example Heuristics: 8 Puzzle 5/15/2023 AI -VI BCA D 41
  • 44. Example 2 –Try urself 5/15/2023 AI -VI BCA D 44
  • 45. Best First Search (Informed Search) Best-first search is depends on the heuristic function and the structure of the problem. In the best first search algorithm, we expand the node which is closest to the goal node and the closest cost is estimated by heuristic function, Performance of the algorithm depends on how well the cost or evaluation function is designed. 5/15/2023 AI -VI BCA D 45
  • 46. Best First Search Algorithm Create two list: open[ ] and close[ ] list Open – node that has been generated and had heuristic applied but not yet examined Close-nodes that has already been examined. Step 1: Place the starting node into the OPEN list. Step 2: If the OPEN list is empty, Stop and return failure. Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and places it in the CLOSED list. Step 4: Expand the node n, and generate the successors of node n. Step 5: Check each successor of node n, and find whether 5/15/2023 AI -VI BCA D 46
  • 47. Step 6: For each successor node, algorithm checks for evaluation function f(n), and then check if the node has been in either OPEN or CLOSED list. If the node has not been in both list, then add it to the OPEN list. Step 7: Return to Step 2. 5/15/2023 AI -VI BCA D 47
  • 48. Best first search SBFG We start from source "S" and search for goal “G" using given costs and Best First search. Open =[] ,closed=[] Open=[S], closed=[] 5/15/2023 AI -VI BCA D 48
  • 49. In BFS(Breadth first search) and DFS(Depth first search), when we are at a node, we can consider any of the adjacent as next node. So both BFS and DFS blindly explore paths without considering any cost function. The idea of Best First Search is to use an evaluation function to decide which adjacent is most promising and then explore. Best First Search falls under the category of Heuristic Search or Informed Search. 5/15/2023 AI -VI BCA D 49
  • 50. Analysis : The worst case time complexity for Best First Search is O(n * Log n) where n is the number of nodes. In worst case, we may have to visit all nodes before we reach the goal. Advantage.  It is more efficient than that of BFS and DFS.  Time complexity of Best first search is much less than Breadth first search.  The Best first search allows us to switch between paths by gaining the benefits of both breadth first and depth first search. Disadvantage  Sometimes, it covers more distance than our consideration. 5/15/2023 AI -VI BCA D 50
  • 51. Means-Ends Analysis - 1961 by Allen Newell, and Herbert A. Simon Means-Ends Analysis is problem-solving techniques used in Artificial intelligence for limiting search in AI programs. It is a mixture of Backward and forward search technique. Means-ends analysis Works: The means-ends analysis process can be applied recursively for a problem. It is a strategy to control search in problem-solving. working of MEA technique for solving a problem. First, evaluate the difference between Initial State and final State. Select the various operators which can be applied for each difference. Apply the operator at each difference, which reduces the difference between the current state and goal state. 5/15/2023 AI -VI BCA D 51
  • 52. Algorithm  Let's take the Current state as CURRENT and Goal State as GOAL, then the following are the steps for the MEA algorithm.  Step 1: Compare CURRENT to GOAL, if there are no differences between both then return Success and Exit.  Step 2: Else, select the most significant difference and reduce it by doing the following steps until the success or failure occurs.  Select a new operator O which is applicable for the current difference, and if there is no such operator, then signal failure.  Attempt to apply operator O to CURRENT. Make a description of two states. i) O-Start, a state in which O’s preconditions are satisfied. ii) O-Result, the state that would result if O were applied In O-start.  If (First-Part <------ MEA (CURRENT, O-START) And (LAST-Part <----- MEA (O-Result, GOAL), are successful, then signal Success and return the result of combining FIRST-PART, O, and LAST-PART. 5/15/2023 AI -VI BCA D 52
  • 54. Operator Subgoaling  create the sub-problem of the current state, in which operator can be applied, such type of backward chaining in which operators are selected, and then sub goals are set up to establish the preconditions of the operator is called Operator Subgoaling. 5/15/2023 AI -VI BCA D 54
  • 58.  To reach the goal state using MEA,  1. Apply move operator to pull out circle from the rectangle  2. Apply shrink operator to reduce the size of the rectangle. 5/15/2023 AI -VI BCA D 58
  • 59. Example 2 :Toy problem: chicken crossing 5/15/2023 AI -VI BCA D 59
  • 65. Game Playing Algorithms  Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making and game theory. It provides an optimal move for the player assuming that opponent is also playing optimally.  Mini-Max algorithm uses recursion to search through the game-tree.  Min-Max algorithm is mostly used for game playing in AI. Such as Chess, Checkers, tic-tac-toe, go, and various tow-players game. This Algorithm computes the min-max decision for the current state.  In this algorithm two players play the game, one is called MAX and other is called MIN.  Both the players fight it as the opponent player gets the minimum benefit while they get the maximum benefit.  Both Players of the game are opponent of each other, where MAX will select the maximized value and MIN will select the minimized value.  The minimax algorithm performs a depth-first search algorithm for the exploration of the complete game tree.  The minimax algorithm proceeds all the way down to the terminal node of the tree, then backtrack the tree as the recursion. 5/15/2023 AI -VI BCA D 65
  • 67. Working of Min-Max Algorithm  The working of the minimax algorithm can be easily described using an example. Below we have taken an example of game-tree which is representing the two-player game.  In this example, there are two players one is called Maximizer and other is called Minimizer.  Maximizer will try to get the Maximum possible score, and Minimizer will try to get the minimum possible score.  This algorithm applies DFS, so in this game-tree, we have to go all the way through the leaves to reach the terminal nodes.  At the terminal node, the terminal values are given so we will compare those value and backtrack the tree until the initial state occurs. Following are the main steps involved in solving the two-player game tree: 5/15/2023 AI -VI BCA D 67
  • 68.  Step-1: In the first step, the algorithm generates the entire game-tree and apply the utility function to get the utility values for the terminal states. In the below tree diagram, let's take A is the initial state of the tree. Suppose maximizer takes first turn which has worst-case initial value =- infinity, and minimizer will take next turn which has worst-case initial value = +infinity. 5/15/2023 AI -VI BCA D 68
  • 69.  Step 2: Now, first we find the utilities value for the Maximizer, its initial value is -∞, so we will compare each value in terminal state with initial value of Maximizer and determines the higher nodes values. It will find the maximum among the all.  For node D max(-1,- -∞) => max(-1,4)= 4  For Node E max(2, -∞) => max(2, 6)= 6  For Node F max(-3, -∞) => max(-3,-5) = -3  For node G max(0, -∞) = max(0, 7) = 7 5/15/2023 AI -VI BCA D 69
  • 70.  Step 3: In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞, and will find the 3rd layer node values.  For node B= min(4,6) = 4  For node C= min (-3, 7) = -3 5/15/2023 AI -VI BCA D 70
  • 71.  Step 4: Now it's a turn for Maximizer, and it will again choose the maximum of all nodes value and find the maximum value for the root node. In this game tree, there are only 4 layers, hence we reach immediately to the root node, but in real games, there will be more than 4 layers.  For node A max(4, -3)= 4 5/15/2023 AI -VI BCA D 71
  • 72. Properties of Mini-Max algorithm:  Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in the finite search tree.  Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.  Time complexity- As it performs DFS for the game-tree, so the time complexity of Min-Max algorithm is O(bm), where b is branching factor of the game-tree, and m is the maximum depth of the tree.  Space Complexity- Space complexity of Mini-max algorithm is also similar to DFS which is O(bm). Limitation of the minimax Algorithm:  The main drawback of the minimax algorithm is that it gets really slow for complex games such as Chess, go, etc. This type of games has a huge branching factor, and the player has lots of choices to decide. This limitation of the minimax algorithm can be improved from alpha-beta pruning 5/15/2023 AI -VI BCA D 72
  • 73. Alpha-Beta Pruning  Alpha-beta pruning is a modified version of the minimax algorithm. It is an optimization technique for the minimax algorithm.  in the minimax search algorithm that the number of game states it has to examine are exponential in depth of the tree. Since we cannot eliminate the exponent, but we can cut it to half. Hence there is a technique by which without checking each node of the game tree we can compute the correct minimax decision, and this technique is called pruning.  Pruning involves two threshold parameter Alpha and beta for future expansion, so it is called alpha-beta pruning. It is also called as Alpha-Beta Algorithm.  Alpha-beta pruning can be applied at any depth of a tree, and sometimes it not only prune the tree leaves but also entire sub-tree.  The two-parameter can be defined as:  Alpha: The best (highest-value) choice we have found so far at any point along the path of Maximizer. The initial value of alpha is -∞.  Beta: The best (lowest-value) choice we have found so far at any point along the path of Minimizer. The initial value of beta is +∞.  The Alpha-beta pruning to a standard minimax algorithm returns the same move as the standard algorithm does, but it removes all the nodes which are not really affecting the final decision but making algorithm slow. Hence by pruning these nodes, it makes the algorithm fast. 5/15/2023 AI -VI BCA D 73
  • 74. Condition for Alpha-beta pruning:  Condition for Alpha-beta pruning:  α>=β  Key points about alpha-beta pruning:  The Max player will only update the value of alpha.  The Min player will only update the value of beta.  While backtracking the tree, the node values will be passed to upper nodes instead of values of alpha and beta.  We will only pass the alpha, beta values to the child nodes. 5/15/2023 AI -VI BCA D 74
  • 75. Working of Alpha-Beta Pruning:  Step 1: At the first step the, Max player will start first move from node A where α= - ∞ and β= +∞, these value of alpha and beta passed down to node B where again α= -∞ and β= +∞, and Node B passes the same value to its child D. 5/15/2023 AI -VI BCA D 75
  • 76.  Step 2: At Node D, the value of α will be calculated as its turn for Max. The value of α is compared with firstly 2 and then 3, and the max (2, 3) = 3 will be the value of α at node D and node value will also 3. 5/15/2023 AI -VI BCA D 76
  • 77.  Step 3: Now algorithm backtrack to node B, where the value of β will change as this is a turn of Min, Now β= +∞, will compare with the available subsequent nodes value, i.e. min (∞, 3) = 3, hence at node B now α= -∞, and β= 3.  In the next step, algorithm traverse the next successor of Node B which is node E, and the values of α= -∞, and β= 3 will also be passed. 5/15/2023 AI -VI BCA D 77
  • 78.  Step 4: At node E, Max will take its turn, and the value of alpha will change. The current value of alpha will be compared with 5, so max (-∞, 5) = 5, hence at node E α= 5 and β= 3, where α>=β, so the right successor of E will be pruned, and algorithm will not traverse it, and the value at node E will be 5. 5/15/2023 AI -VI BCA D 78
  • 79.  Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At node A, the value of alpha will be changed the maximum available value is 3 as max (-∞, 3)= 3, and β= +∞, these two values now passes to right successor of A which is Node C.  At node C, α=3 and β= +∞, and the same values will be passed on to node F. 5/15/2023 AI -VI BCA D 79
  • 80.  Step 6: At node F, again the value of α will be compared with left child which is 0, and max(3,0)= 3, and then compared with right child which is 1, and max(3,1)= 3 still α remains 3, but the node value of F will become 1. 5/15/2023 AI -VI BCA D 80
  • 81.  Step 7: Node F returns the node value 1 to node C, at C α= 3 and β= +∞, here the value of beta will be changed, it will compare with 1 so min (∞, 1) = 1. Now at C, α=3 and β= 1, and again it satisfies the condition α>=β, so the next child of C which is G will be pruned, and the algorithm will not compute the entire sub-tree G. 5/15/2023 AI -VI BCA D 81
  • 82.  Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1) = 3. Following is the final game tree which is the showing the nodes which are computed and nodes which has never computed. Hence the optimal value for the maximizer is 3 for this example. 5/15/2023 AI -VI BCA D 82
  • 83. Move Ordering in Alpha-Beta pruning:  The effectiveness of alpha-beta pruning is highly dependent on the order in which each node is examined. Move order is an important aspect of alpha-beta pruning. It can be of two types:  Worst ordering: In some cases, alpha-beta pruning algorithm does not prune any of the leaves of the tree, and works exactly as minimax algorithm. In this case, it also consumes more time because of alpha-beta factors, such a move of pruning is called worst ordering. In this case, the best move occurs on the right side of the tree. The time complexity for such an order is O(bm).  Ideal ordering: The ideal ordering for alpha-beta pruning occurs when lots of pruning happens in the tree, and best moves occur at the left side of the tree. We apply DFS hence it first search left of the tree and go deep twice as minimax algorithm in the same amount of time. Complexity in ideal ordering is O(bm/2). 5/15/2023 AI -VI BCA D 83
  • 84. Rules to find good ordering:  Following are some rules to find good ordering in alpha-beta pruning:  Occur the best move from the shallowest node.  Order the nodes in the tree such that the best nodes are checked first.  Use domain knowledge while finding the best move. Ex: for Chess, try order: captures first, then threats, then forward moves, backward moves.  We can bookkeep the states, as there is a possibility that states may repeat. 5/15/2023 AI -VI BCA D 84
  • 85. Thank you.. Dr.Thenmozhi K THANK YOU.. thenmithu@gmail.com 5/15/2023 AI -VI BCA D 85