Title: Great Ideas in Computer Science
1Great Ideas in Computer Science
- Artificial Intelligence
- COMP 41 Apr 19 and Apr 24
2What is Artificial Intelligence?
- Artificial man-made
- What is Intelligence?
3The Turing Test
- 1950 Turing proposed a test for determining if a
machine is intelligent - A machine is intelligent if it can behave in an
manner indistinguishable from a human
4The Turing Test
The Tao of Computing by Henry Walker
5Intelligence?
6Intelligence?
7Intelligence?
8Intelligence?
Conversations taken from Hamlet on the
Holodeck by Janet H. Murray
9John Searles Counterargument
- 1980 John Searle proposed a counterargument
against the Turing Test - a simulation of intelligence is not necessarily
intelligent
10Searles Chinese Room
http//www.unc.edu/prinz/pictures/c-room.gif
11Analysis The Chinese Room
- The human in the Chinese Room behaves exactly as
a computer program - follows instructions
- interprets input data
- creates output data
- The human does not understand Chinese!
12Real AI
- AI research has been successful in more modest
goals - rather than creating intelligence, AI has
focused on clever problem solving
13Kinds of AI
- Symbolic
- programs that manipulate symbols according to
well defined algorithms and programs - the knowledge in symbolic AI is carefully coded
by humans - Connectionist
- programs that simulate the brain has a network of
simple neurons - neural networks learn to recognize patterns
14The Water Jug Problem
- You have
- a 3 gallon bottle (b3),
- a 4 gallon bottle (b4) and
- a hose.
- Put exactly two gallons in the 4 gallon bottle.
15Represent Problem State
state of b3
state of b4
1 gal in b3
2 gal in b4
16Determine Possible State Changes
- 1. Fill b3
- 2. Fill b4
- 3. Empty b3
- 4. Empty b4
- 5. Move from b3 to b4 until b4 full
- 6. Move from b3 to b4 until b3 empty
- 7. Move from b4 to b3 until b3 full
- 8. Move from b4 to b3 until b4 empty
17Search for Solution
- Apply all possible changes to current state
- Remove states already seen
- If any state is the goal state, stop
- Repeat for all new states
18First Level Search
Rule 1
Rule 2
19Second Level Search
1
2
2
1
7
6
4
3
20Second Level Search
1
2
2
1
7
6
4
3
X
X
Weve already seen these
21A Possible Solution
2
7
3
2
7
22Water Jug System FSA
finite state automata from Simulation Model
Design and Execuction by Paul A. Fishwick
23Water Jug System Solution
24A TicTacToe AI
- Problem State represent TTT board as a list of 9
characters, which might be X, O or B (blank).The
characters are indexed from 0 to 8, where the
index indicates positions as followsFor
example represents
XBBOXBBBB
25TTT AI 1
- Write down every possible board and the best move
to make when that board is encountered. - The AI simply looks for the current board and
responds with the specified move.
26TTT AI 1 - Analysis
- This strategy completely encodes some human
players strategy it will be exactly as good as
the player (assuming no mistakes in coding) - There are 83 512 possible board states to be
encoded - This AI will be very fast
- This is tedious for TacTacToe and probably not
practical for more complex games any other game
will require a complete recoding of moves
27TTT AI 2
- Determine all possible moves from current board
- If any move wins the game, assign the move the
highest possible rating. - Otherwise, for each possible move, determine
every possible opponent move. See which is worst
(by recursively applying this procedure).
Whatever rating that move has, assign it to the
current move. - Select the move with the highest rating.
28TTT AI 2 - Analysis
- This is an example of an AI algorithm called the
min-max procedure. We attempt to find the move
that maximizes our chance of winning, while
minimizing our opponents chance of winning. - This takes much more computation time than the
first AI. - This is more difficult to program, but easier to
determine the rules. - This procedure easily adapts to other games (3D
TicTacToe, checkers, chess, )
29TTT AI 2 Analysis (continued)
- From the initial empty board, we will have to
consider as many as 98765432 9!
362880 moves to determine opening move - Computers can do 1 billion operations per second,
easy to consider 632880 moves in a reasonable
turn time.
30TTT AI 3
- We can add heuristic rules that can be applied to
certain situations this are rules that encode
knowledge or strategies more like human players - Example always start with center position
31The Traveling Salesman Problem
- Given a list of cities and traveling distances
between cities, determine the shortest route that
takes a salesman to every city
32Traveling Salesman AI 1
- Generate every possible route
- Compute the distance of every route
- Select the shortest route
- For n cities, this requires evaluation of n!
routes.
33TS AI 1 - Analysis
- For n cities, this requires evaluation of n!
routes. 10! 3,628,80020!
2,432,902,008,176,640,000 - This gets too expensive for even a small number
of cities!
34TS AI 2
- 1. Arbitrarily select a starting city
- 2. Look at all cities that have not yet been
visited and select the nearest one - 3. Repeat step 2 until all cities have been
visited
35TS AI 2 - Analysis
- This is a heuristic algorithm
- This solution will produce a short route, but not
necessarily the shortest route (the maximum
error can be computed) - For n cities, this executes in time proportional
to n2, which is considerable faster than n!
36TS AI Analysis continued
n n2 n!
5 25 120
10 100 3,628,800
20 400 2 x 1018
100 10,000 10158
1000 1,000,000 102564