In artificial intelligence and operations research, a Weighted Constraint Satisfaction Problem (WCSP), also known as Valued Constraint Satisfaction Problem (VCSP), is a generalization of a constraint satisfaction problem (CSP) where some of the constraints can be violated (according to a violation degree) and in which preferences among solutions can be expressed. This generalization makes it possible to represent more real-world problems, in particular those that are over-constrained (no solution can be found without violating at least one constraint), or those where we want to find a minimal-cost solution (according to a cost function) among multiple possible solutions.
A Weighted Constraint Network (WCN), aka Cost Function Network (CFN), is a triplet ⟨ X , C , k ⟩ {\displaystyle \langle X,C,k\rangle } where X is a finite set of discrete variables, C is a finite set of soft constraints and k > 0 {\displaystyle k>0} is either a natural integer or ∞ {\displaystyle \infty } .
Each soft constraint c S ∈ C {\displaystyle c_{S}\in C} involves an ordered set S of variables, called its scope, and is defined as a cost function from l ( S ) {\displaystyle l(S)} to ⟨ 0 , . . . , k ⟩ {\displaystyle \langle 0,...,k\rangle } where l ( S ) {\displaystyle l(S)} is the set of possible instantiations of S. When an instantiation I ∈ l ( S ) {\displaystyle I\in l(S)} is given the cost k, i.e., c S ( I ) = k {\displaystyle c_{S}(I)=k} , it is said forbidden. Otherwise it is permitted with the corresponding cost (0 being completely satisfactory).
In WCSP, specific subclass of Valued CSP (VCSP),[1] costs are combined with the specific operator ⊕ {\displaystyle \oplus } defined as:
The partial inverse of ⊕ {\displaystyle \oplus } is ⊖ {\displaystyle \ominus } defined by:
Without any loss of generality, the existence of a nullary constraint c ∅ {\displaystyle c_{\emptyset }} (a cost) as well as the presence of a unary constraint c x {\displaystyle c_{x}} for every variable x is assumed.
The total cost of a complete instantiation I ∈ l ( X ) {\displaystyle I\in l(X)} is the bounded sum of the cost of I on c S {\displaystyle c_{S}} for all soft constraint c S ∈ C {\displaystyle c_{S}\in C} , including the nullary cost c ∅ {\displaystyle c_{\emptyset }} and the unary costs for I of the variables in X.
Considering a WCN/CFN, the usual (NP-hard) task of WCSP is to find a complete instantiation with a minimal cost. Other tasks in the related field of graphical model can be defined.[2]
Node consistency (NC) and Arc consistency (AC), introduced for the Constraint Satisfaction Problem (CSP), have been studied later in the context of WCSP. Furthermore, several consistencies about the best form of arc consistency have been proposed: Full Directional Arc consistency (FDAC),[3] Existential Directional Arc consistency (EDAC),[4] Virtual Arc consistency (VAC)[5] and Optimal Soft Arc consistency (OSAC).[6]
Algorithms enforcing such properties are based on Equivalence Preserving Transformations (EPTs) that allow safe moves of costs among constraints. Three basic costs transfer operations are:
The goal of Equivalence Preserving Transformations is to concentrate costs on the nullary constraint c ∅ {\displaystyle c_{\emptyset }} and remove efficiently instantiations and values with a cost, added to c ∅ {\displaystyle c_{\emptyset }} , that is greater than or equal to the forbidden cost or the cost of the best solution found so far. A branch-and-bound method is typically used to solve WCSPs, with lower bound c ∅ {\displaystyle c_{\emptyset }} and upper bound k.
An alternative to cost transfer algorithms is the algorithm PFC-MRDAC[7] which is a classical branch and bound algorithm that computes lower bound l b {\displaystyle lb} at each node of the search tree, that corresponds to an under-estimation of the cost of any solution that can be obtained from this node. The cost of the best solution found is u b {\displaystyle ub} . When l b ≥ u b {\displaystyle lb\geq ub} , then the search tree from this node is pruned.
Another more recent approach is based on super-reparametrizations[8] which allows to relax the problem to compute tighter bounds.
Cost transfer algorithms have been shown to be particularly efficient to solve real-world problem when soft constraints are binary or ternary (maximal arity of constraints in the problem is equal to 2 or 3). For soft constraints of large arity, cost transfer becomes a serious issue because the risk of combinatorial explosion has to be controlled.
An algorithm, called GACw-WSTR,[9] has been proposed to enforce a weak version of the property Generalized Arc Consistency (GAC) on soft constraints defined extensionally by listing tuples and their costs. This algorithm combines two techniques, namely, Simple Tabular Reduction (STR)[10] and cost transfer. Values that are no longer consistent with respect to GAC are identified and minimum costs of values are computed. This is particularly useful for efficiently performing projection operations that are required to establish GAC.
Global cost functions with a dedicated semantic (e.g. SoftAllDifferent, SoftAmong) and polytime complexity have been also studied.[11]
Many real-world WCSP benchmarks are available on http://genoweb.toulouse.inra.fr/~degivry/evalgm[12] and https://forgemia.inra.fr/thomas.schiex/cost-function-library (older version at http://costfunction.org/en/benchmark). More MaxCSP benchmarks available on http://www.cril.univ-artois.fr/~lecoutre/#/benchmarks (deprecated site, see also http://xcsp.org/series).