Title: Intro to Computation
1Intro to Computation AI
- Dr. Jill Fain Lehman
- School of Computer Science
- Lecture 5 November 20, 1997
2Review
- Introduced graph structures basic operations
- Homework think about knowledge and
knowledge-rich processes - During generation (e.g. similar sites)
- During traversal (e.g. query search)
- Today 2 examples of how AI uses graphs
- Semantic nets inheritance
- Constraint satisfaction
3Semantic Nets
- Type of slot-and-filler structure.
- Meaning of concept comes from way it is connected
to other objects. - Graph nodes represent objects labeled edges
represent relations between objects or attributes
and their values. - Edge labels may be domain independent or domain
dependent . - Edge types usually play a role in processing.
Main process inheritance.
4Example of a Semantic Net
handed
Person
right
bats
equal-to-handed
isa
avg
Pitcher
.252
instance
3-finger- Brown
team
Chicago Cubs
5Attributes Values
- Isa and instance class inclusion and membership.
More generally an attribute A may be a
specialization or generalization of another
attribute, e.g. height/physical-size. - Inverses, e.g. has-part/part-of.
- Semantics of attribute may restrict value, e.g.
average must be a number between .000 and 1.000.,
age of a person lt age of each parent. - Values may be given, computed or inherited.
6Inheritance
- Inference technique based on organization of
objects into classes and a generalization
hierarchy.
height
Male
510
61
isa
height
Baseball player
Team(Pee-wee) Brooklyn Avg(Pee-wee)
.262 Height(Pee-wee) 61
avg
.252
isa
avg
Fielder
.262
instance
Pee-Wee- Reese
Brooklyn Dodgers
team
7Inheritance Algorithm
To retrieve a value V for attribute A of an
instance object O 1. Find O in the net. 2. If
there is a value there for A report that
value. 3. Otherwise follow the instance link (no
link means failure) and report the value of
A associated with the class. 4. Otherwise follow
isa links up the hierarchy until a value V
is found for A or until no more isa links are
available. Fine if your hierarchy is a treebut
what if its a directed, acyclic graph (DAG)?
8DAGs
Bird fly yes
Quaker pacifist true
Republican pacifist false
isa
isa
Ostrich fly no
isa
isa
Pet-bird
Maggie pacifist ?
instance
Fifi fly?
instance
Birds want specific knowledge to dominate
general. Pacifists want to report ambiguity
rather than reach arbitrary conclusion. Can we
modify algorithm using path length to solve the
problem?
9More DAGs
Bird fly yes
isa
No, because path length tends to correspond to
the degree of elaboration of a class in the
knowledge base and some classes are usually more
elaborated than others. What we really want is
to base inheritance on idea of inferential
distance.
isa
Ostrich fly no
Pet-bird
instance
isa
Plumed ostrich
instance
Fifi fly?
10Inferential Distance (Touretzky)
- Class1 is closer to class2 than to class3 iff
class1 has an inference path through class2 to
class3. - Note defines only a partial ordering.
- Inheritance for feature f gives the set of
competing values such that each value v - Has been derived from a class c in fs class
hierarchy and - v is not contradicted by any class that has a
shorter inferential distance to c than f does.
11Semantic Nets Conclusions
- In general, anything you can do in a predicate
logic theorem prover you can do in a semantic net
via inheritance. - Semantic nets can be boosted to first-order logic
through the use of partitioning. - Frame languages (e.g. Parmenides) formalize nets
and their operations they are programming
languages based on the architecture of nets. - A net involves representational decisions that
affect completeness and correctness the paradigm
is general, the power comes from the content.
12Constraint Satisfaction
- Many problems viewed as choosing consistent
assignment of values to features, e.g. speech
NL, vision, job-shop scheduling/logistics. - Number of values/feature may be large, number of
combinations of feature/value intractable. - But not all feature/values and combinations may
be permissible. - Naturally-occurring constraints
- Imposed constraints (e.g. homework)
- Use constraint knowledge to cut down search.
13CS Graphs Structure
- Analyze the problem domain to determine object
features (nodes), relations (edges), possible
values (stored at nodes or edges), and
constraints, defined in a constraint language.
SEND MORE ---------- MONEY
S
E
Y
N
R
Val ? (0..9) C1 DEY C2 EON C3 val
val(others)
D
O
M
14CS Graphs Operations
- Constraints are propagated along edges that
relate dependent objects, generally until each
feature is assigned a single value. - Search may be required to propagate hypothetical
constraints (guesses at values) these
constraints will need to be undone when they lead
to inconsistencies (the inability to assign some
other feature a value given the guess).
15Domain-independent CS Algorithm
1. Set OPEN to the set of vertices. Then do until
an inconsistency is detected or until OPEN is
empty a. Select an OBJ in OPEN and reduce
possible values according to constraints
provided by adjacency set. b. If first time
OBJ examined or if values reduced, add adjacency
set to OPEN. c. Remove OBJ from
OPEN. 2. If each feature has a single value then
quit (solution found). 3. If inconsistency arose,
return failure. 4. If neither 2 nor 3 then until
solution is found or all solutions have been
eliminated a. Select an object whose value
is not determined and assign a value. b.
Recursively invoke CS on graph.
16Example Scene Analysis for Polyhedra
17Line Classes
gt
Boundaries
-
gt
Real edges
-
gt
Concave
-
gt
Interiors
-
gt
gt
All lines
Convex
Shadows
Pseudo edges
c
gt
Cracks
c
gt
gt
gt
gt
gt
gt
gt
18Common Junctions
Psi
L
X
Arrow
Trihedral vertices
K
Fork
Peak
T
Ka
19Combinatorics Simple Case
- Trihedral vertices, no concave or crack edges,
uniform illumination (no shadows) - 4 ways to label a line, so
- 42 16 labelings for an L
- 43 64 labelings for fork, arrow, and T
- BUT out of 208 junctions, only 18 are physically
possible - Still, savings dont look that big...
20Combinatorics No Assumptions
Vertex Approximate Approximate
type possible labelings physical labelings
L 2.50x103 Fork 1.25x105 T 1.25x105 Arrow
1.25x105 Psi 6.25x106 K 6.25x106 X 6.25x106
Multi 6.25x106 Peak 6.25x106 Ka 3.12x108
80 500 500 70 300 100 100 100 10 30
21Waltzs Algorithm
1. Find borders and label them border has no
vertices outside it. 2. Number vertices to be
traversed in order a. Number boundary
vertices first. b. Number interior vertices by
moving from a numbered vertex toward an
adjacent unnumbered one. 3. Now visit each vertex
V in order and attempt to label a. Attach all
physically possible labels of type V. b. For
each vertex A adjacent to V and already visited,
eliminate from V any labeling for which
there is no consistent label at A. c. For each
vertex adjacent to A visited in step b, do i.
Eliminate labels inconsistent with V. ii.If any
eliminated, propagate constraints to neighbors
of A. iii. Continue to propagate until there are
no adjacent labeled vertices or no change
made to a set.
22Simplest Example (trihedral)
B
C
A
D
G
E
F
A ((lt lt) (gt gt) (gt ) ( lt) (gt -)(- lt)) 6 Ls F
((--).()(lt-lt)...) 3 Arrows,
4 Forks, 4 Ts
23Constraints for A
B
C
Before
A
A ((lt lt)(gt gt)(gt ) ( gt)(lt -)(-gt))
B ((- -) (gt gt) ( - ) ( )(- - -
)(- lt lt)(gt - gt)(lt lt -) (lt - lt)(lt lt)(lt gt
lt)(lt lt lt))
D
G
F ((- -) (gt gt) ( - ) ( )(- - -
)(- lt lt)(gt - gt)(lt lt -) (lt - lt)(lt lt)(lt gt
lt)(lt lt lt))
E
F
After
A ((gt gt))
24Constraints for B
B
C
Before
A
B ((- -) (gt gt) ( - ) ( )(- - -
)(- lt lt)(gt - gt)(lt lt -) (lt - lt)(lt lt)(lt gt
lt)(lt lt lt))
D
A ((gt gt))
G
G ((- -) (gt gt) ( - ) ( )(- - -
)(- lt lt)(gt - gt)(lt lt -) (lt - lt)(lt lt)(lt gt
lt)(lt lt lt))
E
F
After
B ((gt gt) (gt - gt))
Backup to A produces no changes.
25Constraints for C
B
C
Before
A
C ((lt lt)(gt gt)(gt ) ( gt)(lt -)(-gt))
B ((gt gt) (gt - gt))
D
D ((- -) (gt gt) ( - ) ( )(- - -
)(- lt lt)(gt - gt)(lt lt -) (lt - lt)(lt lt)(lt gt
lt)(lt lt lt))
G
E
F
After
C ((gt gt))
Backup to B produces no changes.
26When Youre Done...
A ((gt gt)) B ((gt gt)(gt - gt)) C ((gt gt)) D ((gt
gt)(gt - gt)) E ((gt gt)) F ((gt gt) (gt - gt)) G
(( ) (- - -))
G
27Waltzs Algorithm Factoids
- Guaranteed to find unique correct figure labeling
if one exists. - If more than one labeling exists, at least one
vertex set will have multiple entries by doing a
depth-first exhaustive traversal of the graph you
can generate all possible labelings. - Illumination serves to reduce ambiguity.
28Constraint Satisfaction Conclusions
- Constraints are a source of knowledge that can be
traded off against search. - The expressive power of the constraint language
trades off against the cost of propagating
constraints and detecting inconsistencies. - In general, strong constraints may make an
intractable problem computable in practice, but
does not change the basic exponential nature of
the search space.