0% found this document useful (0 votes)
20 views53 pages

Introduction to Artificial Intelligence

Science projects

Uploaded by

manishmk55021212
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)
20 views53 pages

Introduction to Artificial Intelligence

Science projects

Uploaded by

manishmk55021212
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

ARTIFICIAL INTELLIGECE

Course Organization

• Books
a) Artificial Intelligence
Author Name: Elaine Rich and Kevin Knight
b) Artificial Intelligence – A Modern Approach
Author Name: Stuart Russell and Peter Norvig
c) Introduction to Artificial Intelligence & Expert Systems
Author Name: Dan W. Patterson

• Lab Practical:
AI Language to be learned: PROLOG (PROgramming LOGic)
Books:
a) Introduction to Turbo Prolog
Author Name: Carl Townsend
INTRODUCTION TO ARTIFICIAL INTELLIGENCE
Intelligence

• Intelligent:
having or showing intelligence
Examples: speech recognition, face detection, smell identification,
decision making, learning new things.

• Intelligence:
The capability of learning, understanding, reasoning and
learning from mistakes.
Types of Intelligence

Types of Intelligence:

• Natural Intelligence:
Capacity of the mind to understand principles, truths, facts or meanings,
acquire knowledge, and apply it to practice using the ability to learn and
comprehend.
• Artificial Intelligence or Machine Intelligence:
Study of how to make computers do things which at the moment people do
better.
Objectives of AI

• To understand and model the workings of


natural intelligence and human beings

• Implement them to create intelligent systems


with machine intelligence

• Examples:
□ Robots – completely artificial
□ Cyborgs – organisms that combin e natural and
artificial intelligence as well as physical components,
e.g. a cyborg may have half a human brain combined
with an artificial brain
What is Artificial Intelligence ?

• making computer programs that appear to think?


• the automation of activities we associate with human thinking,
like decision making, learning ... ?

• the art of creating machines that perform functions that


require intelligence when performed by people ?
What is Artificial Intelligence ?

• the study of computations that make it possible to perceive,


reason and act ?

• a branch of computer science that is concerned with the


automation of intelligent behavior?

• anything in Computing Science that we don't yet know how to


do ? (!)
What is Artificial Intelligence ?

THOUGHT Systems that think Systems that think


like humans rationally

Systems that act Systems that act


BEHAVIOR like humans rationally

HUMAN RATIONAL
(able to think and make
decisions based on reasons)
Thinking Humanly: Cognitive Modelling

• Cognitive Science: Interdisciplinary field (AI, psychology,


linguistics, philosophy, anthropology) that tries to form
computational theories of human cognition.
• Cognitive Science approach
– Try to get “ inside” our minds
• Cognitive science brings together theories and experimental
evidence to model internal activities of the brain.
Thinking Rationally: Laws of Thought

• Rational - defined in terms of logic


• Represent facts about the world via logic
• Logic can’ t express everything (e.g. uncertainty)
Right thinking:- unquestionable reasoning processes
Syllogism:- form of reasoning in which a conclusion is
drawn from two statements.
Example:
Ram is a man

Ram must die

All men must die


Acting humanly: Turing Test

• Designed by Alan Turing (1950)


• It’ s a behavioral test (to check if a system acts like a human)
• The Turing Test: a computer is programmed well enough to
have a conversation with an interrogator (for example through a
computer terminal) and passes the test if the interrogator
cannot distinguish, if there is a computer or a human at the other
end.
Turing Test

For passing Turing Test, the computer would need


□ Natural Language
□ Knowledge Representation
□ Complex Reasoning
□ Machine Learning
Foundations of AI

• Philosophy
• Mathematics
• Psychology
• Computer Engineering
• Control theory and Cybernetics
• Linguistics
• Neuroscience
Foundations of AI (Contd.)

• 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

• Mathematics
• Mathematics formalizes the three main area of AI: , ,
and
• Computation leads to analysis of the problems that can be computed
• Probability contributes the to handle in AI
• combines and (bias)
Foundations of AI (Contd.)

• 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

• 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.
Foundations of AI (Contd.)

• Control theory and Cybernetics


– How can artifacts operate under their own control?
– The artifacts adjust their actions
• To do better for the environment over time
• Based on an objective function and feedback from the environment
– Not limited only to linear systems but also other problems
• as language, vision, and planning, etc.

• Linguistics
– For understanding natural languages
• different approaches has been adopted from the linguistic work
– Formal languages
– Syntactic and semantic analysis
– Knowledge representation
Foundations of AI (Contd.)

• Neuroscience
– To design AI systems, that emulates human intelligence,
– And to build neural networks that mimic brain structure.
History

• 1950: Alan Turing introduced Turing Test for evaluation of


intelligence and published
Claude Shannon published
as a search.

• 1956: John McCarthy coined the term .


Demonstration of the first running AI program at Carnegie
Mellon University.

• 1958: John McCarthy invents LISP programming language for


AI.

• 1964: Danny Bobrow's dissertation at MIT showed that


computers can understand natural language well enough to
solve algebra word problems correctly.
History (Contd.)

• 1965: Joseph Weizenbaum at MIT built , an interactive


problem that carries on a dialogue in English.

• 1969: Scientists at Stanford Research Institute


Developed , a robot, equipped with locomotion,
perception, and problem solving.

• 1973: The Assembly Robotics group at Edinburgh University


built , the Famous Scottish Robot, capable of using
vision to locate and assemble models.

• 1979: The first computer-controlled autonomous vehicle,


Stanford Cart, was built.
History (Contd.)

• 1985Harold Cohen created and demonstrated the drawing


program, .

• 1990Major advances in all areas of AI −


– Significant demonstrations in machine learning
– Case-based reasoning
– Multi-agent planning
– Scheduling
– Data mining, Web Crawler
– natural language understanding and translation
– Vision, Virtual Reality
– Games
History (Contd.)

• 1997: The Deep Blue Chess Program beats the then world
chess champion, Garry Kasparov.

• 2000: Interactive robot pets become commercially available.


MIT displays , a robot with a face that expresses
emotions. The robot explores remote regions of
Antarctica and locates meteorites.
Applications of AI

AI has been dominant in various fields such as −


• Gaming − AI plays crucial role in strategic games such as
chess, poker, tic-tac-toe, etc., where machine can think of large
number of possible positions based on heuristic knowledge.
• Natural Language Processing − It is possible to interact with
the computer that understands natural language spoken by
humans.
• Expert Systems − There are some applications which
integrate machine, software, and special information to impart
reasoning and advising. They provide explanation and advice
to the users.
Applications of AI (Contd.)

• Vision Systems − These systems understand, interpret, and


comprehend visual input on the computer. For example,
– A spying aeroplane takes photographs, which are used to figure out
spatial information or map of the areas.
– Doctors use clinical expert system to diagnose the patient.
– Police use computer software that can recognize the face of criminal
with the stored portrait made by forensic artist.
• Speech Recognition − Some intelligent systems are capable
of hearing and comprehending the language in terms of
sentences and their meanings while a human talks to it. It can
handle different accents, slang words, noise in the background,
change in human’ s noise due to cold, etc.
Applications of AI (Contd.)

• Handwriting Recognition − The handwriting recognition


software reads the text written on paper by a pen or on screen
by a stylus. It can recognize the shapes of the letters and
convert it into editable text.
• Intelligent Robots − Robots are able to perform the tasks
given by a human. They have sensors to detect physical data
from the real world such as light, heat, temperature, movement,
sound, bump, and pressure. They have efficient processors,
multiple sensors and huge memory, to exhibit intelligence. In
addition, they are capable of learning from their mistakes and
they can adapt to the new environment.
Things to remember in AI

■ What are our underlying assumptions about intelligence?


■ What kinds of techniques will be useful for solving AI
problems?

■ At what level of detail, if at all, are we trying to model human


intelligence?

■ How will we know when we have succeeded in building an


intelligent program?
Underlying Assumptions

Physical symbol system hypothesis

A physical symbol system consists of

■ Symbols - physical patterns, e.g., alphabets

■ Symbol structure- instances of symbols, called or


expression tokens related together,e.g.,words

■ Processes- act on expressions to produce


more expressions, e.g., creation,
modification, deletion.

Example of physical symbol system is the human mind.


Acting Rationally: The rational agent approach

• Agent: An entity that perceives (observes) its environment and is able to


execute actions to change it.
• Agents have inherent goals that they want to achieve (e.g. survive,
reproduce).
• A rational agent acts in a way to maximize the achievement of its goals.
Rational Agents

• Human Agent:
□ Sensors: 5 senses, i.e., eyes, ears, nose, tongue, skin
□ Effectors: hands, legs and other body parts
• Robotic Agent:
□ Sensors: camera or infrared range finders,
microphones, touch screens.
□ Effectors: various motors.
Examples of Intelligent Systems

• Medical advice system


□ Symptoms, findings, patient’ s answers
□ Questions, tests, therapy recommendations

• credit card fraud detection


• information retrieval, Google
• aircraft, pipeline inspection
• speech understanding, generation, translation
• pattern recognition
• Knowledge representation
• Many more
A Cyborg
Task Domains of Artificial Intelligence

• Mundane (ordinary) Tasks:


□ Perception
• Vision
• Speech
□ Natural Languages
• Understanding
• Generation
• Translation
□ Common Sense Reasoning
□ Robot Control
Task Domains of Artificial Intelligence

• Formal Tasks
□ Games: Chess, Checkers
□ Mathematics: Geometry, Logic, Proving properties of
programs
• Expert Tasks:
□ Engineering: Design, Fault finding, Manufacturing,
Planning
□ Scientific Analysis
□ Medical Diagnosis
□ Financial Analysis
AI Techniques

■ Intelligence requires knowledge


■ Characteristics of knowledge which are undesirable:
□ Voluminous
□ Hard to characterize accurately
□ Constantly changing
□ Differs from data by being organized in a way that corresponds to the
situations in which it will be used.
■ The knowledge should be represented in the AI Technique so
that the technique can exploit it.
2. AI Techniques

Definition: An AI Technique is a method that exploits knowledge


that should be represented in such a way that:
■ The knowledge captures generalization
□ A class in C++ is a generalization of objects
■ The representation can be understood by people who provide
the knowledge
□ A variable name representing a value should be named in such a
manner that all other programmers can understand what it means
■ The knowledge should be easily modifiable or updatable to
reflect changes in the world
□ The variable should be easily modifiable by assigning it a new value
2. AI Techniques

■ It can be used in a great many situations even if it is not totally


accurate or complete
□ Even if a machine does not have enough data to take a decision, it
should be able to take a decision and continue its work

■ It can be used to overcome its own sheer bulk by helping to


narrow down the range of possibilities in a situation
□ To identify suitable candidates for an interview, the knowledge of their
qualifications helps to shortlist the candidates
□ Searching for information using Google – a general string vs a
specific string
Application of AI Techniques to Tic-Tac-Toe:
Program 1
Program 1 for Tic-Tac-Toe:Data Structures

■ Data structures: 1 2 3
□ Board :
4 5 6 Board
A 9-element vector
Each element can contain the value 7 8 9
0 if corresponding square is blank
1 if filled with a X
1 2 3 4 5 6 7 8 9
2 if filled with a O

□ Movetable :
Large vector of 19,683 (39) elements
1 2 3 4 5 6 7 8 9
Each element of which is a 9-element
vector whose contents are chosen in 1
such a way so as to allow the
2
algorithm to work.

19683

Movetable
Program 1 for Tic-Tac-Toe:Algorithm

To make a move, do the


following: Initial Board 1 2 3 4 5 6 7 8 9
vector
Step 1: Take value of the 0 0 1 0 1 2 2 0 0
vector Board as a base 3
number. Convert it to (X)10=(001012200)3
decimal.
1 2 3 4 5 6 7 8 9
Step 2: Use the number
1
computed in Step 1 as an
index into Movetable and 2
access the vector(X) X 2 2 0 2 0 1 1 2 2
stored there.

Step3: Set Board equal to 19683
vector X in Movetable

Next Board vector (Next Move)


Application of AI Techniques to Tic-Tac-Toe:
Program 2
Program 2 for Tic-Tac-Toe: Data Structures

■ Data structures:
□ Board :
A 9-element vector
Each element can contain the value
2 if corresponding square is blank (B)
3 if filled with a X
5 if filled with a O
□ Turn :
Integer indicating next move
Program 2 for Tic-Tac-Toe:Subprocedures

■ Subprocedures used are:


□ Make2 : if Board[5]=2
returns 5
otherwise
returns any blank non-corner square
(2,4,6,8)
□ Posswin(p) : ibility of player p ning
if player p can not win on his next move
returns 0
else
returns the number of the square which
will be the winning move
(How is the move found?->next slide)
Program 2 for Tic-Tac-Toe:Subprocedures

Posswin(p) : How to find the next move?


Multiply the 3 values (on the data structure Board) of each of a row or a
column or a diagonal and check for specific values:
e.g.
1. If product = 18 = 3*3*2 then X can win
X X B

2. If product = 50 = 5*5*2 then O can win


OO B

If a winning row is found, the blank element is determined and the


number of that square is returned.
Program 2 for Tic-Tac-Toe:Subprocedures

□ Go(n) : - Go to square n

- If Turn is odd, makes Board[n] = 3 (X)

If Turn is even, makes Board[n] = 5 (O)

- Increments Turn by 1
Program 2 for Tic-Tac-Toe:Algorithm

■ Initially, all the values on Board


are 2 (blank)
■ Turn=1(X)
X
1
Go(1) (upper left corner).

O
■ Turn=2(O)
If Board[5] is blank, Go(5), else 2
Go(1).
■ Turn=3(X)
If Board[9] is blank, Go(9), else
Go(3). X
3
Program 2 for Tic-Tac-Toe:Algorithm

■ Turn=4(O)
If Posswin(X) is not 0, then
Go(Posswin(X)) [i.e., block
opponent’ s win], else Go(Make2).
X
1 O
4

Here Posswin(X)=0 then Go(Make2).

O
Suppose Make2 returns 2, so Go(2).
■ Turn=5(X) 2
If Posswin(X) is not 0 then
Go(Posswin(X)) [i.e., win]

X X
else if Posswin(O) is not 0, then
Go(Posswin(O)) [i.e., block win]
5 3
else if Board[7] is blank, Go(7)
else Go(3).
Here Posswin(O) <> 0, Go(8).
Program 2 for Tic-Tac-Toe:Algorithm

■ Turn=6(O)
If Posswin(O) is
Go(Posswin(O)),
not 0 then
X
1 O
4 X
7
else if Posswin(X) is not 0 then
Go(Posswin(X))
else Go(Make2)
Here Posswin(X)<>0, Go(7). O 2
■ Turn=7(X)

O X
If Posswin(X) is not 0 then
Go(Posswin(X)),
else if Posswin(O) is not 0 then
Go(Posswin(O))
6 5 X 3

else go anywhere that is blank


Here Posswin(O)<>0, Go(3).
Program 2 for Tic-Tac-Toe:Algorithm

■ Turn=8(O)
If Posswin(O) is not 0 then
Go(Posswin(O)), X
1 O
4 X
7
else if Posswin(X) is not 0 then
Go(Posswin(X))
else go anywhere that is blank
Here Posswin(X)<>0, Go(6). X 9 O O 2 8
■ Turn=9(X) (same as Turn 7)

O X
If Posswin(X) is not 0 then
Go(Posswin(X)),
else if Posswin(O) is not 0 then
Go(Posswin(O))
6 5 X 3

else go anywhere that is blank


Here Posswin(O)<>0, Go(4). GAME OVER
Application of AI Techniques to Tic-Tac-Toe:
Program 3
Program 3 for Tic-Tac-Toe:Data Structures

■ BoardPosition is a structure containing


□ A 9-element array representing the board
□ A list of board positions that could result from the next
move
□ A number or rating representing an estimate of how likely
the board position is to lead to an ultimate win for the
player to move.
Program 3 for Tic-Tac-Toe:Algorithm

Steps:
1. For the next move, look ahead at the board positions that
result from each possible move.
2. Decide which position is best
3. Make the move that leads to that position
4. Assign the rating of that best move to the current position
In Step 2, to decide which of a set of board positions is best, do
the following for each of them:
2(a) See if it is a win. If so, call it the best by giving it the
highest rating.
(continued… )
Program 3 for Tic-Tac-Toe:Algorithm

2(b) Otherwise, consider all the moves the opponent would make
next.
See which is worst by recursively calling the first step. Assume the
opponent will make that move.
Whatever rating that move has, assign it to the node being
considered.
2(c) The best node is then the one with the highest rating.
This algorithm will look ahead at various sequences of moves in order to find
a sequence that leads to a win.
It attempts to maximize the likelihood of winning, while assuming that the
opponent will try to minimize that likelihood.
This algorithm is called the MINIMAX Procedure.
Comments on the Three Programs

□ Program 1: Fast but takes up lot of memory


If it is to be extended to 3D Tic-Tac-Toe,
it would require 327 entries in MoveTable
(not possible)
□ Program 2: Slower and less efficient
But requires much less space
Strategy is simpler but is predetermined
Cannot be generalized to any sequence
of moves.
□ Program 3: Slower
Can be extended to games more
complex than Tic-Tac-Toe

You might also like