Title: Constraint Satisfaction Problems and Consistency Restoration
1Constraint Satisfaction Problems and Consistency
Restoration
- Florent Launay
- Undergraduate student at FIT
2Summary
- Focused interest in time point-sequencing
problem. - What are CSPs ?
- Crossword Problem.
- Dealing with consistency.
- 1. Finding and storing consistent relations
- 2. Finding a minimal set to remove
inconsistency - Linking the algorithms
- Questions, comments.
- The Program
3Focus interest
- Relation from lt, gt, , ltgt, lt, gt, ltgt
- Here, we can see that some constraints between
the set of points P1, P2, P3 exist - P1 lt P2
- P2 lt P3
P1
P2
P3
4What are CSPs ?
X gt 5 X ltgt 9 X lt 12
5What are CSPs ?
- Example
- Common names from English vocabulary beginning
with a c, ending with a t, but that doesnt
contain any e
Valid set count, cart, chat, court,
6What are CSPs ?
X gt 5
X ltgt 9
X lt 12
X lt 15
X gt 3
5
9
12
15
3
Valid regions 5,5, 5,9, 9,12
7What are CSPs ?
X gt 5
X ltgt 9
X lt 12
X gt 13
5
9
12
13
No valid region gt The system is inconsistent
8The crossword problem
Definition, Size of the world, across or down,
eventual existing letters. Definition 13 Part
of the human body, beginning with an
H (ambiguous)
W
O
E A D ?
A N D ?
A I R
H
N O T
A N D
HEAD, HAND, HAIR
Definition 14 Negation
9Dealing with consistency
- Within a set of relations, some relation can
conflict with other relations in a system, making
the whole system inconsistent.
Lets have a look to the following example.
10A simple example
- Let s consider a point P1 on a time line basis
11A simple example
P3ltP1 and P3gtP2
Valid region
P2
P1
No valid region can be found for P3 !!!
12Dealing with consistency
- With that kind of inconsistency, two interesting
questions arise - Which are the relations that make the system
inconsistent ? - What would be a minimal set to remove to make the
system consistent ?
131. Finding and storing inconsistent relations
System of relations
Consistent
NO
Store inconsistent relations
YES
Finish
Finish (Call the 2nd algorithm)
14Inconsistent relations
- FIND MULTIPLE EQUALITY
- gtStore inconsistent relations
- VERIFY CONSISTENCY IN CASE OF UNIQUE EQUALITY
- gtStore inconsistent relations
- FIND THE BOX PRE-PROCESSING
- gtStore inconsistent relations
-
- FIND VALID REGIONS
- gtIf no inconsistency has been found
15Inconsistent relations
If Pnew P3
And Pnew P6
The system is inconsistent since P3ltgtP6
P2
P1
P3
P4
P5
P6
Pnew
Pnew
16Inconsistent relations
- VERIFY CONSISTENCY IN CASE OF UNIQUE EQUALITY
-
If Pnew P3
And Pnew lt P2
The system is inconsistent
P2
P1
P3
P4
P5
P6
Pnew
17Inconsistent relations
- FIND THE BOX PRE-PROCESSING
-
-
If If we found that a valid region for Pnew was
P3,P4, P4,P5
Then, no other relation should forbid that ex
Pnew gt P6, Or the system becomes inconsistent
P2
P1
P3
P4
P5
P6
18Inconsistent relations
- FIND VALID REGIONS
- gtIf no inconsistency has been found
A valid region region could be P2,P3,
P3,P3, P3,P4, P4,P5, P5,P5, P5,P6
P2
P1
P3
P4
P5
P6
19Inconsistent relations
End of the first algorithm
202. Finding a minimal set to remove to make the
system consistent
SET OF RELATIONS MAKING THE SYSTEM INCONSISTENT
Algorithm
MINIMUM SET OF RELATIONS MAKING THE SYSTEM
INCONSISTENT
MAXIXMUM SET OF CONSISTENT RELATIONS
212. Finding a minimal set to remove to make the
system consistent
- This short algorithm finds a minimal set. We
will illustrate this with an other example. But
first, we have to introduce the notion of degree
of inconsistency.
22Degree of inconsistency
- Here, if we want to add a new point Pnew such
that - Pnew lt P1, Pnew gt P5
- Pnew lt P2, Pnew gt P6
- Pnew lt P3,
- Pnew lt P4,
P2
P1
P3
P4
P5
P6
23Degree of inconsistency
- From here, we can see that
- Pnew lt P1 conflicts with Pnew gt P5 Pnew lt P3
conflicts with Pnew gt P5 - Pnew lt P1 conflicts with Pnew gt P6 Pnew lt P3
conflicts with Pnew gt P6 - Pnew lt P2 conflicts with Pnew gt P5 Pnew lt P4
conflicts with Pnew gt P5 - Pnew lt P2 conflicts with Pnew gt P6 Pnew lt P4
conflicts with Pnew gt P6
P2
P1
P3
P4
P5
P6
24- Questions before we move to the Algorithm ?
25Algorithm
- Var
- S set of all relations making the system
inconsistent - nS number of relations in S
- R Temporary relation with highest degree of
inconsistency in S - mR degree of inconsistency of R
- I a set of minimal relation to remove in
order to make the system consistent
26Algorithm
- Initialize I to be empty
- While (nS ! 0)
- Find the relation R with highest inconsistent
degree m - nS nS mR
- Remove 1 from every inconsistent degree from
every relation conflicting with R - Record R in I
- Remove every inconsistent relation
conflicting with R from S - Remove R from S
-
27Example
- Let us consider the last example. Here are the
variables of the algorithm.
S
2 Pinc lt P1 Pinc gt P5 4
S P1,P2, P3, P4, P5, P6
2 Pinc lt P1 Pinc gt P6 4
2 Pinc lt P2 Pinc gt P5 4
mR 0
2 Pinc lt P2 Pinc gt P6 4
R
nS relations
2 Pinc lt P3 Pinc gt P5 4
nS 8
2 Pinc lt P3 Pinc gt P6 4
I
2 Pinc lt P4 Pinc gt P5 4
2 Pinc lt P4 Pinc gt P6 4
Degree of inconsistency
28Example
- One relation with highest inconsistency degree is
- Pinc gt P5.
S
2 Pinc lt P1 Pinc gt P5 4
1
S P1,P2, P3, P4, P5, P6
2 Pinc lt P1 Pinc gt P6 4
1
2 Pinc lt P2 Pinc gt P5 4
mR 0
4
1
PincgtP5
2 Pinc lt P2 Pinc gt P6 4
R
1
2 Pinc lt P3 Pinc gt P5 4
nS 8
8 4 4
1
2 Pinc lt P3 Pinc gt P6 4
I
PincgtP5
1
2 Pinc lt P4 Pinc gt P5 4
1
2 Pinc lt P4 Pinc gt P6 4
1
Remove 1 from every inconsistent degree from
every relation conflicting with R
Find the relation R with highest inconsistency
degree
nS nS mR
Record R in I
Remove every inconsistent relation conflicting
with R from S
Remove R from S
29Example
The relation with highest inconsistency degree is
now PincgtP6.
S P1,P2, P3, P4, P6
S
mR 4
4
PincgtP6
R PincgtP5
1 Pinc lt P1 Pinc gt P6 4
0
nS 4
4 4 0
1 Pinc lt P2 Pinc gt P6 4
0
I PincgtP5
PincgtP5 , PincgtP6
1 Pinc lt P3 Pinc gt P6 4
0
1 Pinc lt P4 Pinc gt P6 4
0
n 0, the system is now consistent, and a
minimal set to remove is found I PincgtP5,
PincgtP6
Remove 1 from every inconsistent degree from
every relation conflicting with R
nS nS mR
Find the relation R with highest inconsistency
degree
Record R in I
Remove every inconsistent relation conflicting
with R from S
Remove R from S
30Linking the algorithms
31Linking the algorithms
Choose input
Set constraints
Perform algorithm
Consistent ?
Store Input
Yes
No
Find Set of inconsistent relations
S
Find minimal set to remove to make the system
consistent
I
32- Constraint programming represents one of the
closest approaches computer science has yet made
to the Holy Grail of programming the user states
the problem, the computer solves it. - Eugene C. Freuder, CONSTRAINTS, April 1997
33 34