Académique Documents
Professionnel Documents
Culture Documents
Medelln 2013
Motivation
MARIANA
http://www.uca.edu.ar/uca/index.php/ingreso/index/es/universidad/ing resantes/ingreso-buenos-aires/
Siri
http://www.youtube.com/watch?v=0ubSbju9u68&feature=watch_response
Existor
www.existor.com
ABSOLUTELY NOT !
+ some pattern matching + some knowledge + some randomness
10
11
In robotics:
14
15
17
18
19
Work very well for learning, classifying and pattern matching. Very robust and noise-resistant.
20
Example: ECG-diagnosis
22
But at the end What is Artificial Intelligence? Well, Artificial Intelligence is ...
23
Medelln 2013
(E.Rich, Chapt.2)
Basis search methods.
(Rich, Chapt.3 + Russel&Norvig + Nilsson) Game Playing (Winston, Chapt.6 + Rich + Russel&Norvig )
25
26
What is state-space representation? Which are the technical issues that arise in that context? What are the alternatives that the paradigm offers to solve a problem in the state-space representation?
1 3
2
5
7
4 6
Problem: find a sequence of moves (allowed under the rules of the 8-puzzle game) that transform this board situation in a desired goal situation:
1 8 7
2 6
3 4 5
http://mypuzzle.org/sliding
http://www.permadi.com/java/puzzle8/puzzle8a.html
== PRODUCTION RULES
Represent the initial state (s). Formulate precisely when a state satisfies the goal of our problem. Activate the production rules on the initial state and its descendants, until a goal state is reached.
Ex.:
1 3 8 2 7 5 4 6
using a 3 X 3 matrix
How to formulate production rules? (repr. 2) Ex.: express how/when squares may be moved? Or: express how/when the blank space is moved? When is a rule applicable to a state? (matching) How to formulate when the goal criterion is satified and how to verify that it is? How/which rules to activate? (control)
1 3 8 2 7 5 4 6
1 8 2 3 7 5 4 6
1 3 8 2 7 5 4 6
1 3 2 4 5
8 7 6
goal
8 puzzle= 181.444 15 Puzzle = 650.000.000 24 Puzzle = 5000.000.000.000.000.000.0000.000
1 3 8 2 7 5 4 6
1 8 2 3 7 5 4 6
1 3 8 2 7 5 4 6
1 3 2 4 5
8 7 6
goal
But this tree is only IMPLICITLY available !!
Ex.:
8 List: (( king_black, 8, C), ( knight_black, 7, B), ( pawn_black, 7, G), ( pawn_black, 5, F), ( pawn_white, 2, H), ( king_white, 1, E))
7
6 5 4 3 2 1
A B C D E F G H
34
Chess (2):
A B C D E F G H
( (pawn_white,2,x) , (blank, 3, x), (blank, 4, x) )
add( ( pawn_white, 4, x) ), remove( (pawn_white, 2, x) )
35
Chess (3):
List: (( king_black, 8, C), ( knight_black, 7, B), ( pawn_black, 7, G), ( pawn_black, 5, F), ( pawn_white, 2, H), ( king_white, 1, E))
A B C D E F G H
( (pawn_white,2,x) , (blank, 3, x), (blank, 4, x) ) add( ( pawn_white, 4, x) ), remove( (pawn_white, 2, x) )
Matching mechanism !!
Chess (4):
37
Chess (5):
Need a theorem prover ( e.g. Prolog) to verify that the state is a winning one.
Chess (6).
Chess (7).
Implicit search tree ~15 Move 1
2 ~ (15)
Move 2
~ (15)
Move 3
Need very efficient search techniques to find good paths in such combinatorial trees.
41
[ 0, 0 ]
goal state:
[ 2, x ]
42
[ 4, y ]
[ x, 3 ]
Empty large:
[ x, y ] and x > 0 [ 0, y ]
[ x - d, y ]
[ 4, y-(4-x)]
44
Fill small
[ 0, 3 ]
*
[ 4, 3]
Fill small
[ 3, 3 ]
Redundant subspace !
[ 0, 2 ]
Empty large
[ 2, 0 ]
Fill large:
[ x, y ] and x < 4
[ 4, y ]
Fill small:
[ x, y ] and y < 3 [ x, 3 ]
Empty large:
[ x, y ] and x > 0 [ 0, y ]
Fill small
[ 0, 3 ]
[ 0, 0 ]
Fill small
[ 0, 3 ] LOOP ! [ 0, 0 ] [ 4, 2 ] [ 0, 2 ] [ 3, 3 ]
Empty large
[ 2, 0 ]
[ 1, 3 ]
[ 4, 3 ]
[ 3, 0 ]
[ 1, 0 ]
[ 3, 3 ]
...
Avoids generating loops: but needs to keep track of ALL the nodes.
48
Ex.: 8-puzzle: any or shortest path problem. Ex.: Traveling salesperson problem:
Boston
3000
SanFrancisco
250
1450
NewYork
1700
1200
Miami
1600
Find a sequence of cities ABCDEA such that the total distance is MINIMAL.
State: the list of cities that are already visited Ex.: ( NewYork, Boston ) Initial state: Ex.: ( NewYork ) Rules: add 1 city to the list that is not yet a member add the first city if you already have 5 members Goal criterion: first and last city are equal
Boston NewYork SanFrancisco
Miami
Dallas
50
( NewYork )
250
250
1200
1200
1500
2900
1500
2900
( NewYork, Miami )
( NewYork, Dallas )
Keep track of accumulated costs in each state if you want to be sure to get the best path.
51
Ex.: Computing symbolic integrals: State: the integral to compute Rules: integration reduction rules Goal: all integrals have been eliminated x2 + 3x + sin2x . cos2x dx
AND
x2 dx
x3/3 3 xdx
3xdx
sin2x . cos2x dx
((sin2x)/2)2dx
... ...
(1 - cos2x).cos2x dx
... AND-OR-tree search ...
Ex.: Blocks world problem. Initially: C is on A and B is on the table. Rules: to move any free block to another or to the table Goal: A is on B and B is on C.
C A
AND-OR-tree?
B
Goal: A on B and B on C
AND
C A B C A B
Goal: A on B
Goal: B on C
53
AND
C A B C A B
Goal: A on B
Goal: B on C
Goal: A on B
B C A
A B
Goal states
Forward reasoning (or forward chaining): from initial states to goal states.
55
Goal states
Backward reasoning (or backward chaining): from goal states to initial states.
Criteria:
Sometimes equivalent: (Ex.: 8-puzzle:)
1 3 2 5
8 7
1 8 7
2 6
3 4 5
4 6
Branching factor (Ex.: see previous slide) Sometimes: no way to start from the goal states because there are too many (Ex.: chess) because you cant (easily) formulate the rules in 2 directions.
57
Criteria (2):
The ratio of initial states versus goal states:
Ex.: finding your way to some destination Providing explanation facilities: (Ex.: expert systems with user interaction)
Backward reasoning!
Medelln 2013
Graphs
Graphs are the mathematical and computer science abstraction that capture many shared and common concepts of real-life objects such as
networks, e.g.
water electricity internet
Graphs
Many problems in CS/AI can be reduced to problems in graph theory,
gives a good way to share results, methods & implementations across many areas
Graph Theory has its own jargon; but it is worth becoming familiar with it
e.g. in discussions of network topology, social networks,
Terminology of Graphs
Just giving the ideas. Exact mathematical definitions not needed for this course, and are available in many textbooks, wikipedia, etc. A Graph consists of a set V of nodes, and a set E of edges Node
has a unique label for identification
Edge
connects two nodes any two nodes have at most one edge between them usually forbid self-edges : edges from a node back to itself can be a
directed edge: e.g. from A to B a one-way street undirected edge: e.g. between A and B a standard street
Graph Example
This is not a map! The positions of the nodes do not matter, only their interconnections E.g. London Underground Map gives interconnections, but not true locations
B A F D C
Mapas
Mapas
Mapa
Graph Example
Crossing of edges (arcos,aristas) has no meaning
A-D and B-E cross in the picture but they do not interconnect
A B D E G F C
F D A E B
Terminology of Graphs
B D C E G
Path connected sequence of edges (arcos-aristas): e.g. A to B to F to C to G usually not allowed to use the same node (or edge) twice if the edges are directed then the path has to follow the directions of the edges. E.g. follow the one-way streets on a map
Reachable
Node B is said to be reachable from node A if and only if there is a path from A to B
Relevance to real-world: many search problems are questions about whether or not some goal is reachable from some start node part of maintaining the internet topology is ensuring that any node (site) is reachable from any other site a design factor in the internet was that nodes stay reachable even if some links are broken e.g. in the event of nuclear war
Connected Graphs
Connected Graph. Definition:
for any two nodes there is a path between them i.e. any node is reachable from any other node
B F
D
C E G
Connected Graphs
E.g. this graph is disconnected There is no path from A to B
B F
D
C E G
Cycles
Definition: a cycle is a path that goes in a loop from a node back to itself, and without using the same node twice E.g. A-B-E-A in
A B F D
C E G
Tree
A tree is a graph
that is connected but becomes disconnected if you remove any edge (cut the edge)
Matches nature
real trees are connected cut any branch then the tree falls into two pieces
Tree: Example
This is a tree
B F D I
C
J
Acyclic Graphs
Defn: An acyclic graph has no cycles Alternative definition: A tree is a graph that is
connected, and acyclic
Trees
Question: Why is a acyclic equivalent to becomes disconnected on any cut?
A B F D C E G
Trees
A Tree is connected: given any two nodes A and B there exists at least one path between them Question: Given a tree, and any two nodes A and B, is the path between them unique? or might there be pairs of nodes that have more than one path between them? Suppose nodes E and F have two distinct paths P1 and P2 between them: Using P1 followed by reverse(P2), we would be able to construct a cycle. But trees are acyclic, hence, paths between nodes of a tree must be unique B D B D E B
E
A
P1(E,F) F
P1(E,F) U P2(F,E)
D
E P2(E,F)
Trees
A tree is a graph that:
1. is connected but becomes disconnected on removing any edge 2. is connected and acyclic 3. has precisely one path between any two nodes
The above 3 definitions are equivalent Suggestion: become comfortable enough with the definitions for this equivalence to be self-evident
Rooted Trees
Often in trees have a special node called the root E.g.
A B F D I H E G J C
Rooted Trees
Often in trees have a special node called the root Usually also give edges a direction away from the root e.g.
B F D I
C
J
Rooted Trees
Often, on making a picture of a tree Pick up the tree by the root
let it hang, and shake it a bit
B A B F D I H E G J A I C H E G J C
But in practice
you dont usually get the pretty version programs have to use messy representations
\J
\B\H
\B\E
\B\E\A
\B\E\I
\J
\B
\B\H
\B\E
\B\E\A
\B\E\I
\J
\B
\B\H
\B\E
\B\E\A
\B\E\I
Trees: b=2
If the largest branching factor is two then we have a binary tree
F
Trees: b=1
If the largest branching factor is one then we have a linked list These are often used in programming as a container: a way to store a collection of objects
F
Trees: Depth
The depth, d, of a node is just the number of edges it is away from the root node The depth of a tree is the depth of the deepest node
in this case, depth=4
A I d=3 d=0
d=1
d=2
d=4
Tree Sizes
Suppose we have a tree with
branching factor b depth d
Sizes of Trees: Branching Factor Increasing b rapidly increases the tree size:
d 0 1 2 3 4 5 6 nodes at d, b=2, 2d 1 2 4 8 16 32 64 nodes at d, b=3, 3d 1 3 9 27 81 243 729
Sizes of Trees
Pattern seen in binary tree: nodes at d or less = nodes at d+1 1 = 2d+1-1 = O(2d) The number of nodes grows exponentially Another manifestation of the Combinatorial Explosion Similarly, for a general tree number of nodes is O(bd) but, remember big O gives an upper bound, real trees might have a lot fewer nodes Trees are generally very leaf-heavy a large fraction of the nodes are leaves e.g. on your file system you probably have far more files than folders
Summary
Definitions of
graphs path connected cycles, and acyclic tree, and rooted tree
Exercise
Given a tree with Branching factor of 4, how many nodes are acumulated at level 5(d=5)? If the b= 5, how many nodes are acumulated at level 6 (d=6)??
Questions?
Puuufff!!
Be Nice!!!