0% found this document useful (0 votes)
554 views249 pages

AI Unit 1 PPT (21CSC206T)

The document provides an overview of the key concepts of artificial intelligence including definitions of AI, the goals and foundations of AI, the main topics and techniques in AI such as problem solving, agents, search, knowledge representation, and learning. It also discusses examples of AI applications and the advantages and disadvantages of AI.

Uploaded by

Akshay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
554 views249 pages

AI Unit 1 PPT (21CSC206T)

The document provides an overview of the key concepts of artificial intelligence including definitions of AI, the goals and foundations of AI, the main topics and techniques in AI such as problem solving, agents, search, knowledge representation, and learning. It also discusses examples of AI applications and the advantages and disadvantages of AI.

Uploaded by

Akshay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 249

ARTIFICIAL INTELLIGENCE

UNIT – 1

CLR1 : Provide a broad understanding of the basic techniques for building intelligent computer systems and an understanding of
how AI is applied to problems.

CLO1 : Formulate a problem and build intelligent agents


Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
What is Artificial Intelligence?

• A.I. is the study of how to make computers


do things at which, at the moment, people
are better.
Intelligence vs Artificial Intelligence

• Intelligence is a property/ability attributed to people, such as to know,


to think, to talk, to learn, to understand.

Intelligence = Knowledge + ability to perceive, feel, comprehend,


process, communicate, judge, learn.

• Artificial Intelligence is an interdisciplinary field aiming at developing


techniques and tools for solving problems that people are good at.
Intelligence
Definitions of AI

Existing definitions advocate everything from replicating human


intelligence to simply solving knowledge-intensive tasks. Examples:

• “Artificial Intelligence is the design, study and construction of


computer programs that behave intelligently.” --Tom Dean.
• “Artificial Intelligence is the enterprise of constructing a physical
symbol system that can reliably pass the Turing test.” --Matt Ginsberg.
What is Artificial Intelligence ?

THOUGH Systems that Systems that


T think think
like humans rationally

Systems that Systems that


BEHAVIOUR act act
like humans rationally

HUMA RATIONAL
N
Systems that act like humans:
Turing Test

• “The art of creating machines that


perform functions that require intelligence
when performed by people.” (Kurzweil)
• “The study of how to make computers do
things at which, at the moment, people
are better.” (Rich and Knight)
Systems that act like humans

• The Turing Test approach


– a human questioner cannot tell if
• there is a computer or a human answering his
question, via teletype (remote communication)
– The computer must behave intelligently
• Intelligent behavior
– to achieve human-level performance in all
cognitive tasks
Systems that act like humans

• These cognitive tasks include:


– Natural language processing
• for communication with human
– Knowledge representation
• to store information effectively & efficiently
– Automated reasoning
• to retrieve & answer questions using the stored
information
– Machine learning
• to adapt to new circumstances
What is Artificial Intelligence ?

THOUGH Systems that Systems that


T think think
like humans rationally

Systems that Systems that


BEHAVIOUR act act
like humans rationally

HUMA RATIONAL
N
Systems that think like humans:
cognitive modeling
• Humans as observed from ‘inside’
• How do we know how humans think?
– Introspection vs. psychological experiments
• Cognitive Science
• “The exciting new effort to make computers
think … machines with minds in the full and
literal sense” (Haugeland)
• “The automation of] activities that we associate
with human thinking, activities such as decision-
making, problem solving, learning …” (Bellman)
What is Artificial Intelligence ?

THOUGH Systems that Systems that


T think think
like humans rationally

Systems that Systems that


BEHAVIOUR act act
like humans rationally

HUMA RATIONAL
N
Systems that think ‘rationally’
"laws of thought"

• Humans are not always ‘rational’


• Rational - defined in terms of logic?
• Logic can’t express everything (e.g. uncertainty)
• Logical approach is often not feasible in terms of
computation time (needs ‘guidance’)
• “The study of mental facilities through the use
of computational models” (Charniak and
McDermott)
• “The study of the computations that make it
possible to perceive, reason, and act” (Winston)
What is Artificial Intelligence ?

THOUGH Systems that Systems that


T think think
like humans rationally

Systems that Systems that


BEHAVIOUR act act
like humans rationally

HUMA RATIONAL
N
Systems that act rationally:
“Rational agent”
• Rational behavior: doing the right thing
• The right thing: that which is expected to
maximize goal achievement, given the
available information
• Giving answers to questions is ‘acting’.
• I don't care whether a system:
– replicates human thought processes
– makes the same decisions as humans
– uses purely logical reasoning
Systems that act rationally

• Logic only part of a rational agent, not all of


rationality
– Sometimes logic cannot reason a correct
conclusion
– At that time, some specific (in domain) human
knowledge or information is used
• Thus, it covers more generally different situations of
problems
– Compensate the incorrectly reasoned conclusion
Systems that act rationally

•Study AI as rational agent –


2 advantages:
– It is more general than using logic only
• Because: LOGIC + Domain knowledge
– It allows extension of the approach with more
scientific methodologies
Rational agents

⚫ An agent is an entity that perceives and acts


⚫ This course is about designing rational agents
⚫ Abstractly, an agent is a function from percept histories to
actions:
[f: P* A]
⚫ For any given class of environments and tasks, we seek the
agent (or class of agents) with the best performance
⚫ Caveat: computational limitations make perfect rationality

unachievable
design best program for given machine resources
• Artificial
– Produced by human art or effort, rather than
originating naturally.
• Intelligence
• is the ability to acquire knowledge and use it"
[Pigford and Baur]
• So AI was defined as:
– AI is the study of ideas that enable
computers to be intelligent.
– AI is the part of computer science concerned
with design of computer systems that exhibit
human intelligence(From the Concise Oxford
Dictionary)
From the above two definitions, we can see
that AI has two major roles:
– Study the intelligent part concerned with
humans.
– Represent those actions using computers.
Goals of AI

• To make computers more useful by letting


them take over dangerous or tedious tasks
from human
• Understand principles of human intelligence
The Foundation of AI

• Philosophy
– At that time, the study of human intelligence
began with no formal expression
– Initiate the idea of mind as a machine and its
internal operations
The main topics in AI

Artificial intelligence can be considered under a number of


headings:
– Search (includes Game Playing).
– Representing Knowledge and Reasoning with it.
– Planning.
– Learning.
– Natural language processing.
– Expert Systems.
– Interacting with the Environment
(e.g. Vision, Speech recognition, Robotics)
Some Advantages of Artificial Intelligence

– more powerful and more useful computers


– new and improved interfaces
– solving new problems
– better handling of information
– relieves information overload
– conversion of information into knowledge
The Disadvantages

– increased costs
– difficulty with software development - slow and
expensive
– few experienced programmers
– few practical products have reached the market
as yet.
AI – Social Companion
AI in Movies
AI Applications
AI Defined

● Textbook
definition:

– AI may be defined as the branch of computer


science that is concerned with the automation
of intelligent behavior
Applied Areas of AI

• Heuristic Search
• Computer Vision
• Adversarial Search (Games)
• Fuzzy Logic
• Natural Language Processing
• Knowledge Representation
• Planning
• Learning
Examples

• Playing chess • Recognizing speech


• Driving on the highway • Diagnosing diseases
• Mowing the lawn • Translating languages
• Answering questions • Data mining
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
AI Techniques

• AI technique is a method that achieves knowledge. The main AI techniques are:


– Search

– Use of knowledge

– Abstraction
1. Search:-
• Search provides a way of solving problems for which no more direct approach is
available as well as a framework into which any direct techniques that are available
can be embedded. A search program finds a solutions for a problem by trying various
sequences of actions or operators until a solution is found.
Advantages
• It is the best way so far as no better way has been found to solve the problems.
• To solve a problem using search, it is only necessary to code the operator that can be
used; the search will find the sequence of actions that will provide the desired results.
Disadvantages
• Most problems have search spaces so large that it is impossible to search for the
whole space.
AI Techniques

2. Use of knowledge:-
• The use of knowledge provides a way of solving complicated problems by manipulating the
structures of the objects that are concerned.
• The way in which knowledge can be represented for usage in AI techniques:
• AI technique is a method that achieves knowledge that should be represented in such a way that:-
– Knowledge captures generalization. This meaning grouping situations that share important properties
rather than representing each situation separately with such an arrangement of knowledge, an
unreasonable amount of memory, and updating will no longer be required. Anything without this property
is called data rather than knowledge.

– It could easily be adjusted to correct errors end to demonstrate changes in the world.

3. Abstraction:-
• Abstraction finds a way of separating important features and notifications from the unimportant
ones that would otherwise confuse any process.
AI Techniques
AI technique is a method that exploits knowledge that should be
represented in such a way that:

1. The knowledge captures generalizations

2. It can be understood by people who must provide it.

3. It can easily be modified to correct errors

4. It can be used in a great many situations even if it is not totally accurate or


complete
5. It can be used to help overcome its own sheer bulk by helping to narrow the
range of possibilities that must usually be considered.
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Problem Solving with AI
Problem Solving In AI : Introduction

• Problem Solving in games such as “Sudoku” can be an example. It can be done by


building an artificially intelligent system to solve that particular problem. To do this,
one needs to define the problem statements first and then generating the solution
by keeping the conditions in mind.
• Some of the most popularly used problem solving with the help of artificial
intelligence are:
– Chess.
– Travelling Salesman Problem.
– Tower of Hanoi Problem.
– Water-Jug Problem.
– N-Queen Problem.
• Problem Searching
• In general, searching refers to as finding information one needs.
• Searching is the most commonly used technique of problem solving in artificial
intelligence.
• The searching algorithm helps us to search for solution of particular problem.
Problem Solving In AI : Introduction

• Problem
• Problems are the issues which
comes across any system. A solution
is needed to solve that particular
problem.
• Steps : Solve Problem Using Artificial
Intelligence
• The process of solving a problem
consists of five steps. These are:
Problem Solving In AI : Introduction

• Defining The Problem: The definition of the problem must be included


precisely. It should contain the possible initial as well as final situations
which should result in acceptable solution.
• Analyzing The Problem: Analyzing the problem and its requirement must
be done as few features can have immense impact on the resulting
solution.
• Identification Of Solutions: This phase generates reasonable amount of
solutions to the given problem in a particular range.
• Choosing a Solution: From all the identified solutions, the best solution is
chosen basis on the results produced by respective solutions.
• Implementation: After choosing the best solution, its implementation is
done.
Broad Categorisation of AI problems

Structured Problem
Well structed – Yield a right answer
Ill structed – Do not yield a particular answer
Unstructured Problem
Very hard to formulate the problem
Ambiguous in nature
Linear Problem
Have clear solution
All kind of classification problems
Non linear Problem
Relationships between input and output is non linear
Further decision can’t be taken like in linear problem

42
Unit 1 List of Topics
• Introduction to AI-AI techniques • Types of agents
• Problem solving with AI • Other aspects of agents

• AI Models, Data acquisition and • Constraint satisfaction


learning aspects in AI problems(CSP)
• Problem solving- Problem solving • Crypto arithmetic puzzles
process, Formulating problems
• CSP as a search problem-
• Problem types and characteristics constrains and representation
• Problem space and search • CSP-Backtracking, Role of
heuristic
• Intelligent agent
• Rationality and Rational agent with • CSP-Forward checking and
performance measures constraint propagation
• CSP-Intelligent backtracking
• Flexibility and Intelligent agents
• Task environment and its properties
AI Models

44
AI Models

45
AI Models

46
AI Models

47
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Data acquisition and learning aspects in AI
Data acquisition and learning aspects in AI

• Data Acquisition: - In this step, the data are being acquired from
different sources in digital form for storage and analysis purposes. It is
basically divided in three steps: - data collection, data transmission and
data preprocessing.
Data acquisition and learning aspects in AI

• (a) Data Collection: - In this phase, subsequent data or raw data are
collected from real world objects in a systematic manner. Otherwise,
collection of inaccurate data will lead to invalid results after the analysis
phase.
• The collections of data are being done from variety of sources, websites,
click streams, images, videos, etc. As a result, this step not only depends on
the physical characteristics of the data sources but also on the objective of
the data analysis. There are a lot of techniques used to collect accurate data.
• Ex: Log Files: - Web log file is one of the commonly used data collection
method. The purpose of this is to record activities of the Web user in the
form of data source in a specified file format for subsequent analysis.
• Sensors: - Sensors are often used to capture physical quantities which are
finally converted into different digital signals for storage and processing. It
may be further categorized into sound wave, voice, vibration, automobile,
chemical, pressure, weather, current, and temperature.
Data acquisition and learning aspects in AI

• (b) Data Centre Transmission: - After raw data are collected,


they are transferred to a data storage infrastructure
commonly in a data center for subsequent processing and
analysis.
• (c) Data Pre-Processing: - Since data gets collected from
various sources, they may also differ in levels of quality as
noise, consistency, redundancy etc.
• The data pre-processing techniques are designed in such a
way to improve the quality of data which improves the
accuracy of analysis and reduces the storage expenses.
Data acquisition and learning aspects in AI

The following three techniques are used to process the data:


• Integration: - This technique combines the data from various sources to provide a unified view of
data. Preferably, two commonly used traditional methods are data warehousing and data federation.
Data warehousing are also called as ETL which consists of three steps: extract, transform and
loading.
– Extraction: - In this phase, data are selected, collected, processed and analyzed after being
connected to the source systems.
– Transformation: - This step involves the transformation or conversion of extracted data into
the standard format.
– Loading: - The extracted and transformed data are imported into a target storage
infrastructure. The second technique is data federation, where data are being queried and
aggregated from various sources to make data integration technique more dynamic using
virtual database.
• Data Cleaning: - This technique involves the removing of irrelevant data or inaccurate data to
improve the data quality for accuracy, completeness and consistency.
• Redundancy Elimination: - Here, many datasets contains repetition of data or duplication of data
called as redundant data. These unnecessarily increases the data transmission overhead which
degrades the performance of storage systems in a manner like wastage of storage space,
inconsistent data, reduced reliability and corrupted data.
– Data de-duplication techniques are used to remove duplicate copies of repeating data where
a unique segment of data is allocated and stored during storage process and identification is
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Problem – Solving Process
Problem Solving with AI
“ Formulate , Search , Execute “ design for agent

A simple problem-solving agent. It first formulates a goal and a problem,


searches for a sequence of actions that would solve the problem, and then executes the actions
one at a time. When this is complete, it formulates another goal and starts over.
Problem Solving with AI
Components of a problem – Example
A simplified road map of part of Romania.
Problem Solving with AI
Components of a problem
A problem can be defined formally by five components:

• The initial state that the agent starts in /Starting state which
agent knows itself.
• Ex- The initial state for our agent in Romania might be described as In(Arad)

• A description of the possible actions/operators available to the agent. Given a


particular state s, ACTIONS(s) returns the set of actions that can be executed in s.
We say that each of these actions is applicable in s.
• Ex- from the state In(Arad), the applicable actions are {Go(Sibiu), Go(Timisoara),
Go(Zerind)}.
• A description of what each action does; the formal name for this is the transition
model, specified by a function RESULT(s, a) that returns the state that results from
doing action a in state s. We also use the term successor to refer to any state
reachable from a given state by a single action.
• Ex- RESULT(In(Arad),Go(Zerind)) = In(Zerind)
Problem Solving with AI
Components of a problem

• Together, the initial state, actions, and transition model implicitly


define the state space of the problem—the set of all states
reachable from the initial state by any sequence of actions. The
state space forms a directed network or graph in which the nodes
are states and the links between nodes are actions. A path in the
state space is a sequence of states connected by a sequence of
actions.
• Ex- The map of Romania shown can be interpreted as a state-space graph if we view each
road as standing for two driving actions, one in each direction.
• The goal test, which determines whether a given state is a goal
state. Sometimes there is an explicit set of possible goal states, and
the test simply checks whether the given state is one of them.
• Ex- The agent’s goal in Romania is the singleton set {In(Bucharest )}
Problem Solving with AI
Components of a problem
• A path cost function that assigns a numeric cost to each path. The problem-
solving agent chooses a cost function that reflects its own performance
measure.

• The step cost of taking action a to go from one state ‘s’ to reach state ‘y’ is
denoted by c(s, a, y).

Ex- For the agent trying to get to Bucharest, time is of the essence, so the cost of a
path might be its length in kilometres. We assume that the cost of a path can be
described as the sum of the costs of the individual actions along the path. The step
costs for Romania are shown in Figure as route distances. We assume that step costs
are nonnegative.

• A solution to a problem is an action sequence that leads from the initial state
to a goal state. Solution quality is measured by the path cost function, and an
optimal solution has the lowest path cost among all solutions.
Formulating Problems

• Problem Formulation : Choosing relevant set of states &


feasible set of operators for moving from one state to another.

• Search : Is a process of imagining sequences of


operators(actions) applied to initial state and to see which
state reaches goal state.
Toy Problems vs Real-world Problems

• A toy problem is intended to illustrate or


exercise various problem solving methods. It
can be given a concise, exact description.

• A real world problem is one whose


solutions people actually care about. Such
problems tend not to have a single agreed-upon
description, but we can give the general flavor of
their formulations.
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Problem Types

1. Deterministic or observable (single-state)


2. Non-observable (multiple-state)
3. Non-deterministic or partially observable
4. Unknown state space
Problem Types
1. Deterministic or observable(Single-state
problems)
• Each state is fully observable and it goes to
one definite state after any action.
• Here , the goal state is reachable in one
single action or sequence of actions.
• Deterministic environments ignore
uncertainty.
• Ex- Vacuum cleaner with sensor.

65
Problem Types
2. Non-observable(Multiple-state problems) /
conformant problems
• Problem – solving agent does not have any
information about the state.
• Solution may or may not be reached.
• Ex- In case of vacuum cleaner , the goal state is to clean the floor rather
clean floor. Action is to suck if there is dirt. So , in non-observable
condition , as there is no sensor , it will have to suck the dirt , irrespective
of whether it is towards right or left . Here , the solution space is the states
specifying its movement across the floor.
Problem Types
3. Non-deterministic(partially observable) problem
• The effect of action is not clear.
• Percepts provide new information about the current
state.
• Ex- If we take Vacuum cleaner , and now assume that the
sensor is attached to it , then it will suck if there is dirt.
Movement of the cleaner will be based on its current
percept.
Problem Types

Fully observable/ partially observable / Single agent/ Multiagent


unobservable

Static, Discrete: Crossword puzzle.


Dynamic, Continuous: Taxi Driving

Competitive/ Cooperative
Problem Types
4. Unknown state space problems
• Typically exploration problems
• States and impact of actions are not
known
• Ex- online search that involves acting without compete knowledge
of the next state or scheduling without map.
Problem Characteristics
1. Is the problem decomposable ?
2. Can Solution steps be ignored or undone ?
3. Is the Universe Predictable?
4. Is a good solution absolute or relative ?
5. Is the solution a state or a path?
6. What is the role of knowledge?
7. Does the task require interaction with a
person ?
Problem Characteristics- 1. Is the problem decomposable ?
BLOCKS WORLD
Problem Characteristics: 2. Can Solution steps be ignored or undone ?
The 8 – Puzzle

● How would you use AI


techniques to solve the 8-
puzzle problem?
Important Classes of Problem

• Ignorable Ex. Theorem Proving


• Recoverable Ex. The 8-Puzzle
• Irrecoverable Ex. Chess
Problem Characteristics
3. Is the Universe Predictable?

❖ Difference between certain outcome (e.g. 8-


Puzzle) and uncertain outcome (e.g. play
bridge ) .
❖ In case of certain outcome, we can make a
plan to generate a sequence of operation
that guaranteed to lead to a solution. So, that
the outcome is very certain.
❖ In case of uncertain outcome problems, we
follow the process of plan revision as the
plan is carried out and the necessary
feedback is provided. The disadvantage is
that the planning in this case is often very
Problem Characteristics
4. Is a good solution absolute or relative ?
● The facts can be represented using a formal
language called “Predicate Logic”.
● There may be “n” different solutions. If one
solution is found , there is no need to go
back and see if some path might also lead to
a solution.
● Ex: P -> Q
● If marks = 92 -> Grade = O RELATIVE
SOLUTION : Ex. TSP
(Explore all possible solutions)
Problem Characteristics
5. Is the solution a state or a path ?
● To solve a problem, of
finding interpretation, we
need to produce only the
interpretation itself. Record
of processing by how the
interpretation was arrived
is NOT required.
Ex: The President ate Food
with a fork.
● In contrast, if we must
produce, the final state
along with the path that we
found to that state along
with sequence of operations
to produce the final state.
Problem Characteristics
6. What is the role of knowledge ?
Is the lots of knowledge required to solve a problem or is knowledge only
to constrain solutions?

● Ex: Newspaper reading (by a computer) illustrate


difference between problems for which a lot of knowledge
is important only to constrain a search for solution and
those for which a lot of knowledge is required to recognise
a solution.
● Ex: Scanning newspapers to find who support Party A or
Party B in
upcoming elections.
● Assume unlimited computer power.
● The following has to be known at the time to arrive at an
answer
– (i) Name of Party candidates
– (ii) Taxes lowered
– (iii) Improved education, etc.
Problem Characteristics
7. Does the task require interaction with a person ?

There are 2 types of problems:


● Solitary : in which computer is given a
problem description and with NO
DEMAND FOR EXPLANATION of the
reasoning process.
● Conversational: in which there is
intermediate communication between a
person and the computer either to
provide additional assistance to computer
or to provide additional information to
user or both.
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Problem Space and Search
-Formal Description of a Problem
• In AI, we will formally define a problem as
– a space of all possible configurations where each
configuration is called a state
• thus, we use the term state space
– an initial state
– one or more goal states
– a set of rules/operators which move the problem from one
state to the next
• In some cases, we may enumerate all possible states
(see monkey & banana problem on the next slide)
– but usually, such an enumeration will be overwhelmingly
large so we only generate a portion of the state space, the
portion we are currently examining
The Monkey & Bananas Problem
• A monkey is in a cage and bananas are suspended from
the ceiling, the monkey wants to eat a banana but
cannot reach them
– in the room are a chair and a stick
– if the monkey stands on the chair and waves the stick, he can
knock a banana down to eat it
– what are the actions the monkey should take?

Initial state:
monkey on
ground
with empty hand
bananas
suspended
Goal state:
monkey eating
Actions:
climb chair/get
off
Problem Solving

• • Problem solving: The term, Problem Solving relates to analysis in AI.


Problem solving may be characterized as a systematic search through a
range of possible actions to reach some predefined goal or solution.
Problem-solving methods are categorized as special purpose and general
purpose.
• • A special-purpose method is tailor-made for a particular problem,
often exploits very specific features of the situation in which the
problem is embedded.
• • A general-purpose method is applicable to a wide variety of problems.
One General-purpose technique used in AI is ‘means-end analysis’: a
step-bystep, or incremental, reduction of the difference between current
state and final goal.
Example – Toy Problems
Vacuum Cleaner World
Program implements the agent function tabulated

Function Reflex-Vacuum-Agent([location,status])
return an action
If status = Dirty then return Suck
else if location = A then return Right
else if location = B then return left
Toy Problems vs Real-world Problems

• A toy problem is intended to illustrate or


exercise various problem solving methods. It
can be given a concise, exact description.

• A real world problem is one whose


solutions people actually care about. Such
problems tend not to have a single agreed-upon
description, but we can give the general flavor of
their formulations.

84
Toy Problem- 1
Vacuum Cleaner World -Problem Formulation

• State - agent is in one of two locations, each of which might or might


not contain dirt. Thus there are 2 × 22 = 8 possible world states. A
larger environment with n locations has n ·
2n states

• Initial State
– Any one of 8 states

• Actions
– In this simple environment, each state has just three actions: Left , Right ,Suck.
Larger environments might also include Up , Down
Toy Problem- 1
Vacuum Cleaner World -Problem Formulation

• Transition model: The actions have their expected effects, except that
moving Left in the leftmost square, moving Right in the rightmost square,
and Sucking in a clean square have no effect. The complete state space is
shown in the figure .

• State Space for the Vacuum World


Labels on Arcs denote L: Left, R: Right, S: Suck

• Goal Test
– This checks whether all the squares are clean
• Path Cost
– Number of steps (each step costs a value of 1)
Toy Problem- 2
The 8-Puzzle (Sliding Block Puzzle)

The 8-puzzle, an instance of which is shown below, consists of a


3×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.
Toy Problem- 2
The 8-Puzzle (Sliding Block Puzzle)

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.

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 (Other goal configurations are
possible.)
Toy Problem- 2
The 8-Puzzle (Sliding Block Puzzle) - Solution
• hf= +1 for every correct position
• Solution of this problem is “movement of tiles” in order to
reach goal state.
• The transition function or legal move is any one tile movement
by one space in any direction.
Toy Problem- 2
The 8-Puzzle (Sliding Block Puzzle) - Solution
Toy Problem- 2
The 8-Puzzle (Sliding Block Puzzle) - Solution
Toy Problem- 3
Water – Jug Problem

A Water Jug Problem: You are given two jugs,


a 4-gallon one and a 3-gallon one, a pump
which has unlimited water which you can
use to fill the jug, and the ground on which
water may be poured. Neither jug has any
measuring markings on it. How can you get
exactly 2 gallons of water in the 4-gallon jug?
Toy Problem- 3
Water – Jug Problem
Solution:
The state space for this problem can be described as the set of ordered
pairs of integers (x,y)

Where,

X represents the quantity of water in the 4-gallon jug X= 0,1,2,3,4


Y represents the quantity of water in 3-gallon jug Y=0,1,2,3

Note
0 ≤ X ≤ 4, and 0 ≤ Y ≤ 3

Start State: (0,0)


Goal State: (2, n) for any n. Attempting to end up in a goal
state.( since the problem doesn‘t specify the
quantity of water in 3-gallon jug)
Toy Problem- 3
Water – Jug Problem
Generate production rules for the water jug problem
Production Rules:

1. (x,y) -> (4,y) Fill x


2. (x,y) -> (x,3) Fill y
3. (x,y) -> (x-d, y) Pour water out from X
4. (x,y) -> (x,y-d) Pour water from y
5. (x,y) -> (0,y) Empty x
6. (x,y) -> (x,0) Empty y
7. (x,y) -> (4,y-(4-x)) Pour water from y into x until x is full
8. (x,y) -> (x – (3-y), 3) Pour water from x into y until y is full.
9. (x,y) -> (x+y, 0) Pour all water from y to x
10. (x,y) -> (0, x+y) Pour all water from x to y
11. (0,2) -> (2,0) Pour 2 Gallon of water from y to x
12. (2, y) -> (0,y) Pour 2 Gallon of water from x to ground.
Toy Problem- 3
Water – Jug Problem

First solution
1. (x,y) -> (4,y) Fill x
2. (x,y) -> (x,3) Fill y
3. (x,y) -> (x-d, y) Pour water out from X
4. (x,y) -> (x,y-d) Pour water from y
Initial
5. (x,y) -> (0,y) Empty x
R2 6. (x,y) -> (x,0) Empty y
R9 7. (x,y) -> (4,y-(4-x)) Pour water from y into x until x
R2 is full
8. (x,y) -> (x – (3-y), 3) Pour water from x into y until y
R7
is full.
R5 9. (x,y) -> (x+y, 0) Pour all water from y to x
R9 10. (x,y) -> (0, x+y) Pour all water from x to y
11. (0,2) -> (2,0) Pour 2 Gallon of water from y to x
12. (2, y) -> (0,y) Pour 2 Gallon of water from x to
ground.
Toy Problem- 4(a)
4-queens problem

The N Queen is the problem of placing N chess queens on an N×N chessboard


so that no two queens attack each other.
Given a 4 x 4 chessboard and number the rows and column of the
chessboard 1 through 4.

Since, we have to place 4 queens such as q1 q2 q3 and q4 on the


chessboard, such that no two queens attack each other. In such a
conditional each queen must be placed on a different row, i.e., we put
queen "i" on row "i."
Toy Problem- 4(a)
4-queens problem
One possible solution for the 4-queens problem is (2,4,1,3) i.e ,
Toy Problem- 4(a)
4-queens problem
The implicit tree for 4 - queen problem for a solution (2, 4, 1, 3) is as follows:
Toy Problem- 4(a)
4-queens problem

Another solution for 4 - queens problems is (3, 1, 4, 2) i.e


Toy Problem- 4(b)
8-queens problem
“We have 8 queens and an 8x8 Chess
board having alternate black and white
squares. The queens are placed on the
chessboard.

Any queen can attack any other queen


placed on same row, or column or
diagonal. We have to find the proper
placement of queens on the Chess board in
such a way that no queen attacks other
queen”.
Toy Problem- 4(b)
8-queens problem
possible board configuration of 8 queen
problem

In figure , the possible board configuration for 8-queen problem has been
shown. The board has alternative black and white positions on it. The
different positions on the board hold the queens. The production rule for this
game is you cannot put the same queens in a same row or same column or in
same diagonal. After shifting a single queen from its position on the board,
the user have to shift other queens according to the production rule. Starting
from the first row on the board the queen of their corresponding row and
column are to be moved from their original positions to another position.
Finally the player has to be ensured that no rows or columns or diagonals of
on the table is same.
Toy Problem- 4(b)
8-queens problem
The first incremental formulation one might try is the following:
• States: Any arrangement of 0 to 8 queens on the board is a
state.
• Initial state: No queens on the board.
• Actions/Successor function : Add a queen to any empty
square.
• Transition model: Returns the board with a queen added to the
specified square.
• Goal test: 8 queens are on the board, none attacked.
• Path cost: Zero (search cost only exists)
In this formulation, we have 64 · 63 · · · 57 ≈ 1.8×10 14
possible
sequences to investigate.
Toy Problem- 5
BLOCK WORLD
What is the Blocks World? -- The world consists of:
• A flat surface such as a tabletop
• An adequate set of identical blocks which are
identified by letters.
• The blocks can be stacked one on one to form
towers of apparently unlimited height.
• The stacking is achieved using a robot arm which
has fundamental operations and states which can be
assessed using logic and combined using logical
operations.
• The robot can hold one block at a time and only one
block can be moved at a time.
Toy Problem- 5
Toy Problem- 5
Blocks World Problem – Ex .

hf = -10 hf = +10

Heuristic
Toy Problem- 5
Blocks World Problem – Ex .
Step 1
Toy Problem- 5
Blocks World Problem – Ex .
Step 2
Toy Problem- 5
Blocks World Problem – Ex .
Step 3

hf = -1
Toy Problem- 5
Blocks World Problem – Ex .
Step 4
Toy Problem- 5
Blocks World Problem – Ex .
Step 5

hf = +3
Toy Problem- 5
Blocks World Problem – Ex .
Step 6

hf = +10

Global solution for block world


Toy Problem- 5
BLOCK WORLD - STRIPS
(STanford Research Institute Problem Solver)

• STRIPS - an action-centric
representation ,for each action ,
specifies the effect of an action.
Toy Problem- 5
BLOCK WORLD - STRIPS
(STanford Research Institute Problem Solver)

• STRIPS - an action-centric
representation ,for each action ,
specifies the effect of an action.
The STRIPS representation for an action consists of three lists,
• Pre_Cond list contains predicates which have to be true
before operation.
• ADD list contains those predicates which will be true after
operation
• DELETE list contain those predicates which are no longer true
after operation
Toy Problem- 6
Tic Tac Toe
The game Tic Tac Toe is also known as Noughts and Crosses or Xs
and Os ,the player needs to take turns marking the spaces in a 3x3 grid
with their own marks,
if 3 consecutive marks (Horizontal, Vertical,Diagonal) are formed
then the player who owns these moves get won.

Assume ,
So,a player who gets 3 consecutive
Player 1 - X marks first,they will win the game .
Player 2 - O
Toy Problem- 6
Tic Tac Toe
Toy Problem- 7
Missionaries and Cannibals
Let Missionary is denoted by ‘M’ and Cannibal, by ‘C’.
These rules are described below:

All or some of these production rules will have to be used in a


particular sequence to find the solution of the problem.
Toy Problem- 7
Missionaries and Cannibals
Rules applied and their sequence in Missionaries and Cannibals
problem
Toy Problem- 7
Formalization of the M&C Problem

State space: triple (x,y,z) with 0 ≤ x,y,z ≤ 3, where x,y, and


z represent the number of missionaries, cannibals and
boats currently on the original bank.
Initial State: (3,3,1)
Successor function: From each state, either bring one
missionary, one cannibal, two missionaries, two cannibals,
or one of each type to the other bank.
Note: Not all states are attainable (e.g., (0,0,1)), and
some are illegal.
Goal State: (0,0,0) Path Costs: 1 unit per crossing
Toy Problem- 8
Travelling Salesman Problem(Path Finding Problems)

“Given ‘n’ cities connected by roads, and distances between each


pair of cities. A sales person is required to travel each of the cities
exactly once. We are required to find the route of salesperson so
that by covering minimum distance, he can travel all the cities and
come back to the city from where the journey was started”.

Diagrammatically, it is shown below

Fig : Cities and paths connecting these


Toy Problem- 8
Travelling Salesman Problem(Path Finding Problems)

The basic travelling salesperson problem comprises of computing the


shortest route through a given set of cities.

Following Table shows number of cities and the possible routes


mentioned
against them.
Toy Problem- 9
Monkey Banana Problem

“A monkey is in a room. A bunch of


bananas is hanging from the ceiling. The
monkey cannot reach the bananas
directly. However , in the room there is
one chair and a stick. The monkey can
reach the banana standing on the chair.
We have to find the sequence of events by
which monkey can reach the bananas.”
Toy Problem- 9
Monkey Banana Problem
Solution of this problem means finding the sequence of actions
for the monkey to reach the banana.

Monkey standing on the chair and catching the bananas with the
stick.
Summary of Problem Solving with
AI – Toy Problems

1. Block World
2. 4 Queens/ 8 Queens
3. Tic Tac Toe
4. Water Jug
5. Monkey Banana
6. 8 Puzzle
7. TSP
8. Vacuum Cleaner
9. Missionaries and Cannibals
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Intelligent Agents
• An agent is anything that can be viewed as
perceiving its environment through sensors and
acting upon that environment through actuators

• Human agent: eyes, ears, and other organs for


sensors;
• hands,legs, mouth, and other body parts for
actuators
• Robotic agent: cameras and infrared range finders
for sensors;
• various motors for actuators
Agents and Environment

• The agent function maps from percept


histories to actions:
[f: P* A]
• The agent program runs on the physical
architecture to produce f
• agent = architecture + program
Diagram of an Agent

What AI
should fill
Simple Terms

Percept
● Agent’s perceptual inputs at any given
instant
Percept sequence
● Complete history of everything that the
agent has ever perceived.
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Rationality

• Rationality is nothing but 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.
What is Ideal Rational Agent?

• An ideal rational agent is the one, which is capable of doing expected actions to
maximize its performance measure, on the basis of −
• Its percept sequence
• Its built-in knowledge base
• Rationality of an agent depends on the following −
• The performance measures, which determine the degree of success.
• Agent’s Percept Sequence till now.
• The agent’s prior knowledge about the environment.
• The actions that the agent can carry out.
• 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 Performance Measure,
Environment, Actuators, and Sensors (PEAS).
Rational Agents

• Rational Agent: one that does the right thing


• Criteria: Performance measure
• Performance measures for
– Web search engine?
– Tic-tac-toe player? Chess player?
• How does when performance is measured play a
role?
– short vs. long term
Rational Agents

• Omniscient agent
– Knows the actual outcome of its actions
– What information would a chess player need to
have to be omniscient?
• Omniscience is (generally) impossible
– A rational agent should do the right thing based
on the knowledge it has.
Rational Agents

• What is rational depends on four things:


– Performance measure
– Percept sequence: everything agent has seen so far
– Knowledge agent has about environment
– Actions agent is capable of performing
• Ideal Rational Agent
– Does whatever action is expected to maximize its
performance measure, based on percept sequence and
built-in knowledge
The Mapping Table

• In most cases, mapping is explosively too


large to write down explicitly
• In some cases, mapping can be defined via a
specification
– Example: agent to sort a list of numbers
– Sample table for such an agent
Autonomy

• “Independence”
• A system is autonomous if its behavior is
determined by its own experience
– An alarm that goes off at a prespecified time is
not autonomous
– An alarm that goes off when smoke is sensed is
autonomous
• A system without autonomy lacks flexibility
Structure of Intelligent Agents

• AI designes the agent program


• The program runs on some kind of
architecture
• To design an agent program, need to
understand
– Percepts
– Actions
– Goals
– Environment
Unit 1 List of Topics
• Introduction to AI-AI techniques
• Problem solving with AI • Types of agents
• Other aspects of agents
• AI Models, Data acquisition and
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-


• Problem space and search constrains and representation
• CSP-Backtracking, Role of
• Intelligent agent heuristic
• Rationality and Rational agent with
performance measures • CSP-Forward checking and
constraint propagation
• Flexibility and Intelligent agents • CSP-Intelligent backtracking
• Task environment and its properties
Performance Measuring

With any intelligent agent, we want it to find a


(good) solution and not spend forever doing it.
The interesting quantities are, therefore,
• the search cost--how long the agent takes to come
up with the solution to the problem, and
• the path cost--how expensive the actions in the
solution are.
The total cost of the solution is the sum of the
above two quantities.
Performance Measures

STATES,
● TSP - Naive Solution revisited:
OPERATORS,
GOAL TEST &
1) Consider city 1 as the starting and
PATH COST ending point.
2) Generate all (n-1)! Permutations
of cities.
3) Calculate cost of every permutation
and keep track of minimum cost
permutation.

4) Return the permutation


with minimum
cost.
● Solution is complete, optimal, time
and space complexity = n!
Measuring problem-solving performance

● Completeness: Is the algorithm


guaranteed to find a solution when there
is one?
● Optimality: Does the strategyfind
the optimal solution (i.e., lowest path
cost among all solutions)
● Time complexity: How long does it take to
find a solution?
● Space complexity: How much
memory is needed to perform the
search?
Real-world Problems

Example of rational action performed by any intelligent


agent:
Automated Taxi Driver:
Performance Measure: Safe, fast, legal, comfortable
trip, maximize profits.
Environment: Roads, other traffic, customers.
Actuators: Steering wheel, accelerator, brake, signal,
horn.
Sensors: Cameras, sonar, speedometer, GPS,
odometer, engine sensors, keyboard.
Concept of Rationality

• Rational agent
● One that does the right thing
● = every entry in the table for the agent
function is correct (rational).
• What is correct?
● The actions that cause the agent to be most
successful
● So we need ways to measure success.
Performance measure

• Performance measure
● An objective function that determines
● How the agent does successfully
● E.g., 90% or 30% ?
• An agent, based on its percepts
● action sequence :
if desirable, it is said to be performing well.
● No universal performance measure for all
agents
Performance measure

• A general rule:
● Design performance measures according to
● What one actually wants in the environment
● Rather than how one thinks the agent should
behave
• E.g., in vacuum-cleaner world
● We want the floor clean, no matter how the
agent behave
● We don’t restrict how the agent behaves
Rational agent

• For each possible percept sequence,


● an rational agent should select
● an action expected to maximize its performance
measure, given the evidence provided by the percept
sequence and whatever built-in knowledge the agent
has
• E.g., an exam
● Maximize marks, based on
the questions on the paper & your knowledge
Example of a rational agent

• Performance measure
● Awards one point for each clean square
● at each time step, over 10000 time steps
• Prior knowledge about the environment
● The geography of the environment
● Only two squares
● The effect of the actions
Example of a rational agent

• Actions that can perform


● Left, Right, Suck and NoOp
• Percept sequences
● Where is the agent?
● Whether the location contains dirt?

• Under this circumstance, the agent is


rational.
Omniscience

• An omniscient agent
● Knows the actual outcome of its actions in
advance
● No other possible outcomes
● However, impossible in real world
• An example
● crossing a street but died of the fallen
cargo door from 33,000ft irrational?
Omniscience

• Based on the circumstance, it is rational.


• As rationality maximizes
● Expected performance
• Perfection maximizes
● Actual performance
• Hence rational agents are not omniscient.
Learning

• Does a rational agent depend on only


current percept?
● No, the past percept sequence should also be
used
● This is called learning
● After experiencing an episode, the agent
● should adjust its behaviors to perform better for
the same job next time.
Autonomy

• If an agent just relies on the prior knowledge of its


designer rather than its own percepts then the
agent lacks autonomy
A rational agent should be autonomous- it should
learn what it can to compensate for partial or
incorrect prior knowledge.
• E.g., a clock
● No input (percepts)
● Run only but its own algorithm (prior knowledge)
● No learning, no experience, etc.
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Intelligent Agents

• What is an agent ?
● An agent is anything that perceiving its
environment through sensors and acting upon
that environment through actuators
● Example:
● Human is an agent
● A robot is also an agent with cameras and motors
● A thermostat detecting room temperature.
Intelligent Agents
Diagram of an agent

What AI should
fill
Simple Terms

• Percept
● Agent’s perceptual inputs at any given instant
• Percept sequence
● Complete history of everything that the agent has ever
perceived.
Flexibility : Autonomy means “Independence”.
A system is autonomous if its behavior is determined by its
own experience.
A system without autonomy lacks flexibility.
Ex: An alarm that goes on when smoke is sensed is
autonomous.
Agent function & program

• Agent’s behavior is mathematically


described by
● Agent function
● A function mapping any given percept
sequence to an action
• Practically it is described by
● An agent program
● The real implementation
Vacuum-cleaner world

• Perception: Clean or Dirty? where it is in?


• Actions: Move left, Move right, suck, do
nothing
Program – Agent Function

Function Reflex-Vacuum-Agent([location,status]) return an


action
If status = Dirty then return Suck
else if location = A then return Right
else if location = B then return left
Software Agents

• Sometimes, the environment may not be the


real world
● E.g., flight simulator, video games, Internet
● They are all artificial but very complex
environments
● Those agents working in these
environments are called
● Software agent (softbots)
● Because all parts of the agent are software
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Task environments

• Task environments are the problems


● While the rational agents are the solutions
• Specifying the task environment
● PEAS description as fully as possible
● Performance
● Environment

● Actuators

● Sensors

In designing an agent, the first step must always be to specify


the task environment as fully as possible.
• Use automated taxi driver as an example
Task environments

• Performance measure
● How can we judge the automated driver?
● Which factors are considered?
● getting to the correct destination
● minimizing fuel consumption
● minimizing the trip time and/or cost
● minimizing the violations of traffic laws
● maximizing the safety and comfort, etc.
Task environments

• Environment
● A taxi must deal with a variety of roads
● Traffic lights, other vehicles, pedestrians,
stray animals, road works, police cars, etc.
● Interact with the customer
Task environments

• Actuators (for outputs)


● Control over the accelerator, steering, gear
shifting and braking
● A display to communicate with the
customers
• Sensors (for inputs)
● Detect other vehicles, road situations
● GPS (Global Positioning System) to know
where the taxi is
● Many more devices are necessary
Task environments

• A sketch of automated taxi driver


Properties of task environments

• Fully observable vs. Partially observable


● If an agent’s sensors give it access to the
complete state of the environment at each point
in time then the environment is effectively and
fully observable
● if the sensors detect all aspects
● That are relevant to the choice of action
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.
Example:
● A local dirt sensor of the cleaner cannot tell
● Whether other squares are clean or not
Properties of task environments

• Deterministic vs. stochastic


● next state of the environment Completely
determined by the current state and the actions
executed by the agent, then the environment is
deterministic, otherwise, it is Stochastic.
● Strategic environment: deterministic except for
actions of other agents
-Cleaner and taxi driver are:
● Stochastic because of some unobservable aspects noise or
unknown
Properties of task environments

• Episodic vs. sequential


● An episode = agent’s single pair of perception & action
● The quality of the agent’s action does not depend on
other episodes
● Every episode is independent of each other
● Episodic environment is simpler
● The agent does not need to think ahead
• Sequential
● Current action may affect all future decisions
-Ex. Taxi driving and chess.
Properties of task environments

• Static vs. dynamic


● A dynamic environment is always
changing over time
● E.g., the number of people in the street
● While static environment
● E.g., the destination
• Semidynamic
● environment is not changed over time
● but the agent’s performance score does
Properties of task environments

• Discrete vs. continuous


● If there are a limited number of distinct
states, clearly defined percepts and actions,
the environment is discrete
● E.g., Chess game
● Continuous: Taxi driving
Properties of task environments

• Single agent VS. multiagent


● Playing a crossword puzzle – single agent
● Chess playing – two agents
● Competitive multiagent environment
● Chess playing
● Cooperative multiagent environment
● Automated taxi driver
● Avoiding collision
Properties of task environments

• Known vs. unknown


This distinction refers not to the environment itslef but to
the agent’s (or designer’s) state of knowledge about the
environment.
-In known environment, the outcomes for all actions are
given. ( example: solitaire card games).
- If the environment is unknown, the agent will have to learn
how it works in order to make good decisions.( example:
new video game).
Examples of task environments
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Structure of agents

• Agent = architecture + program


● Architecture = some sort of computing device
(sensors + actuators)
● (Agent) Program = some function that
implements the agent mapping = “?”
● Agent Program = Job of AI
Agent programs

• Input for Agent Program


● Only the current percept
• Input for Agent Function
● The entire percept sequence
● The agent must remember all of them
• Implement the agent program as
● A look up table (agent function)
Agent programs

• Skeleton design of an agent program


Types of agent programs

• Four types
● Simple reflex agents
● Model-based reflex agents
● Goal-based agents
● Utility-based agents
Simple reflex agents

• It uses just condition-action rules


● The rules are like the form “if … then …”
● efficient but have narrow range of applicability
● Because knowledge sometimes cannot be stated
explicitly
● Work only
● if the environment is fully observable
Simple reflex agents
Simple reflex agents
A Simple Reflex Agent in Nature

percepts
(size,
motion)

RULES:
(1) If small moving object,
then activate SNAP
(2) If large moving object,
then activate AVOID and inhibit
SNAP
needed for
ELSE (not moving) then NOOP
completeness Action: SNAP or AVOID or
Model-based Reflex Agents

• For the world that is partially observable


● the agent has to keep track of an internal state
● That depends on the percept history
● Reflecting some of the unobserved aspects
● E.g., driving a car and changing lane
• Requiring two types of knowledge
● How the world evolves independently of the agent
● How the agent’s actions affect the world
Example Table Agent
With Internal State

IF THEN
Saw an object ahead, Go straight
and turned right, and
it’s now clear ahead
Saw an object Ahead, Halt
turned right, and object
ahead again
See no objects ahead Go straight

See an object ahead Turn randomly


Example Reflex Agent With Internal State:

Wall-Following

star
t
Actions: left, right, straight, open-door
Rules:
1. If open(left) & open(right) and open(straight) then
choose randomly between right and left
2. If wall(left) and open(right) and open(straight) then straight
3. If wall(right) and open(left) and open(straight) then straight
4. If wall(right) and open(left) and wall(straight) then left
5. If wall(left) and open(right) and wall(straight) then right
6. If wall(left) and door(right) and wall(straight) then open-door
7. If wall(right) and wall(left) and open(straight) then straight.
8. (Default) Move randomly
Model-based Reflex Agents

The agent is with


memory
Model-based Reflex Agents
Goal-based agents

• Current state of the environment is always


not enough
• The goal is another issue to achieve
● Judgment of rationality / correctness
• Actions chosen goals, based on
● the current state
● the current percept
Goal-based agents

• Conclusion
● Goal-based agents are less efficient
● but more flexible
● Agent Different goals different tasks
● Search and planning
● two other sub-fields in AI
● to find out the action sequences to achieve its goal
Goal-based agents
Utility-based agents

• Goals alone are not enough


● to generate high-quality behavior
● E.g. meals in Canteen, good or not ?
• Many action sequences the goals
● some are better and some worse
● If goal means success,
● then utility means the degree of success (how
successful it is)
Utility-based agents(4)
Utility-based agents

• it is said state A has higher utility


● If state A is more preferred than others
• Utility is therefore a function
● that maps a state onto a real number
● the degree of success
Utility-based agents (3)

• Utility has several advantages:


● When there are conflicting goals,
● Only some of the goals but not all can be
achieved
● utility describes the appropriate trade-off
● When there are several goals
● None of them are achieved certainly
● utility provides a way for the decision-making
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Learning Agents

• After an agent is programmed, can it work


immediately?
● No, it still need teaching
• In AI,
● Once an agent is done
● We teach it by giving it a set of examples
● Test it by using another set of examples
• We then say the agent learns
● A learning agent
Learning Agents

• Four conceptual components


● Learning element
● Making improvement
● Performance element
● Selecting external actions
● Critic
● Tells the Learning element how well the agent is doing with
respect to fixed performance standard.
(Feedback from user or examples, good or not?)
● Problem generator
● Suggest actions that will lead to new and informative
experiences.
Learning Agents
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constraints


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Constraint Satisfaction Problem

► Search Space is constrained by a set of conditions and dependencies


► Class of problems where the search space is constrained called as CSP
► For example, Time-table scheduling problem for lecturers.
► Constraint,
► Two Lecturers can not be assigned to same class at the same time
► To solve CSP, the problem is to be decomposed and analyse the
structure
► Constraints are typically mathematical or logical relationships
Solving Constraint Satisfaction Problem
CSP
► Any problem in the world can be mathematically represented as
CSP
► Hypothetical problem does not have constraints
► Constraint restricts movement, arrangement, possibilities and
solutions
► Example: if only concurrency notes of 2,5,10 rupees are available
and we need to give certain amount of money, say Rs. 111 to a
salesman and the total number of notes should be between 40 and
50.
► Expressed as, Let n be number of notes,
• 40 < n < 50
• and
• c1 X 1 + c2 X 2 + c3 X 3 = 111
CSP

► Types of Constraints
► Unary Constraints - Single variable
► Binary Constraints - Two Variables
► Higher Order Constraints - More than two variables
► CSP can be represented as Search Problem
► Initial state is empty assignment, while successor function is a non-
conflicting value assigned to an unassigned variables
► Goal test checks whether the current assignment is complete and path
cost is the cost for the path to reach the goal state
► CSP Solutions leads to the final and complete assignment with no
exception
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Cryptarithmetic puzzles
► Cryptarithmetic puzzles are also represented as CSP
► Example: MIKE + JACK = JOHN
► Replace every letter in puzzle with single number (number
should not be repeated for two different alphabets)
► The domain is { 0,1, ... , 9 }

► Often treated as the ten-variable constraint problem where the


constraints are:
► All the variables should have a different value
► The sum must work out
Cryptarithmetic puzzles
► M * 1000 + I * 100 + K * 10 + E + J * 1000 + A * 100 + C * 10 + K = J
* 1000 + O * 100 + H * 10 + N
► Constraint Domain is represented by Five-tuple and represented by,
• D = {var, f , O, dv, rg}
► Var stands for set variables, f is set functions, O stands for the set of
legitimate operators to be used, dv is domain variable and rg is
range of function in the constraint
► Constraint without conjunction is referred as Primitive constraint (for
Eg., x < 9 )
► Constraint with conjunction is called as non-primitive constraint or a
generic constraint (For Eg., x < 9 and x > 2)
Crypt arithmetic puzzles
– Solved Example
TO
GO Var Value
--- T 2
OUT O 1
G 8
------
U 0
21
81 G = 8/9
---
102
------ 2 + G = U + 10
Cryptarithmetic puzzles
• SEND + MORE = MONEY
c4 c3 c2 c1
S E N D
M O R E
------------------------
MO N E Y
9567
1 085
----------
1 0 8 52
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
CSP- Room Coloring Problem
-CSP as a Search Problem

► Let K for Kitchen, D for Dining Room, H is for Hall, B 2 and B 3 are
bedrooms 2 and 3, MB1 is master bedroom, SR is the store Room, GR is
Guest Room and Lib is Library
► Constraints
► All bedrooms should not be colored red, only one can
► No two adjacent rooms can have the same color
► The colors available are red, blue, green and violet
► Kitchen should not be colored green
► Recommended to color the kitchen as blue
► Dining room should not have violet color
Room Coloring Problem – Representation as a
Search Tree

► Soft Constraints are that they are cost-oriented or


preferred choice
► All paths in the Search tree can not be accepted because
of the violation in constraints
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Backtracking Search for CSP
► Assignment of value to any additional variable within constraint can
generate a legal state (Leads to successor state in search tree)
► Nodes in a branch backtracks when there is no options are available
Example: Map-Coloring

• Variables WA, NT, Q, NSW, V, SA, T


• Domains Di = {red,green,blue}
• Constraints: adjacent regions must have different colors
e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red),
(green,blue),(blue,red),(blue,green)}
Backtracking example

218
Backtracking example

219
Backtracking example

220
Algorithm for Backtracking
Pick initial state
R = set of all possible states
Select state with var assignment
Add to search space
check for con
If Satisfied
Continue
Else
Go to last Decision Point (DP)
Prune the search sub-space from DP
Continue with next decision option
If state = Goal State
Return Solution
Else
Continue
CSP-Backtracking, Role of heuristic

► Backtracking allows to go to the previous decision-making node to


eliminate the invalid search space with respect to constraints
► Heuristics plays a very important role here
► If we are in position to determine which variables should be assigned
next, then backtracking can be improved
► Heuristics help in deciding the initial state as well as subsequent
selected states
► Selection of a variable with minimum number of possible values can
help in simplifying the search
► This is called as Minimum Remaining Values Heuristic (MRV) or Most
Constraint Variable Heuristic
► Restricts the most search which ends up in same variable (which would
make the backtracking ineffective)
Heuristic
► MRV cannot have hold on initial selection process
► Node with maximum constraint is selected over other
unassigned variables - Degree Heuristics
► By degree heuristics, branching factor can not be reduced
► Selection of variables are considered not the values for it,
so the order in which the values of particular variable
can be arranged is tackled by least constraining value
heuristic
Heuristic – Most Constraining Variable
Heuristic- Minimum Remaining Values
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Forward Checking
► To understand the forward checking, we shall see 4 Queens problem
► If an arrangement on the board of a queen x , hampers the position
of queensx +1, then this forward check ensures that the queen x
should not be placed at the selected position and a new position is
to be looked upon
Forward Checking
► Q1 and Q2 are placed in row 1 nad 2 in the left sub-tree, so, search
is halted, since No positions are left for Q3 and Q4
► Forward Checking keeps track of the next moves that are available
for the unassigned variables
► The search will be terminated when there is no legal move available
for the unassigned variables
CSP- Room Coloring Problem
-CSP as a Search Problem

► Let K for Kitchen, D for Dining Room, H is for Hall, B 2 and B 3 are
bedrooms 2 and 3, MB1 is master bedroom, SR is the store Room, GR is
Guest Room and Lib is Library
► Constraints
► All bedrooms should not be colored red, only one can
► No two adjacent rooms can have the same color
► The colors available are red, blue, green and violet
► Kitchen should not be colored green
► Recommended to color the kitchen as blue
► Dining room should not have violet color
Forward Checking – Room Coloring
Problem

► For Room Coloring problem, Considering all the


constraints the mapping can be done in following ways;
► At first, B 2 is selected with Red (R). Accordingly, R is deleted from the
adjacent nodes
► Kitchen is assigned with Blue (B). So, B is deleted form the adjacent
Nodes
► Furthermore, as MB1 is selected green, no color is left for D.
Constraint Propagation
► There is no early detection of any termination / failure
that would possible occur even though the information
regarding the decision is propagated
► Constraint should be propagated rather than the
information
Constraint Propagation
► Step 2 shows the consistency propagated from
D to B2
► Since D is can have only G value and B2 being
adjacent to it, the arc is drawn
► It is mapped as D → B2 or Mathematically,
• A → B is consistent ↔ ∀ legal value a ∈ A, ∃
•non-conflicting value b ∈ B
► Failure detection can take place at early stage
Algorithm for Arc Assignment
► Algorithm for arc assignment is:
► Let C be the variable which is being assigned at a given instance
► X will have some value from D{} where D is domain
► For each and every assigned variable, that is adjacent to X, Say X j
• 1Perform forward check (remove values from domain D that conflict the
decision of the current assignment)
• 2For every other variable X jj that are adjacent or connected to
• Xj ;
• iRemove the values from D from X jj that can’t be taken as further
unassigned variables
• iiRepeat step 2, till no more values can be removed or discarded
► Inconsistency is considered and constraints are propagated in Step (2)
Forward checking

• Idea:
– Keep track of remaining legal values for unassigned variables
– Terminate search when any variable has no legal values

234
WA RGB

NT GB

SA B

Q R

NSW G

Y R

T RGB
Forward checking

• Idea:
– Keep track of remaining legal values for unassigned variables
– Terminate search when any variable has no legal values

236
Forward checking

• Idea:
– Keep track of remaining legal values for unassigned variables
– Terminate search when any variable has no legal values

237
Forward checking

• Idea:
– Keep track of remaining legal values for unassigned variables
– Terminate search when any variable has no legal values

238
Constraint propagation

• Forward checking propagates information from assigned to


unassigned variables, but doesn't provide early detection for
all failures:

• NT and SA cannot both be blue!


• Constraint propagation repeatedly enforces constraints
locally

239
Arc consistency

• Simplest form of propagation makes each arc consistent


• X Y is consistent iff
for every value x of X there is some allowed y

constraint propagation propagates arc consistency on the graph.

240
Arc consistency

• Simplest form of propagation makes each arc consistent


• X Y is consistent iff
for every value x of X there is some allowed y

241
Arc consistency

• Simplest form of propagation makes each arc consistent


• X Y is consistent iff
for every value x of X there is some allowed y

• If X loses a value, neighbors of X need to be rechecked

242
Arc consistency

• Simplest form of propagation makes each arc consistent


• X Y is consistent iff
for every value x of X there is some allowed y

• If X loses a value, neighbors of X need to be rechecked


• Arc consistency detects failure earlier than forward checking
• Can be run as a preprocessor or after each assignment
■ Time complexity: O(n2d3) 243
Arc Consistency
Unit 1 List of Topics
• Flexibility and Intelligent agents
• Introduction to AI-AI techniques • Task environment and its
properties
• Problem solving with AI
• Types of agents
• AI Models, Data acquisition and • Other aspects of agents
learning aspects in AI
• Problem solving- Problem solving • Constraint satisfaction
process, Formulating problems problems(CSP)
• Crypto arithmetic puzzles

• Problem types and characteristics • CSP as a search problem-constrains


• Problem space and search and representation
• CSP-Backtracking, Role of heuristic
• Intelligent agent
• CSP-Forward checking and
• Rationality and Rational agent constraint propagation
with performance measures • CSP-Intelligent backtracking
Intelligent Backtracking
► Conflict set is maintained using forward checking and
maintained
► Considering the 4 Queens problem, Conflict needs to be
detected by the user of conflict set so that a backtrack
can occur
► Backtracking with respect to the conflict set is called as
conflict-directed back jumping
► Back jumping approach can’t actually restrict the earlier
committed mistakes in some other branches
Intelligent Backtracking
► Chronological backtracking: The BACKGRACKING-SEARCH in
which, when a branch of the search fails, back up to the
preceding variable and try a different value for it. (The most
recent decision point is revisited).
• e.g: Suppose we have generated the partial assignment {Q=red,
NSW=green, V=blue, T=red}.
• When we try the next variable SA, we see every value violates
a constraint.
• We back up to T and try a new color, it cannot resolve the
problem.
► Intelligent backtracking: Backtrack to a variable that was responsible for making
one of the possible values of the next variable (e.g. SA) impossible.
Conflict set for a variable: A set of assignments that are in conflict with some value
for that variable.
(e.g. The set {Q=red, NSW=green, V=blue} is the conflict set for SA.)
Backjumping method: Backtracks to the most recent assignment in the conflict set.
(e.g. backjumping would jump over T and try a new value for V.)
END
UNIT-1

You might also like