Presentation is loading. Please wait.

Presentation is loading. Please wait.

Constraint Satisfaction Problems and Consistency Restoration Florent Launay Undergraduate student at FIT.

Similar presentations


Presentation on theme: "Constraint Satisfaction Problems and Consistency Restoration Florent Launay Undergraduate student at FIT."— Presentation transcript:

1 Constraint Satisfaction Problems and Consistency Restoration Florent Launay Undergraduate student at FIT

2 Summary Focused interest in time point-sequencing problem. Focused interest in time point-sequencing problem. What are CSP’s ? What are CSP’s ? Crossword Problem. Crossword Problem. Dealing with consistency. Dealing with consistency. 1. Finding and storing consistent relations 1. Finding and storing consistent relations 2. Finding a “minimal set to remove inconsistency” 2. Finding a “minimal set to remove inconsistency” Linking the algorithms Linking the algorithms Questions, comments. Questions, comments. The Program The Program

3 Focus interest Relation from {, =, <>, =, } P1P2P3 Here, we can see that some constraints between the set of points {P1, P2, P3} exist : P1 < P2 P2 < P3

4 What are CSP’s ? Constraints Constraints X >= 5X <> 9X < 12

5 What are CSP’s ? Example : Example : Common names from English vocabulary beginning with a ‘c’, ending with a ‘t’, but that doesn’t contain any ‘e’… Valid set : {‘count’, ‘cart’, ‘chat’, ‘court’, …}

6 What are CSP’s ? Valid regions and ‘Box’ Valid regions and ‘Box’ 5912 X >= 5X <> 9X < 12 Valid regions = {[5,5], [5,9], [9,12]} X < 15X > 3 153

7 What are CSP’s ? Inconsistencies Inconsistencies 5912 X >= 5X <> 9X < 12X > 13 13 No valid region => The system is inconsistent

8 The crossword problem Constraints Valid Set Inconsistency Definition, Size of the world, across or down, eventual existing letters. Definition 13 : Part of the human body, beginning with an ‘H’ (ambiguous) E A D ?A N D ?A I RH O W Definition 14 : Negation {[HEAD], [HAND], [HAIR]} NOTNOT A N D

9 Dealing with consistency Within a set of relations, some relation can conflict with other relations in a system, making the whole system inconsistent. Within a set of relations, some relation can conflict with other relations in a system, making the whole system inconsistent. Let’s have a look to the following example.

10 A simple example Let s consider a point P1 on a time line basis :

11 A simple example Valid region P2 P2>P1 P3 P2 P1 No valid region can be found for P3 !!!

12 Dealing with consistency With that kind of inconsistency, two interesting questions arise: With that kind of inconsistency, two interesting questions arise: Which are the relations that make the system inconsistent ? Which are the relations that make the system inconsistent ? What would be a minimal set to remove to make the system consistent ? What would be a minimal set to remove to make the system consistent ?

13 1. Finding and storing inconsistent relations System of relations Consistent YES NO Finish Store inconsistent relations Finish (Call the 2nd algorithm)

14 Inconsistent relations FIND MULTIPLE EQUALITY FIND MULTIPLE EQUALITY =>Store inconsistent relations VERIFY CONSISTENCY IN CASE OF UNIQUE EQUALITY VERIFY CONSISTENCY IN CASE OF UNIQUE EQUALITY =>Store inconsistent relations FIND THE BOX: PRE-PROCESSING FIND THE BOX: PRE-PROCESSING =>Store inconsistent relations FIND VALID REGIONS FIND VALID REGIONS =>If no inconsistency has been found

15 Inconsistent relations FIND MULTIPLE EQUALITY FIND MULTIPLE EQUALITY P2P1P3P4P5P6 If Pnew = P3 Pnew And Pnew = P6 The system is inconsistent since P3<>P6

16 Inconsistent relations VERIFY CONSISTENCY IN CASE OF UNIQUE EQUALITY VERIFY CONSISTENCY IN CASE OF UNIQUE EQUALITY P2P1P3P4P5P6 Pnew If Pnew = P3 And Pnew < P2 The system is inconsistent

17 Inconsistent relations FIND THE BOX: PRE-PROCESSING FIND THE BOX: PRE-PROCESSING P2P1P3P4P5P6 If If we found that a valid region for Pnew was {[P3,P4], [P4,P5]} Then, no other relation should forbid that : ex Pnew > P6, Or the system becomes inconsistent

18 Inconsistent relations FIND VALID REGIONS FIND VALID REGIONS =>If no inconsistency has been found P2P1P3P4P5P6 A valid region region could be : {[P2,P3], [P3,P3], [P3,P4], [P4,P5], [P5,P5], [P5,P6]} {[P2,P3], [P3,P3], [P3,P4], [P4,P5], [P5,P5], [P5,P6]}

19 Inconsistent relations End of the first algorithm…

20 2. 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

21 2. 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”.

22 Degree of inconsistency Here, if we want to add a new point Pnew such that: Pnew P5 Pnew P6 Pnew < P3, Pnew < P4, P2P1P3P4P5P6

23 Degree of inconsistency From here, we can see that : Pnew P5 Pnew P5 Pnew P6Pnew P6 Pnew P5Pnew P5 Pnew P6Pnew P6 P2P1P3P4P5P6

24 Questions before we move to the Algorithm ? Questions before we move to the Algorithm ?

25 Algorithm Var: Var: S = set of all relations making the system inconsistent n S = number of relations in S R = Temporary relation with highest degree of inconsistency in S m R = degree of inconsistency of R I = a set of minimal relation to remove in order to make the system consistent

26 Algorithm Initialize I to be empty; Initialize I to be empty; While (n S != 0) { * Find the relation R with highest inconsistent degree m; * n S = n S – m R ; * 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; }

27 Example Let us consider the last example. Here are the variables of the algorithm. Let us consider the last example. Here are the variables of the algorithm. S= {P1,P2, P3, P4, P5, P6} 2 Pinc P5 4 2 Pinc P5 4 2Pinc P6 4 2 Pinc P6 4 2Pinc P5 4 2 Pinc P5 4 2Pinc P6 4 2 Pinc P6 4 2 Pinc P5 4 2 Pinc P5 4 2 Pinc P6 4 2 Pinc P6 4 n S = 8 R = {} m R = 0 I = {} S S n S relations Degree of inconsistency

28 Example One relation with highest inconsistency degree is : One relation with highest inconsistency degree is : Pinc > P5. S= {P1,P2, P3, P4, P5, P6} 2 Pinc P5 4 2 Pinc P5 4 2Pinc P6 4 2 Pinc P6 4 2Pinc P5 4 2 Pinc P5 4 2Pinc P6 4 2 Pinc P6 4 2 Pinc P5 4 2 Pinc P5 4 2 Pinc P6 4 2 Pinc P6 4 n S = 8 R = {} m R = 0 I = {} S 8 – 4 = 4 {Pinc>P5} 4 {Pinc>P5} 1 1 1 1 Find the relation R with highest inconsistency degreen S = n S – m R Remove 1 from every inconsistent degree from every relation conflicting with R Record R in IRemove every inconsistent relation conflicting with R from SRemove R from S 1 1 1 1

29 Example The variables are now : The variables are now : S= {P1,P2, P3, P4, P6} 1Pinc P6 4 1 Pinc P6 4 n S = 4 R = {Pinc>P5} m R = 4 I = {Pinc>P5} S The relation with highest inconsistency degree is now Pinc>P6. 4 {Pinc>P6} 4 – 4 = 0 {Pinc>P5, Pinc>P6} n = 0, the system is now consistent, and a minimal set to remove is found : I = {Pinc>P5, Pinc>P6} is found : I = {Pinc>P5, Pinc>P6} Find the relation R with highest inconsistency degree n S = n S – m R Remove 1 from every inconsistent degree from every relation conflicting with R Record R in IRemove every inconsistent relation conflicting with R from SRemove R from S 0 0 0 0

30 Linking the algorithms

31 Consistent ? Store Input Yes No Find Set of inconsistent relations Find minimal set to remove to make the system consistent Set constraints Choose input S I Perform algorithm

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.” ”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 CONSTRAINTS

33 Questions, comments ? Questions, comments ?

34 The Program… The Program…


Download ppt "Constraint Satisfaction Problems and Consistency Restoration Florent Launay Undergraduate student at FIT."

Similar presentations


Ads by Google