AI Basics for Beginners
AI Basics for Beginners
Basics of AI
Unit I Foundation
References
Lecture Topic To Be Covered Books/Text
Books/Websites
R1. Stuart Russell, Peter Norvig, 'Artificial Intelligence”, A Modern Approach ', Pearson Education/Prentice Hall of India,
(3rd Edition), (2010)
R2.Vinod Chandra, Anand Hareendran, “ Artificial Intelligence and Machine Learning,, PHI Learning Pvt. Ltd., (2014)
R3. Elaine Rich, Kevin Knight and Shivshankar Nair, 'Artificial Intelligence', Tata McGraw Hill, (3rd
Edition), (2009)
Intelligent Agents
What is AI : https://www.youtube.com/watch?v=ad79nYk2keg&t=30s
https://www.youtube.com/watch?v=G-zyTlZQYpE
● Deep Blue was a supercomputer developed by IBM specifically for playing chess
● Deep Blue, with its capability of evaluating 200 million positions per second
● It was a then-state-of-the-art expert system, relying upon rules and variables defined and
fine-tuned by chess masters and computer scientists.
● Current chess engines such as Leela Chess Zero typically use reinforcement machine
learning systems that train a neural network to play, developing its own internal logic rather
than relying upon rules defined by human experts
● Deep Blue is an Expert System designed to play chess.
● https://en.wikipedia.org/wiki/Deep_Blue_(chess_computer)#:~:text=It%20was%20a%20massively%20parallel,all%20housed%20in%20two%20cabine
ts.
Applications of AI
● Applications of Artificial Intelligence: Game Playing, Expert Systems, Natural Language
Processing, Image Understanding, Robotics, Pattern Recognition,Virtual Reality, Computer
Vision, Intelligent Control
● Natural Language Processing, :
● It concerned with giving computers the ability to understand text and spoken words in much
the same way human beings can.
● NLP combines computational linguistics—rule-based modeling of human language—with
statistical, machine learning, and deep learning models.
● Together, these technologies enable computers to process human language in the form of
text or voice data and to ‘understand’ its full meaning, complete with the speaker or writer’s
intent and sentiment.
● NLP drives computer programs that translate text from one language to another, respond to
spoken commands, and summarize large volumes of text rapidly—even in real time.
● We have used NLP in the form of voice-operated GPS systems, digital assistants,
speech-to-text dictation software, customer service chatbots
● Video :
https://www.google.com/search?q=language+translator+hand+held+device&sca_esv=601759512&rlz=1C1CHBD_enIN817IN818&biw=1220&bih=557&tbm=vid&ei=_d-zZb_5MdLk1e8P0req2AE&ved=0ahUKEwj_69rkvvuDAxVScvUHHdKbChsQ4dUDCA0&uact=5&oq=l
anguage+translator+hand+held+device&gs_lp=Eg1nd3Mtd2l6LXZpZGVvIiRsYW5ndWFnZSB0cmFuc2xhdG9yIGhhbmQgaGVsZCBkZXZpY2UyBRAhGJ8FSOJpUKYPWJNfcAB4AJABAJgBuAegAbY-qgELMC4xOC4xOC42LTG4AQPIAQD4AQHCAgsQABiABBiKB
RiRAsICCxAAGIAEGLEDGIMBwgIIEAAYgAQYsQPCAgUQABiABMICDhAAGIAEGIoFGLEDGIMBwgIKEAAYgAQYigUYQ8ICEBAAGIAEGIoFGEMYsQMYgwHCAg4QABiABBiKBRiRAhixA8ICCxAAGIAEGIoFGLEDwgIREAAYgAQYigUYkQIYsQMYgwH
CAgsQABiABBiKBRiGA8ICBhAAGBYYHsICCBAAGIAEGKIEwgIIEAAYCBgeGA3CAgYQIRgKGAqIBgE&sclient=gws-wiz-video#fpstate=ive&vld=cid:71e6f8ed,vid:WeByuOD8k1c,st:0
Applications of AI
● Applications of Artificial Intelligence: Game Playing, Expert Systems, Natural Language
Processing, Image Understanding, Robotics, Pattern Recognition,Virtual Reality, Computer
Vision, Intelligent Control
● Robotics, :
● In industrial robots, machine learning is used to improve production efficiency and reduce
errors on the assembly line in order to improve its production capacity.
● AI is also being used to increase the capabilities of these tools so that they can perform
increasingly complex tasks, from soldering and assembling electronic components, to
complex surgery with greater precision and control, and less invasive procedures for the
patient.
● In the field of health it is also very important in the field of diagnosis, as AI and Machine
Learning can be added to the application of Big Data tools to collect and analyse large
volumes of information relating to other diagnoses.
● Video :
https://www.google.com/search?q=Amazon+warehouses+robots+video&sca_esv=601759512&rlz=1C1CHBD_enIN817IN818&biw=1220&bih=557&ei=xOCzZbvKC5nd1e8Puoy9oA4&ved=0ahUKEwi7vKbDv_uDAxWZbvUHHTpGD-QQ4dUDCBE&uact=5&oq=Amazon+
warehouses+robots+video&gs_lp=Egxnd3Mtd2l6LXNlcnAiHkFtYXpvbiB3YXJlaG91c2VzIHJvYm90cyB2aWRlbzIHEAAYgAQYDTIIEAAYCBgeGA0yCxAAGIAEGIoFGIYDMgsQABiABBiKBRiGAzILEAAYgAQYigUYhgMyCxAAGIAEGIoFGIYDMgsQABiABBiK
BRiGA0iatAFQ-z9Yl6sBcAJ4AZABAJgB2QKgAasvqgEIMC4yNS42LjK4AQPIAQD4AQHCAgoQABhHGNYEGLADwgILEAAYgAQYigUYkQLCAgoQABiABBiKBRhDwgIREC4YgAQYsQMYgwEYxwEY0QPCAgsQLhiDARixAxiABMICFxAuGIAEGIoFGJECGLE
DGIMBGMcBGNEDwgILEAAYgAQYsQMYgwHCAggQABiABBixA8ICJhAuGIAEGIoFGJECGLEDGIMBGMcBGNEDGJcFGNwEGN4EGOAE2AEBwgINEAAYgAQYigUYQxixA8ICBRAAGIAEwgIGEAAYFhgewgIFECEYoAHCAgkQIRgKGKABGArCAggQABi
ABBiiBMICBhAAGAcYHsICCBAAGAgYBxgewgIGEAAYCBge4gMEGAAgQYgGAZAGCLoGBggBEAEYFA&sclient=gws-wiz-serp#fpstate=ive&vld=cid:670d0642,vid:TUx-ljgB-5Q,st:0
https://www.linkedin.com/posts/stevenouri_artificialintelligence-technology-innovation-ugcPost-7155841105475854336-8SYt?utm_source=share
&utm_medium=member_android
Applications of AI
● Applications of Artificial Intelligence: Game Playing, Expert Systems, Natural Language
Processing, Image Understanding, Robotics, Pattern Recognition,Virtual Reality, Computer
Vision, Intelligent Control
● Pattern Recognition :
● Pattern recognition is applied for data of all types, including image, video, text, and audio.
● As the pattern recognition model can identify recurring patterns in data, predictions made by
such models are quite reliable.
● Pattern recognition involves three key steps: analyzing the input data, extracting patterns,
and comparing it with the stored data.
● Video:
https://www.google.com/search?q=pattern+recognition+in+ai&sca_esv=601748582&rlz=1C1CHBD_enIN817IN818&biw=1220&bih=557&tbm=vid&ei=j-KzZaroLoXS1e8Ph8WmyA
s&oq=+Pattern+recognition&gs_lp=Eg1nd3Mtd2l6LXZpZGVvIhQgUGF0dGVybiByZWNvZ25pdGlvbioCCAAyCxAAGIAEGIoFGJECMgsQABiABBiKBRiRAjIKEAAYgAQYigU
YQzIGEAAYBxgeMgYQABgHGB4yChAAGIAEGIoFGEMyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAESJ4TUABYAHAAeACQAQCYAaIBoAGiAaoBAzAuMbgBA
cgBAPgBAQ&sclient=gws-wiz-video#fpstate=ive&vld=cid:50fd672f,vid:edbyqB9raew,st:0
Applications of AI
● Applications of Artificial Intelligence: Game Playing, Expert Systems, Natural Language
Processing, Image Understanding, Robotics, Pattern Recognition,Virtual Reality, Computer
Vision, Intelligent Control
● Virtual Reality :
● AI-generated content for VR and AR involves using machine learning algorithms to analyze
data and generate virtual objects and environments.
● This technology is changing the way we experience VR and AR, and is allowing developers
to create increasingly immersive and realistic virtual worlds for users to explore.
● Gaming: AI algorithms can generate realistic 3D models of game characters and
environments, and even create dynamic game scenarios based on user interactions creating
more immersive and engaging gaming experiences for users
● Training and Simulation: in health care and aviation
● Education and learning
● Video:
https://www.google.com/search?sca_esv=601748582&rlz=1C1CHBD_enIN817IN818&q=applications+of+ai+in+virtual+reality&tbm=vid&source=ln
ms&sa=X&ved=2ahUKEwiGo-S6wvuDAxWhdfUHHfGMCzYQ0pQJegQICxAB&biw=1220&bih=557&dpr=1.57#fpstate=ive&vld=cid:0347d3eb,vi
d:YXziJqnODh0,st:0
●
Categories of AI
•
Categories of AI
• Acting humanly: The Turing Test approach
• The Turing Test, proposed by Alan Turing TURING TEST (1950), was designed to
provide a satisfactory operational definition of intelligence.
• A computer passes the test if a human interrogator, after posing some written questions,
cannot tell whether the written responses come from a person from a computer.
• Programming a computer to pass a rigorously applied test provides plenty to work on.
• The computer would need to possess the following capabilities:
• NATURAL LANGUAGE PROCESSING : To enable it to communicate successfully
in English;
• KNOWLEDGE REPRESENTATION : To store what it knows or hears;
• AUTOMATED REASONING : To use the stored information to answer questions
and to draw new conclusions;
• MACHINE LEARNING • machine learning to adapt to new circumstances and to detect
and extrapolate patterns
https://www.google.com/search?sca_esv=
599381486&q=turing+test+how+does+it+
work&tbm=vid&source=lnms&sa=X&ved=
2ahUKEwjTr7GfpuaDAxWHwzgGHbBAAI
oQ0pQJegQIChAB&biw=1299&bih=654&d
pr=1#fpstate=ive&vld=cid:eb749dc2,vid:sX
x-PpEBR7k,st:0
● The Turing test is based on a party game "Imitation game," with some modifications.
● This game involves three players in which one player is Computer, another player is human
responder, and the third player is a human Interrogator, who is isolated from other two
players and his job is to find that which player is machine among two of them.
● Consider, Player A is a computer, Player B is human, and Player C is an interrogator.
Interrogator is aware that one of them is machine, but he needs to identify this on the basis
of questions and their responses.
https://www.javatpoint.com/turing-test-in-ai
Categories of AI
• Acting humanly: The Turing Test approach
• Turing’s test deliberately avoided direct physical interaction between the interrogator and
the computer, because physical simulation of a person is unnecessary for intelligence.
• TOTAL TURING TEST Test includes a video signal so that the interrogator can test the
subject’s perceptual abilities, as well as the opportunity for the interrogator to pass
physical objects “through the hatch.”
Human Robotic
Autonomous
Omniscient
• Ideal Rational Agent: For each possible percept sequence, an ideal rational agent should
do whatever action is expected to maximize its performance measure, on the basis of the
evidence provided by the percept sequence and whatever built-in knowledge the agent has.
• An Intelligent Agent must sense, must act, must be autonomous (to some extent) and
rational
• An omniscient agent knows the actual outcome of its actions, and can act accordingly
Intelligent Agents
• Rationality And Omniscience:
• An omniscient agent knows the actual outcome of its actions, and can act
accordingly; but omniscience is impossible in reality.
• Example:
• I am walking along the some road only for pedestrians and I see an old friend
across the street.
• There is no traffic nearby and I'm not otherwise engaged, so, being rational, I start
to cross the street.
• Meanwhile, at 33,000 feet, a cargo door falls off a passing airliner, and before I
make it to the other side of the street I am flattened.
• Was I irrational to cross the street? It is unlikely that my obituary would read "Idiot
attempts to cross street."
• So Rationality is concerned with expected success given what has been
perceived.
• Crossing the street was rational because most of the time the crossing would be
successful, and there was no way I could have foreseen the falling door.
Intelligent Agents
• Rationality And Omniscience:
• Another agent that was equipped with radar for detecting falling doors or a
steel cage strong enough to repel them would be more successful, but it would
not be any more rational.
• So we cannot blame an agent for failing to take into account something it could not
perceive, or for failing to take an action (such as repelling the cargo door) that it is
incapable of taking.
• But relaxing the requirement of perfection is not just a question of being fair to
agents.
• An intelligent agent should always do what is actually the right thing, it will be
impossible to design an agent to fulfill this specification
• Rational at any given time depends on four things:
– The performance measure that defines degree of success.
– Everything that the agent has perceived so far. We will call this complete
perceptual history the percept sequence.
– What the agent knows about the environment.
– The actions that the agent can perform.
Intelligent Agents
• Ideal Rational Agent: For each possible percept sequence, an ideal rational agent
should do whatever action is expected to maximize its performance measure, on the
basis of the evidence provided by the percept sequence and whatever built-in
knowledge the agent has.
• For Previous example:
• if an agent does not look both ways before crossing a busy road, then its
percept sequence will not tell it that there is a large truck approaching at high
speed.
• The definition seems to say that it would be OK for it to cross the road. In fact, this
interpretation is wrong on two counts.
• First, it would not be rational to cross the road: the risk of crossing without looking
is too great.
• Second, an ideal rational agent would have chosen the "looking" action before
stepping into the street, because looking helps maximize the expected performance.
• Doing actions in order to obtain useful information is an important part of
rationality
Intelligent Agents
• An Intelligent Agent must sense, must act, must be autonomous (to some
extent) and rational.
• AI is about building rational agents. An agent is something that perceives and acts.
• A rational agent always does the right thing.
• Agent Performance
• The performance measure is a subjective measure to characterize how successful
an agent is.
• The success can be measured in various ways :
– It can be measured in terms of speed or efficiency of the agent.
– It can be measured by the accuracy or the quality of the solutions achieved by
the agent.
– It can also be measured by power usage, money, etc.
• Example : consider the an agent that is supposed to vacuum a dirty floor.
• AI assistants, like Alexa and Siri, are examples of intelligent agents as they use sensors to
perceive a request made by the user and the automatically collect data from the internet without
the user's help
• Alexa Video
Intelligent Agents
• The vacuum-cleaner world :
• There are two locations: squares A and B. The vacuum agent perceives which
square it is in
• The vacuum agent perceives in which square it is in and whether there is dirt in
the square.
• if the current square is dirty, then suck, otherwise move to the other square.
• Partial tabulation of a simple agent function for the vacuum-cleaner world
Intelligent Agents
• Agent Performance
• A performance measure embodies the criterion for success of an agent's
behaviour.
• Example : consider the an agent that is supposed to vacuum a dirty floor.
• The performance measure would be the amount of dirt cleaned up in a single
eight-hour shift.
• A more sophisticated performance measure would factor in the amount of
electricity consumed and the amount of noise generated as well.
• A third performance measure might give highest marks to an agent that not only
cleans the floor quietly and efficiently, but also finds time to go windsurfing at the
weekend
• Thus evaluating performance is also important.
• If we measured how much dirt the agent had cleaned up in the first hour of the day,
we would be rewarding those agents that start fast (even if they do little or no work
later on), and punishing those that work consistently. Thus,
• we want to measure performance over the long run, be it an eight-hour shift or a
lifetime.
• The notion of an agent is meant to be a tool for analyzing systems, not an absolute
characterization that divides the world into agents and non-agents.
• Consider a clock it can be thought of as a simple agent.
• As an agent, most clocks always do the right action: moving their hands (or
displaying digits) in the proper fashion.
• Clocks are a kind of degenerate agent in that their percept sequence is empty; no
matter what happens outside, the clock's action should be unaffected.
Intelligent Agents
• The notion of an agent is meant to be a tool for analyzing systems, not an
absolute characterization that divides the world into agents and non-agents.
• Consider a clock it can be thought of as a simple agent.
• As an agent, most clocks always do the right action: moving their hands (or
displaying digits) in the proper fashion.
• Clocks are a kind of degenerate agent in that their percept sequence is empty; no
matter what happens outside, the clock's action should be unaffected.
• This is not quite true. If the clock and its owner take a trip from California to
Australia, the right thing for the clock to do would be to turn itself back six
hours.
• We do not get upset at our clocks for failing to do this because we realize that they
are acting rationally, given their lack of perceptual equipment
• So an agent's behavior depends only on its percept sequence to date
• We can describe any particular agent by making a table of the action it takes
in response to each possible percept sequence and have a mapping from
percept sequences to actions
• So mappings describe agents, then ideal mappings describe ideal agents.
• Specifying which action an agent ought to take in response to any given percept
sequence provides a design for an ideal agent.
Intelligent Agents
• Avery simple agent: the square-root function on a calculator.: ideal mapping
and ideal agent design
• The percept sequence for this agent is a sequence of keystrokes representing a
number, and the action is to display a number on the display screen.
• The ideal mapping is that when the percept is a positive number x, the right action is
to display a positive number z such that z2 « x, accurate to, say, 15 decimal places.
• This specification of the ideal mapping does not require the designer to actually
construct a table of square roots. Nor does the square-root function have to use a
table to behave correctly
The Nature of Environment
• Structure of Task Environment
• Agent program: a function that implements the agent mapping from percepts to
actions.
• This agent program runs on computing device called as architecture which can
be computer or special hardware with a software that isolates /connects the
computer and the agent program
• The architecture makes the percepts from the sensors available to the
program, runs the program, and feeds the program's action choices to the
effectors as they are generated.
• The relationship among agents, architectures, and programs can be
– agent = architecture + program
• Software agents (or software robots or softbots) exist in rich, unlimited
domains.
• A softbot designed to fly a flight simulator for a 747.
• The simulator is a very detailed, complex environment, and the software agent must
choose from a wide variety of actions in real time.
• Simple health care softbots
The Nature of Environment
• Task Environment
• For the rationality of an agent(right activity so as to make agent successful) we
require to Performance, Environment ,Actuators, Sensors (PEAS)
Performance tells desirable qualities, Environment tells what the agent will face,
actuators are the controls and sensors are the inputs based on which actuators work
or react
Examples of agent types and their PEAS descriptions.
Sensor Actuator Performance Environment
Fully vs partially
observable Single agent/
Multi-agent
Static Vs Dynamic
The hardest case is partially observable, stochastic, sequential, dynamic, continuous, and
multiagent.
It also turns out that most real situations are so complex that whether they are really
deterministic is a moot point. For practical purposes, they must be treated as stochastic.
Properties of Task Environments
• Fully observable :
• If an agent's sensors give it access to the complete state of the environment at each
point in time, then we say that the task environment is fully observable.
• A task environment is effectively fully observable if the sensors detect all
aspects that are relevant to the choice of action; relevance, in turn, depends on the
performance measure.
• Fully observable environments are convenient because the agent need not maintain
any internal state to keep track of the world.
• For example, a checkers game can be classed as fully observable, because the
agent can observe the full state of the game (how many pieces the opponent has,
how many pieces we have etc.)
• An example of this could be a Poker game. The Agent may not know what cards
the opponent has and will have to make best decision based on what cards the
opponent has played.
• Crossword Puzzle , chess with clock
Properties of Task Environments
• Partially observable:
• An environment might be partially observable because of noisy and inaccurate
sensors or because parts of the state are simply missing from the sensor data-for
• Example,
● a vacuum agent with only a local dirt sensor cannot tell whether there is dirt
in other squares
● an automated taxi cannot see what other drivers are thinking.
•
Properties of Task Environments
• Deterministic vs Stochastic
• If the next state of the environment is completely determined by the current
state and the action executed by the agent, then we say the environment is
deterministic; otherwise, it is stochastic (pattern that may be analysed statistically
but may not be predicted precisely)
• An agent need not worry about uncertainty in a fully observable, deterministic
environment.
• deterministic or stochastic environment is from the point of view of the agent.
• Taxi driving is clearly stochastic in this sense, because one can never predict
the behavior of traffic exactly; moreover, one's tires blow out and one's engine
seizes up without warning.
• The vacuum world as we described it is deterministic, but variations can include
stochastic elements such as randomly appearing dirt and an unreliable suction
mechanism
•
Properties of Task Environments
• Deterministic vs Stochastic
• Deterministic environment is one where your agent’s actions uniquely determine the
outcome.
• Example, in chess, there’s really no randomness when you move a piece.
• The effect of moving a piece is completely predetermined, and no matter where I’m
going to move the same piece, the outcome is the same.
• Crossword
• Games with dice, for example, like backgammon, are stochastic. While you can
still deterministically move your pieces, the outcome of an action also involves
throwing of the dice, and you can’t predict those.
• There’s a certain amount of randomness involved for the outcome of dice, and
therefore, we call this stochastic
Properties of Task Environments
• Episodic vs sequential
• In an episodic task environment, the agent's experience is divided into atomic
episodes.
• Each episode consists of the agent perceiving and then performing a single action.
• Crucially, the next episode does not depend on the actions taken in previous
episodes.
• In episodic environments, the choice of action in each episode depends only on the
episode itself.
• Example :classification tasks, an agent that has to spot defective parts on an
assembly line bases each decision on the current part, regardless of previous
decisions also the current decision doesn't affect whether the next part is defective.
• In sequential environments, the current decision could affect all future
decisions.
• Example: Chess and taxi driving are sequential
• In both cases, short-term actions can have long-term consequences.
• Episodic environments are much simpler than sequential environments because the
agent does not need to think ahead.
Properties of Task Environments
• Episodic vs sequential
• In an episodic task environment, the agent's experience is divided into atomic
episodes.
• Each episode consists of the agent perceiving and then performing a single action.
• Crucially, the next episode does not depend on the actions taken in previous
episodes.
• In episodic environments, the choice of action in each episode depends only on the
episode itself.
• Example :classification tasks, an agent that has to spot defective parts on an
assembly line bases each decision on the current part, regardless of previous
decisions also the current decision doesn't affect whether the next part is defective.
• In sequential environments, the current decision could affect all future
decisions.
• Example: Chess and taxi driving are sequential
• In both cases, short-term actions can have long-term consequences.
• Episodic environments are much simpler than sequential environments because the
agent does not need to think ahead.
Properties of Task Environments
• Static vs Dynamic
• If the environment can change while an agent is deliberating, then we say the
environment is dynamic for that agent; otherwise, it is static.
• Static environments are easy to deal with because the agent need not keep looking
at the world while it is deciding on an action, nor need it worry about the passage of
time.
• Dynamic environments, are continuously asking the agent what it wants to do; if it
hasn't decided yet, that counts as deciding to do nothing.
• If the environment itself does not change with the passage of time but the agent's
performance score does, then we say the environment is semi dynamic.
• Taxi driving is clearly dynamic: the other cars and the taxi itself keep moving
while the driving algorithm dithers about what to do next.
• Chess, when played with a clock, is semi dynamic.
• Crossword puzzles are static.
Properties of Task Environments
• Discrete vs Continuous
• The discrete/continuous distinction can be applied to the state of the environment, to
the way time is handled, and to the percepts and actions of the agent.
• For example, a discrete-state environment such as a chess game has a finite
number of distinct states.
• Chess also has a discrete set of percepts and actions.
• Taxi driving is a continuous state and continuous-time problem: the speed and
location of the taxi and of the other vehicles sweep through a range of continuous
values and do so smoothly over time.
• Taxi-driving actions are also continuous (steering angles, etc.).
• Input from digital cameras is discrete, but is typically treated as representing
continuously varying intensities and locations.
Properties of Task Environments
• Single agent/ Multi-agent
• Example, an agent solving a crossword puzzle by itself is clearly in a single-agent
environment,
• An agent playing chess is in a two-agent environment.
• we have described how an entity may be viewed as an agent, but we have not
explained which entities must be viewed as agents.
• Does an agent A (the taxi driver) have to treat an object B (another vehicle) as an
agent, or can it be treated merely as a stochastically behaving object, analogous to
waves at the beach or leaves blowing in the wind?
• The key distinction is whether B's behavior is best described as maximizing a
performance measure whose value depends on agent A's behavior.
• For example, in chess, the opponent entity B is trying to maximize its performance
measure, which, by the rules of chess, minimizes agent A's performance measure.
• Thus, chess is a competitive multiagent environment.
• In the taxi-driving environment, avoiding collisions maximizes the performance
measure of all agents, so it is a partially cooperative multiagent environment.
• It is also partially competitive because, for example, only one car can occupy a
parking space.
The hardest case is partially observable, stochastic, sequential, dynamic, continuous, and
multiagent.
It also turns out that most real situations are so complex that whether they are really
deterministic is a moot point. For practical purposes, they must be treated as stochastic.
Structure of Agents
• Agent programs
• The TABLE-DRIVEN-AGENT program is invoked for each new percept and returns
an action each time.
• It keeps track of the percept sequence using its own private data structure.
trivial agent program that keeps track of the percept sequence and then uses it to index
into a table of actions to decide what to do.
• The table represents explicitly the agent function that the agent program embodies.
• To build a rational agent in this way, we must construct a table that contains the
appropriate action for every possible percept sequence.
• An agent is meant to be a tool for analyzing systems, not an absolute
characterization that divides the world into agents and non-agents.
Structure of Agents
• Table based agent
• In table based agent the action is looked up from a table based on information about
the agent’s percepts.
• A table is simple way to specify a mapping from percepts to actions.
• The mapping is implicitly defined by a program. The mapping may be implemented
by a rule based system, by a neural network or by a procedure.
• There are several disadvantages to a table based system.
– The tables may become very large.
– Learning a table may take a very long time, especially if the table is large.
– Such systems usually have little autonomy, as all actions are pre-determined.
• Four basic kinds of agent program that embody the principles underlying almost
all intelligent systems:
– Simple reflex agents;
– Model-based reflex agents;
– Goal-based agents; and
– Utility-based agents.
The Nature of Environment
Types of Agents
Simple reflex
agents Learning agents
Goal-based agents
Utility-based agents
• Example
• Utility function maps a state (or a sequence of states) onto a real number,
which describes the associated degree of happiness.
• A complete specification of the utility function allows rational decisions in two
kinds of cases where goals are inadequate.
• First, when there are conflicting goals, only some of which can be achieved (for
example, speed and safety), the utility function specifies the appropriate trade off.
• Second, when there are several goals that the agent can aim for, none of which
can be achieved with certainty, utility provides a way in which the likelihood of
success can be weighed up against the importance of the goals
Learning agents
Learning
Agent
The major points to recall are as follows:
• An agent is something that perceives and acts in an environment. The
agent function for an agent specifies the action taken by the agent in
response to any percept sequence.
• The performance measure evaluates the behavior of the agent in an
environment.
• A rational agent acts so as to maximize the expected value of the
performance measure, given the percept sequence it has seen so far.
• A task environment specification includes the performance measure,
the external environment, the actuators, and the sensors.
• In designing an agent, the first step must always be to specify the task
environment as fully as possible. Task environments vary along several
significant dimensions. They can be fully or partially observable,
deterministic or stochastic, episodic or sequential, static or dynamic,
discrete or continuous, and single-agent or multiagent.
The major points to recall are as follows:
• The agent program implements the agent function. There exists a
variety of basic agent-program designs, reflecting the kind of information
made explicit and used in the decision process. The designs vary in
efficiency, compactness, and flexibility. The appropriate design of the
agent program depends on the nature of the environment.
• Simple reflex agents respond directly to percepts, whereas
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.“
• All agents can improve their performance through learning.
Problem-solving agent
• Formulate goal:
• be in Bucharest
• Formulate problem:
– states: various cities
– actions: drive between cities
• Find solution:
– sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest
Well-defined problems and solutions
Initial State the initial state for our agent in Romania might be
described as In(Arad)
from the state In(Arad), the successor function for the Romania
Actions problem would return { (G o(Sibzu),I n(Sibiu)), (Go(T imisoara), In(
Tzmisoara)), (Go(Zerznd),I n(Zerind)))
State Space is the map of Romania with path as roads
Sudoku
Problem Solving
Approaches
• A toy problem is intended to illustrate or exercise various problem-solving methods.
• It can be given a concise, exact description.
• This means that it can be used easily by different researchers to compare the
performance of algorithms.
• Example Vaccum agent:
• This can be formulated as a problem as follows:
• States: The agent is in one of two locations, each of which might or might not
contain dirt. Thus there are 2 x 2^2 = 8 possible world states.
• Initial state: Any state can be designated as the initial state.
• Successor function: This generates the legal states that result from trying the three
actions (Left, Right, and Suck).
• Goal test: This checks whether all the squares are clean.
• Path cost: Each step costs 1, so the path cost is the number of steps in the path.
The state space for the vacuum world. Arcs denote actions: L = Left, R = Right, S =
Suck.
● State Space Search : Number of states in which the problem can go till it reaches
the goal state
● s : {S,A, Actions(s), Result(s,a), Cost(s,a)}
● S: various states namely start, goal and intermediate
● A: Set of all possible actions : up, down, left, right movement in puzzle problem
● Precise representation of 8 puzzle problem: 3 * 3 board has 9 spaces with 8
numbers on tiles and 1 is empty space
● As the intermediate state are created they will be compared with goal state and if
they match search is stopped
● Action(s) : is selected action out of available up down left or right
● Result(s,a): Resultant state after action is completed
● Cost(s,a): cost of moving to the next state
8 Puzzle problem
The 8-puzzle, consists of a 3 x 3 board with eight numbered tiles and a blank space.
A tile adjacent to the blank space can slide into the space. The object is to reach a
specified goal state, such as the one shown on the right of the figure.
The standard formulation is as follows:
• States: A state description specifies the location of each of the eight tiles and the
blank in one of the nine squares.
• Initial state: Any state can be designated as the initial state. Any given goal
can be reached from exactly half of the possible initial states
• Successor function: This generates the legal states that result from trying the
four actions (blank moves Left, Right, Up, or Down).
• Goal test: This checks whether the state matches the goal configuration
• Path cost: Each step costs 1, so the path cost is the number of steps in the path.
States: locations of tiles
Actions/operators: move blank left, right,
up, down
goal test: goal state (given)
path cost: 1 per move
• The 8-puzzle belongs to the family of sliding-block puzzles, which are often used
as test problems for new search algorithms in AI.
• This general class is known to be NP-complete ie. Nondeterministic Polynomial
time (is a complexity class used to classify decision problems.)
• The State Space of the (n^2 -1) problem has only half of these states are
reachable from any given state
• The 8-puzzle has 9!/2 = 181,440 reachable states ( total States are 9!)and is
easily solved.
• The 15-puzzle (on a 4 x 4 board) has around 1.3 trillion states, and random
instances can be solved optimally in a few milliseconds by the best search
algorithms.
• The 24-puzzle (on a 5 x 5 board) has around 10^25 states, and random instances
are still quite difficult to solve optimally with current machines and algorithms.
Initial State Final State
1 2 3 1 2 3
4 8 - 4 5 6
7 6 5 7 8 -
1 2 3 1 2 3 1 2 3 1 2 3
4 8 5 4 8 5 4 - 5 4 5 -
7 6 - 7 - 6 7 8 6 7 8 6
1 2 3 1 2 3
4 - 8 4 5 6
7 6 5 7 8 -
1 2 3 1 2 3 1 2 3 1 2 3
4 8 - 4 8 5 4 8 5 4 - 5
7 6 5 7 6 - 7 - 6 7 8 6
4 5 6 4 5 -
7 8 - 7 8 6
Initial State Final State
1 2 3 1 2 3
4 - 8 4 5 6
7 6 5 7 8 -
1 2 3 1 2 3 1 2 3 1 2 3
4 6 8 4 6 8 4 6 - 4 - 6
7 - 5 7 5 - 7 5 8 7 5 8
4 5 6 4 5 6
7 8 - 7 - 8
8 Queens Problem
• The goal of the 8-queens problem is to place
eight queens on a chessboard (8 by 8) such
that no queen attacks any other.
• Almost a solution of the 8-queens problem
but the queen in the first column is on the
same diagonal as the Queen in the last column.
Q1
Q1
Q2
Q2
Q4 Q3
Q4
Q3
Place the queens such that there is no queen in that row or column or in
diagonal
Q1
Q2
Q3
Q5
Q4
Q6
Q7
Q8
Q1
Q3
Q2
Q4
Q5
Q6
Q7
Q8
12 Unique Solutions
8-Queens Problem
8 Queens Problem
8 (X,Y | X+Y <=3^ (0,X+Y) {Pour all water from 4-gallon jug
X>0) into 3-gallon jug}
http://aimaterials.blogspot.com/p/blog-page_18.html
Initialization: Iteration 1: Iteration 4:
Start State: (0,0) Current State: (X,3) Current State : (4,2)
Apply Rule 2: Apply Rule 7: Apply Rule 3:
(X,Y | Y<3) -> (X,Y | X+Y<=4 ^Y>0) (X,Y | X>0)
(X,3) (X+Y,0) (0,Y)
{Fill 3-gallon jug} {Pour all water from 3-gallon jug {Empty 4-gallon jug}
Now the state is (X,3) into 4-gallon jug} Now state is (0,2)
Now the state is (3,0)
Iteration 5:
Current State : (0,2)
Iteration 2: Apply Rule 9:
Current State : (3,0) (0,2)
Apply Rule 2: (2,0)
(X,Y | Y<3) -> {Pour 2 gallon water from 3 gallon
(3,3) jug into 4 gallon jug}
{Fill 3-gallon jug} Now the state is (2,0)
Now the state is (3,3)
Goal Achieved.
Iteration 3:
Current State:(3,3)
Apply Rule 5:
(X,Y | X+Y>=4 ^ Y>0)
(4,Y-(4-X))
{Pour water from 3-gallon jug into
4-gallon jug until 4-gallon jug is full}
Now the state is (4,2)
State Space Tree:
https://www.eecis.udel.edu/~mccoy/courses/cisc4-681.10f/lec-materials/handouts/search-water-jug-handout.pdf
Real World Problems: Route Finding Problem
• Route-finding algorithms are used in a variety of applications, such as routing in
computer networks, military operations planning, and airline travel planning
systems.
• These problems are typically complex to specify.
• Example of an airline travel problem :
• States: Each is represented by a location (e.g., an airport) and the current time.
• Initial state: This is specified by the problem.
• Successor function: This returns the states resulting from taking any scheduled
flight (perhaps further specified by seat class and location), leaving later than the
current time plus the within-airport transit time, from the current airport to another.
• Goal test: Are we at the destination by some prespecified time
• Path cost: This depends on monetary cost, waiting time, flight time, customs and
immigration procedures, seat quality, time of day, type of airplane, frequent-flyer
mileage awards, and so on.
Real World Problems: Route Finding Problem
• Commercial travel advice systems use a problem formulation of this kind, with
many additional complications to handle the fare structures that airlines impose.
• Any seasoned traveller knows, however, that not all air travel goes according to
plan.
• A really good system should include contingency plans-such as backup
reservations on alternate flights to the extent that these are justified by the cost and
likelihood of failure of the original plan.
Real World Problems: Travelling Salesperson Problem
• Search techniques used are an explicit search tree that is generated by the initial
state and the successor function that together define the state space.
• A search graph will be used rather than a search tree, when the same state can be
reached from multiple paths
• The root of the search tree is a search node corresponding to the initial state
•
Search Solutions
• Example : finding a route from Arad to Bucharest.
• Initial State :In Arad
• The first step is to test whether this is a goal state.
• Its not so not a goal state, we need to consider some other states.
• This is done by expanding the current state i.e. applying the successor
function to the current state thereby generating a new set of states.
• In this case, we get three new states: In(Sibiu), In(Timisoara), and In(Zerind)
• Every time we have to check whether its a goal state or not, if not ,expand the
current state
• The choice of which state to expand is determined by the search strategy by
using general tree-search algorithm
Search Solutions
• It is important to distinguish between the state space and the search tree.
• For the route finding problem, there are only 20 states in the state space, one for
each city.
• But there are an infinite number of paths in this state space, so the search tree
has an infinite number of nodes.
• For example, the three paths Arad-Sibiu, Arad-Sibiu-Arad, Arad-Sibiu-Arad-Sibiu
are the first three of an infinite sequence of paths.
• A good search algorithm avoids such repeated paths
• A node is a data structure with five components:
• STATE: the state in the state space to which the node corresponds;
• PARENT-NODE: the node in the search tree that generated this node;
• ACTION: the action that was applied to the parent to generate the node;
• PATH-COST: the cost, traditionally denoted by g ( n ) , of the path from the initial
state to the node, as indicated by the parent pointers; and
• DEPTH: the number of steps along the path from the initial state.
• A node is a bookkeeping 'data structure used to represent the search tree.
• A state corresponds to a configuration of the world
Search Solutions
• A node is a bookkeeping 'data structure used to represent the search tree.
• A state corresponds to a configuration of the world
• Nodes are on particular paths, as defined by PARENT-NODE pointers, whereas
states are not.
• Two different nodes can contain the same world state, if that state is generated via
two different search paths.
• The collection of nodes that have been generated but not yet expanded-this
collection is called the fringe.
• Each element of the fringe is a leaf node i.e. a node with no successors in the
tree.
• The collection of nodes is implemented as a queue
Search Solutions
• The operations on a queue are as follows:
• Make Queue (Elements ) Creates a queue with the given element(s).
• Empty (queue) returns true only if there are no more elements in the queue.
• First(queue) returns the first element of the queue.
• Remove First (queue): returns first (queue) and removes it from the queue.
• Insert (Element, queue) inserts an element into the queue and returns the resulting
• queue. (
• Insert ALL (Elements, Queue) inserts a set of elements into the queue and returns
the resulting queue
•
Performance measure for Problem Solving