AI Unit 1-1
AI Unit 1-1
LECTURE-01
Dr. M T L Gayatri
Associate Professor
EEE Department
Artificial Intelligence
• In today's world, technology is growing very fast, and we are getting in touch with
different new technologies day by day.
• Here, one of the booming technologies of computer science is Artificial
Intelligence which is ready to create a new revolution in the world by making
intelligent machines.
• The Artificial Intelligence is now all around us. It is currently working with a
variety of subfields, ranging from general to specific, such as self-driving cars,
playing chess, proving theorems, playing music, Painting, etc.
• AI is one of the fascinating and universal fields of Computer science which has a
great scope in future. AI holds a tendency to cause a machine to work as a
human.
Artificial Intelligence
• 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.“
"It is a branch of computer science by which we can create intelligent machines which can
behave like a human, think like humans, and able to make decisions."
• Artificial Intelligence exists when a machine can have human based skills such as learning,
work, despite that you can create a machine with programmed algorithms which can
• Reactive Machines
• Limited Memory
• Theory of Mind
• Self-Awareness
Philosophy of AI
Advantages of Artificial Intelligence
• High Accuracy with less errors: AI machines or systems are prone to less
information.
Chess game.
• High reliability: AI machines are highly reliable and can perform the same
defusing a bomb, exploring the ocean floor, where to employ a human can be
risky.
• Digital Assistant: AI can be very useful to provide digital assistant to the users
• Useful as a public utility: AI can be very useful for public utilities such as a self-
driving car which can make our journey safer and hassle-free, facial recognition
• Can't think out of the box: Even we are making smarter machines with AI,
but still they cannot work out of the box, as the robot will only do that
but still it does not have the feeling so it cannot make any kind of
people are getting more dependent on devices and hence they are losing
new ideas but still AI machines cannot beat this power of human
technology can be helpful for understanding the universe such as how it works, origin, etc.
AI in Healthcare In the last, five to ten years, AI becoming more advantageous for the healthcare industry
Healthcare Industries are applying AI to make a better and faster diagnosis than humans. AI can help
doctors with diagnoses and can inform when patients are worsening so that medical help can reach to the
AI in Gaming AI can be used for gaming purpose. The AI machines can play strategic games like chess,
AI in Finance AI and finance industries are the best matches for each other. The finance industry is
implementing automation, Chabot, adaptive intelligence, algorithm trading, and machine learning into
financial processes.
Application of AI
AI in Data Security The security of data is crucial for every company and cyber-attacks are growing very
rapidly in the digital world. AI can be used to make your data more safe and secure. Some examples such as
AEG bot, AI2 Platform, are used to determine software bug and cyber-attacks in a better way.
AI in Social Media Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user
profiles, which need to be stored and managed in a very efficient way. AI can organize and manage massive
amounts of data. AI can analyze lots of data to identify the latest trends, hashtag, and requirement of different
users.
AI in Travel & Transport AI is becoming highly demanding for travel industries. AI is capable of doing
various travel related works such as from making travel arrangement to suggesting the hotels, flights, and best
routes to the customers. Travel industries are using AI-powered chat bots which can make human-like
intelligent virtual assistant. Various Industries are currently working for developing self-driven
cars which can make your journey more safe and secure.
robots are programmed such that they can perform some repetitive task, but with the help of
AI, we can create intelligent robots which can perform tasks with their own experiences
without pre-programmed. Humanoid Robots are best examples for AI in robotics, recently the
intelligent Humanoid robot named as Erica and Sophia has been developed which can talk and
entertainment services such as Netflix or Amazon. With the help of ML/AI algorithms, these services show
• AI in Agriculture Agriculture is an area which requires various resources, labor, money, and time for best
result. Now a day's agriculture is becoming digital, and AI is emerging in this field. Agriculture is applying
AI as agriculture robotics, solid and crop monitoring, predictive analysis. AI in agriculture can be very
more demanding in the e-commerce business. AI is helping shoppers to discover associated products with
• AI in education: AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant. AI in the future can be work as a personal virtual tutor
for students, which will be accessible easily at any time and any place.
What is AI?-Various Definitions of AI-
History
16
Acting humanly: Turing Test
• Turing (1950) "Computing machinery and intelligence":
• "Can machines think?" "Can machines behave
intelligently?"
• Operational test for intelligent behavior: the Imitation
Game
• A Computer passes the test if a human interrogator,
after posing some written questions, cannot tell
whether the written responses come from a person or
from a computer.
17
AI Agent
AGENT
• An agent can be anything that perceive its environment through sensors
and act upon that environment through actuators. An Agent runs in the
cycle of perceiving, thinking, and acting. An agent can be:
Human-Agent: A human agent has eyes, ears, and other organs which
work for sensors and hand, legs, vocal tract work for actuators.
Robotic Agent: A robotic agent can have cameras, infrared range
finder, NLP for sensors and various motors for actuators.
Software Agent: Software agent can have keystrokes, file contents as
sensory input and act on those inputs and display output on the screen.
• Hence the world around us is full of agents such as thermostat, cell phone,
camera, and even we are also agents.
AGENT
• Sensor: Sensor is a device which detects the change in the environment
and sends the information to other electronic devices. An agent observes its
environment through sensors.
• Actuators: Actuators are the component of machines that converts energy
into motion. The actuators are only responsible for moving and controlling
a system. An actuator can be an electric motor, gears, rails, etc.
• Effectors: Effectors are the devices which affect the environment.
Effectors can be legs, wheels, arms, fingers, wings, fins, and display
screen.
INTELLIGENT AGENTS
• AGENTS AND ENVIRONMENTS
• An Agent is anything that can be ENVIRONMENT viewed
as perceiving its environment through sensors and
SENSOR acting upon that environment through
actuators.
24
• A Human Agent has eyes, ears, and other organs for
sensors and hands, legs, vocal tract, and so on for
actuators.
• A Robotic Agent might have cameras and infrared range
finders for sensors and various motors for actuators.
• Agent’s behavior is described by the agent function that
maps any given percept (interpret) sequence to an action
25
Intelligent Agent
• An intelligent agent is an autonomous entity which act upon an environment using sensors and
actuators for achieving goals. An intelligent agent may learn from the environment to achieve
27
Figure 2.2 A vacuum-cleaner world with just two locations.
Figure 2.3 Partial tabulation of a simple agent function for the vacuum-cleaner world
shown in Figure 2.2. 28
Structure of an AI Agent
• The task of AI is to design an agent program which implements the
agent function. The structure of an intelligent agent is a combination of
architecture and agent program. It can be viewed as:
Agent = Architecture + Agent program
Following are the main three terms involved in the structure of an
AI agent:
• Architecture: Architecture is machinery that an AI agent executes on.
• Agent Function: Agent function is used to map a percept to an action.
• Agent program: Agent program is an implementation of agent
function. An agent program executes on the physical architecture to
produce function .
PEAS Representation
PEAS is a type of model on which an AI agent
works upon. When we define an AI agent or
rational agent, then we can group its
properties under PEAS representation model.
It is made up of four words:
• P: Performance measure
• E: Environment
• A: Actuators
• S: Sensors
PEAS for self-driving cars
Self-driving cars
Let's suppose a self-driving car then PEAS
representation will be:
– Performance: Safety, time, legal drive, comfort
– Environment: Roads, other vehicles, road signs
– Actuators: Steering, accelerator, brake, signal,
horn
– Sensors: Camera, GPS, speedometer, odometer,
accelerometer, sonar.
Example of Agents with their PEAS
representation
Learning agents
• Described agent programs with various methods for selecting
actions but not explained how the agent programs come into
being.
• Learning has another advantage: 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 Fig. 2.15.
• The most important distinction is between the learning element,
which is responsible for making improvements, and the
performance element, which is responsible for selecting external
actions.
• The performance element is considered to be the entire agent: it
takes in percepts and decides on actions.
39
Figure 2.15 A general learning agent.
The learning element uses feedback from the critic on how the agent is doing
and determines how the performance element should be modified to do
better in the future.
The design of the learning element depends very much on the design of the
performance element. 40
• Given an agent design, learning mechanisms can be constructed to
improve every part of the agent.
• Ex: A chess program could receive a percept indicating that it has
checkmated its opponent, but it needs a performance standard to
know that this is a good thing.
• The last component of the learning agent is the problem generator.
• The point is that if the performance element had its way, it would
keep doing the actions that are best, given what it knows.
• But if the agent is willing to explore a little and do some perhaps
suboptimal actions in the short run, it might discover much better
actions for the long run.
• The performance element consists of whatever collection of
knowledge and procedures the taxi has for selecting its driving
actions.
• Ex: After the taxi makes a quick left turn across three lanes of traffic,
the critic observes the shocking language used by other drivers.
41
• From this experience, the learning element is able to
formulate a rule saying this was a bad action, and the
performance element is modified by installation of the
new rule.
• The learning element can make changes to any of the
“knowledge” components shown in the agent diagrams.
• Ex: If the taxi exerts a certain braking pressure when
driving on a wet road, then it will soon find out how
much deceleration is actually achieved.
• The external performance standard must inform the
agent that the loss of tips is a negative contribution to
its overall performance; then the agent might be able to
learn that violent maneuvers do not contribute to its
own utility.
42
Problem Solving in AI
Problem Formulation
Problem solving-definition
Goal based agent/Problem Solving Agent
Goal formulation and Problem Formulation
Components of Formulating Problem
Initial state
Successor state
Goal Test and
Path cost
1. Initial state: {(2,1,6)(4,0,8), (7,5,3)}
3. Successor function: If we apply down operator to start state, the resultant state has
5 and the blank position switch.
Result: (S,a) –(State, action)Action that result into a state that creates another state.
Ex: Blank space creates the same black space state with its move.
5. Path cost: Each step costs 1, so the path cost is number of steps in the path.
Problem solving agents….
• problem-solving agent is one kind of goal-based agent.
• Problem-solving agents use atomic representations
• Goal-based agents that use more advanced factored or
structured representations are usually called planning agents
• General-purpose search algorithms that can be used to solve
these problems
• Uninformed search algorithms—algorithms that are given no
information about the problem other than its definition.
• some of these algorithms can solve any solvable problem, none
of them can do so efficiently.
• Informed search algorithms, on the other hand, can do quite
well given some guidance on where to look for solutions.
• More general case—where the agent’s future actions may vary
depending on future percepts.
• It uses the concepts of asymptotic complexity (that is, O()
notation) and NP-completeness. 54
A
ABC
BCDE
CDEFG
Example of BFS algorithm
Example of BFS algorithm
Result: ABDCFEG
Uninformed/Blind Search -
Depth-First Search
Step 1 -.
1.STACK: H
Step 2 -
1.Print: H
STACK: A
Step 3 -
2.Print: A
2.STACK: B, D
Step 4 -
3.Print: D
2.STACK: B, F
Step 5 -
3.Print: F
2.STACK: B
DFS (Depth First Search) algorithm
Step 6 -
1.Print: B
2.STACK: C
Step 7 -
3.Print: C
2.STACK: E, G
Step 8 -
3.Print: G
2.STACK: E
Step 9 -
3.Print: E
2.STACK:
Output: HADFBCGE
Satisfaction vs. Optimization
Goal Optimization
Satisfaction
reach the goal optimize(objective fn)
node Constraint Constraint
satisfaction Optimization
© 6
Mausa
Local search and optimization
• Local search
– Keep track of single current state
– Move only to neighboring states
– Ignore paths
• Advantages:
– Use very little memory
– Can often find reasonable solutions in large or infinite (continuous)
state spaces.
current MAKE-NODE(INITIAL-STATE[problem])
loop do
neighbor a highest valued successor of current
if VALUE [neighbor] ≤ VALUE[current] then return STATE[current]
current neighbor
1
4
“Landscape” of
search
• Plateau
s
• Diagonal
ridges
1
7
Escaping Shoulders/local Optima
Enforced Hill Climbing
• Perform breadth first search from a local optima
– to find the next state with better h function
• Typically,
– prolonged periods of exhaustive search
– bridged by relatively quick periods of hill-climbing
© 2
Mausa 0
Hill-climbing: stochastic variations
• Stochastic hill-climbing
– Random selection among the uphill moves.
– The selection probability can vary with the steepness of
the uphill move.
2
1
Hill Climbing with random walk
When the state-space landscape has local minima, any search
that moves only in the greedy direction cannot be complete
Random walk, on the other hand, is asymptotically
complete
2
2
Hill-climbing with random restarts
• If at first you don’t succeed, try, try again!
• Different variations
– For each restart: run until termination vs. run for a fixed time
– Run a fixed number of restarts or run indefinitely
• Analysis
– Say each search has probability p of success
• E.g., for 8-queens, p = 0.14 with no sideways moves
• If you want to pick one local search algorithm, learn this one!!
2
3
Hill-climbing with both
2
4
Simulated Annealing
• Simulated Annealing = physics inspired twist on
random walk
• Basic ideas:
– like hill-climbing identify the quality of the local improvements
– instead of picking the best move, pick one randomly
– say the change in objective function is
– if is positive, then move to that state
– otherwise:
• move to this state with probability proportional to
• thus: worse moves (very large negative ) are executed less often
– however, there is always a chance of escaping from local maxima
– over time, make it less likely to accept locally bad moves
– (Can also make the size of the move random as well, i.e., allow “large” steps in
state space)
2
5
Simulated annealing
function SIMULATED-ANNEALING( problem, schedule) return a solution state
input: problem, a problem
schedule, a mapping from time to temperature
local variables: current, a node.
next, a node.
T, a “temperature” controlling the prob. of downward steps
current MAKE-NODE(INITIAL-STATE[problem])
for t 1 to ∞ do
T schedule[t]
if T = 0 then return current
next a randomly selected successor of current
∆E VALUE[next] - VALUE[current]
if ∆E > 0 then current next
else current next only with probability e∆E /T
2
6
Temperature T
• high T: probability of “locally bad” move is
higher
• low T: probability of “locally bad” move is
lower
• typically, T is decreased as the algorithm
runs longer
• i.e., there is a “temperature schedule”
2
7
Physical Interpretation of Simulated
Annealing
• A Physical Analogy:
• imagine letting a ball roll downhill on the function surface
– this is like hill-climbing (for minimization)
• now imagine shaking the surface, while the ball rolls,
gradually reducing the amount of shaking
– this is like simulated annealing
• Gradient descent
– make a move in the direction of the
gradient
• gradients: closed form or empirical
4
3