3.7.132. Labelling by increasing cost
Some optimisation problems involve minimising a cost consisting of a sum of elementary costs , where each elementary cost is directly linked to the value assigned to a decision variable . Without loss of generality we assume that each decision variable will be assigned a value between 1 and . The link between a decision variable and its corresponding cost is usually expressed by a constraint of the form stating that . During search, while enumerating on the different values of a decision variable , we would like to try out values of so that the corresponding cost increases. This means we want to use a permutation of such that . Note that such permutation can be obtained by sorting the costs by increasing order and by collecting the position where item is located in the sorted list. Assuming that we perform arc-consistency on the , we now describe three different ways to obtain the effect we want to achieve:
A first direct way is to use a built in facility that, given variable and the corresponding list of values introduced before, creates a choice point and tries to successively assign values to . Note that, once is fixed there is no need to enumerate on the corresponding elementary cost variable since, by propagation, will fix . Consequently the cost variables do not need to be passed to the search procedure.
A second indirect way, used when we want to only rely on a standard built in that creates a choice point and tries to assign values to a variable in increasing value order, is to introduce an extra variable . The idea is to link variable to variable in such a way that, when we try to assign values in increasing value order to variable , both variables and get fixed and, in addition, values of are increasing. This can be modelled by introducing the following two constraints:
The effect of a dedicated built in that tries to assign values to a variable according to an explicit list of values is achieved by introducing the first constraint. Again, once is fixed the first constraint will fix variable . Then the second constraint will also fix variable . Consequently, both the cost and the decision variables do not need to be passed to the search procedure, i.e., we just need to pass the newly introduced variables .
Finally, we can first label on the cost variable in increasing value order. If the costs are all distinct then the constraint will fix by propagation since we assume to perform arc-consistency. Otherwise, when the costs are not all distinct, we also need to label the decision variable .
Figure 3.7.35. Given a decision variable and a corresponding cost variable linked by the constraint, illustration of three ways for labelling by increasing cost: partΒ (A) labels directly on the decision variable using an appropriate order so that successive values of are increasing; partΒ (B) introduces a variable linked to by the constraint and labels on by increasing value order; partΒ (C) labels first on the cost variable by increasing value order, and then on variable .
FigureΒ 3.7.35 illustrates the three ways of labelling previously introduced. The primitive member creates a choice point and tries to successively assign variable an integer value from the list with respect to their ordering. The primitive indomain also creates a choice point and tries to successively assign variable an integer value of its domain, by increasing value order.