Skip to main content

Constraint Satisfaction Problems

  • Chapter
  • First Online:
Fundamentals of Artificial Intelligence
  • 12k Accesses

Abstract

Constraint Satisfaction Problems (CSPs) is a theory about some special type of problems, where every move of search is subject to fulfillment  of certain constraints. The chapter introduces with such problems in the beginning, then presents a formal general model of such problems with analysis, explains the solution approach with the synthesis of constraints using simple, as well extended theory of synthesis. Next, it presents the classes of CSP algorithms—generate and test, backtracking, discusses how efficiency can be increased, propagation of constraints, followed with cryptarithmetics, chapter summary, and then at the end a list of exercises for practicing.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 84.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    A complete graph is one in which all possible edges between pairs of vertices are present.

References

  1. Bitner JR, Reingold EM (1975) Backtrack Program Tech. Communications of the ACM 18(11):651–655

    Article  Google Scholar 

  2. Bordeaux L et al (2006) Propositional satisfiability and constraint programming: a comparative survey. ACM Comput Surv 38(4):1–54. https://doi.org/10.1145/1177352

  3. Cooper MC (1997) Fundamental properties of neighborhood substitution constraint satisfaction problems. Artif Intell 90:1–24

    Google Scholar 

  4. Dorndorf U et al (2000) Constraint propagation techniques for the disjunctive scheduling problem. Artif Intell 122:189–240

    Article  MathSciNet  Google Scholar 

  5. Freuder EC (1978) Synthesizing constraint expressions. Commun ACM 21(11):958–966

    Article  MathSciNet  Google Scholar 

  6. Freuder EC (1985) A sufficient condition for backtrack-bounded search. J ACM 32(4):755–761

    Article  MathSciNet  Google Scholar 

  7. Jerrum M (2010) Constraint satisfaction problems and computational complexity. Commun ACM 53(9):98–106

    Article  Google Scholar 

  8. Michalowski M (2008) A general approach to using problems instance data for model refinement in constraint satisfaction problems. A Dissertation Presented to the Faculty of graduate school, USC, Computer Science Department

    Google Scholar 

  9. Scott H (1991) Cooperative solution of constraint satisfaction problems. Science 254:1181–1182

    Article  Google Scholar 

  10. Solomon W et al (1965) Backtrack programming. J ACM 12(4):516–524

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to K. R. Chowdhary .

Exercises

Exercises

  1. 1.

    How many solutions exists for the map coloring of Indian states (see Fig. 10.1)?

  2. 2.

    A problem called, “Minimal Bandwidth Ordering Problem” is described as follows: Given is a graph \(G = (V, E)\), with V as a set of vertices, E as a set of edges (xy), and \(x, y \in V\). If we order the vertices, the bandwidth of a vertex x is the maximum distance between x and a vertex y that is adjacent to it. The bandwidth of ordering is the maximum bandwidth of all the nodes under that ordering. The minimal bandwidth ordering problem is to find an ordering with the minimum bandwidth.

    1. a.

      Formulate the Minimal Bandwidth Ordering Problem as a CSP. Clearly state the parameters: V, D, C. Ignore the minimization requirement.

    2. b.

      Given part (a) above, describe the topology of the constraint graph.

    3. c.

      Given the part (a), what is the size of the search space?

    4. d.

      Are there any constraint satisfaction techniques effective for solving this optimization problem? If yes, explain such techniques, and if no, justify it.

  3. 3.

    Sudoku can be viewed as a binary constraint satisfaction problem.

    1. a.

      What are the variables of this CSP?

    2. b.

      What are their domains?

    3. c.

      How would you translate the requirement that no two of the same digit may occur in the same row, column, or block into binary constraints?

    4. d.

      Does the requirement that each digit occur at least once in each row, column, or block have to be directly specified? Why or why not?

  4. 4.

    For what size of n, the n-queen problem has no solution, with n in the range 1-10.

  5. 5.

    Find out, what techniques have been used for propagation of constraints at various stages in the solution of the problem 10.9.

  6. 6.

    What algorithms or heuristics are relevant to solving some constraint satisfaction problems in the following situations. Justify your answers.

    1. a.

      The domain sizes of the problem vary significantly: some variables have very large domains (over 1, 000 values) and some have very small domains (less than 10 values).

    2. b.

      The problem is so tightly constrained that it is quite unlikely that a solution exists.

  7. 7.

    Solve the following CSP problems:

    1. a.

      \(TWO + TWO = FOUR\)

    2. b.

      \(ABC + DEF = GHIJ\)

    3. c.

      \(ALFA + BETA + GAMA = DELTA\)

  8. 8.

    Give an algorithm for CSP. Justify that this standard algorithm is a depth-first search (DFS). Can the CSP be implemented as:

    1. a.

      Breadth-first search,

    2. b.

      Best-first search.

    Justify. Also, modify the existing DFS algorithm to work as BFS, and as best-first search.

  9. 9.

    Consider the problem of coloring a complete three-vertex graph with three colors, where the nodes \(X_1\), \(X_2\), \(X_3\) are all the set \(\{r~g~b\}\); \(X_{12}\), \(X_{13}\), and \(X_{23}\) all equal \(\{rg~rb~gr~gb~br~bg\}\) and \(X_{123} = \{rgb~rbg~brg~bgr~grb~gbr\}\), the six possible colorings. Make use of extended synthesizing algorithm to color this graph.

  10. 10.

    For the solution of a CSP problem, explain,

    1. a.

      Why it is good heuristics to first choose a variable that is most constrained?

    2. b.

      Why it is good heuristics to first choose a value of a variable that is least constrained?

  11. 11.

    For the solution of a CSP problem, explain,

    1. a.

      For better heuristics, why it is preferred to first choose a variable that is most constrained?

    2. b.

      For better heuristics, why it is preferred to first choose a value of a variable that is least constrained?

Fig. 10.12
figure 12

Tiles to be colored

  1. 12.

    The Fig. 10.12 shows 9-tiles in the form of variables (\(X_1 \ldots X_9\)) for CSP. Write the steps of an algorithm to color these tiles using RGB colors such that no adjacent tiles have the same color. Also, so the final assignment of colors to these tiles. (Note: A tile is adjacent to others if it is in the same row or column and near to the other.)

  2. 13.

    In a department of engineering, there are teachers (\(T_1 \ldots T_8\)), subjects (courses) (\(S_1\ldots S_6\)), tutorials (\(t_1 \ldots t_3\)), lecture theaters (\(LT_1\) \(\ldots LT_3\)), tutorial rooms (\(tr_1, tr_2\)). The courses and tutorials are to be allocated to teachers and rooms on days (\(D_1 \ldots D_5\)), and periods (\(P_1\ldots P_6\)) in a day. The constraints are: no two subjects be given to a teacher on the same day, the teacher should get subject in the same LT every time, as well as the tutorial class in the same tr. The tutorial \(t_i\) shall be engaged by the same teacher who is engaging the course \(S_i\). Define the \(\langle V, D, C\rangle \), elements of each set, and show the part of the graph for assignment.

  3. 14.

    Consider the following definition of Comma-Free Codes: They have the property that, if \(a_1a_2 \ldots a_k\), and \(b_1b_2 \ldots b_k\) are in the subset, then none of the “overlaps” \(a_2a_3 \ldots a_kb_1,\) \(a_3a_4 \ldots b_1b_2,\) \(\ldots ,\) \(a_kb_1 \ldots b_{k-2}b_{k-1}\) are in the subset. Such a subset is called a comma-free dictionary. This is because, in any “message” consisting of consecutive words from this collection, such as \(a_1a_2 \ldots a_k\), \(b_1b_2 \ldots b_k\), one may omit the commas or other separations between words, without the possibility of ambiguity as to word beginning and ending, even if one begins at a random starting point within the message.

    In an investigation of codes with some synchronization properties, we consider \(n^k\) “words” which consist of k alphabets from a n-symbol alphabet. In this, we look for the largest subset of these words which has the comma-free property.

    As an example with three and four-letter English words: if BOOK and INK were in the dictionary, then KIN could not be in the dictionary because of the ambiguity in booKINk, as it would result to identification of individual words as boo+KIN+k, which is inconsistent.

    Find out other words for n-symbols alphabets, and possible upper limits, if any?

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature India Private Limited

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Chowdhary, K.R. (2020). Constraint Satisfaction Problems. In: Fundamentals of Artificial Intelligence. Springer, New Delhi. https://doi.org/10.1007/978-81-322-3972-7_10

Download citation

  • DOI: https://doi.org/10.1007/978-81-322-3972-7_10

  • Published:

  • Publisher Name: Springer, New Delhi

  • Print ISBN: 978-81-322-3970-3

  • Online ISBN: 978-81-322-3972-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics