Table of Contents
Fetching ...

Efficient Implementation of the Global Cardinality Constraint with Costs

Margaux Schmied, Jean-Charles Regin

TL;DR

The paper addresses the costly arc-consistency filtering for the global cardinality constraint with costs (costgcc) in constraint programming. It introduces a landmark-based preprocessing to compute upper bounds on shortest-path distances, reducing the number of explicit path computations required by Régin's costgcc filtering. The approach yields significant runtime improvements and fewer path computations, especially on large graphs and when the cost bound $H$ provides margin, demonstrated on TSP, StockingCost, FJSSP, and CHILD problems. Overall, the method enhances practicality of costgcc constraints by making arc-consistency filtering faster and more scalable in real-world CP applications.

Abstract

The success of Constraint Programming relies partly on the global constraints and implementation of the associated filtering algorithms. Recently, new ideas emerged to improve these implementations in practice, especially regarding the all different constraint. In this paper, we consider the cardinality constraint with costs. The cardinality constraint is a generalization of the all different constraint that specifies the number of times each value must be taken by a given set of variables in a solution. The version with costs introduces an assignment cost and bounds the total sum of assignment costs. The arc consistency filtering algorithm of this constraint is difficult to use in practice, as it systematically searches for many shortest paths. We propose a new approach that works with upper bounds on shortest paths based on landmarks. This approach can be seen as a preprocessing. It is fast and avoids, in practice, a large number of explicit computations of shortest paths.

Efficient Implementation of the Global Cardinality Constraint with Costs

TL;DR

The paper addresses the costly arc-consistency filtering for the global cardinality constraint with costs (costgcc) in constraint programming. It introduces a landmark-based preprocessing to compute upper bounds on shortest-path distances, reducing the number of explicit path computations required by Régin's costgcc filtering. The approach yields significant runtime improvements and fewer path computations, especially on large graphs and when the cost bound provides margin, demonstrated on TSP, StockingCost, FJSSP, and CHILD problems. Overall, the method enhances practicality of costgcc constraints by making arc-consistency filtering faster and more scalable in real-world CP applications.

Abstract

The success of Constraint Programming relies partly on the global constraints and implementation of the associated filtering algorithms. Recently, new ideas emerged to improve these implementations in practice, especially regarding the all different constraint. In this paper, we consider the cardinality constraint with costs. The cardinality constraint is a generalization of the all different constraint that specifies the number of times each value must be taken by a given set of variables in a solution. The version with costs introduces an assignment cost and bounds the total sum of assignment costs. The arc consistency filtering algorithm of this constraint is difficult to use in practice, as it systematically searches for many shortest paths. We propose a new approach that works with upper bounds on shortest paths based on landmarks. This approach can be seen as a preprocessing. It is fast and avoids, in practice, a large number of explicit computations of shortest paths.

Paper Structure

This paper contains 14 sections, 4 theorems, 5 equations, 7 figures, 3 tables, 1 algorithm.

Key Result

Corollary 1

Given any variable $x$ and $b$ the value of $x$ such that $f_{bx} = 1$. Then, the value $a$ of $x$ is not consistent with $C$ iff the two following properties hold:

Figures (7)

  • Figure 1: Example of a global cardinality constraint with costs. Source Regin:CostbasedArcConsistencyforGlobalCardinalityConstraints. The sum of assignment costs must be less than or equal to 11. On the left, the original problem and on the right, the same problem after deleting all arcs that cannot belong to a solution.
  • Figure 2: Example of computation of the consistency for the arcs ($E$, $Julia$) and ($B$, $Peter$). The value $B$ is not consistent with $Peter$. Thus, the dotted arc can be removed from the graph.
  • Figure 3: Example of landmark use. Nodes $B$ and $s$, shown in red, are selected as landmarks.
  • Figure 4: Evolution of the average number of removed arcs for the CHILD, FJSSP and StockingCost instances in function of the multiplier of $H$.
  • Figure 5: Evolution of the average number of useless path computations for CHILD, FJSSP and StockingCost instances in function of the multiplier of $H$. The experimentation involves 4 landmarks.
  • ...and 2 more figures

Theorems & Definitions (10)

  • Definition 1: Regin:CostbasedArcConsistencyforGlobalCardinalityConstraints
  • Definition 2
  • Definition 3: Regin:CostbasedArcConsistencyforGlobalCardinalityConstraints
  • Corollary 1: Regin:CostbasedArcConsistencyforGlobalCardinalityConstraints
  • Proposition 1
  • Proposition 2
  • Definition 4
  • Proposition 3
  • Definition 5
  • Definition 6