Unit 1 AI
Unit 1 AI
INTELLIGENCE
Unit 1
CONTENT
▪ Introduction to AI: What is AI?
▪ Intelligent Agents and environment;
▪ Rationality; the nature of environment; the structure of agents.
▪ Problem solving: Problem-solving agents; Example problems; Searching for solution; Uninformed
search strategies. Informed Search, Exploration,
▪ Constraint Satisfaction
▪ Adversial Search: Informed search strategies; Heuristic functions; On-line search agents and unknown
environment.
▪ Constraint satisfaction problems; Backtracking search for CSPs.
▪ Adversial search: Games; Optimal decisions in games; Alpha-Beta pruning.
INTRODUCTION TO AI
It is a branch of computer science by which intelligent machines is created which can behave like a
human, think like humans, and able to make decisions."
OR
According to the father of Artificial Intelligence, John McCarthy, it is “The science and engineering
of making intelligent machines, especially intelligent computer programs”.
Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial defines
"man-made," and intelligence defines "thinking power", hence AI means "a man-made thinking
power."
Components of Intelligence or What is Intelligence composed of?
1) Learning
2)Reasoning
3)Linguistic Intelligence
4)Perception
5) Problem solving
Learning:
▪ It is the activity of gaining knowledge or skill by studying, practicing, being taught, or experiencing
something. Learning enhances the awareness of the subjects of the study.
▪ The ability of learning is possessed by humans, some animals, and AI-enabled systems.
Reasoning : It is the set of processes that enables us to provide basis for judgement, making decisions, and
prediction.
Problem Solving :
▪ It is the process in which one perceives and tries to arrive at a desired solution from a present situation by
taking some path, which is blocked by known or unknown hurdles.
▪ Problem solving also includes decision making, which is the process of selecting the best suitable alternative
out of multiple alternatives to reach the desired goal are available
Perception:
It is the process of acquiring, interpreting, selecting, and organizing sensory information. Perception
presumes sensing. In humans, perception is aided by sensory organs. In the domain of AI, perception
mechanism puts the data acquired by the sensors together in a meaningful manner.
Linguistic Intelligence : It is one’s ability to use, comprehend, speak, and write the verbal and
written language. It is important in interpersonal communication.
Spatial Learning : It is learning through visual stimuli such as images, colors, maps, etc. For
Example, A person can create roadmap in mind before actually following the road.
Stimulus-Response Learning : It is learning to perform a particular behavior when a certain
stimulus is present. For example, a dog raises its ear on hearing do
AI DISCIPLINES
TYPES OF AI
Artificial Intelligence can be divided in various types, there are mainly two types of main categorization which
are based on capabilities and based on functionally of AI.
AI TYPE 1: BASED ON
Weak AI or Narrow AI:
CAPABILITY
▪ Narrow AI is a type of AI which is able to perform a dedicated task with intelligence. The most
common and currently available AI is Narrow AI in the world of Artificial Intelligence.
▪ Narrow AI cannot perform beyond its field or limitations, as it is only trained for one specific task.
Hence it is also termed as weak AI. Narrow AI can fail in unpredictable ways if it goes beyond its
limits.
▪ Apple Siri is a good example of Narrow AI, but it operates with a limited pre-defined range of
functions.
▪ Some Examples of Narrow AI are playing chess, purchasing suggestions on e-commerce site,
self-driving cars, speech recognition, and image recognition
General AI:
▪ General AI is a type of intelligence which could perform any intellectual task with efficiency like a
human.
▪ The idea behind the general AI to make such a system which could be smarter and think like a human by
its own.
▪ Currently, there is no such system exist which could come under general AI and can perform any task as
perfect as a human.
▪ The worldwide researchers are now focused on developing machines with General AI.
▪ As systems with general AI are still under research and it will take lots of efforts and time to develop
such systems.
Super AI:
▪ Super AI is a level of Intelligence of Systems at which machines could surpass human intelligence and
can perform any task better than human with cognitive properties. It is an outcome of general AI.
▪ Some key characteristics of strong AI include capability include the ability to think, to reason, solve the
puzzle, make judgments, plan, learn, and communicate by its own.
▪ Super AI is still a hypothetical concept of Artificial Intelligence. Development of such systems in real is
still world changing task.
AI TYPE 2: BASED ON
FUNCTIONALITY
1.Reactive Machines
▪ Purely reactive machines are the most basic types of Artificial Intelligence.
▪ Such AI systems do not store memories or past experiences for future actions.
▪ These machines only focus on current scenarios and react on it as per possible best action.
▪ IBM's Deep Blue system is an example of reactive machines.
▪ Google's AlphaGo is also an example of reactive machines.
2. Limited Memory
o Limited memory machines can store past experiences or some data for a short period of time.
o These machines can use stored data for a limited time period only.
o Self-driving cars are one of the best examples of Limited Memory systems. These cars can
store recent speed of nearby cars, the distance of other cars, speed limit, and other information
to navigate the road.
3.Theory of Mind
o Theory of Mind AI should understand the human emotions, people, beliefs, and be able
to interact socially like humans.
o This type of AI machines is still not developed, but researchers are making lots of efforts
and improvement for developing such AI machines.
4.Self-Awareness
o Self-awareness AI is the future of Artificial Intelligence. These machines will be super
intelligent, and will have their own consciousness, sentiments, and self-awareness.
o These machines will be smarter than human mind.
o Self-Awareness AI does not exist in reality still and it is a hypothetical concept.
TYPES OF INTELLIGENCE
1)Linguistic Intelligence
▪ It is the ability to speak, recognize and use the mechanism of grammar, semantic and phonology, It is
an ability to think and express the scenario easily as user understands
▪ Ex: Novelist, Journalist.
2)Musical Intelligence
▪ It is an ability to analyses pitch, rhythm and tone.
▪ Rationality is status of being reasonable, sensible, and having good sense of judgment.
▪ Rationality is concerned with expected actions and results depending upon what the agent has perceived. Performing actions
with the aim of obtaining useful information is an important part of rationality.
Rationality of an agent depends on the following −
• The performance measures, which determine the degree of success.
▪ A rational agent always performs right action, where the right action means the action that causes the agent to be most
successful in the given percept sequence.
The problem the agent solves is characterized by
1. Performance Measure
2. Environment
3. Actuators
4. Sensors (PEAS).
EXAMPLE
▪ Consider the vacuum cleaner which cleanse two rooms A and B, it can take rest for some time by going to
sleep mode. It may make the noise while sucking.
▪ So to measure the performance its cleanliness is not only the criteria but we must consider its noise, it’s
time to travel between two rooms, its sleeping time etc will come into picture while deciding its
performance.
Rationality of the agent is measured by following criteria:
The performance measure that defines the criterion of success.
The agent prior knowledge of the environment.
The possible actions that the agent can perform.
The agent’s percept sequence to date
PEAS
Task environment of any agent is decided by PEAS.
Following are the Properties of the agent to be listed while designing the rational agent.
P: Performance of the AI system.
E: Environment in which it acts.
A: Actuators S: Sensors
PEAS for Self driving car
▪ Performance: Safety, time, legal drive, comfort.
▪ Environment: Roads, other cars, pedestrians, road signs.
▪ Actuators: Steering, accelerator, brake, signal, horn.
▪ Sensors: Camera, sonar, GPS, Speedometer, odometer, accelerometer, engine sensors, keyboard.
• 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 minimax 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.
WORKING OF MIN-MAX
ALGORITHM:
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
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
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
▪ 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
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).
Disadvantage of 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
ALPHA-BETA ALGORITHM
▪Alpha–beta pruning is a search algorithm that seeks to decrease the number of nodes that are evaluated by
the minimax algorithm in its search tree. It is an adversarial search algorithm used commonly for machine
playing of two-player games (Tic-tac-toe, Chess, Go, etc.). It stops completely evaluating a move when at least
one possibility has been found that proves the move to be worse than a previously examined move. Such
moves need not be evaluated further. When applied to a standard minimax tree, it returns the same move as
minimax would, but prunes away branches that cannot possibly influence the final decision.
▪Eliminating a branch without consideration is called pruning
Procedure for pruning or cut off:-
● Traverse the search tree in depth-first order
● Starts with – ∞
● Starts with + ∞