Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Constraint satisfaction
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
In [[artificial intelligence]] and [[operations research]], '''constraint satisfaction''' is the process of finding a solution through a set of [[Constraint (mathematics)|constraint]]s that impose conditions that the [[Variable (mathematics)|variables]] must [[satisfiability|satisfy]].<ref name="Tsang2014">{{cite book|first=Edward|last=Tsang|title=Foundations of Constraint Satisfaction: The Classic Text|url=https://books.google.com/books?id=UFmRAwAAQBAJ|date=13 May 2014|publisher=BoD – Books on Demand|isbn=978-3-7357-2366-6|access-date=25 August 2018|archive-date=6 October 2024|archive-url=https://web.archive.org/web/20241006110429/https://books.google.com/books?id=UFmRAwAAQBAJ|url-status=live}}</ref> A solution is therefore an assignment of values to the variables that satisfies all constraints—that is, a point in the [[feasible region]]. The techniques used in constraint satisfaction depend on the kind of constraints being considered. Often used are [[Finite domain constraint|constraints on a finite domain]], to the point that [[constraint satisfaction problem]]s are typically identified with problems based on constraints on a finite domain. Such problems are usually solved via [[Search algorithm|search]], in particular a form of [[backtracking]] or [[local search (constraint satisfaction)|local search]]. [[Constraint propagation]] is another family of methods used on such problems; most of them are incomplete in general, that is, they may solve the problem or prove it unsatisfiable, but not always. Constraint propagation methods are also used in conjunction with search to make a given problem simpler to solve. Other considered kinds of constraints are on [[real number|real]] or [[rational number|rational]] numbers; solving problems on these constraints is done via [[variable elimination]] or the [[simplex algorithm]]. Constraint satisfaction as a general problem originated in the field of [[artificial intelligence]] in the 1970s (see for example {{Harv|Laurière|1978}}). However, when the constraints are expressed as multivariate [[linear equation]]s defining (in)equalities, the field goes back to [[Joseph Fourier]] in the 19th century: [[George Dantzig]]'s invention of the [[simplex algorithm]] for [[linear programming]] (a special case of mathematical optimization) in 1946 has allowed determining feasible solutions to problems containing hundreds of variables. During the 1980s and 1990s, embedding of constraints into a [[programming language]] was developed. The first language devised expressly with intrinsic support for [[constraint programming]] was [[Prolog]]. Since then, constraint-programming libraries have become available in other languages, such as [[C++]] or [[Java (programming language)|Java]] (e.g., Choco for Java<ref>Choco: An Open-Source java library for constraint programming. https://choco-solver.org Accessed Dec 12, 2021.</ref>). ==Constraint satisfaction problem== {{main|Constraint satisfaction problem}} As originally defined in artificial intelligence, constraints enumerate the possible values a set of variables may take in a given world. A [[possible world]] is a total assignment of values to variables representing a way the world (real or imaginary) could be.<ref>{{Cite web | url=https://artint.info/2e/html/ArtInt2e.Ch4.S1.SS1.html | title=4.1.1 Variables and Worlds‣ 4.1 Possible Worlds, Variables, and Constraints ‣ Chapter 4 Reasoning with Constraints ‣ Artificial Intelligence: Foundations of Computational Agents, 2nd Edition | access-date=2018-11-29 | archive-date=2018-11-29 | archive-url=https://web.archive.org/web/20181129100131/https://artint.info/2e/html/ArtInt2e.Ch4.S1.SS1.html | url-status=live }}</ref> Informally, a finite domain is a finite set of arbitrary elements. A constraint satisfaction problem on such domain contains a set of variables whose values can only be taken from the domain, and a set of constraints, each constraint specifying the allowed values for a group of variables. A solution to this problem is an evaluation of the variables that satisfies all constraints. In other words, a solution is a way for assigning a value to each variable in such a way that all constraints are satisfied by these values. In some circumstances, there may exist additional requirements: one may be interested not only in the solution (and in the fastest or most computationally efficient way to reach it) but in how it was reached; e.g. one may want the "simplest" solution ("simplest" in a logical, non-computational sense that has to be precisely defined). This is often the case in logic games such as [[Sudoku]]. In practice, constraints are often expressed in compact form, rather than enumerating all the values of the variables that would satisfy the constraint. One of the most-used constraints is the (obvious) one establishing that the values of the affected variables must be all different. Problems that can be expressed as constraint satisfaction problems are the [[eight queens puzzle]], the [[Sudoku]] solving problem and many other logic puzzles, the [[Boolean satisfiability problem]], [[Scheduling (production processes)|scheduling]] problems, [[interval propagation|bounded-error estimation]] problems and various problems on graphs such as the [[graph coloring]] problem. While usually not included in the above definition of a constraint satisfaction problem, arithmetic equations and inequalities bound the values of the variables they contain and can therefore be considered a form of constraints. Their domain is the set of numbers (either integer, rational, or real), which is infinite: therefore, the relations of these constraints may be infinite as well; for example, <math>X=Y+1</math> has an infinite number of pairs of satisfying values. Arithmetic equations and inequalities are often not considered within the definition of a "constraint satisfaction problem", which is limited to finite domains. They are however used often in [[constraint programming]]. It can be shown that the arithmetic inequalities or equations present in some types of finite logic puzzles such as [[Futoshiki]] or [[Kakuro]] (also known as Cross Sums) can be dealt with as non-arithmetic constraints (see ''Pattern-Based Constraint Satisfaction and Logic Puzzles''<ref name="Pattern-Based Constraint Satisfaction and Logic Puzzles">{{in lang|en}} {{cite news | first = Denis | last = Berthier | title = Pattern-Based Constraint Satisfaction and Logic Puzzles | url = http://www.carva.org/denis.berthier/PBCS | archive-url = https://archive.today/20130112121944/http://www.carva.org/denis.berthier/PBCS | url-status = dead | archive-date = 12 January 2013 | work = Lulu Publishers | isbn = 978-1-291-20339-4 | date = 20 November 2012 | accessdate = 24 October 2012 }}</ref>). ===Solving=== Constraint satisfaction problems on finite domains are typically solved using a form of [[Search algorithm|search]]. The most-used techniques are variants of [[backtracking]], [[constraint propagation]], and [[Local search (optimization)|local search]]. These techniques are used on problems with [[nonlinear]] constraints. [[Variable elimination]] and the [[simplex algorithm]] are used for solving [[linear]] and [[polynomial]] equations and inequalities, and problems containing variables with infinite domain. These are typically solved as [[Optimization (mathematics)|optimization]] problems in which the optimized function is the number of violated constraints. ===Complexity=== {{main|Complexity of constraint satisfaction}} Solving a constraint satisfaction problem on a finite domain is an [[NP-complete]] problem with respect to the domain size. Research has shown a number of [[Tractable problem|tractable]] subcases, some limiting the allowed constraint relations, some requiring the scopes of constraints to form a tree, possibly in a reformulated version of the problem. Research has also established relationships of the constraint satisfaction problem with problems in other areas such as [[finite model theory]]. ==Constraint programming== {{main|Constraint programming}} Constraint programming is the use of constraints as a programming language to encode and solve problems. This is often done by embedding constraints into a [[programming language]], which is called the host language. Constraint programming originated from a formalization of equalities of [[term (logic)|term]]s in [[Prolog II]], leading to a general framework for embedding constraints into a [[logic programming]] language. The most common host languages are [[Prolog]], [[C++]], and [[Java (programming language)|Java]], but other languages have been used as well. ===Constraint logic programming=== {{main|Constraint logic programming}} A constraint logic program is a [[Logic programming|logic program]] that contains constraints in the bodies of clauses. As an example, the clause <code>A(X):-X>0,B(X)</code> is a clause containing the constraint <code>X>0</code> in the body. Constraints can also be present in the goal. The constraints in the goal and in the clauses used to prove the goal are accumulated into a set called [[constraint store]]. This set contains the constraints the interpreter has assumed satisfiable in order to proceed in the evaluation. As a result, if this set is detected unsatisfiable, the interpreter backtracks. Equations of terms, as used in logic programming, are considered a particular form of constraints, which can be simplified using [[unification (computing)|unification]]. As a result, the constraint store can be considered an extension of the concept of [[substitution (logic)|substitution]] that is used in regular logic programming. The most common kinds of constraints used in constraint logic programming are constraints over integers/rational/real numbers and constraints over finite domains. [[Concurrent constraint logic programming]] languages have also been developed. They significantly differ from non-concurrent constraint logic programming in that they are aimed at programming [[concurrent process]]es that may not terminate. [[Constraint handling rules]] can be seen as a form of concurrent constraint logic programming, but are also sometimes used within a non-concurrent constraint logic programming language. They allow for rewriting constraints or to infer new ones based on the truth of conditions. ===Constraint satisfaction toolkits=== Constraint satisfaction toolkits are [[Software library|software libraries]] for [[imperative programming language]]s that are used to encode and solve a constraint satisfaction problem. * [[Cassowary constraint solver]], an [[open source]] project for constraint satisfaction (accessible from C, Java, Python and other languages). * Comet, a commercial programming language and toolkit * [[Gecode]], an open source portable toolkit written in C++ developed as a production-quality and highly efficient implementation of a complete theoretical background. * [[Gelisp]], an open source portable wrapper of [[Gecode]] to [[Lisp (programming language)|Lisp]].<ref>Mauricio Toro, Carlos Agon, Camilo Rueda, Gerard Assayag. "[http://www.jatit.org/volumes/Vol86No2/17Vol86No2.pdf GELISP: A FRAMEWORK TO REPRESENT MUSICAL CONSTRAINT SATISFACTION PROBLEMS AND SEARCH STRATEGIES] {{Webarchive|url=https://web.archive.org/web/20241006110337/http://www.jatit.org/volumes/Vol86No2/17Vol86No2.pdf |date=2024-10-06 }}." Journal of Theoretical and Applied Information Technology 86 (2). 2016. 327-331.</ref> http://gelisp.sourceforge.net/ * [[IBM]] [[ILOG]] [http://www.ibm.com/analytics/cplex-cp-optimizer CP Optimizer]: C++, [https://pypi.python.org/pypi/docplex Python], Java, .NET libraries (proprietary, [https://ibm.biz/COS_Faculty free for academic use]).<ref name="CPOptimizer2018">{{cite journal|vauthors=Laborie P, Rogerie J, Shaw P, Vilim P|date=2018|title=IBM ILOG CP optimizer for scheduling|journal=Constraints|volume=23|issue=2|pages=210–250|doi=10.1007/s10601-018-9281-x|s2cid=4360357}}</ref> Successor of ILOG Solver/Scheduler, which was considered the market leader in commercial constraint programming software as of 2006<ref name="RossiBeek2006">{{cite book|first1=Francesca|last1=Rossi|author1-link=Francesca Rossi|author2=Peter Van Beek|author3=Toby Walsh|title=Handbook of constraint programming|url=https://books.google.com/books?id=Kjap9ZWcKOoC&pg=PA157|year=2006|publisher=Elsevier|isbn=978-0-444-52726-4|page=157}}</ref> * [[JaCoP (solver)|JaCoP]], an open source Java constraint solver. * [[Koalog]], a commercial Java-based constraint solver. * [[logilab-constraint]], an open source constraint solver written in pure Python with constraint propagation algorithms. * [[Minion (solver)|Minion]], an open-source constraint solver written in C++, with a small language for the purpose of specifying models/problems. * ZDC, an open source program developed in the [[Computer-Aided Constraint Satisfaction Project]] for modelling and solving constraint satisfaction problems. ===Other constraint programming languages=== Constraint toolkits are a way for embedding constraints into an [[imperative programming language]]. However, they are only used as external libraries for encoding and solving problems. An approach in which constraints are integrated into an imperative programming language is taken in the [[Kaleidoscope programming language]]. Constraints have also been embedded into [[Functional programming|functional programming languages]]. == See also == * [[Constraint satisfaction problem]] * [[Constraint (mathematics)]] * [[Candidate solution]] * [[Boolean satisfiability problem]] * [[Decision theory]] * [[Satisfiability modulo theories]] * [[Knowledge-based configuration]] ==References== {{Reflist}} {{Refbegin}} *{{cite book | last=Apt | first=Krzysztof | author-link=Krzysztof R. Apt | title=Principles of constraint programming | publisher=Cambridge University Press | year=2003 | isbn=978-0-521-82583-2 | url-access=registration | url=https://archive.org/details/principlesofcons0000aptk }} *{{cite book | last=Dechter | first=Rina | title=Constraint processing | publisher=Morgan Kaufmann | year=2003 | url=https://archive.org/details/constraintproces00rina | isbn=978-1-55860-890-0 }} *{{cite journal | last1=Dincbas | first1=M. | last2=Simonis | first2=H. | last3=Van Hentenryck | first3=P. | year= 1990 | title=Solving Large Combinatorial Problems in Logic Programming | journal=[[Journal of Logic Programming]] | volume=8 | issue=1–2 | pages=75–93 | doi=10.1016/0743-1066(90)90052-7 | doi-access=free }} *{{cite book |editor-first=Eugene |editor-last=Freuder |editor2-first=Alan |editor2-last=Mackworth |title=Constraint-based reasoning |publisher=MIT Press |isbn=978-0-262-56075-7 |year=1994 |url=https://books.google.com/books?id=7EVjkM8_A_gC |access-date=2020-12-27 |archive-date=2024-10-06 |archive-url=https://web.archive.org/web/20241006110431/https://books.google.com/books?id=7EVjkM8_A_gC |url-status=live }} *{{cite book | last=Frühwirth | first=Thom |author2=Slim Abdennadher | title=Essentials of constraint programming | year=2003 | publisher=Springer | isbn=978-3-540-67623-2 }} *{{cite book | last=Guesguen | first=Hans |author2=Hertzberg Joachim | title=A Perspective of Constraint Based Reasoning | year=1992 | publisher=Springer | isbn=978-3-540-55510-0 }} *{{cite journal | last=Jaffar | first=Joxan |author2=Michael J. Maher | title=Constraint logic programming: a survey | journal=Journal of Logic Programming | volume=19/20 | pages=503–581 | year=1994 | doi=10.1016/0743-1066(94)90033-7 | doi-access=free }} *{{cite journal | last=Laurière | first=Jean-Louis | year=1978 | title=A Language and a Program for Stating and Solving Combinatorial Problems | journal=[[Artificial Intelligence (journal)|Artificial Intelligence]] | volume=10 | issue=1 | pages=29–127 | doi=10.1016/0004-3702(78)90029-2 }} *{{cite book | last=Lecoutre | first=Christophe | title=Constraint Networks: Techniques and Algorithms | publisher=ISTE/Wiley | year=2009 | url=http://www.iste.co.uk/index.php?f=a&ACTION=View&id=250 | isbn=978-1-84821-106-3 | access-date=2009-09-06 | archive-date=2017-11-07 | archive-url=https://web.archive.org/web/20171107071437/http://www.iste.co.uk/index.php?f=a&ACTION=View&id=250 | url-status=live }} *{{cite book | last=Marriott | first=Kim |author2=Peter J. Stuckey | title=Programming with constraints: An introduction | year=1998 | publisher=MIT Press | isbn=978-0-262-13341-8 }} *{{cite book | editor-last=Rossi | editor-first=Francesca | editor2=Peter van Beek | editor3=Toby Walsh | title=Handbook of Constraint Programming | publisher=Elsevier | year=2006 | url=http://www.elsevier.com/wps/find/bookdescription.cws_home/708863/description#description | isbn=978-0-444-52726-4 | access-date=2006-10-13 | archive-url=https://web.archive.org/web/20121004035038/http://www.elsevier.com/wps/find/bookdescription.cws_home/708863/description#description | archive-date=2012-10-04 | url-status=dead }} *{{cite book | first=Edward | last=Tsang | title=Foundations of Constraint Satisfaction | publisher=Academic Press | year=1993 | url=http://www.bracil.net/edward/FCS.html | isbn=978-0-12-701610-8 | access-date=2007-06-07 | archive-date=2021-04-23 | archive-url=https://web.archive.org/web/20210423052600/https://www.bracil.net/edward/fcs.html | url-status=live }} *{{cite book | first=Pascal | last=Van Hentenryck | title=Constraint Satisfaction in Logic Programming | publisher=MIT Press | year=1989 | isbn=978-0-262-08181-8 | url=https://archive.org/details/Constraint_00_VanH }} *{{cite journal | last1=Rashidi | first1=Hassan. | last2=Tsang | first2=Edward. | year= 2012 | title=Novel constraints satisfaction models for optimization problems in container terminals | journal=Journal of Applied Mathematical Modelling | volume=37 | issue=6 | pages=3601–34 | doi=10.1016/j.apm.2012.07.042 | doi-access=free }} {{Refend}} ==External links== *[https://web.archive.org/web/20090211163302/http://4c.ucc.ie/web/outreach/tutorial.html CSP Tutorial] ===Videos=== *[https://www.youtube.com/watch?v=J4xMBJNy41w Constraint Satisfaction Lecture by Dr Madhu Sharma (3:47)] *[https://www.youtube.com/watch?v=wrs6Lvo5LZM Introduction of Constraint Satisfaction Problems by Edward Tsang (7:34)] *[https://www.youtube.com/watch?v=UhAmM3z6KS0 Constraint Satisfaction Problems by Wheeler Ruml (9:18)] *[https://www.youtube.com/watch?v=il20Q5tXp-A Lecture on Constraint Satisfaction Problems by Indian Institute of Technology Madras (51:59)] *[https://www.youtube.com/watch?v=hJ9WOiueJes Lecture on CSPs (1:16:39)] *[https://www.youtube.com/watch?v=595zA9OXCns Lecture on Constraint Satisfaction Problems by Berkeley AI (1:17:38)] *[https://www.youtube.com/watch?v=il20Q5tXp-A Graduate Course in AI 5: Constraint Satisfaction by Prof Mausam (1:34:29)] {{Major subfields of optimization}} {{Authority control}} [[Category:Constraint programming|*]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite news
(
edit
)
Template:Cite web
(
edit
)
Template:Harv
(
edit
)
Template:In lang
(
edit
)
Template:Main
(
edit
)
Template:Major subfields of optimization
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:Webarchive
(
edit
)