Time: 1.5 hours
Constraint satisfaction problem
(CSP) (約束滿足問題)
Definition: "mathematical problems defined as a set of objects whose state must satisfy a number of constraints or limitations" (Wikipedia)
屬於AI和Operation Research研究的領域.
可以建模為CSP的問題有: 四色問題, Sudoku等.
Formal definition
Formally, a constraint satisfaction problem is defined as a triple , where X is a set of variables, D is a domain of values, and C is a set of constraints. Every constraint is in turn a pair , where t is a tuple of variables and R is a set of tuples of values; all these tuples having the same number of elements; as a result R is a relation.
An evaluation of the variables is a function from variables to domains, . Such an evaluation satisfies a constraint if . A solution is an evaluation that satisfies all constraints.
Example
求解CSP問題的方法
Constraint satisfaction problems on finite domains are typically solved using a form of search.
Backtracking
Constraint learning
Constraint propagation
Local search
Constraint optimization problem (COP) (約束最佳化問題)
定義
"defined as a regular constraint satisfaction problem in which constraints are weighted and the goal is to find a solution maximizing the weight of satisfied constraints." (Wikipedia)
定義一個objective function, 對於CSP的每一個解, 計算出objective function的值. 使objective function的值最優的就是COP的解.
(4C Outreach Programme)
IP與CP的比較
CP: a much richer constraint language
IP: more efficient algorithms to solve linear arithmetic constraints
Constraint programming (約束編程)
"a programming paradigm where relations between variables are stated in the form of constraints" (Wikipedia)
是一種declarative programming, 不像imperative programming需要指定執行的步驟.
Constraint programming最早源於constraint logic programming, 當前比較流行的CLP語言如Prolog.
部分imperative programming語言通過獨立的包來支援constraint programming, 比如Choco (for Java), Comet( for C). etc.
另外Common Lisp也支援constraint programming.
有專門針對CP的國際會議: International Conference on Principles and Practice of Constraint Programming(一年一屆, 今年第15屆了)
References
* Wikipedia,
* CSP Tutorial, http://4c.ucc.ie/web/outreach/tutorial.html
* Michela Milano, Chapter 3, Branch-and-infer: a framework for combining CP and IP, Constraint and integer programming: toward a unified methodology, Google Books