Chapter 2 Preliminaries: an overview of optimisation techniques
2.3 Summary of solution approaches to combinatorial optimisation problems
2.4.1 Propagation
Constraint propagation removes (some) inconsistent values from their corresponding domains, based on the considerations on the individual constraints. By doing so, the search space can be significantly reduced. Hence, constraint propagation is essential to make constraint programming solvers efficient.
LetCbe a constraint on the variables x1, x2… xnwith respective domainsD= D1, D2…
Dn, apropagation algorithmforCremoves the values fromD= D1, D2… Dnthat do not
participate in a solution toC.
Let P=(X, D, C) be a CSP. We transform P into a smaller CSP P’ by repeatedly applying the propagation algorithms for all constraints in C until there is no more domain reduction. This process is called constraint propagation. When the process terminates, we say that each constraint, and the CSP, is locally consistent and that we have achieved a notion of local consistency on the constraints and the CSP. The term
local consistencyreflects that we do not obtain a globally consistent CSP, but a CSP in which each constraint is locally consistent.
We begin by introducing the node consistency that deals with the unary constraints. Then we introduce the most popular notion of local consistency, thearc consistencythat deals with the binary constraints. Then we discuss its natural generalisation to arbitrary constraints, called the hyper-arc consistency (also called generalised arc consistency GAC). Other consistency and a thorough description of the process of constraint propagation are given by [3].
Definition 6 (node consistent): We call a CSP node consistent if for every variable x,
every unary constraint onxcoincides with the domain ofx.
Example 5 (node consistent): Consider a CSP with constraints defined in the form (C, x1≥0… xn≥0; x1N x... nN),where C does not contain any unary constraints and N
denotes the set of natural numbers. This CSP is node consistent, since for each variable its unique unary constraint is satisfied by all the values in the variable domain.
Definition 7 (arc consistent): Consider a binary constraint C on the variables x and y
with a domain of Dxand Dy respectively, that is CDxDy. We call Carc consistent
if , , ( , ) , , , ( , ) , x y y x a D b D a b C b D a D a b C
We call a CSP arc consistent if all its binary constraints are arc consistent.
Example 6 (arc consistent): Consider a CSP with two variables x and y over the domainDx= [5…10] andDy= [3…7], and only one constraint,x<y. This CSP is not arc
consistent. For instance, take the value 8 on the domain of x, there is no y in domain such that 8<y.
Definition 8 (generalised arc consistent): The notion of arc consistency can be generalised in a natural way to arbitrary constraints. A constraint C is generalised arc consistent if for every involved domain, each element of it participates in a solution toC. We call a CSP generalised arc consistent if all its constraints are generalised arc consistent.
Example 7 (generalised arc consistent):Consider again the CSP in Example 3, i.e.
1 2 3 1 2 {2, 3}, {1, 2,3, 4}, {1, 2}, 4, (2-4) ( , , ) (2-5) x x x x x AllDifferent x x x
We apply constraint propagation until both constraints are generalised arc consistent: 1 2 3 {2, 3} {1, 2, 3, 4} (2 4) {1, 2} x x x 1 2 3 {2,3} {1, 2} (2 5) {1, 2} x x x 1 2 3 {3} {1, 2} (2 4) {1, 2} x x x 1 2 3 {3} {1} (2 5) {1, 2} x x x 1 2 3 {3} {1} {2} x x x
The two constraints are examined sequentially, as indicated above by the arcs. We first examine constraint (2-4), and deduce that values 3 and 4 in D2 do not appear in a
solution to it. Then we examine the constraint (2-5) and remove value 2 fromD1. This is
becausex2 and x3saturate values 1 and 2. Next we need to re-examine constraint (2-4)
and remove value 2 fromD2. Then we consider constraint (2-5) again and remove value
1 from D3. The resulting CSP is generalised arc consistent. In fact, we have found a
solution to the CSP.
Constraint propagation algorithms are the algorithms that achieve local consistency. In the literature, it is also called filtering algorithm. There are general constraint propagation algorithms to achieve the node consistency and arc consistency, etc. (see book [3]). Arc consistency is the basic propagation mechanism that is used in almost all solvers. The most well-known algorithm for arc consistency is AC3[9], proposed by Mackworth for the binary constraint network and was extended to GAC in arbitrary constraints in [10].
The main component of GAC3 (illustrated in Fig. 2.1) is the revision of an arc, that is, the update of a domain with respect to a constraint. Updating a domainDiof variablexi
with respect to a constraint C means removing every value in its domain which is not consistent with C. The function Revise(xi,C) takes each valuedi in Di in turn (line 2),
and looks for a support on Cfordi(line 3). If such a support is not found,diis removed
from the domain Di and the fact that Di has been changed is flagged (line 4-5). The
Fig. 2.1 AC3/GAC3 [4]
The main algorithm is a simple loop that revises the arcs until no change occurs, to ensure that all domains are consistent with all constraints. To avoid too many useless calls to Revise function (as this is the case in every basic AC algorithm such as AC1or AC2 [9]), the algorithm maintains a list ofQof all the pairs (xi,C) for which we are not
guaranteed thatDi is arc consistent onC. In line 7,Qis filled with all possible pairs (xi,
C) such thatxiX C( ). Then the main loop (line 8) picks the pairs (xi, C) inQone by
one (line 9) and calls Revise (xi,C) (line 10). If Di is wiped out, the algorithm returns
false (line 11). Otherwise, ifDi is modified, it can be the case that a value for another
variable xj has lost its support on a constraint C’ involving both xi and xj. Hence, all
pairs (xj,C’) such that x xi, jX C( ')must be again recorded in Q (line 12). When Q is
empty, the algorithm returns true (line 13) as we are guaranteed that all arcs have been revised and all remaining values of all variables are consistent with all constraints.
Algorithm: AC3/GAC3
FunctionRevise (inxi: variable;C: constraint): Boolean: Begin
1: CHANGE=false; 2: for each diD x( )i do
3: ifvalue didoes not have a support on constraintCthen 4: remove di fromD x( )i
5: CHANGE=true 6 : return CHANGE
FunctionAC3/GAC3(inX):Boolean: Begin
/*initialization*/
7: Q{( , )x C Ci C,xiX C( )}; /* propagation*/
8: while Q do
9: select and remove ( , )x Ci fromQ 10: if Revise( , )x Ci then
11: if D x( )i thenreturn false:
12: else Q Q {( , ')x Cj C' C C' C x xi, jX C( ') j i}
13: return true end
AC4 is proposed by Mohr and Henderson to improve the time complexity [11] [12]. AC 6 and AC 2001 are other improvements of the arc consistency algorithms. Here we only present the main techniques to enforce arc consistency. Other techniques exist to reduce the cost of arc consistency. They are usually based on one of the arc consistency algorithms presented above to improve its performance. For more details about the algorithms we refer to [4].
There are also specific constraint propagation algorithms tailored for certain global constraints. Actually, this is the field that attracts research on the integration of CP with OR techniques. The integration of specialized graph algorithms, such as matching and network flow algorithms [13] for reducing variable domains in global AllDifferent and cardinality constraint are some of such successful examples.
Constraint propagation is usually applied each time when a domain has been changed. Consequently, the propagation algorithm that we apply to make a CSP locally consistent should be as efficient as possible. However, a propagation algorithm does not need to remove all such values, as this may lead to an exponential running time due to the nature of some constraints (see the complexity analysis of arc consistency in [4]).