Chapter 2 Preliminaries: an overview of optimisation techniques
2.3 Summary of solution approaches to combinatorial optimisation problems
2.4.2 Search
After constraint propagation, we usually encounter three kinds of scenarios:
the problem is inconsistent, which means no feasible solution exist;
there is only one value in each variable’s domain, which means we found the solution;
there is more than one value in each variable’s domain, which means we have to start to search for the solution.
The solution process of CP uses a search tree, which is a particular rooted tree. The vertices of search trees are often referred to as nodes. The arcs of search trees are often
referred to as branches. Further, if (u, v) is an arc of a search tree, we say that v is a direct descendant ofuanduis the parent ofv.
Definition 9 (Search tree): Let P be a CSP. A search tree for P is a rooted tree such that:
its nodes are CSPs,
its root isP,
if P1… Pmwhere m>0 are all direct descendants of P0, then the union of the
solution sets ofP1…Pmis equal to the solution set ofP0.
We say that a nodePof a search tree is at depthdif the length of the path from the root toPisd.
Definition 9 is a very general notion. In CP, a search tree is dynamically built by
splitting a CSP into smaller CSPs, until we reach a failed or a solved CSP. A CSP is split into smaller CSPs either by splitting a constraint (for example a disjunction) or by splitting the domain of a variable. For more information about splitting we refer readers to [3]. In this thesis we only apply the latter.
At each node in the search tree we apply constraint propagation to the corresponding CSP. As a result, we may detect that the CSP is inconsistent, or we may reduce some domains of the CSP. In both cases fewer nodes need to be generated and traversed, so the propagation can speed up the solution process. An example of a search tree in which we refer explicitly to constraint propagation and splitting is depicted in Fig. 2.2.
In Fig. 2.2, the constraint propagation (as introduced in section 2.4.2) and splitting are applied in an alternated fashion. Such a general definition allows to model arbitrary forms of constraint propagation and splitting [3]. The most common form of domain splitting consists of labeling of the domain of a variable. Informally, it consists of taking a variable, sayx, and splitting its domain into singleton sets. Each such singleton set, say {a}, corresponding to a CSP in which the domain of the variable x is replaced by {a}. Another domain splitting consists of enumerating a domain of a variable,
known asbinary tree. In the implementation of the algorithms, binary tree is applied in the solver system we applied.
Fig. 2.2 A search tree for a CSP [4]
Variable and value ordering heuristics
To split the domain of a variable, we first select a variable and then decide how to split its domain. This process is guided by variable and value orderingheuristics.Heuristicis defined as a ‘rule of thumb’ based on domain knowledge from a particular application, which gives guidance in the solution of a problem [6]. Heuristic plays an important role in solving procedure not only in CP paradigm, but also in local search and meta- heuristics which will be detailed in section 2.7.
Variable and value ordering heuristics impose an ordering on the variables and values, respectively. The order in which variables and values are selected has a great impact on the search process. A variable ordering heuristic imposes a partial order on the variables with non-singleton domains. An example is the “most constrained first” variable ordering heuristic. It orders the variables with respect to the number of their appearance in the constraints. A variable that appears the most often is ordered first. It is likely that changing the domains of such variables will cause more values to be removed by constraint propagation. Another variable ordering heuristic is the “smallest domain
first” heuristic. This heuristic orders the variables with respect to the size of their domains. A variable that has the smallest domain is ordered first. The advantages of this heuristic are that less nodes are needed to be generated in the search tree, and that inconsistent CSPs are detected earlier. In case two or more variables are incomparable, we can for example apply the lexicographic ordering to these variables and obtain a total order.
A value ordering heuristic induces a partial order on the domain of a variable. It orders the values in the domain according to a certain criterion. An example is the lexicographic value ordering heuristic, which orders the values with respect to the lexicographic ordering [6]. Another example is the random value ordering heuristic, which orders the variables randomly. In case a value ordering heuristic imposes a partial order on a domain, we can apply the lexicographic or random value ordering heuristic to incomparable values to create a total order. A value ordering heuristic is also referred to as a branching heuristic because it decides the order of the branches in the search tree.
Search strategies
A search strategy defines the traversal of the search tree. In this thesis we apply the search strategies such as Depth First Search and Limited Discrepancy Search. We assume that all direct descendants of a node in a search tree are totally ordered, for example based on the value ordering heuristic.
First we describe Depth First Search (DFS) [3] which starts at the root node and proceed by descending to its first descendant. This process continues until a leaf is reached. Then it backtracks to the parent of the leaf and descends to its next descendant, if it exists. This process continues until it backtracks to the root node and all its descendants have been visited.
Next we describe Limited Discrepancy Search (LDS), introduced by Harvey and Ginsberg [14] (illustrated by Fig. 2.3). LDS is motivated by the following idea. Suppose
we have good heuristics to build the search tree, i.e. the first leaf that the search visits is likely to be a solution. If this leaf is not a solution, it is likely that only a small number of mistakes were made along the path from the root to this leaf. Hence, LDS visits the nodes next to the leaf whose paths from the root differ only in one choice from the initial path. LDS continues this process by gradually visiting the leaves with a higher discrepancy from the initial path. Formally, let P0be a node with ordered descendants
P1, P2…Pm. The discrepancy of Piis the discrepancy of P0+i-1 for i = 1; 2…m. The
discrepancy of the root node is 0. LDS can now be described as:
Set the level of discrepancy k = 0. Start at the root node and proceed by descending to its first descendant provided that its discrepancy is not higher than
k. This process continues until the search reaches a leaf. Then it backtracks to the parent of the leaf and descends to its next descendant, provided that it exists and its discrepancy is not higher than k. This process continues until it backtracks to the root node and all its descendants whose discrepancy is not higher than k have been visited. Setk = k + 1and repeat this process until it is back at the root node and all its descendants have been visited.
a. discrepancy 0 b. discrepancy 1
c. discrepancy 2 d. discrepancy 3
Fig. 2.3 Limited Discrepancy Search [14]
In CP, constraint modelling, variable/value order heuristics and search strategies interact in the whole procedure of problem solving. None of these decisions can be made independently from the others.
Constraint Optimisation Problem
The search for an optimal solution (or all optimal solutions) to a Constraint Optimisation Problem (COP) is performed similar to the search for a solution to a CSP. Recall that a COP consists of a CSP together with an objective function f to be optimised (see Definition 5). Assume (without loss of generality) that we want to minimizef. The objective function value is represented by a variablez. When we find a solution to the CSP, the corresponding value of z, sayz = a, serves as an upper bound for the optimal value off. We then add the constraintz<ato all CSPs in the search tree and continue.
Perhaps the most widely used technique for solving COP is Branch-and-Bound, a well known method in both CP and OR. Next we give a brief introduction to the Branch-and- Bound in CP.
The Branch-and-Bound uses bounding heuristic to prune the search space. This (lower or upper) bounding heuristic, denoted by h, is a function that maps assignments (even partial assignments) to a numeric value to serve as an estimate of the objective function [15]. More precisely, h applied to some partial assignment is an estimate of the best values of the objective function applied to all solutions (complete assignments) that rise by extending this partial assignment [15]. Naturally, the efficiency of the Branch-and- Bound method is highly dependent on the availability of good heuristics. In such a case, the Branch-and-Bound algorithm can prune the search subtrees where the optimal solution does not settle. Note that there are two possibilities when the subtree can be pruned:
• there is no solution in the subtree at all,
• all solutions in the subtree are suboptimal only (they are not optimal).
Of course, the closer the heuristic is to the objective function, the larger the subtree that can be pruned. On the other hand, we need a reliable heuristic ensuring that no subtree where the optimal solution settles is pruned. This reliability can be achieved easily if the
heuristic isadmissible. That is, in case of minimization problem, the heuristic (i.e. the lower bounding heuristic) is an underestimation of the optimisation function, i.e. the value of the heuristic function is not higher than the value of the objective function. In case of maximization problems, we require the heuristic (the upper bounding heuristic), to be an overestimation of the objective function. In both cases, we can guarantee the soundness and completeness of the Branch-and-Bound algorithm [15].
There exist several modifications of the Branch-and-Bound algorithm; we will present here the depth first Branch-and-Bound method that is derived from the backtracking algorithm for solving a COP. The algorithm uses two global variables to store the current upper bound (when minimizing the optimisation function) and the best solution found so far. It behaves like chronological backtracking algorithm except that the value of the heuristic function, i.e. lower bound is computed as soon as a value is assigned to the variable. If this lower bound value exceeds the upper bound, then the subtree under the current partial assignment is pruned immediately. Initially, the bound is set to (plus) infinity and during the computation it records the value of the objective function for the best solution found so far.