CS3491 - Unit 1 - Problem Solving (1)
CS3491 - Unit 1 - Problem Solving (1)
3rd Semester
Linear Integrated
4th Semester
2nd Semester
Wireless
Communication -
EC3501 Embedded Systems
and IOT Design -
ET3491
VLSI and Chip Design
5th Semester
8th Semester
6th Semester
SYLLABUS:
Introduction to AI - AI Applications - Problem solving agents – search
algorithms – uninformed search strategies – Heuristic search
strategies – Local search and optimization problems – adversarial
search – constraint satisfaction problems (CSP)
PART A
1. What is Artificial Intelligence? Or Define Artificial Intelligence.
Artificial intelligence is a wide-ranging branch of computer science
concerned with building smart machines capable of performing tasks
that typically require human intelligence.
Artificial Intelligence is the process of building intelligent machines from
vast volumes of data.
Systems learn from past learning and experiences and perform human-
like tasks.
It enhances the speed, precision, and effectiveness of human efforts.
Page: 1 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 2 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 3 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
AI includes predictive
Data Science includes data
modeling to predict events ML is a subset of Artificial
operations based on user
based on the previous and Intelligence.
requirements.
current data.
It is mainly used in fraud Applications of AI include Online recommendations, facial
detection, healthcare, BI chat bots, voice assistants, recognition, and NLP are a few
analysis, and more. and weather prediction. examples of ML.
Page: 4 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Types of Agent
Simple reflex agents respond directly to percepts.
Model-based reflex agents maintain internal state to track aspects of
the world that are not evident in the current percept.
Goal-based agents act to achieve their goals, and
Utility-based agents try to maximize their own expected “happiness.”
17. Define Problem Solving Agent. List the steps involved in Problem
Solving Agent.
Problem Solving Agent
Problem-solving agent is a goal-based agent that focuses on goals
using a group of algorithms and techniques to solve a well-defined
problem.
Page: 5 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
An agent may need to plan a sequence of actions that form a path
to a goal state.
Such an agent is called a problem-solving agent, and the
computational process it undertakes is called search.
Steps performed by Problem-solving agent
Goal Formulation
Problem Formulation
Search
Solution
Execution
19. Define search algorithms and list the types of search algorithm.
A search algorithm takes a search problem as input and returns a
solution.
Types of Search Algorithm
Uninformed Search Algorithms
o Depth First Search
o Depth Limited Search
o Breadth First Search
o Iterative Deepening Search
o Uniform Cost Search
o Bidirectional Search
Informed (Heuristic) Search Strategies
o Greedy Search
o A* Tree Search
20. Define Depth First Search. List the advantages and disadvantages
of DFS.
• Depth-first search (DFS) is an algorithm for traversing or searching
tree or graph data structures.
• The algorithm starts at the root node and explores as far as possible
along each branch before backtracking.
Page: 6 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
21. Which solution would DFS find to move from node S to node G if run
on the graph below?
Solution.
22. Define Depth Limited Search. List its advantages and disadvantages.
A depth-limited search algorithm is similar to depth-first search with a
predetermined limit.
Depth-limited search can solve the drawback of the infinite path in the
Depth-first search.
Page: 7 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Advantages:
Depth-limited search is Memory efficient.
Disadvantages:
Depth-limited search also has a disadvantage of incompleteness.
It may not be optimal if the problem has more than one solution.
23. Define Bre adth- first se arch (B FS) . List its advantages and disadvantages.
• Breadth-first search (BFS) is an algorithm for traversing or searching
tree or graph data structures.
• It starts at the tree root and explores all of the neighbor nodes at the
present depth prior to moving on to the nodes at the next depth level.
Advantages of Breadth-first Search:
If a solution is available, BFS will provide it.
If there are multiple answers to a problem, BFS will present the simplest
solution with the fewest steps.
Disadvantages of Breadth-first Search:
It necessitates a large amount of memory.
If the solution is located far from the root node, BFS will take a long time.
24. Which solution would BFS find to move from node S to node G if run on
the graph below?
Solution.
Page: 8 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
26. Define Uniform Cost Search. List its advantages and disadvantages.
A searching algorithm for traversing a weighted tree or graph is uniform-
cost search.
When a separate cost is provided for each edge, this algorithm is used.
The uniform-cost search's main purpose is to discover the shortest path
to the goal node with the lowest cumulative cost.
Cost of a node is defined as:
cost(node) = cumulative cost of all nodes from root
cost(root) = 0
Advantages of Uniform-cost Search:
The path with the lowest cost is chosen at each state.
UCS is complete only if states are finite and there should be no loop
with zero weight.
UCS is optimal only if there is no negative cost.
Disadvantages of Uniform-cost Search:
It is just concerned with the expense of the path.
27. Which solution would UCS find to move from node S to node G if run on
the graph below?
Page: 9 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution.
29. Define informed (heuristic) search strategies and mention its types.
Here, the algorithms have information on the goal state, which helps
in more efficient searching.
This information is obtained by something called a heuristic.
Search Heuristics:
In an informed search, a heuristic is a function h(n) estimates how
close a state is to the goal state.
h(n) = estimated cost of the cheapest path from the state at node n to
a goal state.
Page: 10 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
30. Find the path from S to G using greedy search. The heuristic values h
of each node below the name of the node.
Solution.
Starting from S, we can traverse to A(h=9) or D(h=5). We choose D,
as it has the lower heuristic cost. Now from D, we can move to
B(h=4) or E(h=3). We choose E with a lower heuristic cost. Finally,
from E, we go to G(h=0). This entire traversal is shown in the search
tree below, in blue.
Page: 11 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution.
Starting from S, the algorithm computes g(x) + h(x) for all nodes in
the fringe at each step, choosing the node with the lowest sum.
The entire work is shown in the table below.
Page: 12 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution
Page: 13 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 14 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 15 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 16 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
PART B
1. Define Artificial Intelligence and its types, goals, advantages and limitations
in detail.
ARTIFICIAL INTELLIGENCE:
1.1 Artificial Intelligence Definition
1.2 Types of Artificial Intelligence
1.2.1 Types of Artificial Intelligence-based on capabilities
1.2.2 Types of Artificial Intelligence-based on functionalities
1.3 Four possible goals to pursue in artificial intelligence:
1.3.1 Acting humanly: The Turing test approach
1.3.2 Thinking humanly: The cognitive modeling approach
1.3.3 Thinking rationally: The “laws of thought” approach
1.3.4 Acting rationally: The rational agent approach
1.4 Subfields of Artificial Intelligence
1.5 Advantages of Artificial Intelligence
1.6 Limitations of Artificial Intelligence
Page: 17 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 18 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 19 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Cognitive Science
o Cognitive science is the interdisciplinary study of mind and
intelligence, embracing philosophy, psychology, artificial
intelligence, neuroscience, linguistics, and anthropology.
Page: 20 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 21 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
o Cognitive Computing:
The ultimate goal of cognitive computing is to imitate the human
thought process in a computer model.
Using self-learning algorithms, pattern recognition by neural
networks, and natural language processing, a computer can mimic
the human way of thinking.
Here, computerized models are deployed to simulate the human
cognition process.
o Computer Vision:
Computer vision works by allowing computers to see, recognize, and
process images, the same way as human vision does, and then it
provides an appropriate output.
The computer must understand what it sees, and then analyze it,
accordingly.
o Natural Language Processing:
Natural language processing means developing methods that help us
communicate with machines using natural human languages like
English.
Page: 22 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 23 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Table 1.2 - Comparison of Data Science, Artificial Intelligence and Machine Learning:
Page: 24 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
1950:
Alan Turing publishes Computing Machinery and Intelligence. In the
paper, Turing—proposes to answer the question 'can machines
think?' and introduces the Turing Test to determine if a computer can
demonstrate the same intelligence as a human. The value of the
Turing test has been debated ever since.
1956:
John McCarthy coins the term 'artificial intelligence' at the first-ever
AI conference at Dartmouth College. Later that year, Allen Newell,
J.C. Shaw, and Herbert Simon create the Logic Theorist, the first-ever
running AI software program.
1958:
In 1958, John McCarthy had defined the high-level language Lisp,
which was to become the dominant AI programming language for the
next 30 years.
1959:
At IBM, Nathaniel Rochester and his colleagues produced some of the
first AI programs.
Herbert Gelernter (1959) constructed the Geometry Theorem Prover,
which was able to prove theorems that many students of mathematics
would find quite tricky.
1967:
Frank Rosenblatt builds the Mark 1 Perceptron, the first computer
based on a neural network that 'learned' though trial and error.
1980s:
Neural networks which use a back propagation algorithm to train
itself become widely used in AI applications.
1997:
IBM's Deep Blue beats then world chess champion Garry Kasparov, in
a chess match (and rematch).
2011:
IBM Watson beats champions Ken Jennings and Brad Rutter
at Jeopardy!
2015:
Baidu'sMinwa supercomputer uses a special kind of deep neural
network called a convolution neural network to identify and categorize
images with a higher rate of accuracy than the average human.
2016:
DeepMind'sAlphaGo program, powered by a deep neural network,
beats Lee Sodol, the world champion Go player, in a five-game match.
Page: 25 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
APPLICATIONS OF AI:
4.1. AI Application in E-Commerce
4.2. AI Application in Education
4.3. AI Application in Lifestyle
4.4. AI Application in Navigation
4.5. AI Application in Robotics
4.6. AI Application in Human Resource
4.7. AI Application in Healthcare
4.8. AI Application in Agriculture
4.9. AI Application in Gaming
4.10. AI Application in Automobiles
4.11. AI Application in Social Media
4.12. AI Application in Marketing
4.13. AI Application in Chatbots
4.14. AI Application in Finance
4.1. AI Application in E-Commerce
Personalized Shopping
o Artificial Intelligence technology is used to create
recommendation engines.
Page: 26 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 27 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 28 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 29 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
AGENTS
5.1 Agents and Environments
5.2 Basic Terminologies
5.3 Steps in designing an agent
5.4 Types of Agent
Page: 30 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Environments
The environment could be everything—the entire universe.
Page: 31 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Rational Agent
A rational agent acts so as to maximize the expected value of the
performance measure, given the percept sequence it has seen so
far.
Task Environment
A task environment specification includes the performance
measure, the external environment, the actuators, and the
sensors.
Page: 32 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Model-based reflex
Goal-based agents
Learning agents:
Page: 33 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
It allows the agent to operate in initially unknown environments and to become more
competent than its initial knowledge alone might allow. A learning agent can be divided into
four conceptual components, as shown in figure 1.10:
Page: 34 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 35 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 36 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Cells can contain objects, which the agent can pick up, push, or
otherwise act upon; a wall or other impassible obstacle in acell
prevents an agent from moving into that cell.
The vacuum world canbe formulated as a grid world problem as
shown in figure 1.12:
Page: 37 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 38 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
SEARCH ALGORITHMS
7.1 Search Algorithm
7.2 Types of Search Algorithm
7.2.1 UNINFORMED SEARCH ALGORITHMS
7.2.1.1 Depth First Search
7.2.1.2 Depth Limited Search
7.2.1.3 Breadth First Search
7.2.1.4 Iterative Deepening Search
7.2.1.5 Uniform Cost Search
7.2.1.6 Bidirectional Search
7.2.2 INFORMED (HEURISTIC) SEARCH STRATEGIES
7.2.2.1 Greedy Search
7.2.2.2 A* Tree Search
7.2.2.3 A* Graph Search
Page: 39 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
• These type of search does not maintain any internal state, that’s
it is also known as Blind search.
• Types of uninformed search algorithms are shown in Figure 1.13.
7.2.1.1 Depth First Search
7.2.1.2 Depth Limited Search
7.2.1.3 Breadth First Search
7.2.1.4 Iterative Deepening Search
7.2.1.5 Uniform Cost Search
7.2.1.6 Bidirectional Search
Each of these algorithms will have:
A problem graph, containing the start node S and the goal node
G.
A strategy, describing the manner in which the graph will be
traversed to get to G.
A fringe, which is a data structure used to store all the possible
states (nodes) from the current states.
A tree, that results while traversing to the goal node.
A solution plan, which the sequence of nodes from S to G.
Page: 40 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Example:
Page: 41 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution.
Algorithm
Page: 42 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Advantages:
Depth-limited search is Memory efficient.
Disadvantages:
Depth-limited search also has a disadvantage of incompleteness.
It may not be optimal if the problem has more than one solution.
Page: 43 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Example:
Page: 44 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 45 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution.
Page: 46 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Further, change the depth-limit =[0-3], it will again expand the nodes
from level 0 till level 3 and the search terminate
with A->B->D->F->E->H sequence where H is the desired goal node.
Page: 47 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Example:
Which solution would UCS find to move from node S to node G if run
on the graph below?
Solution.
Page: 48 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Search Heuristics:
In an informed search, a heuristic is a functionh(n) estimates how
close a state is to the goal state.
h(n) = estimated cost of the cheapest path from the state at node n to
a goal state.
Page: 49 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Example:
Question. Find the path from S to G using greedy search. The heuristic
values h of each node below the name of the node.
Page: 50 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution.
Starting from S, we can traverse to A(h=9) or D(h=5). We choose D,
as it has the lower heuristic cost. Now from D, we can move to
B(h=4) or E(h=3). We choose E with a lower heuristic cost. Finally,
from E, we go to G(h=0). This entire traversal is shown in the search
tree below, in blue.
Heuristic:
The following points should be noted with heuristics in A* search.
f(x) = g(x) + h(x)
h(x) is called the forward cost and is an estimate of the distance of
the current node from the goal node.
g(x) is called the backward cost and is the cumulative cost of a
node from the root node.
A* search is optimal only when for all nodes, the forward cost for a
node h(x) underestimates the actual cost h*(x) to reach the goal.
This property of A* heuristic is called admissibility.
Admissibility: 0 <= h(x) <= h*(x)
Page: 51 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution.
Starting from S, the algorithm computes g(x) + h(x) for all nodes in the
fringe at each step, choosing the node with the lowest sum.
The entire work is shown in the table below.
A* algorithm
Page: 52 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Example:
Question. Use graph searches to find paths from S to G in the following
graph.
Page: 53 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Solution
Page: 54 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
The local search algorithm explores the above landscape by finding the
following two points:
Global Minimum: If the elevation corresponds to the cost, then the task
is to find the lowest valley, which is known as Global Minimum.
Page: 55 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 56 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
The topographical regions shown in the Figure 1.19 can be defined as:
Global Maximum: It is the highest point on the hill, which is the goal
state.
Local Maximum: It is the peak higher than all other peaks but lower
than the global maximum.
Flat local maximum: It is the flat area over the hill where it has no
uphill or downhill. It is a saturated point of the hill.
Shoulder: It is also a flat area where the summit is possible.
Current state: It is the current position of the person.
Page: 57 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 58 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 59 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
ADVERSARIAL SEARCH
9.1 Adversarial Search in Artificial Intelligence
9.2 Elements of Game Playing search
9.3 Example:
9.3.1 Game Tree For Tic Tac Toe
9.4 Types Of Algorithms In Adversarial Search
9.4.1 Minimax Strategy / Minimax Algorithm
9.4.2 Alpha – Beta Pruning
Page: 60 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
9.3 Example:
Game tic-tac-toe, has two or three possible outcomes.
Either to win, to lose, or to draw the match with values +1,-1 or 0.
Game tree designed for tic-tac-toe refer Figure 1.23.
Here, the node represents the game state and edges represent the moves
taken by the players.
Page: 61 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Game Tree
A game tree is where the nodes represent the states of the game and
edges represent the moves made by the players in the game.
Players will be two namely:
o MIN: Decrease the chances to win the game.
o MAX: Increases his chances of winning the game.
Page: 62 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
MAX will choose that path which will increase its utility value and MIN
will choose the opposite path which could help it to minimize MAX’s
utility value.
Step 2:
Now, first we find the utilities value for the Maximizer, its initial value
is -∞,
For node D max(-1,- -∞) => max(-1,4)= 4
o For Node E max(2, -∞) => max(2, 6)= 6
o For Node F max(-3, -∞) => max(-3,-5) = -3
o For node G max(0, -∞) = max(0, 7) = 7
Page: 63 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
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.
o For node B= min(4,6) = 4
o For node C= min (-3, 7) = -3
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 reach immediately to the
root node, but in real games, there will be more than 4 layers.
o For node A max(4, -3)= 4
Page: 64 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
That was the complete workflow of the minimax two player game.
Minimax algorithm
Page: 65 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
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.
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.
Page: 66 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
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.
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.
Page: 67 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
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.
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.
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.
Page: 68 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
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.
The game will be started from the last level of the game tree,
and the value will be chosen accordingly.
The rule which will be followed is: “Explore nodes if necessary
otherwise prune the unnecessary nodes.”
Page: 69 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 70 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 71 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
Page: 72 / 73
By R.Manickavasagan,AP/CSE
www.BrainKart.com
CS 3491 – ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING UNIT 1
There are many possible solutions to this problem, such as in figure 1.26
Page: 73 / 73
By R.Manickavasagan,AP/CSE
Click on Subject/Paper under Semester to enter.
Environmental Sciences
Professional English and Sustainability -
Professional English - - II - HS3252 Discrete Mathematics GE3451
I - HS3152 - MA3354
Statistics and Theory of Computation
Matrices and Calculus Numerical Methods - Digital Principles and - CS3452
3rd Semester
4th Semester
- MA3151 MA3251 Computer Organization
1st Semester
2nd Semester
8th Semester
6th Semester
3rd Semester
Linear Integrated
4th Semester
2nd Semester
Wireless
Communication -
EC3501 Embedded Systems
and IOT Design -
ET3491
VLSI and Chip Design
5th Semester
8th Semester
6th Semester
4th Semester
- MA3151 MA3251 Computer Organization
1st Semester
2nd Semester
Computer Networks -
CS3591
Object Oriented
Full Stack Web Software Engineering - Human Values and
5th Semester
8th Semester
6th Semester
Elective 1 Elective-5
Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering