1 / 21

CSP: Definition, Creation, and Algorithms

CSP: Definition, Creation, and Algorithms. Mr. Tianbing Lin t.lin@ieee.org Dr. Goodwin Scott University of Windsor. Outline. Introduction of Constraint Satisfaction Problem Algorithms: Backtracking, Forward Checking, Back Jump, Dynamic Backtracking Evaluation: Random CSP, N-Queen

rhett
Télécharger la présentation

CSP: Definition, Creation, and Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSP: Definition, Creation, and Algorithms Mr. Tianbing Lin t.lin@ieee.org Dr. Goodwin Scott University of Windsor

  2. Outline • Introduction of Constraint Satisfaction Problem • Algorithms: Backtracking, Forward Checking, Back Jump, Dynamic Backtracking • Evaluation: Random CSP, N-Queen • Experimental Result • Question?

  3. Introduction of CSP • Given a set of variables X={x1, x2…xn} and a finite set Di of possible values (its domain) for every variable. • Given some constraints restricting the values • How to assign values for all the variables so that all the constraints are satisfied?

  4. Introduction of CSP: N-Queen • Variables: Q1, Q2, Q3, Q4 • Domain: {1, 2, 3, 4} • Constraints: Qi<>Qj: Not in the same row |Qi-Qj|<>|i-j|: Not in diagonal • Extentional Constraints: (Q1, Q2): {(1,3), (1,4), (2, 4), (3,1), (4, 1), (4, 2)} (Q1, Q3): …

  5. Introduction of CSP: Graph Coloring • Paint the graph with different colors • 3 Color?

  6. Algorithms: Overview • Systematic Algorithms: Backtracking, Forward Checking… • Search the whole solution space systematically • In most cases, slow • Heuristical Algorithms: Hill-climbing, Simulated Annealing, Genetic Algorithm… • In some cases, fast • Might not get solution at all.

  7. Algorithms: Backtracking

  8. Algorithms: Forward Checking

  9. Algorithms: Back Jumping • if we find all the values of Variable C are invalid because they are conflict with the value of Variable A, then we don't need to change the value of B to check C again. We can directly jump to another value of Variable A, skip other values of B (under A1 value). • N-Queen problem can not demonstrate this algorithm.

  10. Algorithms: Dynamic Backtracking • When we back jump to A from C, we reset value of B. • Do we really have to reset B, if it’s not conflict with A or C? • We dynamically change the order of variables: Before, A->B->C. Now: B->A->C

  11. Algorithms: Dynamic Backtracking • Example of Graph Coloring: We’ve finished painting the 3 slides in the north and 2 slides in the south. We don’t need to change the value of south slides.

  12. Evaluation: N-Queen • N-Queen is a nature test scheme. • Normally a PC can solve 30-Queen problem in reasonable time using above algorithms. • Drawback: Every assignment create (almost) same number of “no-good” for other variables.

  13. Evaluation: Random CSP • Randomized constraints can be created according number of variables, average number of constraints, average tightness. • Use average solving time to compare different algorithms.

  14. Experimental Results

  15. Experimental Results: Sort by Variable Number

  16. Experimental Results: Sort by Tightness

  17. Considering Tightness • Constraint density can’t assure the tightness of the CSP. For example, we have CSP A and CSP B (domain size: 3, 3 variables): • Density of Constraint 1 and Density of Constraint 2 are 33.3%. Solution is empty, so the tightness is 0/27

  18. Considering Tightness • Density of Constraint 1 and Density of Constraint 2 are 33.3%, Can have 9 solutions{(1, 1, 1) (1, 1, 2) (1, 1, 3) (2, 1, 1) (2, 1, 2) (2, 1, 3) (3, 1, 1) (3, 1, 2) (3, 1, 3)}, which means the tightness is 9/27=33%.

  19. Considering Tightness • The smallest constraint density of all the constraints is the maximum value of tightness the CSP can have. The exact value of the tightness depends on the relation of the constraint tables.

  20. Reference • [1] Barták, R., “Constraint Programming: In Pursuit of the Holy Grail”, in Proceedings of the Week of Doctoral Students (WDS99), Part IV, MatFyzPress, Prague, June 1999, pp. 555-564. • [2] Malek Mouhoub, class notes of Artificial Intelligence. • [3] Prosser, P., Binary constraint satisfaction problems: Some are harder than others, Proceedings ECAI-94 (11th European Conference on Artificial Intelligence) • [4] White, S, Enhancing Knowledge Acquisition with Constraint Technology, PhD Thesis, University of Aberdeen • [5] Pedro Meseguer, CSP: Constraint Programming • [6] Joe Culberson and Toby Walsh , Tightness of Constraint Satisfaction Problems • [7] Peter van Beek and Rina Dechter, Constraint Tightness and Looseness versus Local and Global Consistency

  21. Thank you Question?

More Related