4. Constraints in Search and Knowledge
Representation
Constraints and constraint satisfaction are interesting in two
ways.
1. Constraints supply a different method of imposing
knowledge on a problem
2. Constraint propagation enables on to reach a global solution
using only local search, with obvious savings in the search space
9/18/20174
5. Again, (2) shows the interdependency of knowledge and
search.
In practice one typically has a set of parameters whose values
you are after, and a set of constraints which when applied to a
single parameter do not determine it uniquely, but when
applied to all the parameters do provide a unique global
solution.
9/18/20175
6. The algorithm goes like:
9/18/20176
Until a complete solution is found or all paths are dead ends
1. Select an unexpanded node of the search graph.
2.Apply the constraint inference rules to the selected node to
generate all possible new constraints.
3. If the set of constraints contains a contradiction announce this
path is dead end.
4. Else if the set of constraints describes a complete solution
announce SUCCESS.
5. Else apply the problem space rules to generate new partial
solutions which are consistent with the latest constraints. Insert
these solutions in the search graph.
7. Constraint Propagation in line labeling
9/18/20177
One of the most elegantAI applications of constraint
satisfaction is junction and line labeling in computer vision,
an example of symbolic, rather than numeric, constraint
propagation.
Human beings have been shown to have an in-built ability to
make sense of the 3D shape implications of 2D line drawings,
especially polyhedra.
This ability comes about because there are provably very few
ways of interpretation line drawings.
This ability has been captured in machine vision programs,
the simplest of which we outline now
8. 9/18/20178
Consider objects which:
are without cracks and opaque
with only 3-faced junctions
and are viewed from general (generic) positions.
Let us now look at edges on a polyhedral object.
These can be convex, concave or occluding (two sorts), so there
are four ways of labeling a line.
We label these with a plus, a minus, or left or right arrows (by
convention the solid face is to right of edge when traversed in
the direction of the arrow).
9. 9/18/20179
If we make these restrictions (Note they can be lifted), it turns out
that there are only four types of junction to be considered.These are
L-junctions,Y- or fork-junctions,W- or arrow-junctions andT-
junctions.
12. How can line-labeling be done
automatically?
9/18/201712
There are some powerful constraints on the possible junction type.
These are related to the way surfaces can be arranged in the 3D
world.
You will deal with this aspect in the (selective) computer vision
course.
There are four ways of labeling a line, there should be 16 ways of
describing an L-junction and 64 ways for each ofW,Y andT.
So there could be 208 labeled junction types in all. In fact there
are only 16 allowed junction types.
13. Waltz labeling algorithm
9/18/201713
Take the line drawing and on each vertex heap up the possible
junctions.
Now suppose we exit the junction along an edge via a (+) label,
for example.
This would mean we must enter the next junction via a (+) label.
Suppose there was no such possibility: we should obviously
discount the initial choice of junction and so on.
Thus we travel around loops propagating the constraints, until we
can do no more in that loop.
Then we pass to another and so on.
Only when there is a complete irreducible interpretation do we
stop.
14. An example of Waltz Constraint
Propagation
9/18/201714
18. Waltz Algorithm: Constraint
Satisfaction
Talks about the line drawings
Many perceptual tasks appear to be highly complex
because the number of interpretations that can be assigned to
individual components of an input is large and the number of
combinations of those components also appears to be
enormous
Clear analysis can show that many combinations can not
occur
These natural constraints can be exploited in the
understanding process to reduce the complexity from
unmanageable to manageable.
9/18/201718
19. Important steps for using constraints in
problem solving:
1.Analyze the problem domain to determine the actual
constraints.
2. Solve the problem by applying a constraint satisfaction
algorithm.
9/18/201719
20. Consider for example
a three dimensional line drawing
analysis process is to determine the object described by the
lines.
geometric relationships between different types of line
junctions helped to determine the object types
Three Dimensional Polyhedral junction types. 9/18/201720
21. InWaltz’s algorithm, labels are assigned to lines of various
types-say concave edges are produced by two adjacent
touching surfaces which induce a concave (less than 180
Degrees) depth change
Conversely, convex edges produce a convexly viewed depth
(greater than 180 degrees), and a boundary edge outlines a
surface that obstructs other objects
9/18/201721
22. To label a concave edge, a minus sign is used
Convex edges one labeled with a plus sign, and a right or left
arrow is used to label the boundary edges
By restricting vertices to be the intersection of three object
faces, it is possible to reduce the number of basic vertex
types to only four : the L, theT , the Fork and the Arrow
9/18/201722
23. The L types ForkTypesT types
Valid junction labels for three-dimensional shapes.
9/18/201723
24. Referring to previous figure
When a three-dimensional object is viewed from all possible
positions, the four junction types, together with the valid
edge labels, give rise to eighteen different permissible
junction configurations as shown in previous slide figure
Geometric constraints, together with a consistent labeling
scheme, can simplify the object identification process.
A set of labeling rules which facilitates this process can be
developed for different classes of objects
9/18/201724
25. Following rules will apply for many
polyhedral objects:
1.The arrow should be directed to mark boundaries by
traversing the object in a clockwise direction.
2. Unbroken lines should have the same lable assigned at both
ends.
3.When a fork is labeled with a+ edge, it must have all three
edges label as + , and
4.Arrow junctions which have a label on both bard edges
must also have a + label on the shaft.
9/18/201725
26. These rules can be applied to a
polygonal object as given in figure
Example of object labeling
9/18/201726
27. Applying Waltz for Pyramid
Starting with any edge having an object face on its right, the
external boundary is labeled with the a in a clockwise
direction
Interior lines are then labeled with + or _ consistent with
the other labeling rules
To see how waltz constraint satisfaction algorithm works,
consider the image drawing of a pyramid as given in figure3
at the right side of the pyramid are all possible labeling for
the four ujunctionsA, b, C and D.
9/18/201727
29. Using these labels as mutual constraints on connected junctions,
permissible labels for the whole pyramid can be determined
The constraint satisfaction procedure works as follows:
Starting at an arbitrary junction, sayA, a record of all permissible
labels is made for that junction.
An adjacent junction is then chosen, say , B and labels which are
inconsistent with the lineAB are then eliminated from the permissible
A and B lists
In this case, the line joining B can only be a +, - or an up arrow a
consequently, two of the possible A labeling can be eliminated and the
remaining are
9/18/201729
30. Choosing junction c next, we find that the BC constraints are
satisfied by all of the B and C labeling, so on reduction is
possible with this step
On the other hand, the line AC must be labeled as – or as an
up-left-arrow ß to be consistent
Therefore, an additional label for A can be eliminated to
reduce the remainder to the following:
9/18/201730
31. This new restriction on a now permit the elimination of one B
labeling to maintain consistency.
Thus, the permissible B labeling remaining are now
This reduction in turn, places a new restriction on BC, permitting
the elimination of one C label, since BC must now be labeled as a
+ only.
This leaves the remaining C labels as show in below diagram.
9/18/201731
32. Moving now to junction d, we see that of the six possible D
leadings, only three satisfy the BD constraint of a up or a
down arrow.
Therefore, the remaining permissible labeling for d are now
Continuing with the above procedure, we see that further
label eliminations are not possible since all constraints have
been satisfied
This process is completed by finding the different
combinations of unique labeling that can be assigned to the
figure
An enumerations of the remaining label shows that its is
possible to find only three different labeling
9/18/201732
40. Real world CSPs
Assignment problems: e.g., who teaches what class !
Timetabling problems: e.g., which class is offered when and
where? !
Hardware configuration !
Transportation scheduling ! Factory scheduling !
Floor-planning !
Fault diagnosis ! … lots more! !
Many real-world problems involve real-valued variables…
9/18/201740