Chapter 01 Intro
Chapter 01 Intro
An Introduction to
Artificial Intelligence
Outline
What is AI?
The foundations of AI
A brief history of AI
The state of the art
Introductory problems
Tools and Programming Languages for AI
Intelligence:
“ability to learn, understand and think”
(Oxford dictionary)
Artificial Intelligence:
“attempts to understand intelligent entities”
“strives to build intelligent entities”
(Stuart Russel & Peter Norvig [1])
Schools of Thought:
Typical research:
General Problem Solver (GPS), Newell & Simon
Obstacles:
Informal knowledge representation.
Computational complexity and resources.
X X
o
Data Structure:
1 2 3
4 5 6
7 8 9 1 2 3 4 5 6 7 8 9
2-D game-board 1-D Vector
Elements of vector:
0 : Empty
1 : X
2 : O
The vector is a ternary number
Data Structure:
X
000 000 001
. .
. .
Algorithm:
1.View the vector as a ternary number. Convert it to
a decimal number.
Comments:
3. Difficult to extend.
Data Structure:
Use vector, called board, as Solution 1
However, elements of the vector:
2 : Empty
3 :X
5 :O
Function Library:
1 2 3
1. Make2:
Return a location on a game-board. 4 5 6
7 8 9
IF (board[5] = 2)
RETURN 5; //the center cell.
ELSE
RETURN any cell that is not at the board’s corner;
// (cell: 2,4,6,8)
Function Library:
Let P represent for X or O
can_win(P) :
P has filled already at least two cells on a straight line
(horizontal, vertical, or diagonal)
cannot_win(P) = NOT(can_win(P))
Function Library:
2. Posswin(P):
IF (cannot_win(P))
RETURN 0;
ELSE
RETURN index to the empty cell on the line of
can_win(P)
Function Library:
Let odd numbers are turns of X
Let even numbers are turns of O
Algorithm:
1. Turn = 1: (X moves)
Go(1) //make a move at the left-top cell
2. Turn = 2: (O moves)
IF board[5] is empty THEN
Go(5)
ELSE
Go(1)
Algorithm:
3. Turn = 3: (X moves)
IF board[9] is empty THEN
Go(9)
ELSE
Go(3).
4. Turn = 4: (O moves)
IF Posswin(X) <> 0 THEN
Go(Posswin(X))
//Prevent the opponent to win
ELSE Go(Make2)
Artificial Intelligence: An Introduction to Artificial Intelligence Slide: 31
Tic-Tac-Toe: Solution 2
Algorithm:
5. Turn = 5: (X moves)
IF Posswin(X) <> 0 THEN
Go(Posswin(X))
//Win for X.
ELSE IF Posswin(O) <> THEN
Go(Posswin(O))
//Prevent the opponent to win
ELSE IF board[7] is empty THEN
Go(7)
ELSE Go(3).
Artificial Intelligence: An Introduction to Artificial Intelligence Slide: 32
Tic-Tac-Toe: Solution 2
Comments:
3. Hard to generalize.
8 3 4
1 5 9
6 7 2
15 (8 + 5)
Artificial Intelligence: An Introduction to Artificial Intelligence Slide: 34
Tic-Tac-Toe: Solution 2
Comments:
Data structure:
1. Game-board: Use vector as described for the
above program
2. List:
Contains possible game-boards generated from
the current game-board
Algorithm:
1. If it is a win, give it the highest rating.
3. The best node is then the one with the highest rating.
Current game-board
Algorithm:
Comments:
1. Require much more time to consider all possible
moves.
Data structure:
Question Patterns:
Set of predefined TEMPLATEs.
Given TEMLATEs, generate PATTERNs to match with
input text. For example,
Algorithm:
1. MATCH(TEMPLATE, QUESTION) PATTERNs.
Algorithm:
Example:
TEMPATE: “What did X Y”
QUESTION: “What did Mary go shopping for”
PATTERN:
Mary go shopping for Z
PATTERN+:
ANSWER:
Z = a new coat.
Artificial Intelligence: An Introduction to Artificial Intelligence Slide: 44
Question Answering: Solution 1
Answers:
“a red one”
“a red coat”
Comments:
Data structure:
Should have an efficient representation for input
text, input questions.
Algorithm:
1. Convert the input text to the internal representation,
referred to as structured text.
Algorithm:
3. MATCH(structured text, structured question).
Comments:
Data structure:
World Model:
An internal representation for the world.
Including: objects, actions, situation, see the following
chart.
IntegratedText:
An internal representation of the input text that has the
relation to the world model.
14. C takes M
Algorithm:
1. Convert the input text to an internal
representation.
4. Return answer.
Artificial Intelligence: An Introduction to Artificial Intelligence Slide: 56
Question Answering: Solution 3
Algorithm:
Comments
Programming Languages:
Prolog
Java
C++
Tools:
For building expert systems or rule-based
systems:
CLIPS: C Language Integrated Production System
JESS: Java Expert System Shell
For processing semantics:
RDF, RDFS, OIL
Artificial Intelligence: An Introduction to Artificial Intelligence Slide: 59
Homework