A Modelling Pearl with Sortedness Constraints
Author(s) -
Nicolas Beldiceanu,
Mats Carlsson,
Pierre Flener,
Xavier Lorca,
Justin Pearson,
Thierry Petit,
Charles Prud’Homme
Publication year - 2018
Publication title -
epic series in computing
Language(s) - English
Resource type - Conference proceedings
SCImago Journal Rank - 0.21
H-Index - 7
ISSN - 2398-7340
DOI - 10.29007/b4dz
Subject(s) - constraint programming , constraint (computer aided design) , sort , computer science , pearl , constraint logic programming , tuple , theoretical computer science , permutation (music) , constraint graph , feature (linguistics) , binary constraint , mathematical optimization , mathematics , discrete mathematics , philosophy , linguistics , physics , geometry , theology , stochastic programming , acoustics , information retrieval
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.
Accelerating Research
Robert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom
Address
John Eccles HouseRobert Robinson Avenue,
Oxford Science Park, Oxford
OX4 4GP, United Kingdom