A Modelling Pearl with Sortedness Constraints

Beldiceanu, Nicolas and Carlsson, Mats and Flener, Pierre and Lorca, Xavier and Pearson, Justin and Petit, Thierry and Prud'homme, Charles (2015) A Modelling Pearl with Sortedness Constraints. In: Global Conference on Artificial Intelligence, October 16-19, 2015, Tbilisi, Georgia.

PDF (Open Access)

Official URL:


Some constraint programming solvers and constraint modelling languages feature the Sort(L,P,S) constraint, which holds if S is a nondecreasing rearrangement of the list L, the permutation being made explicit by the optional list P. However, such sortedness constraints do not seem to be used much in practice. We argue that reasons for this neglect are that it is impossible to require the underlying sort to be stable, so that Sort cannot be guaranteed to be a total-function constraint, and that L cannot contain tuples of variables, some of which form the key for the sort. To overcome these limitations, we introduce the StableKeysort constraint, decompose it using existing constraints, and propose a propagator. This new constraint enables a powerful modelling idiom, which we illustrate by elegant and scalable models of two problems that are otherwise hard to encode as constraint programs.

Item Type:Conference or Workshop Item (Paper)
ID Code:5916
Deposited By:Mats Carlsson
Deposited On:23 Dec 2015 13:38
Last Modified:23 Dec 2015 13:38

Repository Staff Only: item control page