18csc305j Ai Unit1
18csc305j Ai Unit1
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.
HUMAN RATIONAL
Systems that act like humans:
Turing Test
?
• You enter a room which has a computer
terminal. You have a fixed period of time to
type what you want into the terminal, and
study the replies. At the other end of the line is
either a human being or a computer system.
• If it is a computer system, and at the end of the
period you cannot reliably determine whether
it is a system or a human, then the system is
deemed to be intelligent.
Systems that act like humans
HUMAN RATIONAL
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 ?
HUMAN RATIONAL
Systems that think ‘rationally’
"laws of thought"
HUMAN RATIONAL
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
• 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 Foundation of AI
• Psychology
– How do humans think and act?
– The study of human reasoning and acting
– Provides reasoning models for AI
– Strengthen the ideas
• humans and other animals can be considered as
information processing machines
The Foundation of AI
• Computer Engineering
– How to build an efficient computer?
– Provides the artifact that makes AI application
possible
– The power of computer makes computation of
large and difficult problems more easily
– AI has also contributed its own work to computer
science, including: time-sharing, the linked list
data type, OOP, etc.
The Foundation of AI
• Linguistics
– For understanding natural languages
• different approaches has been adopted from the
linguistic work
– Formal languages
– Syntactic and semantic analysis
– Knowledge representation
The main topics in AI
– 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:
• Heuristic Search
• Computer Vision
• Adversarial Search (Games)
• Fuzzy Logic
• Natural Language Processing
• Knowledge Representation
• Planning
• Learning
Examples
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 should be represented in such a way that it can be understood by the people who must prepare it. For
many programs, the size of the data can be achieved automatically by taking a reading from a number of
instruments, but in many AI areas, most of the knowledge a program has must be provided by people in
terms that they understand it.
• It could easily be adjusted to correct errors end to demonstrate changes in the world.
• It can be used to overcome its own through volume by helping to restrict the range of possibilities that
must usually be considered or discussed.
• It could be used in different situations even though it may not entirely be complete.
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.
AI Techniques
• 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
Structed Problem
Well structed – Yield a right answer
Ill structed – Do not yield a particular answer
Unstructed 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
50
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
learning aspects in AI • Constraint satisfaction
• Problem solving- Problem solving problems(CSP)
process, Formulating problems • Crypto arithmetic puzzles
52
AI Models
53
AI Models
• Semiotic Models
- Based on Sign processes / signification and communication.
- Code is specific which gives meaning to each sign based on the sound or letters
that human use to form words or movements.
• Statistical Models
- Refers to representation and formulation of relationships through statistical
techniques.
- Statistical model employs probabilistic approaches and is typically a collection of
probability density function and distribution functions.
54
Unit 1 List of Topics
• Introduction to AI-AI techniques
• 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
• Problem space and search
• CSP as a search problem-
constrains and representation
• Intelligent agent
• CSP-Backtracking, Role of
• Rationality and Rational agent with
performance measures
heuristic
• 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)
• 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
68
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
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
Initial state:
monkey on ground
with empty hand
bananas suspended
Goal state:
monkey eating
Actions:
climb chair/get off
grab X
wave X
eat X
• • 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
87
Toy Problem- 1
Vacuum Cleaner World -Problem Formulation
• 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 .
• 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)
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.)
Path cost: Each step costs 1, so the path cost is the number of steps
in the path.
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
Where,
Note
0 ≤ X ≤ 4, and 0 ≤ Y ≤ 3
Start State:(2,(0,0)
n) for any n. Attempting to end up in a goal state.
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:
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
Initial 4. (x,y) -> (x,y-d) Pour water from y
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
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)
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
Assume ,
So,a player who gets 3
Player 1 - X consecutive marks first,they will
Player 2 - O win the game .
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:
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
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
• 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
• Problem space and search
• CSP as a search problem-
constrains and representation
• Intelligent agent
• CSP-Backtracking, Role of
• Rationality and Rational agent with
performance measures
heuristic
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
• 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
• Problem space and search
• CSP as a search problem-
constrains and representation
• Intelligent agent
• CSP-Backtracking, Role of
• Rationality and Rational agent with
performance measures
heuristic
• 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
• 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
• “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
Problem formulation(Actions):
Move Left, Move Right, Suck, NoOp(do
nothing)
Vacuum-cleaner world
STATES,
● TSP - Naive Solution revisited:
OPERATORS,
GOAL TEST &
1)Consider city 1 as the starting and ending
PATH COST point.
2) Generate all (n-1)! Permutations of cities.