Principles and Practice of Constraint Programming 2015
Principles and Practice of Constraint Programming 2015
)
LNCS 9255
123
Lecture Notes in Computer Science 9255
Commenced Publication in 1973
Founding and Former Series Editors:
Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board
David Hutchison
Lancaster University, Lancaster, UK
Takeo Kanade
Carnegie Mellon University, Pittsburgh, PA, USA
Josef Kittler
University of Surrey, Guildford, UK
Jon M. Kleinberg
Cornell University, Ithaca, NY, USA
Friedemann Mattern
ETH Zurich, Zürich, Switzerland
John C. Mitchell
Stanford University, Stanford, CA, USA
Moni Naor
Weizmann Institute of Science, Rehovot, Israel
C. Pandu Rangan
Indian Institute of Technology, Madras, India
Bernhard Steffen
TU Dortmund University, Dortmund, Germany
Demetri Terzopoulos
University of California, Los Angeles, CA, USA
Doug Tygar
University of California, Berkeley, CA, USA
Gerhard Weikum
Max Planck Institute for Informatics, Saarbrücken, Germany
More information about this series at http://www.springer.com/series/7408
Gilles Pesant (Ed.)
123
Editor
Gilles Pesant
École Polytechnique de Montréal
Montréal, Québec
Canada
This volume contains the proceedings of the 21st International Conference on the
Principles and Practice of Constraint Programming (CP 2015), which was held in Cork,
Ireland, from August 31 to September 4, 2015. Detailed information about the con-
ference is available at http://cp2015.a4cp.org. The CP conference is the annual inter-
national conference on constraint programming. It is concerned with all aspects of
computing with constraints, including theory, algorithms, environments, languages,
models, systems, and applications such as decision making, resource allocation,
scheduling, configuration, and planning.
For the purpose of the conference’s scientific programming, we invited submissions
to the technical, application, and published journal tracks. We received 80, 25, and 14
submissions to these tracks respectively. Authors chose to submit either long (15 pages)
or short (8 pages) papers to the technical and application tracks. The review process for
the technical track relied on a two-level Program Committee and on additional reviewers
recruited by Program Committee members. Each submission to the technical track was
assigned to one member of the Senior Program Committee and three members of the
track’s Program Committee. Submissions to the application track were each assigned to
three members of its Program Committee. Every paper received at least three reviews.
Once the initial reviews were in, authors were given an opportunity to respond before a
detailed discussion was undertaken at the level of the Program Committees, overseen by
the Program Chair and the Senior Program Committee member or the Application Track
Chair, as appropriate. For the first time this year the Senior Program Committee did not
meet in person but deliberated by video conference instead. The published journal track
gives an opportunity to discuss important results in the area of constraint programming
that appeared recently in relevant journals, but had not been previously presented to the
community at conferences. Submissions were evaluated by a separate Program Com-
mittee for relevance and significance.
At the end of the reviewing process, we accepted 39 papers from the technical track,
15 papers from the application track, and 10 papers from the published journal paper
track. The Senior Program Committee awarded the Best Paper Prize to John N. Hooker
for “Projection, Consistency, and George Boole” and the Best Student Paper Prize to
Alexander Ivrii, Sharad Malik, Kuldeep S. Meel, and Moshe Vardi for “On Computing
Minimal Independent Support and Its Applications to Sampling and Counting.” The
Application Track Program Committee awarded the Best Application Paper Prize to
Tommaso Urli and Philip Kilby for “Long-Haul Fleet Mix and Routing Optimisation
with Constraint Programming and Large Neighbourhood Search.” The Program Chair
and the Constraints journal editor-in-chief, Michela Milano, also invited six papers
from the technical and application tracks for direct publication in that journal. These
were presented at the conference like any other paper and they appear in the pro-
ceedings as a one-page abstract.
VI Preface
This edition of the conference was part of George Boole 200, a celebration of the
life and work of George Boole who was born in 1815 and worked at the University
College of Cork. It was also co-located with the 31st International Conference on Logic
Programming (ICLP 2015). The conference program featured three invited talks by
Claire Bagley, Gerhard Friedrich (joint with ICLP), and Douglas R. Smith. This vol-
ume includes one-page abstracts of their talks. The conference also featured four
tutorials and six satellite workshops, whose topics are listed in this volume. The
Doctoral Program gave PhD. students an opportunity to present their work to more
senior researchers, to meet with an assigned mentor for advice on their research and
early career, to attend special tutorials, and to interact with one another. The winners
of the 2015 ACP Research Excellence Award and Doctoral Research Award presented
their award talks. The results of the annual MiniZinc Challenge were announced and a
joint ICLP/CP Programming Competition was held. For the first time an Industry
Outreach effort, headed by Helmut Simonis, provided formal opportunities for CP
researchers and representatives from industry to interact: The former were presented
with industrial problems to solve in a friendly competition and the latter were presented
with samples of industrial problems solved using CP technology. Following the con-
ference, a CSPlib sprint event took place to update this library of constraint satisfaction
problems. All these contributed to a very exciting program.
I am grateful to many people who made this conference such a success. First of all, to
the authors who provided excellent material to select from. Then to the members of the
Program Committees and additional reviewers who worked hard to provide constructive,
high-quality reviews. To members of the Senior Program Committee who helped me
ensure that each paper was adequately discussed, wrote meta-reviews for their assigned
papers, and participated in live remote deliberations — for some, quite early or late in the
day. To Christian Schulte in particular, who agreed to step in where I had a conflict of
interest. Of course there is a whole team standing with me, who chaired various aspects
of the conference: Ken Brown, Barry O’Sullivan (Conference Chairs) and their own local
team (Barry Hurley as webmaster; Kathy Bunney who provided coordinating support; the
technical and administrative support staff of the Insight Centre for Data Analytics at
UCC), Louis-Martin Rousseau (Application Track Chair), Thomas Schiex (Published
Journal Track Chair), David Bergman and Marie Pelleau (Doctoral Program Chairs),
Willem-Jan van Hoeve (Workshop and Tutorial Chair), Helmut Simonis (Industry Out-
reach Chair), and Ian Miguel (Publicity Chair). Thank you for your dedication! I
acknowledge and thank our sponsors for their generous support: they include, at the time
of writing, the Association for Constraint Programming, the Association for Logic Pro-
gramming, ECCAI — the European Coordinating Committee for Artificial Intelligence,
the Insight Centre for Data Analytics, Science Foundation Ireland, Springer, and Uni-
versity College Cork. Finally, I thank the ACP Executive Committee for the trust they
showed me in asking me to serve as Program Chair. It has been an honor.
Tutorials
Workshops
Conference Chairs
Ken Brown University College Cork, Ireland
Barry O’Sullivan University College Cork, Ireland
Program Chair
Gilles Pesant École Polytechnique de Montréal, Canada
Publicity Chair
Ian Miguel University of St Andrews, UK
Claire Bagley
Oracle is a large global technology organization, whose product offerings have grown
organically and through the acquisition of first class companies. Its leadership has
expanded to the entire technology stack, to span the full range of computer hardware,
operating systems, programming languages, databases, enterprise software, collabora-
tion management tools, and into the cloud.
With thousands of products and tools running the full imaginable breadth and depth
of a technology stack, it is then not surprising that Oracle is exposed to a vast number
of complex combinatorial problems, as well as the different types of technology to
solve them. Indeed, many of the classical applications and variations of constraint
problems are represented: planning, scheduling, rostering, vehicle routing, configura-
tion, networking, grid optimization, logistics, analytics, and cloud management. As
expected with the development of products and the acquisition of companies operating
in these domains, a large number of technologies come into play including Constraint
Programming (CP), Mathematical Programming (MP), local search, heuristics,
knowledge-based reasoning, genetic algorithms, machine learning, and many more.
The Advanced Constraint Technology (ACT) group at Oracle is tasked with
identifying, understanding and solving the complex combinatorial problems that arise
in a diverse field of application environments. Our expertise and industry proven ACT
products are available to assist Oracle development teams on how to best model and
solve their problems using CP, MP, Heuristics, and Hybrid solutions.
In this talk we examine some of the successful solutions to constrained problems
within such a large corporation. We discuss at a high level the many opportunities for
further integration and unification of constraint technologies into more products and
tools, including the challenge of modeling and solving in highly interactive scenarios.
Most importantly, we open the discussion about various challenges faced by large
front-end centered companies, with many degrees of separation between organizations,
who must balance resources to focus over immediate and long-term deliverables.
Industrial Success Stories of ASP and CP:
What’s Still Open?
Gerhard Friedrich
Abstract More than 25 years ago together with Siemens we started to inves-
tigate the possibility of substituting the classical rule-based configuration
approach by model- based techniques. It turned out that in those days only
constrained programming (CP) had any real chance of meeting the application
demands. By exploiting CP we were able to significantly improve the produc-
tivity of highly trained employees (by more than 300 %) and to substantially
reduce software development and maintenance costs (by more than 80 %) [4].
Consequently, CP has been our method of choice for problem solving in
industrial projects since 1989 [3].
Some years ago, we started to investigate answer set programming (ASP) techniques
[2], mainly because of the possibility to apply a very expressive logical first-order
language for specifying problems. It emerged that, by using simply problem encoding,
we were able to solve difficult real world problem instances witnessing the enormous
improvements of logic programming over the last decades [1].
Although ASP and CP have proven their practical applicability, we will point out
challenges of large problems of the electronic and the semiconductor industry. In
particular, we will stress the power of problem-specific heuristics [5, 9] which turned
out to be the key in many applications of problem solvers.
Looking at the famous equation “algorithm = logic + control” [6] most of the current
work in the AI community assumes that control should be problem- independent and
only the logical specification depends on the problem to be solved, i.e. “algorithm =
logic(problem) + control”. It is not surprising that for the current problem solving
technology this is a practical approach up to a certain size of the problem instances, since
we deal with NP-hard problems in many cases. However, it is observed (and examples
are given [10, 7]) that problem-specific heuristics allow enormous run-time improve-
ments. This success is based on problem-specific control, i.e. “algorithm = logic
(problem) + control(problem)”. Unfortunately, the design of such problem-specific
heuristics is very time-consuming and redesigns are frequently required because of
recurrent changes of the problem. Interestingly, humans are very successful at devel-
oping such problem-specific heuristics. Therefore, we argue that the automation of
generating problem-specific heuristics with satisfying quality is still an important basic
AI research goal with high practical impact that should be achievable [8].
Industrial Success Stories of ASP and CP XVII
References
1. Aschinger, M., Drescher, C., Friedrich, G., Gottlob, G., Jeavons, P., Ryabokon, A., Thor-
stensen, E.: Optimization methods for the partner units problem. In: Achterberg, T., Beck, J.C.
(eds.) CPAIOR 2011. LNCS, vol. 6697, pp. 4–19. Springer, Heidelberg (2011). http://dx.doi.
org/10.1007/978-3-642-21311-3
2. Brewka, G., Eiter, T., Truszczynski, M.: Answer set programming at a glance. Commun.
ACM 54(12), 92–103 (2011). http://doi.acm.org/10.1145/2043174.2043195
3. Falkner, A., Haselboeck, A., Schenner, G., Schreiner, H.: Benefits from three configurator
generations. In: Blecker, T., Edwards, K., Friedrich, G., Hvam, L., Salvodor, F. (eds.)
Innovative Processes and Products for Mass Customization, vol. 3, pp. 89–103 (2007)
4. Fleischanderl, G., Friedrich, G., Haselböck, A., Schreiner, H., Stumptner, M.: Configuring
large systems using generative constraint satisfaction. IEEE Intell. Syst. 13(4), 59–68 (1998)
5. Gebser, M., Kaufmann, B., Romero, J., Otero, R., Schaub, T., Wanko, P.: Domain-specific
heuristics in answer set programming. In: desJardins, M., Littman, M.L. (eds.) Proceedings
of the Twenty-Seventh AAAI Conference on Artificial Intelligence, July 14–18, 2013,
Bellevue, Washington, USA. AAAI Press (2013). http://www.aaai.org/ocs/index.php/AAAI/
AAAI13/paper/view/6278
6. Kowalski, R.A.: Algorithm = logic + control. Commun. ACM 22(7), 424–436 (1979). http://
doi.acm.org/10.1145/359131.359136
7. Mersheeva, V., Friedrich, G.: Multi-uav monitoring with priorities and limited energy
resources. In: Brafman, R.I., Domshlak, C., Haslum, P., Zilberstein, S. (eds.) Proceedings
of the Twenty-Fifth International Conference on Automated Planning and Scheduling,
ICAPS 2015, Jerusalem, Israel, June 7-11, 2015, ICAPS 2015. pp. 347–356. AAAI Press
(2015). http://www.aaai.org/ocs/index.php/ICAPS/ICAPS15/paper/view/10460
8. Pearl, J.: On the discovery and generation of certain heuristics. AI Mag. 4(1), 23–33 (1983).
http://www.aaai.org/ojs/index.php/aimagazine/article/view/385
9. Schrijvers, T., Tack, G., Wuille, P., Samulowitz, H., Stuckey, P.J.: Search combinators.
Constraints 18(2), 269–305 (2013). http://dx.doi.org/10.1007/s10601-012- 9137-8
10. Teppan, E.C., Friedrich, G., Falkner, A.A.: Quickpup: A heuristic backtracking algorithm for
the partner units configuration problem. In: Fromherz, M.P.J., Muñoz- Avila, H. (eds.)
Proceedings of the Twenty-Fourth Conference on Innovative Applications of Artificial
Intelligence, July 22–26, 2012, Toronto, Ontario, Canada. AAAI (2012). http://www.aaai.
org/ocs/index.php/IAAI/IAAI-12/paper/view/4793
Synthesis of Constraint Solvers
References
1. Rehof, J., Mogenson, T.: Tractable constraints finite semilattices. Sci. Comput. Program. 35,
191–221 (1999)
2. Smith, D.R., Westfold, S.: Toward Synthesis Constraint Solvers. Tech. rep., Kestrel Institute
(2013). http://www.kestrel.edu/home/people/smith/pub/CW- report.pdf
Contents
Technical Track
Simple and Scalable Time-Table Filtering for the Cumulative Constraint . . . . 149
Steven Gay, Renaud Hartert, and Pierre Schaus
XX Contents
Application Track
Find Your Way Back: Mobility Profile Mining with Constraints . . . . . . . . . . 638
Lars Kotthoff, Mirco Nanni, Riccardo Guidotti, and Barry O’Sullivan
1 Introduction
In this paper we study linear integer constraints (LI constraints), that is, con-
straints of the form a1 x1 +· · ·+an xn # a0 , where the ai are integer given values,
the xi are finite-domain integer variables, and the relation operator # belongs
to {<, >, ≤, ≥, =, =}. We will assume w.l.o.g that # is ≤, the ai are positive and
all the domains of the variables are {0, 1..di }, since other cases can be reduced to
this one.1 Special case of linear constraints are: pseudo-Boolean (PB) constraints
where the domain of each variable is {0..1}, cardinality (CARD) constraints
where additionally ai = 1, 1 ≤ i ≤ n, and at-most-one (AMO) constraints where
additionally a0 = 1.
Linear integer constraints appear in many combinatorial problems such as
scheduling, planning or software verification, and, therefore, many different SMT
solvers [9,14] and encodings [4,6,11] have been suggested for handling them.
There are two main approaches to encoding linear constraints: cardinality con-
straints are encoded as some variation of a sorting network [3]; multi-decision
diagrams (MDDs) are used to encode more general linear constraints [5], which
in the special case of pseudo-Boolean constraints collapse to binary decision
diagrams (BDDs).
1
See [5] for details. Note that propagation is severely hampered by replacing equalities
by a pair of inequalities.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 3–11, 2015.
DOI: 10.1007/978-3-319-23219-5 1
4 I. Abı́o et al.
2 Preliminaries
2.1 SAT Solving
Let X = {x1 , x2 , . . .} be a fixed set of propositional variables. If x ∈ X then x
and ¬x are positive and negative literals, respectively. The negation of a literal
l, written ¬l, denotes ¬x if l is x, and x if l is ¬x. A clause is a disjunction of
literals l1 ∨ · · · ∨ ln . An implication x1 → x2 is notation for the clause ¬x1 ∨ x2 ,
similarly x1 ← x2 denotes x1 ∨ ¬x2 . A CNF formula is a conjunction of clauses.
A (partial) assignment A is a set of literals such that {x, ¬x} ⊆ A for any
x ∈ X , i.e., no contradictory literals appear. A literal l is true () in A if l ∈ A, is
false (⊥) in A if ¬l ∈ A, and is undefined in A otherwise. A clause C is true in A
if at least one of its literals is true in A. A formula F is true in A if all its clauses
are true in A. In that case, A is a model of F . Systems that decide whether a
formula F has any model are called SAT-solvers, and the main inference rule
they implement is unit propagation: given a CNF F and an assignment A, find
a clause in F such that all its literals are false in A except one, say l, which
is undefined, add l to A and repeat the process until reaching a fix-point. A
detailed explanation can be found in [7].
Let [l..u] where l and u are integers represent the set {l, . . . , u}. Let y be
an integer variable with domain [0..d]. The order encoding introduces Boolean
variables yi for 1 ≤ i ≤ d. A variable yi is true iff y < i. The encoding also
introduces the clauses yi → yi+1 for 1 ≤ i < d.
Encoding Linear Constraints with Implication Chains to CNF 5
We can prove that the algorithm returns a correct MDD, that is no larger
than the MDD (BDD) encoding of C, and that the resulting CNF encoding is
domain consistent on the original variables x1 , . . . , xn . Proofs are available at [1].
(a) (b)
Fig. 1. The MDDs that result from 4x1 + 2x2 + 5x3 + 4x4 ≤ 9 encoded (a) without
and (b) with the chain x1 ⇐ x2 ⇐ x3 .
5 Experiments
Table 1. Results for sports league scheduling, showing the number of runs that find a
solution of different quality after different time limits (seconds).
References
1. Abio, I., Mayer-Eichberge, V., Stuckey, P.: Encoding linear constraints with impli-
cation chains to CNF. Tech. rep., University of Melbourne (2015). http://www.
people.eng.unimelb.edu.au/pstuckey/papers/cp2015a.pdf
2. Abı́o, I.: Solving hard industrial combinatorial problems with SAT. Ph.D. thesis,
Technical University of Catalonia (UPC) (2013)
3. Abı́o, I., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E.: A parametric
approach for smaller and better encodings of cardinality constraints. In: Schulte,
C. (ed.) CP 2013. LNCS, vol. 8124, pp. 80–96. Springer, Heidelberg (2013)
4. Abı́o, I., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E., Mayer-
Eichberger, V.: A New Look at BDDs for Pseudo-Boolean Constraints. J. Artif.
Intell. Res. (JAIR) 45, 443–480 (2012)
5. Abı́o, I., Stuckey, P.J.: Encoding linear constraints into SAT. In: O’Sullivan, B.
(ed.) CP 2014. LNCS, vol. 8656, pp. 75–91. Springer, Heidelberg (2014)
6. Bailleux, O., Boufkhad, Y., Roussel, O.: New encodings of pseudo-boolean con-
straints into CNF. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 181–194.
Springer, Heidelberg (2009)
7. Biere, A., Heule, M., van Maaren, H., Walsh, T. (eds.): Handbook of Satisfiability,
Frontiers in Artificial Intelligence and Applications, vol. 185. IOS Press (2009)
8. Bofill, M., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E., Rubio, A.: The
barcelogic SMT solver. In: Gupta, A., Malik, S. (eds.) CAV 2008. LNCS, vol. 5123,
pp. 294–298. Springer, Heidelberg (2008)
9. Dutertre, B., de Moura, L.: The YICES SMT Solver. Tech. rep., Computer Science
Laboratory, SRI International (2006). http://yices.csl.sri.com
10. Eén, N., Biere, A.: Effective preprocessing in SAT through variable and clause elim-
ination. In: Bacchus, F., Walsh, T. (eds.) SAT 2005. LNCS, vol. 3569, pp. 61–75.
Springer, Heidelberg (2005)
11. Eén, N., Sörensson, N.: Translating Pseudo-Boolean Constraints into SAT. Journal
on Satisfiability, Boolean Modeling and Computation 2(1–4), 1–26 (2006)
12. Gent, I.P., Prosser, P., Smith, B.M.: A 0/1 encoding of the GACLex constraint for
pairs of vectors. In: ECAI 2002 workshop W9: Modelling and Solving Problems
with Constraints. University of Glasgow (2002)
13. Heule, M.J.H., Järvisalo, M., Biere, A.: Efficient CNF simplification based on
binary implication graphs. In: Sakallah, K.A., Simon, L. (eds.) SAT 2011. LNCS,
vol. 6695, pp. 201–215. Springer, Heidelberg (2011)
14. de Moura, L., Bjorner, N.: Z3: An Efficient SMT Solver. Tech. rep., Microsoft
Research, Redmond (2007). http://research.microsoft.com/projects/z3
15. Ohrimenko, O., Stuckey, P., Codish, M.: Propagation via lazy clause generation.
Constraints 14(3), 357–391 (2009)
16. Petit, T., Régin, J.-C., Beldiceanu, N.: A Θ(n) bound-consistency algorithm for
the increasing sum constraint. In: Lee, Jimmy (ed.) CP 2011. LNCS, vol. 6876, pp.
721–728. Springer, Heidelberg (2011)
17. Srinivasan, A., Ham, T., Malik, S., Brayton, R.: Algorithms for discrete function
manipulation. In: 1990 IEEE International Conference on Computer-Aided Design,
ICCAD 1990, pp. 92–95. Digest of Technical Papers (1990)
Anytime Hybrid Best-First Search with Tree
Decomposition for Weighted CSP
1 Introduction
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 12–29, 2015.
DOI: 10.1007/978-3-319-23219-5 2
Anytime Hybrid Best-First Search with Tree Decomposition 13
2 Background
Our presentation is restricted to binary problems for simplicity. Our implemen-
tation does not have such restriction. A binary Cost Function Network (CFN) is
a triplet (X, D, W ). X = {1, . . . , n} is a set of n variables. Each variable i ∈ X
has a finite domain Di ∈ D of values than can be assigned to it. The maximum
domain size is d. W is a set of cost functions. A binary cost function wij ∈ W is
a function wij : Di × Dj → [0, k] where k is a given maximum integer cost cor-
responding to a completely forbidden assignment (expressing hard constraints).
14 D. Allouche et al.
If they do not exist, we add to W one unary cost function for every variable such
that wi : Di → [0, k] and a zero arity constraint w∅ (a constant cost payed by
any assignment, defining a lower bound on the optimum). All these additional
cost functions will have initial value 0, leaving the semantics of the problem
unchanged.
The Weighted Constraint Satisfaction Problem (WCSP) is to find a
n
minimum
cost complete assignment: min (a1 ,...,an )∈ i Di {w∅ + i=1 wi (ai ) +
w (a
wij ∈W ij i j , a )}, an optimization problem with an associated NP-complete
decision problem.
The WCSP can be solved exactly using Branch and Bound maintaining some
lower bound: at each node ν of a tree, we use the local non naive lower bound
ν.lb = w∅ provided by a given soft arc consistency [5]. Each node corresponds to
a sequence of decisions ν.δ. The root node has an empty decision sequence. When
a node is explored, an unassigned variable is chosen and a branching decision
to either assign the variable to a chosen value (left branch, positive decision)
or remove the value from the domain (right branch, negative decision) is taken.
The number of decisions taken to reach a given node ν is the depth of the node,
ν.depth. A node of the search tree that corresponds to a complete assignment is
called a leaf. At this point, ν.lb is assumed to be equal to the node cost (which
is guaranteed by all soft arc consistencies).
The graph G = (X, E) of a CFN has
one vertex for each variable and one edge
(i, j) for every binary cost function wij ∈
W . A tree decomposition of this graph is
defined by a tree (C, T ). The set of nodes
of the tree is C = {C1 , . . . , Cm } where Ce
is a set of variables (Ce ⊆ X) called a clus-
ter. T is a set of edges connecting clusters
and forming a tree (a connected acyclic
graph). The set ofclusters C must cover
all the variables ( Ce ∈C Ce = X) and all
the cost functions (∀{i, j} ∈ E, ∃Ce ∈
C s.t. i, j ∈ Ce ). Furthermore, if a vari-
able i appears in two clusters Ce and Cg ,
i must also appear in all the clusters Cf on
the unique path from Ce to Cg in (C, T ). Fig. 1. A tree-decomposition of the
If the cardinality of the largest cluster in a CELAR06 radio frequency assignment
tree decomposition is ω + 1 then the width problem, rooted in C1 with subproblem
of the decomposition is ω. The treewidth P5 highlighted.
of a graph is the minimum width among
all its decompositions [24].
node at depth 0. Iteratively, a best node is explored: the node is removed and
replaced by its two left and right children with updated decisions, lower bound
and depth. In this paper we always choose as best node a node with the smallest
ν.lb, breaking ties by selecting a node with maximum ν.depth. The first leaf of the
tree explored is then guaranteed to be an optimal solution [14,22]. The list open
may reach a size in O(dn ) and, if incrementality in the lower bound computation
is sought, each node should hold the minimum data-structures required for soft
arc consistency enforcing (in O(ed) per node).
The pseudocode for Hybrid BFS is described as Algorithm 1. HBFS starts
with the empty root node in the list of open nodes. It then iteratively picks a
best node ν from the open list as above, replays all the decisions in ν.δ leading to
an assignment Aν , while maintaining consistency. It then performs a depth-first
search probe starting from that node for a limited number Z of backtracks. The
DFS algorithm is a standard DFS algorithm except for the fact that, when the
bound on the number of backtracks is reached, it places all the nodes corre-
sponding to open right branches of its current search state in the open list (see
Figure 2).
At the price of increased memory usage, this
1
hybrid maintains the advantages of depth-first
search. Since it spends a significant amount of its
time in a DFS subroutine, it can exploit the incre- 2
mentality of arc consistency filtering during DFS
search without any extra space cost: nodes in the 3 6
open list will just contain decisions δ and lower
bound lb, avoiding the extra O(ed) space required 4 5 7
for incrementality during BFS. However, each time
a node is picked up in open, the set of ν.depth 8
decisions must be “replayed” and local consistency
reinforced from the root node state, leading to Fig. 2. A tree that is par-
redundant propagation. This cost can be mitigated tially explored by DFS with
to some degree by merging all decisions into one. backtrack limit = 3. Nodes
Hence, a single fixpoint has to be computed rather with a bold border are
than ν.depth. Additionally, the cost can be fur- leaves, nodes with no border
ther reduced using other techniques employed by are placed in the open list
copying solvers [26]. Regardless of these mitigation after the backtrack bound is
techniques, some redundancy is unavoidable, hence exceeded. Nodes are num-
the number of backtracks performed at each DFS bered in the order they are
visited.
probe should be large enough to avoid excessive
redundancy.
Second, as it is allowed to perform Z backtracks in a depth-first manner
before it picks a new node, it may find new and better incumbent solutions, thus
it is anytime. The number of backtracks of each DFS probe should be sufficiently
small to offer quick diversification: by exploring a new best node, we are offered
the opportunity to reconsider early choices, similarly to what LDS [8] and Luby
16 D. Allouche et al.
randomized restarts [18] may offer. Additionally, with early upper bounds, we
can also prune the open node list and remove all nodes such that ν.lb ≥ ub.
To balance the conflicting objectives of reducing repeated propagation and
diversification, we dynamically adjust the amount of backtracks Z that can be
performed during one DFS probe by trying to keep the observed rate of redun-
dantly propagated decisions between reasonable bounds (α and β). In all the
algorithms here, we assume that the number of nodes (Nodes) and backtracks
(Backtracks) are implicitly maintained during search.
This hybrid does not preserve the polyspace complexity of DFS. However, it
can easily be made anyspace. If memory is exhausted (or a memory upper bound
is reached, with the same effect), the algorithm can switch from bounded DFS
to complete DFS. This means that for every node it picks from the open list, it
explores the entire subtree under that node. Hence, it will not generate any new
open nodes. It can continue in this mode of operation until memory pressure is
relieved.
Finally, this method computes stronger global lower bounds than DFS, as the
cost of a best node in the open list defines a global lower bound, as in BFS. DFS
instead cannot improve on the global lower bound computed at the root until it
finally visits the first right branch. In the context of a single instance this is only
important in the sense that it provides a better estimation of the optimality gap.
However, we will see that this can improve performance in decomposition-based
methods.
Alternate search space exploration schemes have been proposed in the field of
heuristic search, as variations of A* search. These schemes can be applied to dis-
Anytime Hybrid Best-First Search with Tree Decomposition 17
upper bound.2 Caches are initially empty and return naive values LB Pe /A = 0
and UB Pe /A = k for all clusters and separator assignments.
BTD-DFS has two main disadvantages: first, it has very poor anytime behavior,
as it cannot produce a solution in a decomposition with k leaves until k − 1 leaf
clusters have been completely solved. This affects the strength of pruning, as
2
This is clearly redundant for BTD-DFS, but allows a more uniform presentation with
BTD-HBFS.
20 D. Allouche et al.
values are only pruned if the current lower bound added to the marginal cost of
the value exceeds the upper bound. Second, because child clusters are examined
in order, only the lower bounds of siblings earlier than Cf in that order can
contribute to pruning in Cf . For example, consider a cluster Ce with 3 child
e
clusters Cf1 , Cf2 , Cf3 . Assume that ub = 31 and under an assignment A, w∅ has
known cost 10 while Pf1 |Af1 , Pf2 |Af2 and Pf3 |Af3 all have optimal cost 10, and
lb(Pf1 |Af1 ) = lb(Pf2 |Af2 ) = lb(Pf3 |Af3 ) = 0. Clearly the subproblem under Ce
cannot improve on the upper bound, but when we solve Cf1 and Cf2 , BTD-DFS
does not reduce the effective upper bound at all. However, it may be relatively
easy to prove a lower bound of 7 for each of the child clusters. If we had this
information, we could backtrack.
HBFS has the ability to quickly provide good lower and upper bounds and inter-
rupts itself as soon as the limit number of backtracks is reached. Using HBFS instead
of DFS in BTD should allow to quickly probe each subproblem to obtain interme-
diate upper and lower bounds for each of them. The upper bounds can be used to
quickly build a global solution, giving anytime behavior to BTD. The lower bounds
of all subproblems can be used to improve pruning in all other clusters.
The pseudocode of BTD-HBFS is described as Algorithm 3. It takes the same
arguments as BTD-DFS but ignores the last one (used only to pass informa-
tion from BTD-HBFS to BTD-DFS). BTD-HBFS relies on BTD-DFS pseudocode,
assuming that all grayed lines of BTD-DFS are active. These reactivated lines
in Algorithm 2 impose per-cluster and per-subproblem backtrack limits. Every
cluster Ce has a counter Ce .backtracks for number of backtracks performed inside
the cluster and an associated limit Ce .limit. Every subproblem Pe has a limit
Pe .limit on the number of backtracks N performed inside the subproblem. Ini-
tially, Ce .limit = Pe .limit = ∞ for all Ce ∈ C.
Every subproblem Pe |Ae has its own list of open nodes Pe |Ae .open for each
upper bound which it is given. The value of the upper bound participates in
the definition of the actual search space that needs to be explored. If the same
subproblem is revisited later with a lower upper bound, then the search space
shrinks and we can just copy the open list associated with the higher bound and
prune all nodes ν such that ν.lb ≥ ub. But if the upper bound is more relaxed
than any previous upper bound then we need to create a new open list starting
with the root node.
Finally, the loop in line 1 is interrupted as soon as the optimality gap reduces
or the number of backtracks reaches the subproblem limit, making the search
more dynamic. If subproblems quickly update their bound, the remaining back-
tracks can be used in a higher cluster. However, the subproblem under each
child cluster is guaranteed to get at least Z backtracks. The result is that we
spend most of the time in leaf clusters. When one cluster exhausts its budget,
the search quickly returns to the root cluster.
Example 1. Consider the example in figure 3. We have a CFN with the tree
decomposition given in the box labeled (C, T ) and the search in each cluster is
shown in a box labeled by that cluster’s name. Let N = 2 and Z = 1 in this
example. The search visits nodes as they are numbered in the figure. When it
Anytime Hybrid Best-First Search with Tree Decomposition 21
BTD-HBFS addresses both the issues of BTD that we identified above. First, it is
anytime, because as soon as UB Pe |Ae < k for all subproblems, we can combine the
assignments that gave these upper bounds to produce a global solution. Second, it
constantly updates lower bounds for all active subproblems, so the search effort in
each subproblem immediately exploits all other lower bounds.
22 D. Allouche et al.
(C, T ) C1
C1 1
C2 C3 2 19
C4 C5 3
C2 /A1 C3 /A1
5 15
6 16 17
7 18
C4 /A2 C5 /A2
8 12
9 11 13
10 14
Fig. 3. An example of a run of BTD-HBFS. White nodes are open, nodes with a black
border are conflicts (square) or solutions (circle). Grey nodes with a white border are
explored but put back in the open list. Grey nodes with no border are closed.
Like HBFS, BTD-HBFS can be made anyspace, i.e., its memory usage can be
limited to any amount beyond what is needed for BTD-DFS, including zero. The
cache of bounds can also be limited, at the expense of additional subproblem
recomputations, leading to worst-case complexity exponential in the tree decom-
position height.
Proof (Sketch). For correctness, observe that BTD-DFS solves independent sub-
problems separately using DFS, hence using HBFS or any other solution method
does not affect correctness. Each leaf node in an internal cluster is closed only
Anytime Hybrid Best-First Search with Tree Decomposition 23
when all child clusters are solved, hence all bounds for each subproblem and
open node list are correct. Finally, exploration at the root cluster continues until
the optimality gap is closed. Complexity stems from the complexity of BTD and
the additional overhead of storing open lists for each separator assignment and
upper bound.
AND/OR Branch and Bound search has already been combined with BFS [20].
The resulting AOBF algorithm, has good worst-case time complexity similar to
BTD-DFS, but otherwise has the space-intensive non anytime behavior of BFS.
The poor anytime ability of BTD has been addressed by breadth-rotating
AND/OR search (BRAO) [21]. BRAO interleaves DFS on all components, so
it can combine the incumbents of all components to produce a global solution.
However, as it performs DFS on each component, it does not produce better
lower bounds.
OR-decomposition [12] is an anytime method that exploits lower bounds
produced by other clusters by performing DFS in which it interleaves variable
choices from all components, and uses caching to achieve the same effect as BTD.
However, the global lower bound it computes depends on the partial assignments
of all components. Thus it may revisit the same partial assignment of one com-
ponent many times. This may also inhibit its anytime behavior, as a high cost
partial assignment in one component will prevent other components from reach-
ing good solutions. Moreover, the local lower bound for each component is only
updated by visiting the right branch at its root.
Russian Doll Search [25], uses DFS to solve each cluster of a rooted tree
decomposition in topological order. This method is not anytime, as it cannot
produce a solution until it starts solving the root cluster. Moreover, it computes
lower bounds that are independent of the separator assignment, hence can be
lower than their true value.
5 Experimental Results
3
http://hci.iwr.uni-heidelberg.de/opengm2/
24 D. Allouche et al.
and additional instances from the CostFunctionLib4 . This is a total of more than
3,000 instances that can be encoded as Cost Function Networks, available at
http://genoweb.toulouse.inra.fr/∼degivry/evalgm, with domain sizes that range
from d = 2 to 503, n = 2 to 903, 884 variables, and e = 3 to 2, 912, 880 cost
functions of arity from r = 2 to 580. We used toulbar2 version 0.9.8.0-dev5 on
a cluster of 48-core Opteron 6176 nodes at 2.3 GHz with 378 GB RAM, with a
limit of 24 simultaneous jobs per node.
In all cases, the local lower bound is provided by maintaining EDAC [13].
The variable ordering includes both weighted-degree [4] and last-conflict [15]
heuristics. The value ordering is to select the EAC support value first [13]. All
executions used a min-fill variable ordering for DAC preprocessing. For HBFS, we
set the node recomputation parameters to [α, β] = [5%, 10%] and the backtrack
limit N to 10, 000.
The methods based on BTD use a different value ordering heuristic: if a
solution is known for a cluster, it keeps the same value if possible and if not
uses EAC support values as the previous methods. A min-fill ordering is used
for building a tree decomposition. Children of a cluster are statically sorted by
minimum separator size first and smallest number of subproblem variables next.
Our aim is to determine whether HBFS is able to improve over DFS both in
terms of number of problems solved (including the optimality proof) and in its
anytime behavior. Similarly, we compare BTD-HBFS to BTD-DFS. We include in
our comparison two methods that are known to significantly improve the upper
bound anytime behavior of DFS: Limited Discrepancy Search [8] and DFS with
Luby restarts [18].
We also include results from BRAO [21] using the daoopt solver6 with static
mini-bucket lower bounds of different strength (i-bound set to 15 and 35) and
without local search nor iterative min-fill preprocessing. daoopt is restricted to
cost functions expressed by complete tables, hence we exclude most MaxSAT
families (except MIPLib and MaxClique) in tests where we use it.
We show in figure 4 a cactus plot comparing all the algorithms that do not use
tree decompositions, but also include BTD-HBFSrk for reference (see below). We
see that HBFS is the best performing decomposition-unaware algorithm. It out-
performs DFS and DFS with Luby restarts significantly, and slightly outperforms
LDS.
Although our benchmark set includes very large instances, and our HBFS
implementation does not include automatic control of space usage, no instance
required more than 32 GB. The median memory usage was 36.8 MB for DFS
and 38.2 MB for hybrid BFS. The worst-case largest ratio between HBFS and
4
https://mulcyber.toulouse.inra.fr/projects/costfunctionlib
5
Available in the git repository at https://mulcyber.toulouse.inra.fr/projects/
toulbar2/ in the bfs branch.
6
https://github.com/lotten/daoopt
Anytime Hybrid Best-First Search with Tree Decomposition 25
Fig. 4. Number of solved instances within a given time. Methods in the legend are
sorted at time=20min.
B
12.1M B = 31.4 on MRF Grid instance grid20x20.f15 (unsolved in
DFS was 379.8M
one hour by both methods).
In figure 5, we compare algorithms exploiting a tree decomposition (BTD-
like) or a pseudo-tree (BRAO).We see that BTD-HBFS slightly outperforms BTD-
DFS, both outperforming BRAO. However, many of these instances have large
treewidth and BTD-like methods are not ideal for these. Even for instances with
small treewidth, the decomposition is often a deep tree in which each cluster
shares all but one variables with its parent. In these cases, following the tree
decomposition imposes a static variable ordering on BTD, while HBFS degrades
to DFS. Finding good tree decompositions is not straightforward [10,11]. A sim-
ple way to improve one is to merge clusters until no separator has size greater
than k, even if this increases width. We call the algorithms that apply this
BTD-DFSrk and BTD-HBFSrk . Figure 5 includes results for BTD-DFSr4 and BTD-
HBFSr4 . BTD-DFSr4 is significantly better than BTD-DFS and BTD-HBFSr4 out-
performs BTD-DFSr4 by an even greater margin. BTD-HBFSr4 is also the overall
best performer as shown in figure 4.
To analyze the algorithms’ anytime behavior, we first show in figure 6 the evo-
lution of the lower and upper bounds for two instances: the SPOT5 404 (left)
and the RLFAP CELAR06 instances (right). We solve both instances using DFS,
LDS, DFS with Luby restarts, HBFS, BTD-DFS and BTD-HBFS. In both instances,
we see that HBFS and BTD-HBFS improve significantly on the upper bound any-
time ability of DFS and BTD-DFS, respectively. Moreover, the lower bound that
they report increases quickly in the beginning and keeps increasing with time.
For all other algorithms, the lower bound increases by small amounts and infre-
quently, when the left branch of the root node is closed. The HBFS variants are
as fast as the base algorithms in proving optimality.
26 D. Allouche et al.
100
90
80
70
60
0.1 1 10 100 1000
Fig. 6. Evolution of the lower and upper bounds (Y axis, in cost units) as time (X axis,
in seconds) passes for HBFS, Luby restart, LDS, and DFS on SPOT5 404 instance (left)
and also BTD, and BTD-HBFS for the RLFAP CELAR06 instance (right). Methods are
sorted in increasing time to find the optimum. For each curve, the first point represents
the time where the optimum is found and the second point the time (if any) of proof
of optimality.
In figure 7, we summarize the evolution of lower and upper bounds for each
algorithm over all instances that required more than 5 sec to be solved by DFS.
Specifically, for each instance I we normalize all costs as follows: the initial
lower bound produced by EDAC (which is common to all algorithms) is 0; the
best – but potentially suboptimal – solution found by any algorithm is 1; the
worst solution is 2. This normalization is invariant to translation and scaling.
Additionally, we normalize time from 0 to 1 for each pair of algorithm A and
instance I, so that preprocessing ends at time 0 and each run finishes at time
1. This time normalization is different for different instances and for different
algorithms on the same instance. A point
x, y on the lower bound line for
algorithm A in figure 7 means that after normalized runtime x, algorithm A has
proved on average over all instances a normalized lower bound of y and similarly
for the upper bound. We show both the upper and lower bound curves for all
Anytime Hybrid Best-First Search with Tree Decomposition 27
Fig. 7. Average evolution of normalized upper and lower bounds for each algorithm.
algorithms evaluated here. In order for the last point of each curve to be visible,
we extend all curves horizontally after 1.0.
This figure mostly ignores absolute performance in order to illustrate the
evolution of upper and lower bounds with each algorithm, hence cannot be inter-
preted without the additional information provided by the cactus plots in figures
4 and 5. It confirms that HBFS improves on DFS in terms of both upper and
lower bound anytime behavior and similarly for BTD-HBFSr4 over BTD-DFSr4
and BRAO, with the latter being especially dramatic. The two HBFS variants
are, as expected, significantly better than all other algorithms in terms of the
lower bounds they produce. HBFS and BTD-HBFSr4 produce solutions of the
same quality as LDS, while DFS-Luby is slightly better than this group on this
restricted benchmark set (without MaxSAT).
Despite the fact that time to solve an instance is normalized away in figure
7, it does give some information that is absent from the cactus plots and that
is the average normalized lower and upper bounds at time 1. Figure 7 tells us
that DFS-Luby finds the best solution most often, as its upper bound curve is
the lowest at time 1. It is followed closely by the HBFS variants and LDS, while
DFS and BTD-DFSr4 are significantly worse. On the other hand, DFS-Luby is
significantly worse than the HBFS variants in the cactus plot. HBFS and BTD-
HBFSr4 give better lower bounds in those instances that they failed to solve, so
their lower bound curves are higher at point 1.
6 Conclusions
Hybrid BFS is an easily implemented variant of the Branch and Bound algo-
rithm combining advantages of BFS and DFS. While being a generic strategy,
applicable to essentially any combinatorial optimization framework, we used it
to improve Depth-First Branch and Bound maintaining soft arc consistency and
28 D. Allouche et al.
References
1. Ansótegui, C., Bonet, M.L., Gabàs, J., Levy, J.: Improving sat-based weighted
maxsat solvers. In: Proc. of CP 2012, Québec City, Canada, pp. 86–101 (2012)
2. van den Berg, J., Shah, R., Huang, A., Goldberg, K.: ANA*: Anytime nonparamet-
ric A*. In: Proceedings of Twenty-Fifth AAAI Conference on Artificial Intelligence
(AAAI 2011) (2011)
3. Berthold, T.: Primal heuristics for mixed integer programs. Master’s thesis, Tech-
nischen Universität Berlin (2006). urn:nbn:de:0297-zib-10293
4. Boussemart, F., Hemery, F., Lecoutre, C., Sais, L.: Boosting systematic search by
weighting constraints. In: ECAI, vol. 16, p. 146 (2004)
5. Cooper, M., de Givry, S., Sanchez, M., Schiex, T., Zytnicki, M., Werner, T.: Soft
arc consistency revisited. Artificial Intelligence 174(7), 449–478 (2010)
6. Dechter, R., Mateescu, R.: And/or search spaces for graphical models. Artificial
Intelligence 171(2), 73–106 (2007)
7. de Givry, S., Schiex, T., Verfaillie, G.: Exploiting tree decomposition and soft local
consistency in weighted CSP. In: Proc. of the National Conference on Artificial
Intelligence, AAAI 2006, pp. 22–27 (2006)
8. Harvey, W.D., Ginsberg, M.L.: Limited discrepency search. In: Proc. of the 14th
IJCAI, Montréal, Canada (1995)
9. Jégou, P., Terrioux, C.: Hybrid backtracking bounded by tree-decomposition of
constraint networks. Artif. Intell. 146(1), 43–75 (2003)
10. Jégou, P., Terrioux, C.: Combining restarts, nogoods and decompositions for solv-
ing csps. In: Proc. of ECAI 2014, Prague, Czech Republic, pp. 465–470 (2014)
11. Jégou, P., Terrioux, C.: Tree-decompositions with connected clusters for solving
constraint networks. In: Proc. of CP 2014, Lyon, France, pp. 407–423 (2014)
Anytime Hybrid Best-First Search with Tree Decomposition 29
1 Introduction
Modern finite-domain constraint programming (CP) solvers employ a constraint
propagation process in which domain changes for the variables are propagated
between constraints. To allow for more communication and knowledge sharing
between constraints, several techniques have been proposed. One possibility is to
propagate more structural information than variable domains, such as (relaxed)
decision diagrams [1,10]. Another option, in the context of optimization prob-
lems, is to combine constraints with the objective function, and utilize mathe-
matical programming relaxations for stronger cost-based filtering [7,15]. These
approaches, however, have in common that consistency checks are done sepa-
rately and independently for each constraint. Higher-order consistencies, such as
pairwise consistency [12] can consider multiple constraints simultaneously, but
may suffer from a relatively high computational cost.
We propose an alternative, and generic, approach to improve the propaga-
tion between constraints based on Lagrangian decomposition [9]. In Lagrangian
decomposition, the constraint set of a given problem is partitioned into struc-
tured subproblems, each of which is defined on a duplicate copy of the original
variables. To link the subproblems, constraints are added to ensure that each
of the duplicates is equal to the original variable. These latter constraints are
then relaxed with an associated Lagrangian multiplier, and moved to the objec-
tive. This results in independent subproblems that can be separately optimized.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 30–38, 2015.
DOI: 10.1007/978-3-319-23219-5 3
Improved Constraint Propagation via Lagrangian Decomposition 31
Intuitively, the idea is to force the variables to take the same value in each con-
straint, via the Lagrangian penalties, which are iteratively updated. This will
somehow synchronize the consistency checks for each of the constraints; instead
of allowing each constraint to check its consistency w.r.t. an arbitrary tuple, we
iteratively arrive at tuples with minimal disagreement.
Since constraint programming has been designed to work with (global) con-
straints that capture a specific structure of the problem, the application of
Lagrangian decomposition in this context seems natural and promising. Indeed,
we show that the Lagrangian decomposition is not only useful to improve the
bound on the objective, but can also be applied for cost-based domain filtering.
The structure of the paper is as follows. We first provide an overview of the
most relevant related work in Section 2. In Section 3 we recall the Lagrangian
decomposition scheme. We apply this to constraint programming models in
Section 4. Experimental results on instances with multiple alldiff constraints
are given in Section 5, while Section 6 provides results on set covering problems.
We conclude in Section 7.
2 Related Work
Lagrangian relaxations have been widely applied in operations research as well
as constraint programming. One of the first applications in CP is the work by
Benoist et al. [2] on the Traveling Tournament Problem. A formal treatment
was provided by Sellmann [16] who showed that optimal Lagrangian multipliers
may not result in the most effective domain filtering. Recently, [8] introduced
a framework for automated Lagrangian relaxation in a constraint programming
context. That work explicitly generalizes Lagrangian relaxations to CP problems
using measures of constraint violations, or degrees of satisfiability.
Adapting weights for improving propagation has also been applied in the
context of Valued Constraint Satisfaction Problems [6]. In that work, a lin-
ear programming model is proposed for computing Optimal Soft Arc Consis-
tency, but Lagrangian relaxations are not used. Khemmoudj et al. [13] combine
arc consistency with Lagrangian relaxation for filtering constraint satisfaction
problems (CSPs). They consider binary CSPs (i.e., each constraint has at most
two variables in its scope) in extensional form. Lastly, Bergman et al. [3] intro-
duce Lagrangian relaxations in the context of propagating (relaxed) decision
diagrams.
3 Lagrangian Decomposition
Lagrangian decomposition has been introduced to strengthen Lagrangian bounds
for integer linear optimization problems [9]. Consider an integer linear program
of the form:
(P ) max{f x | Ax ≤ b, Cx ≤ d, x ∈ X},
for some feasible set X, where x ∈ Rn is a vector of variables, f ∈ Rn represents
a ‘weight’ vector, A and C represent constraint coefficient matrices, and b and
32 D. Bergman et al.
The Lagrangian dual is to find those Lagrangian multipliers λ that provide the
best bound:
min LP (λ).
λ
Guignard and Kim [9] show that the optimal bound obtained from this
Lagrangian decomposition is at least as strong as the standard Lagrangian
bounds from dualizing either Ax ≤ b or Cx ≤ d. Lagrangian decomposition may
be particularly useful when the problem is composed of several well-structured
subproblems, such as those defined by (global) constraints in CP models.
max f (x1 , . . . , xn )
s.t. Cj (x1 , . . . , xn ) j ∈ {1, . . . , m} (1)
xi ∈ Di i ∈ {1, . . . , n}
For simplicity we assume here that all variables appear in all constraints, but
we can allow a different subset of variables for each constraint. Also, Cj may
represent any substructure, for example a global constraint, a table constraint, or
a collection of constraints. We introduce for each variable xi and each constraint
j = 1, . . . , m a duplicate variable yij with domain Di . We let the set yi1 represent
Improved Constraint Propagation via Lagrangian Decomposition 33
our ‘base’ variables, to which we will compare the variables yij for j = 2, . . . , m.
The reformulated COP is as follows:
max f (y11 , . . . , yn1 )
s.t. Cj (y1j , . . . , ynj ) j ∈ {1, . . . , m}
yi1 = yij i ∈ {1, . . . , n}, j ∈ {2, . . . , m}
yij ∈ Di i ∈ {1, . . . , n}, j ∈ {1, . . . , m}
j
This leads to the following decomposition (for any given set of multipliers λi ):
⎧ ⎫
⎨ m n ⎬
max f (y11 , . . . , yn1 ) − λji [yi1 ] | C1 (y11 , . . . , yn1 )
⎩ ⎭
m
n j=2 i=1
j j
+ max λi [yi ] | Cj (y1j , . . . , ynj )
j=2 i=1
This CSP is domain consistent as well as pairwise consistent, and has one solution
(x1 , x2 , x3 , x4 , x5 ) = (b, c, a, a, b).
We construct a Lagrangian decomposition based on the constraints
C1 , C2 , C3 . To link these, we only need to introduce the constraints y22 = y21 ,
y33 = y31 , y53 = y52 , and their associated multipliers. This yields the following
three subproblems, with respective objective values z1 , z2 , z3 :
2 3
z1 = max −λ2 [y21 ] − λ3 [y31 ] | alldiff(y11 , y21 , y31 )
2 3
z2 = max λ2 [y22 ] − λ5 [y52 ] | alldiff(y22 , y42 , y52 )
3 3
z3 = max λ3 [y33 ] + λ5 [y53 ] | alldiff(y33 , y53 )
We generated instances with n = 10, 11, 12, 13, 14, k = 4, and |Sj | = n − 2 for
all j = 1, . . . , 5. For the Lagrangian decomposition, we partition the alldiff
constraints into two arbitrary subsets of size two, and define one multi-valued
decision diagram (MDD) for each subset. In other words, we apply MDD prop-
agation to these subsets of alldiff constraints. The two MDDs thus formed
are the basis for the Lagrangian decomposition, which follows the description in
Section 4 (where the j-th MDD represents constraint set Cj ).
We implemented the MDD propagation as well as the Lagrangian decom-
position as a global constraint in IBM ILOG CPO 12.6, similar to [5]. The
(near-)optimal Lagrangian multipliers were computed using the Kelly-Cheney-
Goldstein method [14], using IBM ILOG CPLEX 12.6 as the linear programming
solver. We fix the CP search to be lexicographic in the order of the variables, to
ensure the search tree is the same across all instances. We compare the perfor-
mance with and without Lagrangian multipliers.
In Figure 1.a we show the root node percent gap for the 25 instances (where
the optimal value was obtained by formulating an integer linear program and
solving the instances using CPLEX). The reduction in the gap can be sub-
stantial, in some case several orders of magnitude. This reduction in the opti-
mality gap and additional cost-based filtering due to the Lagrangian multipliers
enables more instances to be solved in shorter computational time, as depicted in
Figure 1.b. Depending on the configuration of the alldiff systems the improve-
ment can be marginal and in some cases negligible.
36 D. Bergman et al.
Fig. 2. Evaluating the bound from Lagrangian decomposition for set covering problems
of varying bandwidth.
contain element i. Then the cost for variable xi is taken uniform randomly in
[0.75∗c(i), 1.25∗c(i)]. The results are shown in Figure 2, showing the average over
the five instances per bandwidth. Figure 2.a depicts four lines: the optimal solu-
tion (found by CPLEX), the average bound without using Lagrangian decom-
position, the maximum bound without using Lagrangian decomposition, and
lastly the average bound when using the Lagrangian decomposition. Lagrangian
decomposition generates bounds of much better quality than the independent
BDDs. For example, for bandwidth 65 the average bound of 27.53 is improved
to 77.80 using the Lagrangian decomposition, on average.
We also compare the Lagrangian decomposition to the original BDD relax-
ation from [4] that represents all constraints in a single BDD respecting a given
maximum width. A larger width leads to a stronger relaxation and better bounds.
Figure 2.b compares the percent gap (between the lower bound and the optimal
solution) of the BDD relaxation for maximum widths 2,000 and 20,000 with
that of the Lagrangian decomposition. We note that the BDD relaxation with
maximum width 2,000 has about the same memory requirements as the separate
BDDs for the Lagrangian decomposition. As the bandwidth increases, the qual-
ity of BDD relaxation rapidly declines, while the Lagrangian decomposition is
much more stable and outperforms the BDD relaxation (decreasing the gap from
117.6% to 33% for bandwidth 75 and maximum width 2,000). This demonstrates
that Lagrangian decompositions can be used to improve BDD-based optimiza-
tion when a single BDD relaxation can no longer provide sufficient power to
represent the entire problem. We do note, however, that the Lagrangian decom-
position takes more time to compute (on average 60s) compared to the single
BDD relaxation (on average 1.4s for width 2,000 and 17s for width 20,000).
7 Conclusion
We have introduced Lagrangian decomposition in the context of constraint pro-
gramming as a generic approach to improve the constraint propagation process.
The key idea is that we penalize variables in different constraints to take differ-
ent assignments. We have shown how this approach can be utilized for stronger
38 D. Bergman et al.
cost-based domain filtering, and that it leads to improved bounds for systems of
alldiff constraints and set covering problems.
References
1. Andersen, H.R., Hadzic, T., Hooker, J.N., Tiedemann, P.: A constraint store based
on multivalued decision diagrams. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741,
pp. 118–132. Springer, Heidelberg (2007)
2. Benoist, T., Laburthe, F., Rottembourg, B.: Lagrange relaxation and con-
straint programming collaborative schemes for traveling tournament problems. In:
Proceedings of the International Workshop on Integration of Artificial Intelligence
and Operations Research Techniques in Constraint Programming for Combinato-
rial Optimization Problems (CPAIOR 2001) (2001)
3. Bergman, D., Cire, A.A., van Hoeve, W.J.: Lagrangian Bounds from Decision Dia-
grams. Constraints 20(3), 346–361 (2015)
4. Bergman, D., van Hoeve, W.-J., Hooker, J.N.: Manipulating MDD relaxations for
combinatorial optimization. In: Achterberg, T., Beck, J.C. (eds.) CPAIOR 2011.
LNCS, vol. 6697, pp. 20–35. Springer, Heidelberg (2011)
5. Cire, A.A., van Hoeve, W.J.: Multivalued Decision Diagrams for Sequencing Prob-
lems. Operations Research 61(6), 1411–1428 (2013)
6. Cooper, M.C., de Givry, S., Sanchez, M., Schiex, T., Zytnicki, M., Werner, T.: Soft
arc consistency revisited. Artificial Intelligence 174(7–8), 449–478 (2010)
7. Focacci, F., Lodi, A., Milano, M.: Cost-based domain filtering. In: Jaffar, J. (ed.)
CP 1999. LNCS, vol. 1713, pp. 189–203. Springer, Heidelberg (1999)
8. Fontaine, D., Michel, L., Van Hentenryck, P.: Constraint-based lagrangian relax-
ation. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 324–339. Springer,
Heidelberg (2014)
9. Guignard, M., Kim, S.: Lagrangian Decomposition: A Model Yielding Stronger
Lagrangian Bounds. Mathematical Programming 39, 215–228 (1987)
10. Hoda, S., van Hoeve, W.-J., Hooker, J.N.: A systematic approach to MDD-
based constraint programming. In: Cohen, D. (ed.) CP 2010. LNCS, vol. 6308,
pp. 266–280. Springer, Heidelberg (2010)
11. van Hoeve, W.J., Katriel, I.: Global constraints. In: Handbook of Constraint Pro-
gramming, pp. 169–208. Elsevier (2006)
12. Janssen, P., Jégou, P., Nouguier, B., Vilarem, M.C.: A filtering process for general
constraint-satisfaction problems: achieving pairwise-consistency using an associ-
ated binary representation. In: IEEE International Workshop on Tools for Arti-
ficial Intelligence, Architectures, Languages and Algorithms, pp. 420–427. IEEE
(1989)
13. Khemmoudj, M.O.I., Bennaceur, H., Nagih, A.: Combining arc-consistency and
dual lagrangean relaxation for filtering CSPS. In: Barták, R., Milano, M. (eds.)
CPAIOR 2005. LNCS, vol. 3524, pp. 258–272. Springer, Heidelberg (2005)
14. Lemaréchal, C.: Lagrangian relaxation. In: Jünger, M., Naddef, D. (eds.) Com-
putational Combinatorial Optimization. LNCS, vol. 2241, pp. 112–156. Springer,
Heidelberg (2001)
15. Régin, J.-C.: Arc consistency for global cardinality constraints with costs. In:
Jaffar, J. (ed.) CP 1999. LNCS, vol. 1713, pp. 390–404. Springer, Heidelberg (1999)
16. Sellmann, M.: Theoretical foundations of cp-based lagrangian relaxation. In:
Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 634–647. Springer, Heidelberg
(2004)
Strengthening Convex Relaxations with Bound
Tightening for Power Network Optimization
1 Introduction
In (mixed-integer) nonlinear optimization, convexification is used to obtain dual
bounds, complementing primal heuristics. In many cases, these convex relax-
ations are parametrized by variable bounds and the tighter the bounds are, the
stronger the relaxations. There is thus a strong potential for synergies between
convex optimization and constraint programming. This paper explores these
synergies in the context of power system optimization.
The power industry has been undergoing a fundamental transformation in
recent years. Deregulation, the emergence of power markets, pressure for reduced
capital investment, and the need to secure a clean sustainable energy supply all
stress the importance of efficiency and reliability in the design and operation of
power networks. As a result, optimization has become a critical component of
NICTA—NICTA is funded by the Australian Government through the Department
of Communications and the Australian Research Council through the ICT Centre
of Excellence Program.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 39–57, 2015.
DOI: 10.1007/978-3-319-23219-5 4
40 C. Coffrin et al.
the emerging smart-grid [28] and has resulted in millions of dollars in annual
savings [32].
Power network applications range from long-term network design and invest-
ment tasks [7,12,21] to minute-by-minute operation tasks [14,16,17,19,23]. All
of these optimization problems share a common core, the Alternating Current
(AC) power flow equations, which model the steady-state physics of power flows.
These equations form a system of continuous non-convex nonlinear equations
that prove to be a significant challenge for existing general-purpose optimiza-
tion tools. It is thus not surprising that, in the last decade, significant attention
has been devoted to developing computationally efficient convex relaxations.
The main contribution of this paper is to show that constraint program-
ming can substantially improve the quality of convex relaxations for power flow
applications. To obtain this result, the paper defines the concept of constraint
relaxation networks and generalizes traditional consistency notions to these net-
works, including minimal network and bound consistency. These concepts, and
the associated algorithms, are then applied to optimal power flow applications
with and without load uncertainty. The experimental results demonstrate the
significant value of bound tightening for power flow applications. In particular,
The rest of the paper is organized as follows. Section 2 reviews the AC power flow
feasibility problem and introduces the notations. Section 3 reviews the state-of-
the-art QC power flow relaxation, which is essential for building efficient consis-
tency algorithms. Section 4 formalizes the idea of constraint relaxation networks
and Section 5 applies this formalism to AC power flows. Section 6 studies the
quality of bound tightening in this application domain and Section 7 evalu-
ates the proposed methods on the ubiquitous AC Optimal Power Flow problem.
Section 8 illustrates the potential of the proposed methods on power flow appli-
cations incorporating uncertainty and Section 9 concludes the paper.
2 AC Power Flow
A power network is composed of a variety of components such as buses, lines,
generators, and loads. The network can be interpreted as a graph (N, E) where
the set of buses N represent the nodes and the set of lines E represent the edges.
Strengthening Convex Relaxations with Bound Tightening 41
Note that E is a set of directed arcs and E R will be used to indicate those arcs in
the reverse direction. To break numerical symmetries in the model and to allow
easy comparison of solutions, a reference node r ∈ N is also specified.
Every node i ∈ N in the network has three properties, voltage Vi = vi ∠θi ,
power generation Sig = pgi + iqig , and power consumption Sid = pdi + iqid , all of
which are complex numbers due to the oscillating nature of AC power. Each line
(i, j) ∈ E has an admittance Yij = gij + ibij , also a complex number. These
network values are connected by two fundamental physical laws, Kirchhoff’s
Current Law (KCL),
Sig − Sid = Sij ∀ i ∈ N (1)
(i,j)∈E∪E R
Note that bold values indicate parameters that are constant in the classic AC
power flow problem and non-bold values are the decision variables.
In addition to these physical laws, the following operational constraints are
required in AC power flows. Generator output limitations on S g ,
Note that power networks are designed and operated so that −π/3 ≤ θ Δl ≤
θ Δu ≤ π/3 [22] and values as low as π/18 are common in practice [33]. Addi-
tionally the values of v l , v u , su must be positive as they are bounds on the
magnitudes of complex numbers.
Combining all of these constraints and expanding them into their real-number
representation yields the AC Power Flow Feasibility Problem (AC-PF) presented
in Model 1. The input data is indicated by bold values and a description of
the decision variables is given in the model. Constraint (7a) sets the reference
angle. Constraints (7b)–(7c) capture KCL and constraints (7d)–(7e) capture
Ohm’s Law. Constraints (7f) link the phase angle differences on the lines to the
bus variables and constraints (7g) enforce the thermal limit on the lines. This
particular formulation of AC-PF is advantageous as the auxiliary variables θΔ , p,
42 C. Coffrin et al.
wi = vi2 i ∈ N (8a)
R Δ
wij = vi vj cos(θij ) ∀(i, j) ∈ E (8b)
I Δ
wij = vi vj sin(θij ) ∀(i, j) ∈ E (8c)
When Model 1 is lifted into this W-space, all of the remaining constraints are
convex. On its own, this lifted model is a weak relaxation but the QC relaxation
strengthens it by developing convex relaxations of the nonlinear equations (8a)–
(8c) for the operational bounds on variables v and θΔ . The convex envelopes for
the square and bilinear functions are well-known [27], i.e.,
2 T
x̌ ≥ x2
x ≡ (T-CONV)
x̌ ≤ (xu + xl )x − xu xl
⎧
⎪
⎪ ˇ ≥ xl y + y l x − xl y l
xy
⎪
⎪
⎨xy
ˇ ≥ xu y + y u x − x u y u
xyM ≡ (M-CONV)
⎪
⎪ ˇ ≤ xl y + y u x − x l y u
xy
⎪
⎪
⎩
ˇ ≤ xu y + y l x − x u y l
xy
Under the assumption that the phase angle difference bound is within −π/2 ≤
θ Δl ≤ θ Δu ≤ π/2, relaxations for sine and cosine are given by
ˇ ≤ cos(x)
cx
cos(x)C ≡ cos(xl )−cos(xu )
(C-CONV)
ˇ ≥
cx (xl −xu )
(x − xl ) + cos(xl )
⎧
m
m
⎪
⎪sxˇ ≤ cos x
x − xm
+ sin x
if xl < 0 ∧ xu > 0
⎪
⎪ 2 2 2
⎪
⎪
m
m
⎪
⎪ m
⎪
⎪ ˇ ≥ cos 2
sx x
x + 2 − sin 2
x x
if xl < 0 ∧ xu > 0
⎪
⎪
⎪
⎨sxˇ ≤ sin(x) if xl ≥ 0
sin(x)S ≡ (S-CONV)
⎪
⎪
l
)−sin(xu )
⎪
⎪ ˇ ≥ sin(x
sx (x − xl ) + sin(xl ) if xl ≥ 0
⎪
⎪
(xl −xu )
⎪
⎪
⎪
l
)−sin(xu )
⎪
⎪ ˇ ≤ sin(x
sx l −xu ) (x − xl ) + sin(xl ) if xu ≤ 0
⎪
⎪
(x
⎩
ˇ ≥ sin(x)
sx if xu ≤ 0
where xm = max(−xl , xu ). These are a generalization of the relaxations pro-
posed in [18] to support asymmetrical bounds on x. Utilizing these building
44 C. Coffrin et al.
1.0
1.0
0.8
0.5
0.5
0.4
Cosine
0.0
0.0
0.0
0.8
−0.5
−0.5
Sine
0.4
Variable Bound
Constraint
−1.0
−1.0
Feasible Region Sine Cosine
0.0
−1.0 −0.5 0.0 0.5 1.0 −1.0 −0.5 0.0 0.5 1.0 −1.0 −0.5 0.0 0.5 1.0
Note that the bounds are not necessarily solutions themselves but are as tight
as the floating-point accuracy allows for. Given a CCN P = (X, I, C), its largest
minimal network P = (X , I , C) (Im ⊆ I) always exists and is unique since
there are only finitely many floating-point intervals.
The concept of bound consistency [39] captures a relaxation of the mini-
mal network: It only requires the variable bounds to be tight locally for each
constraint.
Once again, given a CCN P = (X, I, C), its largest bound-consistent network
P = (X, Im , C) (Im ⊆ I) always exists and is unique. In the following, we use
minCCN (X, I, C) and bcCCN (X, I, C) to denote these networks, i.e.,
minCCRN(X, I, R) bcCCN(X, I, C)
I n := I; I n := I;
repeat repeat
I o := I n ; I o := I n ;
I n := minCCN(X, I o , R(I o )); for all c ∈ C
until I o = I n Icn
:= minCCN(X, I o , {c});
return I n ; I n := c∈C Icn ;
until I o = I n
return I n ;
Fig. 2. Computing the Minimal Fig. 3. Computing the Largest
Continuous Constraint Relaxation Bound-Consistent Constraint Net-
Networks work.
Proposition 1. Let (X, I, C) be a CCN and let (X, I, R) be a CCRN such that
R = {r | c ∈ C ∧ r is a relaxation of c}. Then,
The idea of bounds propagation for global optimization goes as far back as
[6]: It was subsequently implemented in the Numerica system which also per-
forms bound propagation on a linearization of the nonlinear constraints [37,38].
The notion of using bound reductions for improving convex relaxations of non-
convex programs was first widely recognized in the Branch-and-Reduce (BnR)
algorithm [34]. BnR is a natural extension of Branch-and-Bound over continuous
domains, which includes additional steps to reduce the domains of the variables
at each search node. This line of work has developed into two core bound reduc-
tion ideas: (1) Feasibility-Based Range Reduction (FBRR), which is concerned
with pruning techniques based on feasibility information and (2) Optimality
Based Range Reduction (OBRR), which develops bound reductions based on
Lagrangian-duality arguments [35]. A variety of methods have been developed
for FBRR and OBRR with various pruning strength and computational time
tradeoffs [5,25,34]. However, all these methods are non-global bound reduction
techniques and may be iterated until a desired level of consistency is achieved.
Strengthening Convex Relaxations with Bound Tightening 49
Observe that this computation is inherently parallel, since all the optimizations
are independent.
that captures constraints (7f)–(7g), (10a)–(10k) for each line (i, j) ∈ E. The
use of this global constraint means that QC-B computes a stronger form of
bounds consistency than one based purely on Model 2. This stronger level of
consistency is necessary to obtain reasonable bound tightenings. Note that all the
optimizations in algorithms QC-N and QC-B are convex optimization problems
which can be solved in polynomial time.
the number of fixpoint iterations. The total runtimes of the QC-B and QC-N
algorithms vary widely based on the size of the network under consideration
and can range from seconds to hours. Fortunately, regardless of the size of the
network, the number of iterations in the fixpoint computation is small (often
less than 10). As a result, the parallel runtime of the algorithms scale well with
the size of the network and rarely exceeds 1 minute, which is well within the
runtime requirements of the majority of network optimization applications.2
The complete non-convex AC-OPF problem is Model 1 with objective (11) and
the QC relaxation of this problem is Model 2 with objective (11).
The goal is to compare five AC-OPF relaxations for bounding primal AC-
OPF solutions produced by IPOPT, which only guarantees local optimality. The
five relaxations under consideration are as follows:
1. QC - as defined in Model 2.
2. QC-B - bcCCRN for Model 2.
3. QC-N - minCCRN for Model 2.
4. SDP - a state-of-the-art relaxation based on semi-definite programming [26].
5. SDP-N - the SDP relaxation strengthened with bounds from QC-N.
There is no need to consider other existing relaxations as the QC and SDP
dominate them [11]. The computational environment and test cases are those of
Section 6. SDPT3 4.0 [36] was used to solve the SDP models.
Table 1 presents the detailed performance and runtime results on all 57 test
cases. They can be summarized as follows: (1) The optimality gaps of the QC
relaxation are significantly reduced by both QC-N and QC-B; (2) QC-N closes
the AC-OPF optimality gap to below 1% in 90% of the cases considered and
closes 10 open test cases; (3) QC-N almost always outperforms the SDP relax-
ation in quality with comparable parallel runtimes; (4) For the test cases with
significant optimality gaps, QC-N outperforms the SDP relaxation most often,
even when the SDP relaxation is strengthened with QC-N bounds (i.e., SDP-N).
2
Dedicated high performance computational resources are commonplace in power
system operation centers. The T∞ runtime is realistic in these settings where high-
level of reliability is critical.
52 C. Coffrin et al.
Table 1. Quality and Runtime Results of Convex Relaxations on the AC-OPF Problem
(bold - best in row (runtime used to break ties in quality), — - solving error)
Overall, these results clearly establish QC-N is the new state-of-the-art con-
vex relaxation of the AC-OPF. General purpose global optimization solvers (e.g.,
Couenne 0.4 [3] and SCIP 3.1.1 [1,8]) were also considered for comparison. Pre-
liminary results indicated that these general purpose solvers are much slower
than the dedicated power flow relaxations considered here and cannot produce
competitive lower bounds on these networks with in 10 hours of computation.
QC−N
QC−U−N
0 20 40 60 80 100
Angle Diff. Sign Unknown (% of lines)
loss due to uncertainty. The results indicate that, even when load uncertainty is
incorporated, minCCRN still prunes the variable domains significantly, typically
reducing the voltage angle domains by 80% and the voltage magnitude domains
by 10%, and determining the sign of θΔ for about 30% of the lines. The domain
reduction on θΔ in QC-U-N is particularly significant.
Figure 7 considers the AC-OPF and summarizes the optimality gaps pro-
duced under load certainty and uncertainty. QC-U-N produces significant
improvement in optimality gaps, moving from < 5% (QC) to less than < 1%.
Obviously, load certainty (QC-N) closes the remaining 1%.
9 Conclusion
This paper studied how bound tightening can improve convex relaxations by
adapting traditional constraint-programming concepts (e.g., minimal network
and bound consistency) to a relaxation framework. It showed that, on power
flow applications, bound tightening over the QC relaxation can dramatically
reduce variable domains. Moreover, on the ubiquitous AC-OPF problem, the QC
relaxation, enhanced by bound tightening, almost always outperforms the state-
of-the-art SDP relaxation on the optimal power flow problem. The paper also
showed that bound tightening yields significant benefits under load uncertainty,
demonstrating a breadth of applicability. These results highlight the significant
potential synergies between constraint programming and convex optimization
for complex engineering problems.
References
1. Achterberg, T.: Scip: solving constraint integer programs. Mathematical Program-
ming Computation 1(1), 1–41 (2009). http://dx.doi.org/10.1007/s12532-008-0001-1
Strengthening Convex Relaxations with Bound Tightening 55
2. Bai, X., Wei, H., Fujisawa, K., Wang, Y.: Semidefinite programming for optimal
power flow problems. International Journal of Electrical Power & Energy Systems
30(67), 383–392 (2008)
3. Belotti, P.: Couenne: User manual (2009). https://projects.coin-or.org/Couenne/
(accessed April 10, 2015)
4. Belotti, P., Cafieri, S., Lee, J., Liberti, L.: On feasibility based bounds tightening
(2012). http://www.optimization-online.org/DB HTML/2012/01/3325.html
5. Belotti, P., Lee, J., Liberti, L., Margot, F., Wachter, A.: Branching and bounds
tightening techniques for non-convex minlp. Optimization Methods Software 24(4–
5), 597–634 (2009)
6. Benhamou, F., McAllester, D., Van Hentenryck, P.: Clp (intervals) revisited.Tech.
rep., Brown University, Providence, RI, USA (1994)
7. Bent, R., Coffrin, C., Gumucio, R., Van Hentenryck, P.: Transmission network
expansion planning: Bridging the gap between ac heuristics and dc approximations.
In: Proceedings of the 18th Power Systems Computation Conference (PSCC 2014),
Wroclaw, Poland (2014)
8. Berthold, T., Heinz, S., Vigerske, S.: Extending a cip framework to solvemiqcps.
In: Lee, J., Leyffer, S. (eds.) Mixed Integer Nonlinear Programming. The IMA
Volumes in Mathematics and its Applications, vol. 154, pp. 427–444. Springer
New York (2012)
9. Chen, Y., Luh, P., Guan, C., Zhao, Y., Michel, L., Coolbeth, M., Friedland, P.,
Rourke, S.: Short-term load forecasting: Similar day-based wavelet neural networks.
IEEE Transactions on Power Systems 25(1), 322–330 (2010)
10. Coffrin, C., Gordon, D., Scott, P.: NESTA, The Nicta Energy System Test Case
Archive. CoRR abs/1411.0359 (2014). http://arxiv.org/abs/1411.0359
11. Coffrin, C., Hijazi, H., Van Hentenryck, P.: The QC Relaxation: Theoretical and
Computational Results on Optimal Power Flow. CoRR abs/1502.07847 (2015).
http://arxiv.org/abs/1502.07847
12. Coffrin, C., Van Hentenryck, P.: Transmission system restoration: Co-optimization
of repairs, load pickups, and generation dispatch. International Journal of Electrical
Power & Energy Systems (2015) (forthcoming)
13. Farivar, M., Clarke, C., Low, S., Chandy, K.: Inverter var control for distribution
systems with renewables. In: 2011 IEEE International Conference on Smart Grid
Communications (SmartGridComm), pp. 457–462, October 2011
14. Fisher, E., O’Neill, R., Ferris, M.: Optimal transmission switching. IEEE Transac-
tions on Power Systems 23(3), 1346–1355 (2008)
15. Fourer, R., Gay, D.M., Kernighan, B.: AMPL: a mathematical programming lan-
guage. In: Wallace, S.W. (ed.) Algorithms and Model Formulations in Mathemat-
ical Programming, pp. 150–151. Springer-Verlag New York Inc., New York (1989)
16. Fu, Y., Shahidehpour, M., Li, Z.: Security-constrained unit commitment with ac
constraints*. IEEE Transactions on Power Systems 20(3), 1538–1550 (2005)
17. Hedman, K., Ferris, M., O’Neill, R., Fisher, E., Oren, S.: Co-optimization of gen-
eration unit commitment and transmission switching with n-1 reliability. In: 2010
IEEE Power and Energy Society General Meeting, pp. 1–1, July 2010
18. Hijazi, H., Coffrin, C., Van Hentenryck, P.: Convex quadratic relaxations
of mixed-integer nonlinear programs in power systems (2013). http://www.
optimization-online.org/DB HTML/2013/09/4057.html
56 C. Coffrin et al.
19. Hijazi, H., Thiebaux, S.: Optimal ac distribution systems reconfiguration. In:
Proceedings of the 18th Power Systems Computation Conference (PSCC 2014),
Wroclaw, Poland (2014)
20. Jabr, R.: Radial distribution load flow using conic programming. IEEE Transac-
tions on Power Systems 21(3), 1458–1459 (2006)
21. Jabr, R.: Optimization of ac transmission system planning. IEEE Transactions on
Power Systems 28(3), 2779–2787 (2013)
22. Kundur, P.: Power System Stability and Control. McGraw-Hill Professional (1994)
23. Lavaei, J., Low, S.: Zero duality gap in optimal power flow problem. IEEE Trans-
actions on Power Systems 27(1), 92–107 (2012)
24. Lehmann, K., Grastien, A., Van Hentenryck, P.: AC-Feasibility on Tree Networks
is NP-Hard. IEEE Transactions on Power Systems (2015) (to appear)
25. Liberti, L.: Writing global optimization software. In: Liberti, L., Maculan, N.
(eds.) Global Optimization, Nonconvex Optimization and Its Applications, vol. 84,
pp. 211–262. Springer, US (2006). http://dx.doi.org/10.1007/0-387-30528-9 8
26. Madani, R., Ashraphijuo, M., Lavaei, J.: Promises of conic relaxation for
contingency-constrained optimal power flow problem (2014). http://www.ee.
columbia.edu/lavaei/SCOPF 2014.pdf (accessed February 22, 2015)
27. McCormick, G.: Computability of global solutions to factorable nonconvex pro-
grams: Part i convex underestimating problems. Mathematical Programming 10,
146–175 (1976)
28. Miller, J.: Power system optimization smart grid, demand dispatch, and micro-
grids, September 2011. http://www.netl.doe.gov/smartgrid/referenceshelf/
presentations/SE%20Dist%20Apparatus%20School Final 082911 rev2.pdf
(accessed April 22, 2012)
29. Momoh, J., Adapa, R., El-Hawary, M.: A review of selected optimal power flow lit-
erature to 1993. i. nonlinear and quadratic programming approaches. IEEE Trans-
actions on Power Systems 14(1), 96–104 (1999)
30. Momoh, J., El-Hawary, M., Adapa, R.: A review of selected optimal power flow
literature to 1993. ii. newton, linear programming and interior point methods.
IEEE Transactions on Power Systems 14(1), 105–111 (1999)
31. Montanari, U.: Networks of Constraints : Fundamental Properties and Applications
to Picture Processing. Information Science 7(2), 95–132 (1974)
32. Ott, A.: Unit commitment in the pjm day-ahead and real-time mar-
kets, June 2010. http://www.ferc.gov/eventcalendar/Files/20100601131610-Ott,
%20PJM.pdf (accessed April 22, 2012)
33. Purchala, K., Meeus, L., Van Dommelen, D., Belmans, R.: Usefulness of DC power
flow for active power flow analysis. In: Power Engineering Society General Meeting,
pp. 454–459 (2005)
34. Ryoo, H., Sahinidis, N.: A branch-and-reduce approach to global optimization.
Journal of Global Optimization 8(2), 107–138 (1996)
35. Sahinidis, N.: Global optimization and constraint satisfaction: the branch-and-
reduce approach. In: Bliek, C., Jermann, C., Neumaier, A. (eds.) Global Optimiza-
tion and Constraint Satisfaction. LNCS, vol. 2861, pp. 1–16. Springer, Heidelberg
(2003)
36. Toh, K.C., Todd, M., Ttnc, R.H.: Sdpt3 - a matlab software package for semidefi-
nite programming. Optimization Methods and Software 11, 545–581 (1999)
37. Van Hentenryck, P., McAllister, D., Kapur, D.: Solving Polynomial Systems Using
a Branch and Prune Approach. SIAM Journal on Numerical Analysis 34(2) (1997)
Strengthening Convex Relaxations with Bound Tightening 57
38. Van Hentenryck, P., Michel, L., Deville, Y.: Numerica: a Modeling Language for
Global Optimization. The MIT Press, Cambridge (1997)
39. Van Hentenryck, P., Saraswat, V., Deville, Y.: The design, implementation, and
evaluation of the constraint language cc(FD). In: Podelski, A. (ed.) Constraint Pro-
gramming: Basics and Trends. LNCS, vol. 910, pp. 293–316. Springer, Heidelberg
(1995)
40. Verma, A.: Power grid security analysis: An optimization approach. Ph.D. thesis,
Columbia University (2009)
41. Wächter, A., Biegler, L.T.: On the implementation of a primal-dual interior point
filter line search algorithm for large-scale nonlinear programming. Mathematical
Programming 106(1), 25–57 (2006)
Broken Triangles Revisited
1 Introduction
The notion of broken triangle has generated a certain amount of interest in the
constraints community: it has led to the definition of novel tractable classes [3,7],
variable elimination rules [1] and domain reduction rules [4,5]. The merging of
pairs of values in the same variable domain which do not belong to a broken
triangle has been shown to lead to considerable reduction of search space size
for certain benchmark instances of binary CSP [4]. The corresponding reduction
operation, known as BTP-merging, is satisfiability-preserving and is therefore
worthy of a deeper theoretical analysis as a potentially useful preprocessing
operation. An obvious question is whether the order in which BTP-merging
operations, and other domain-reduction operations such as arc consistency, are
performed has an effect on the number of possible merges.
Definition 1. A binary CSP instance I consists of
– a set X of n variables,
– a domain D(x) of possible values for each variable x ∈ X, with d the maxi-
mum domain size,
– a relation Rxy ⊆ D(x) × D(y), for each pair of distinct variables x, y ∈ X,
which consists of the set of compatible pairs of values (a, b) for variables
(x, y).
A partial solution to I on Y = {y1 , . . . , yr } ⊆ X is a set {y1 , a1 , . . . , yr , ar }
such that ∀i, j ∈ [1, r], (ai , aj ) ∈ Ryi yj . A solution to I is a partial solution on
X.
M.C. Cooper—supported by ANR Project ANR-10-BLAN-0210 and EPSRC grant
EP/L021226/1.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 58–73, 2015.
DOI: 10.1007/978-3-319-23219-5 5
Broken Triangles Revisited 59
• a
d •hhhh
A
h
h• b
y A
A x
e A•
z
can be BTP-merged. The possible interactions between arc consistency (AC) and
neighbourhood substitution (NS) are relatively simple and can be summarised
as follows:
1. The fact that a ∈ D(x) is AC-supported or not at variable y remains invariant
after the elimination of any other value b (in D(x) \ {a} or in the domain
D(z) of any variable z = x) by neighbourhood substitution.
2. An arc-consistent value a ∈ D(x) that is neighbourhood substitutable
remains neighbourhood substitutable after the elimination of any other value
by arc consistency.
3. On the other hand, a value a ∈ D(x) may become neighbourhood substi-
tutable after the elimination of a value c ∈ D(y) (y = x) by arc consistency.
Indeed, it has been shown that the maximum cumulated number of elimina-
tions by arc consistency and neighbourhood substitution can be achieved by
first establishing arc consistency and then applying any convergent sequence
of NS eliminations (i.e. any valid sequence of eliminations by neighbourhood
substitution until no more NS eliminations are possible) [2].
• • • •
a • c •
b • @
•l • @
@
l @
@
@ll @ @
@ l @ @
@ l @ @
(a) @• l• (b) @• @•
Fig. 2. (a) An instance in which applying AC leads to the elimination of all values
(starting with the values a and b), but applying BTP merging leads to just one elimi-
nation, namely the merging of a with b (with the resulting instance shown in (b)).
• • • •
%@ @
@ @
% @ @ @ @
% @ @ @ @
% @ @ @ @
a •h% h @•
@ ( a •hh @•
@ (
@ hh( h( h(((( hhh
h( (((
b •% ( h( h h @ @
( (h(
( h h @
l (( hhh (( hhh
(@
c •e l@
@• c •(@ @•
@e
@
@
l
@e @l @ @
@e @ l @ @
@e@l @ @
(a) l•
e• @
@ (b) @• @•
• • • •
@ @
%@,@
@ @ % ,@ @
@ @ %,, @ @
@ @ %, @ @
d •hhh @ (@• %
, @ @•
hh( ((((
@ ( h(
h h @ •,
% @
((( hhh l
c •(@ h
@• e
l
@•
@ @
e
@ @ ell
@ @ e l
@ @ el
(c) @• @• (d) e• l•
Fig. 3. (a) An instance in which applying AC leads to one elimination (the value b)
(as shown in (b)), but applying BTP merging leads to two eliminations, namely a with
b (shown in (c)) and then d with c (shown in (d)).
In order to prevent the possibility of merging both (ai , bi ) and (ai , bi ), we
define the following constraints for zi , xij and yij : ∀j Rxij zi = {(bi , ci )} and
Ryij zi = {(bi , ci )}; ∀j ∀ k Rxij yik = {(ai , ai )}. These constraints are shown
in Figure 4(a) for a single j (where a pair of points not joined by a solid line
are incompatible). By this gadget, we create a broken triangle on each yij when
merging values in the xij and vice versa.
Then for each clause Ci = (Xj , Xk , Xl ), we add the following constraints in
order to have at least one of the literals Xj , Xk , Xl true: Ryji yki = {(aj , bk )},
Ryki yli = {(ak , bl )} and Ryli yji = {(al , bj )}. This construction, shown in
Figure 4(b), is such that it allows two mergings on the variables yji , yki , yli
before a broken triangle is created. For example, merging aj , bj and then ak , bk
creates a broken triangle on ai , bi . So a third merging is not possible.
Broken Triangles Revisited 63
ai • • ai aj • • bk
Fig. 4. (a) Representation of the variable Xi and its negation (by the possibility of
performing a merge in D(xij ) or D(yij ), respectively, according to rules (1),(2)). (b)
Representation of the clause (Xj ∨ Xk ∨ Xl ). Pairs of points joined by a solid line are
compatible and incompatible otherwise.
zj zk
cj • ck •
@
@
@ @
bj • @• bj
bk • @• bk
T
•Taj
aj • T ak • • ak
T
yji
xji
T yki xki
T
al •
• al
bl • • bl
e
%
yli e %x
e % li
e%
cl •
zl
The reduction given in the proof of Theorem 1 supposes that no arc consis-
tency operations are used. We will now show that it is possible to modify the
reduction so as to prevent the elimination of any values in the instance ICSP
by arc consistency, even when the maximum size of the domains d is bounded
by a constant as small as 3. Recall that an arc-consistent instance remains arc-
consistent after any number of BTP-mergings.
Proof. In order to ensure arc consistency of the instance ICSP , we add a new
value di to the domain of each of the variables xij , yij , zi . However, we can-
not simply make di compatible with all values in all other domains, because
this would allow all values to be merged with di , destroying in the process the
semantics of the reduction.
In the three binary constraints concerning the triple of variables xij , yij , zi ,
we make di compatible with all values in the other two domains except di . In
other words, we add the following tuples to constraint relations, as illustrated in
Figure 6:
Fig. 6. Ensuring arc consistency between the variables zi , yij , xij by addition of new
values di .
Broken Triangles Revisited 65
not introduce any broken triangles on ai , bi or ai , bi . With these constraints we
ensure arc consistency without changing any of the properties of ICSP used in
the reduction from 3-SAT described in the proof of Theorem 1. For each pair of
values ai , bi ∈ D(xij ) and ai , bi ∈ D(yij ), no new broken triangle is created since
these two values always have the same compatibility with all the new values dk .
As we have seen, the constraints shown in Figure 6 prevent any merging of the
new values dk .
When we say that two values a and b can never be BTP-merged, it means that
we add two variables va and vb , with only one value a in D(va ), and only one
value b in D(vb ), such that a is compatible with a and incompatible with b , b
is compatible with b and incompatible with a , a is compatible with b and all
other edges containing either a or b are incompatible. The purpose of making
a (respectively b ) incompatible will all values in the instance except a and b
(respectively b and a ) is twofold. First, it ensures that no future BTP-merging
can establish a compatibility between a (respectively b ) and b (respectively a)
and thus destroy the broken triangle. Second, it ensures that the only broken
triangle introduced by a and b is on a and b, so that the addition of a and b
does not prevent any other BTP-merging than the one between a and b.
When we say that two values a and b can only be BTP-merged if either a
or b has been previously BTP-merged with some third value c, it means that
we add two variables va and vb , with only one value a in D(va ), and only one
value b in D(vb ), such that a is compatible with a and incompatible with b ,
b is compatible with b and incompatible with a , c is compatible with both a
and b , a is compatible with b and all other edges containing either a or b are
incompatible. Here again, the purpose of making a (respectively b ) incompatible
will all values in the instance except a, b and c (respectively b, a and c) is
twofold. First, it ensures that no future BTP-merging that does not include c
can establish a compatibility between a (respectively b ) and b (respectively a)
and thus destroy the broken triangle. Second, it ensures that the only broken
triangle introduced by a and b is on a and b, so that the addition of a and b
does not prevent any other BTP-merging than the one between a and b.
For every couple of values that can never be BTP-merged, and for every
couple of values that can only be BTP-merged when one of them has been
previously BTP-merged with some third value, we add two new single-valued
variables to ICSP . Therefore, the third point in the definition of ICSP adds 2n
Broken Triangles Revisited 67
variables to ICSP , the fourth and fifth points in the definition of ICSP add 4nm
variables to ICSP and the sixth point in the definition of ICSP adds 9n(n − 1)
variables to ICSP . Therefore, the total number of single-valued variables added
to ICSP is n(2 + 4m + 9(n − 1)), as expected from the first point in the definition
of ICSP .
Proof. We transform the binary CSP instance ICSP from the proof of Theorem 3
into an arc-consistent binary CSP instance ICSP . To do so, we add a new value
di in D(vi ) for 1 ≤ i ≤ n(2 + 4m + 9(n − 1)) such that all di are incompatible
with each other and compatible with all other points in ICSP . This ensures arc
consistency. It remains to show that:
1. For any couple of values (a, b) ∈ D(v0 ), adding the values di does not create
the broken triangle on a and b, even if a or b is the result of a previous
BTP-merging:
Suppose that we have two values a, b ∈ D(v0 ) such that adding the values di
68 M.C. Cooper et al.
One motivation for studying the single-variable version of the problem was
that if all values in D(x) can be BTP-merged, then the variable x can be elim-
inated since its domain becomes a singleton. Our proof of NP-hardness in the
single-variable case relied on a large domain which was not actually reduced
to a singleton. There remains therefore an interesting open question concerning
the complexity of eliminating the largest number of variables by sequences of
BTP-merging operations.
Since testing whether two values a, b ∈ D(x) are BTP-mergeable requires testing
all pairs of assignments to all pairs of distinct variables y, z = x, it is natural
to investigate weaker versions which are less costly to test. Two such weaker
versions are neighbourhood substitutability [6] and virtual interchangeability [8].
Broken Triangles Revisited 69
x
t •
1 • •
QQ
Q
2 •
s Q Q
Q Q
1 • • Q Q•
S
@ 3
Q
Q
2 •
PPS
@ Q •
SP
@P t
(a) P
•
S@ P•Q
3 PP
S@ P
Q P x
S @• PP
P Q •
S PPQ PQ
S PQP•
•
x
•
t
1 •Q
•
Q
Q
2 •Q Q
s
Q Q
1 • • Q Q•
S
@ 3
Q
Q
•P
{2, 3} S
@ Q•
PS@
PP t
(b)
S@PP•P
S @ QQ PP
PP x
S @•PP Q P•
Q
S PPQ
S PQP•
•
x
•
•
t
2 •
Q
s
Q
1 • • Q •
S
@{1, 3}
Q
Q
S
•P
{2, 3} @ Q•
PS@
PP t
(c)
S@PP•P
S @ QQ PP
PP x
S @•P Q P•
S PPQ PQ
S PQP•
•
Fig. 7. (a) Gadget for choosing a truth value for x: true if the two values in D(x) are
merged; false if the two values in D(x) are merged. This same gagdet (b) after merging
the values 2 and 3 in D(s), then (c) after merging the values 1 and 3 in D(t) .
Broken Triangles Revisited 71
u
x1
• •
x 0
•P • •
PP 1
(a) PP
x2
•P P• •
PP 2
PP
P• •
3
x •
Q
Q
•Q
QQ •
S
v
Q Q v
y • Q Q•
•P • S
Q
PP
S
S
(b)
Q P PP
•
Q
•
•
P
S
PP S •
S
PP
z • S•
P
•
Fig. 8. (a) Gadget for making copies of a variable x: if the two values in D(x) can be
merged, then the two values in D(x1 ) and the two values in D(x2 ) can be merged. (b)
Gadget used in the simulation of a clause: the variable v is true (i.e. the two values in
its domain can be merged) if and only if x, y, z are all true.
This gadget therefore allows us to make multiple copies of the variable x all with
the same truth value.
To complete the proof, we now show how to code each clause c of I3SAT . There
are exactly seven assignments to the variables in c which satisfy this clause. For
each of these assignments, we add a gadget of the form shown in Figure 8(b). The
variables x, y, z are the output of the gadgets introduced above and correspond
to the variables x, y, z occurring in the clause c in I3SAT . In the example shown
in the figure, the satisfying assignment is x = y = z = true. When the two
values in each of the domains of these three variables can be merged (and only
in this case), the values in the domain of v can also be merged. The triangle of
variables to the right of v in Figure 8(b) prevents the merging of the values in
D(v) when only two of the three variables x, y, z are assigned true.
In order to have the same number of copies of x and x in our construction,
we also add a gadget similar to Figure 8(b) for the one non-satisfying assignment
to the three variables of the clause c: in this case, the variable v is constrained
by two other variables (as is the variable v in Figure 8(b)) which prevents the
merging of the values in D(v).
Suppose that there are n variables and m clauses in I3SAT . The maximum
total number of merges which can be performed in ICSP is 3 per gadget shown in
72 M.C. Cooper et al.
Figure 7, 4 per gadget shown in Figure 8(a) and 1 per gadget shown in Figure 8(b)
(provided the gadget corresponds to a truth assignment which satisfies the clause
c). Each clause c requires four copies of each of the three variables x occurring
in c (as well as four copies of x). For each copy of each literal assigned the value
true, there are 4 merges in the gadget of Figure 8(a). For the first occurrence
of each variable, produced by the gadget of Figure 7, there is one less merge (3
instead of 4). Finally, for each satisfied clause there is one merge. This implies
that we can perform a total of k = 48m − n + m = 49m − n merges in ICSP if
and only if I3SAT is satisfiable. Since this reduction is clearly polynomial, this
completes the proof.
6 Conclusion
References
1. Cohen, D.A., Cooper, M.C.: Guillaume Escamocher and Stanislav Živný, Variable
and Value Elimination in Binary Constraint Satisfaction via Forbidden Patterns. J.
Comp. Systems Science (2015). http://dx.doi.org/10.1016/j.jcss.2015.02.001
2. Martin, C.: Cooper, Fundamental Properties of Neighbourhood Substitution in Con-
straint Satisfaction Problems. Artif. Intell. 90(1–2), 1–24 (1997)
3. Cooper, M.C., Jeavons, P.G., Salamon, A.Z.: Generalizing constraint satisfaction on
trees: Hybrid tractability and variable elimination. Artif. Intell. 174(9–10), 570–584
(2010)
4. Cooper, M.C., El Mouelhi, A., Terrioux, C., Zanuttini, B.: On broken triangles.
In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 9–24. Springer, Heidelberg
(2014)
Broken Triangles Revisited 73
1 Introduction
Finding islands of tractability, generally called tractable classes is an important
issue in Artificial Intelligence, especially in Constraint Satisfaction Problems
(CSPs [1]). Many studies have addressed this issue, from the very beginnings
of Artificial Intelligence. These results are often theoretical in nature with, in
certain cases, tractable classes which can be considered as somewhat artifi-
cial. But some tractable classes have actually been used in practice, such as
the classes defined by constraint networks with bounded tree-width [2,3]. More
recently, the concept of hybrid class has been defined, for example with the
Supported by ANR Project ANR-10-BLAN-0210 and EPSRC grant EP/L021226/1.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 74–88, 2015.
DOI: 10.1007/978-3-319-23219-5 6
A Microstructure-Based Family of Tractable Classes for CSPs 75
class BTP [4]. This class strictly contains both structural tractable classes (such
as tree-structured CSPs) and tractable classes defined by language restrictions.
One major advantage of this class, in addition to its generalization of already-
known tractable classes, is related to its practical interest. Indeed, instances of
this class can be solved in polynomial time using algorithms, such as MAC (Main-
taining Arc-Consistency [5]) and RFL (Real Full Look-ahead [6]), implemented
in efficient solvers which allows it to be used directly in practice. In addition,
it may also help to explain theoretically the practical efficiency of solvers, even
though the theoretical complexity of the algorithms employed by the solvers is
exponential in the worst case.
In this paper, we return to this type of approach by generalizing the tractable
class BTP which is defined by a property excluding certain patterns (called
Broken Triangles) in the microstructure graph associated with a binary CSP
instance. Very recent work in this same direction introduced the class ETP
[7] which generalizes BTP by relaxing some of its conditions, since it tolerates
some broken triangles which are forbidden by BTP . Here we propose a broader
generalization called k-BTP which extends this previous work along two axes.
First, in the spirit of ETP , the new class allows the presence of a larger number of
broken triangles, generalizing strictly ETP (and thus BTP ). Secondly, the class
k-BTP is parameterized by a constant k, thus providing a generic version, which
may prove of theoretical interest for general values of k, although in practice we
consider the case k = 3 to be of most interest. Thus, while BTP is defined
for sets of three variables and ETP for sets of four variables, k-BTP is defined
on the basis of sets of k + 1 variables where k is a fixed constant. According
to this approach, BTP = 2-BTP while ETP 3-BTP . Thus, this approach
makes it possible to strictly generalize these two classes. Furthermore, k-BTP
retains some of their interesting properties and practical advantages mentioned
above. Notably, we show that classical algorithms such as MAC or RFL can solve
instances belonging to k-BTP in polynomial time, assuming that these instances
verify Strong k-Consistency [8]. Moreover, we highlight the relationships of this
class with known structural and hybrid classes. We show in particular that the
class of constraint networks whose tree-width is bounded by k is strictly included
in the class k-BTP . This result gives a first answer to a question recently asked by
M. Vardi about the relationships between ETP and the tractable class induced
by instances of bounded tree-width. We also highlight a recent but relatively
unknown result that was proposed by Naanaa [9] whose relationships with k-
BTP we investigate.
In Section 2 we recall the definitions of the tractable classes BTP and ETP . In
Section 3 we define the new class k-BTP and show that instances from this class
can be detected in polynomial time even when the variable order is not known
in advance. Furthermore, we show that, under the extra hypothesis of strong
k-consistency, such instances can be solved in polynomial time, and, in fact,
standard algorithms will solve them. In Section 4 we investigate relationships
between k-BTP and several known tractable classes and in Section 5 we report
results of experimental trials on benchmark problems.
76 M.C. Cooper et al.
2 Background
Formally, a constraint satisfaction problem also called constraint network is
a triple (X, D, C), where X = {x1 , . . . , xn } is a set of n variables, D =
(Dx1 , . . . , Dxn ) is a list of finite domains of values, one per variable, and
C = {c1 , . . . , ce } is a finite set of e constraints. Each constraint ci is a pair
(S(ci ), R(ci )), where S(ci ) = {xi1 , . . . , xik } ⊆ X is the scope of ci , and
R(ci ) ⊆ Dxi1 × · · · × Dxik is its compatibility relation. The arity of ci is |S(ci )|.
In this paper, we only deal with the case of binary CSPs, that is CSPs for which
all the constraints are of arity 2. Hence, we will denote by cij the constraints
involving xi and xj . The structure of a constraint network is represented by a
graph, called the constraint graph, whose vertices correspond to variables and
edges to the constraint scopes. An assignment to a subset Y of X is said to be
consistent if it does not violate any constraint whose scope is included in Y .
We use the notation R(cij )[a] to represent the set of values in Dxj compatible
with a ∈ Dxi . Thus, if there is a constraint with scope {i, j}, then R(cij )[a] =
{b ∈ Dxj |(a, b) ∈ R(cij )}; if there is no constraint with scope {i, j}, then, by
default, R(cij )[a] = Dxj . We recall the BTP property presented in [4].
Definition (BTP). A binary CSP instance (X, D, C) satisfies the Broken Tri-
angle Property (BTP) w.r.t. the variable ordering < if, for all triples of vari-
ables (xi , xj , xk ) s.t. i < j < k, if (vi , vj ) ∈ R(cij ), (vi , vk ) ∈ R(cik ) and
(vj , vk ) ∈ R(cjk ), then either (vi , vk ) ∈ R(cik ) or (vj , vk ) ∈ R(cjk ). If neither
of these two tuples exist, (vi , vj , vk , vk ) is called a broken triangle on xk w.r.t.
xi and xj .
If there exists at least one broken triangle on xk w.r.t. xi and xj , (xi , xj , xk ) is
called a broken triple on xk w.r.t. xi and xj . Let BTP be the set of the instances
for which BTP holds w.r.t. some variable ordering. The BTP property is related
to the compatibility between domain values, which can be graphically visualized
(Figure 1) on the microstructure graph. For example, in Figure 1 (a), there is
a broken triangle on x3 with respect to the variables x1 and x2 since we have
(v1 , v3 ) ∈
/ R(c13 ) and (v2 , v3 ) ∈
/ R(c23 ) while (v1 , v2 ) ∈ R(c12 ), (v1 , v3 ) ∈ R(c13 )
and (v2 , v3 ) ∈ R(c23 ) hold. So (x1 , x2 , x3 ) is a broken triple on x3 w.r.t. x1
and x2 . In contrast, in Figure 1 (b), if one of the two dashed edges (that is
binary tuples) appears in the microstructure, the BTP property holds for all
variable orderings.
Very recently, the property BTP has been relaxed to the Extendable-Triple
Property [7] by considering four variables rather than three, and allowing some
broken triangles.
Definition (ETP). A binary CSP instance P satisfies the Extendable-Triple
Property (ETP) with respect to the variable ordering < if, and only if, for all
subsets of four variables (xi , xj , xk , xl ) such that i < j < k < l, there is at most
one broken triple on xl among (xi , xj , xl ), (xi , xk , xl ) and (xj , xk , xl ).
In this way, a binary CSP can satisfy the ETP property while it contains two
broken triples among (xi , xj , xk , xl ), one on xk , and another one on xl , while
A Microstructure-Based Family of Tractable Classes for CSPs 77
x1 x3 x1 x3
v3 v3
v1 v’3 v1 v’3
x2 v2 x2 v2
(a) (b)
Fig. 1. A non-BTP instance (a) and a BTP one (b) w.r.t. the order x1 < x2 < x3 if
one of the dashed lines occurs.
none is possible with BTP. So, ETP strictly generalizes BTP since each instance
satisfying BTP satisfies ETP while the reverse is false. So the class of instances
satisfying BTP (denoted BTP ) is strictly included in the class of instances sat-
isfying ETP (denoted ETP ) as indicated in Theorem 1 of [7] (BTP ETP ).
As in the case of BTP, ETP allows us to define a tractable class but we need to
impose an additional property related to the level of local consistency which must
be verified. While the set of instances satisfying BTP define a tractable class, the
set of instances satisfying ETP must also satisfy Strong-Path-Consistency [8],
that is arc and path-consistency. Nevertheless, such instances have some of the
desirable properties of instances satisfying BTP, e.g. they can be solved in poly-
nomial time by usual algorithms such as MAC or RFL. In the next section, we
introduce a new property which generalizes BTP and ETP.
1. adding a new variable xij (with domain Dxij = Dxi ) for each constraint cij
2. adding a new equality constraint between each xi and xij
3. replacing each constraint ({xi , xj }, R) by the constraint ({xij , xj }, R).
Let < be any variable order in I in which all the new variables xij occur after
all the original variables xk . Since each variable is constrained by at most two
variables which precede it in this order, we can easily deduce that I satisfies
ETP. It follows from this polynomial reduction that deciding whether an instance
of the class ETP is satisfiable is NP-complete. 2
To ensure the tractability of the class k-BTP , we consider an additional
condition which is that instances satisfy Strong k-Consistency [8].
Definition (Strong k-Consistency). A binary CSP instance P satisfies i-
Consistency if any consistent assignment to i − 1 variables can be extended to
a consistent assignment on any ith variable. A binary CSP instance P satisfies
Strong k-Consistency if it satisfies i-Consistency for all i such that 1 < i ≤ k.
Strong k-Consistency and k-BTP allow us to define a new tractable class:
Theorem 4. Let P be a binary CSP instance P such that there exists a constant
k with 2 ≤ k < n for which P satisfies both Strong k-Consistency and k-BTP
w.r.t. the variable ordering <. Then P is consistent and a solution can be found
in polynomial time.
Proof: We consider an ordering for variable assignments corresponding to the
ordering <. As the instance satisfies Strong k-Consistency, it satisfies arc-
consistency and thus, no domain is empty and each value has a support in
each other domain. Moreover, as the instance satisfies Strong k-Consistency, we
have a consistent assignment on the k first variables. Now, and more generally,
suppose that we have a consistent assignment (u1 , u2 , . . . ul−1 , ul ) for the l first
variables x1 , x2 , . . . xl−1 , xl in the ordering, with k ≤ l < n. We show that this
assignment can be consistently extended to the variable xl+1 . To show this, we
must prove that ∩1≤i≤l R(cil+1 )[ui ] = ∅, that is there is at least one value in the
domain of xl+1 which is compatible with the assignment (u1 , u2 , . . . ul−1 , ul ).
We first prove this for l = k. Consider the consistent assignment
(u1 , u2 , . . . uk−1 , uk ) on the k first variables. Consider a k + 1th variable xk+1
appearing later in the ordering. Since P satisfies k-BTP , there exists at least
one triple of variables (xj , xj , xk+1 ) with 1 ≤ j = j ≤ k such that there is no
broken triangle on xk+1 w.r.t. xj and xj . By Lemma 2.4 given in [4], we have:
(R(cjk+1 )[uj ] ⊆ R(cj k+1 )[uj ])
or
(R(cj k+1 )[uj ] ⊆ R(cjk+1 )[uj ])
Without loss of generality, assume that we have R(cjk+1 )[uj ] ⊆ R(cj k+1 )[uj ]
and j < j . Since P satisfies Strong k-Consistency, we know that the sub-
assignment of (u1 , u2 , . . . , uj , . . . uk−1 , uk ) on k−1 variables excluding the assign-
ment uj for xj can be consistently extended to xk+1 . Moreover, we know that
80 M.C. Cooper et al.
R(cjk+1 )[uj ] ⊆ R(cj k+1 )[uj ] and by arc-consistency, R(cij ik+1 )[uj ] = ∅. Thus,
(u1 , u2 , . . . , uj , . . . , uj , . . . , uk , uk+1 ) is a consistent assignment to the k + 1 first
variables.
Note that this proof holds for all subsets of k + 1 variables such that
xk+1 appears later in the ordering <, not only for the k + 1 first variables
x1 , x2 , . . . xk−1 , xk and xk+1 .
Now, we prove the property for l with k < l < n. That is, we show that a
consistent assignment (u1 , u2 , . . . ul−1 , ul ) can be extended to a (l +1)th variable.
As induction hypothesis, we assume that every consistent assignment on l − 1
variables can be extended to a lth variable, which appears later in the considered
ordering <.
Consider a consistent assignment (u1 , u2 , . . . ul−1 , ul ) on the l first vari-
ables. Let (ui1 , ui2 , . . . uik ) be a sub-assignment on k variables of the assign-
ment (u1 , u2 , . . . ul−1 , ul ). As P satisfies k-BTP, and as k < l < n, for all
subsets of k variables xi1 , xi2 , . . . xik , we know that there is a triangle which
is not broken in xl+1 w.r.t. xij and xij , with xij and xij appearing in the
variables xi1 , xi2 , . . . xik . So, without loss of generality, we can consider that
i1 ≤ ij < ij ≤ ik ≤ l and we have R(cij l+1 )[uij ] ⊆ R(cij l+1 )[uij ]. Note that
xij and xij can be interchanged in the ordering if necessary.
Now, consider the consistent assignment (u1 , u2 , . . . ul−1 , ul ) on the l
first variables. By the induction hypothesis, each partial assignment of
(u1 , u2 , . . . ul−1 , ul ) on l − 1 variables can be extended to a consistent assign-
ment on xl+1 with a compatible value ul+1 . So, consider the partial assign-
ment on l − 1 variables where uij does not appear. This assignment is
for example (u1 , u2 , . . . uij , . . . ul−1 , ul , ul+1 ). As we have R(cij l+1 )[uij ] ⊆
R(cij l+1 )[uij ], the value uij is also compatible with ul+1 , and thus the assign-
ment (u1 , u2 , . . . uij , . . . uij , . . . ul−1 , ul , ul+1 ) on the l + 1 first variables is a con-
sistent assignment.
So, every consistent assignment (u1 , u2 , . . . ul−1 , ul ) on (x1 , x2 , . . . xl−1 , xl )
can be extended to a (l + 1)th variable, for all l with k < l < n. And more gener-
ally, we have shown that every consistent assignment on l variables, not necessar-
ily consecutive in the ordering (as are the l first variables), can be extended to a
consistent assignment for every (l+1)th variable which appears after these l vari-
ables in the ordering < associated with k-BTP. Thus, the induction hypothesis
holds for the next step.
Note that this proof also shows that an instance which satisfies Strong
k-Consistency and k-BTP (with respect to the variable ordering <) is consistent.
Finally, given the ordering <, we show that finding a solution can be per-
formed in polynomial time. Given a consistent assignment (u1 , u2 , . . . ul ) with
l < n, finding a compatible value ul+1 for the next variable xl+1 is feasible by
searching in its domain whose size is at most d. For each value, we need to ver-
ify the constraints connecting the variable xl+1 which can be done in O(el+1 )
if the next variable xl+1 has el+1 neighbors in the previous variables. Since
Σ1≤l<n el+1 = e, the total cost to find a solution is O((n + e).d). 2
A Microstructure-Based Family of Tractable Classes for CSPs 81
the relationships between k-TW and ETP or other generalizations of BTP . The
next theorems give a first partial answer to this question.
Theorem 6. k-TW (k + 1)-BTP .
Proof: We show firstly that k-TW ⊆ (k + 1)-BTP . It is well known that if the
tree-width of a binary instance of CSP is bounded by k, there is an ordering
< on variables, such that for xi ∈ X, |{xj ∈ X : j < i and cji ∈ C}| ≤ k [2].
Now, consider a subset of k + 2 variables xi1 , xi2 , . . . xik , xik+1 , xik+2 such that
i1 < i2 < · · · < ik−1 < ik < ik+1 < ik+2 . Since the tree-width is bounded
by k, we know that there are at most k constraints cij ik+2 ∈ C. So, there is
at least one triple of variables (xij , xij , xik+2 ) with 1 ≤ j = j ≤ k such that
cij ik+2 ∈
/ C or cij ik+2 ∈
/ C. Without loss of generality, assume that there is no
constraint cij ik+2 ∈ C. Thus, there is no broken triangle on xik+2 w.r.t. xij and
xij because all the values of Dxij are compatible with all the values of Dxik+2 .
So, the considered instance of CSP satisfies the property (k + 1)-BTP . Finally,
it is easy to define instances whose tree-width is strictly greater than k which
satisfy the property (k + 1)-BTP . For example, we can consider an instance of
CSP with domains of size one, with the complete constraint graph, and with one
solution. The tree-width of this instance is n − 1 while it satisfies k-BTP for all
possible values of k. 2
The cost of checking for satisfiability of instances in k-TW has a similar
cost to that of achieving Strong (k+1)-Consistency, that is O(nk+1 dk+1 ). Nev-
ertheless, this does not allow us to establish a formal inclusion of k-TW in
(k+1)-BTP -S(k+1)C which is tractable while (k+1)-BTP is NP-complete for
k ≥ 2 by Theorem 3. But if we denote k-TW -S(k+1)C, the class of binary CSPs
instances belonging to k-TW and which satisfy Strong (k+1)-Consistency, the
next result holds:
Theorem 7. k-TW -S(k+1)C (k + 1)-BTP -S(k+1)C.
The tractable class BTP has also recently been generalized in a different
way to that proposed in this paper, again by noticing that not all broken trian-
gles need to be forbidden [12]. We will show that these two generalizations are
orthogonal.
Definition (∀∃-BTP). A binary CSP instance P satisfies the property ∀∃-BTP
w.r.t. the variable ordering < if, and only if, for each pair of variables xi , xk such
that i < k, for all vi ∈ Dxi , ∃vk ∈ Dxk such that (vi , vk ) ∈ R(cik ) and for all xj
with j < k and j = i, and for all vj ∈ Dxj and for all vk ∈ Dxk , (vi , vj , vk , vk )
is not a broken triangle on xk w.r.t. xi and xj . Let ∀∃-BTP be the set of the
instances for which ∀∃-BTP holds w.r.t. some variable ordering.
The class ∀∃-BTP can be solved and recognized in polynomial time [12]. It
represents a tractable class which strictly includes BTP since it does not forbid
all broken triangles. Since k-BTP also does not forbid all broken triangles, it is
natural to compare these two classes. We do this for the special case k = 3, but
the same argument applies for any value of k ≥ 3.
A Microstructure-Based Family of Tractable Classes for CSPs 83
Theorem 8. Even for sets of binary CSP instances which are strong path con-
sistent, the properties 3-BTP and ∀∃-BTP are incomparable.
(where the notation A ⊂ B means that A is a proper subset of B). Observe that
{Ei }i∈I cannot be independent if ∃j = j ∈ I such that Ej ⊆ Ej , since in this
case and with J = I \ {j } we would have
Ei = Ej .
i∈I j∈J
i1 < . . . < ik+1 < m, by the definition of (k+1)-BTP, we must have R(cij m )[aj ] ⊆
R(cij m )[aj ] for some j = j ∈ {1, . . . , k + 1}; hence, as observed above, the sets
{R(cij m )[aj ]}j=1,...,k+1 cannot be independent. It follows that the tractability of
(k+1)-BTP -S(k+1)C is also a corollary of the result of Naanaa [9]. On the other
hand, the property (k + 1)-BTP, although subsumed by DR-k, can be detected in
time complexity O(nk dk + n3 d4 ) compared to O(nk+1 dk+1 ) for DR-k.
5 Experiments
In this section, we compare the tractable classes BTP , ETP -SPC , k-BTP -SkC
and DR-k-1 (where SPC stands for Strong Path Consistency) from a practical
viewpoint. We only consider the case k = 3, since strong k-consistency becomes
too expensive in time for k > 3 and may add constraints of arity k − 1.
Tractable classes are often critized for being artificial in the sense that their
underlying properties seldom occur in real instances. So, here, we first highlight
the existence of instances belonging to some of these classes among the bench-
mark instances classically exploited for solver evaluations and comparisons. More
precisely, our experiments involve 2,373 binary benchmarks from the third CSP
Solver Competition1 and cover all the benchmarks exploited in [7].
Then we will investigate the possible link between efficient solving and
belonging to these tractable classes.
Since the tractable classes ETP -SPC , 3-BTP -SPC and DR-2 require strong
path-consistency, we first achieve SPC on each instance before checking whether
it belongs to the considered classes, in the same spirit as [14,15]. In so doing, 628
instances are detected as inconsistent and so they trivially belong to all of these
tractable classes. 85 of the remaining instances belong to 3-BTP -SPC while 87
have directional rank at most two. Among these instances, we have respectively
71 and 76 instances in BTP -SPC and ETP -SPC . These differences between
these tractable classes are well highlighted by some instances of the bqwh-
15-106 family since we can observe all the possible configurations of the rela-
tions BTP -SPC ETP -SPC 3-BTP -SPC DR-2. For example, instance
bqwh-15-106-13 belongs to all the considered tractable classes while instances
bqwh-15-106-28, bqwh-15-106-16 and bqwh-15-106-76 only belong respectively
to three, two or one of these tractable classes. Table 1 presents some instances
belonging to classes ETP -SPC , 3-BTP -SPC or DR-2. It also provides the
tree-width w of these instances and their tree-width w once SPC is enforced.
When the exact tree-width is unknown (recall that computing an optimal tree-
decomposition is an NP-hard problem), we give a range. We can note the diver-
sity of these instances (academic, random or real-world instances). Some of these
instances belong to 3-BTP -SPC or DR-2 thanks to their structure. For instance,
1
See http://www.cril.univ-artois.fr/CPAI08.
A Microstructure-Based Family of Tractable Classes for CSPs 85
Table 1. Some instances belonging to BTP -SPC , ETP -SPC , 3-BTP -SPC or DR-2
after the application of SPC with their tree-width w and the tree-width w of the
instances once SPC is enforced.
graph12-w0 and hanoi-7 have an acyclic constraint graph while the tree-width of
domino-100-100 and crossword-m1-uk-puzzle01 is two. However, most instances
have a tree-width greater than two. Moreover, in most cases, the application
of SPC may significantly increase the original tree-width of these instances. For
example, the tree-width of instance driverlogw-09-sat is initially bounded by 108
and is equal to 629 after the application of SPC. This increase is explained by
the pairs of values which are forbidden by SPC. When SPC forbids a pair of
values (vi , vj ) for a given pair of variables (xi , xj ), it removes (vi , vj ) from the
relation R(cij ) if the constraint cij exists. However, if the constraint cij does not
exist yet, SPC must first add it to the problem. In such a case, depending on the
added constraints and their number, the tree-width may significantly increase.
Note that the considered instances whose tree-width is initially at most two have
a tree-width unchanged by the application of SPC.
can exploit some tractable classes to explain the efficiency of solvers on some
instances. Indeed, we think that tractable classes are more useful from a practi-
cal viewpoint if they are implicitly handled by classical solvers than by ad-hoc
methods (as is generally the case). For instance, it is well kwown that MAC
can solve in backtrack-free manner any binary CSP whose constraint network is
acyclic without knowing that the instance has this particular feature [16].
Most state-of-the-art solvers rely on variants of MAC or RFL algorithms. In
the following, we focus our study on MAC but we have observed similar results
for RFL.
As far as solving is concerned, all the instances belonging to 3-BTP -SPC
or DR-2 are solved in a backtrack-free manner by MAC except the instance
driverlogw-04c-sat which needs one backtrack. Note that MAC has no knowledge
about the variable ordering used to satisfy 3-BTP or to obtain a directional rank
of at most two. In most cases, we have observed that the ordering CSP instance
built in the proof of Theorem 2 in order to compute a suitable variable ordering
has no constraints. So any variable ordering is suitable. In contrast, for about
a dozen instances, this CSP has several constraints but remains clearly under-
constrained and the constraint network has several connected components. This
ensues that the ordering CSP in general a huge number of solutions. So it is very
likely that MAC exploits implicitly one of these suitable variable orderings. For
example, the ordering CSP for checking whether the bqwh-15-106-76 instance
(which has 106 variables) has a directional rank at most two has 65 connected
components and admits more than 33 million solutions.
Some of the instances are solved efficiently by MAC in a backtrack-free man-
ner even though they do not belong to one of the studied tractable classes. Hence,
we now consider the notion of backdoor [17] with the aim in view to provide some
explanation about this efficiency in the same spirit as [7]. A backdoor is a set of
variables defined with respect to a class such that once the backdoor variables
are assigned, the problem falls in the class. Here, we are interested in back-
doors which are discovered implicitly by MAC when it assigns some variables.
Indeed, after some assignments and the associated filtering, the remaining part
of the problem may become tractable. So we assess the number of variables which
must be assigned before MAC finds implicitly a backdoor w.r.t. one of the studied
classes. In practice, over the 50 considered instances, we observe that MAC finds
a backdoor w.r.t. BTP after having assigned more variables than for the other
considered classes. The numbers of assigned variables required to find a backdoor
respectively for ETP and 3-BTP are very close, and even equal in most cases.
By considering DR-2, we save a few variables compared to ETP and 3-BTP . For
example, MAC needs to assign at most five variables before finding a backdoor
w.r.t. to 3-BTP or DR-2 for 14 instances compared to 12 and 4 instances, respec-
tively, for ETP and BTP 2 . Of course, the resulting instances do not necessarily
satisfy strong path-consistency and so we cannot exploit directly Theorem 5 to
explain the efficiency of MAC. Nevertheless, when the instance is 3-BTP and
2
Note that these instances do not include all the instances mentioned in [7] since some
of them belong to 3-BTP -SPC and/or DR-2.
A Microstructure-Based Family of Tractable Classes for CSPs 87
strong path-consistent after having assigned some variables, MAC may exploit
implicitly a suitable variable ordering since, as evoked above, the corresponding
ordering CSP often admits a large number of solutions. Furthermore Theorem 5
provides sufficient conditions so that MAC solves some instances in polynomial
time, but these conditions are not always necessary. For instance, MAC solves
the instances which belong to BTP in polynomial time without requiring a suit-
able variable ordering or the satisfaction of strong path-consistency. Hence, one
part of the explanation of the practical efficiency of MAC may lie in its ability
to exploit implicitly different tractable classes.
6 Conclusion
This paper introduces a novel family of tractable classes for binary CSPs, denoted
k-BTP whose tractability is associated with a given level of strong k-consistency.
It is based on a hierarchy of classes of instances with the BTP class as the
base case. While BTP is defined on subsets of 3 variables, the k-BTP class is
defined on sets of k+1 variables, while relaxing the restrictive conditions imposed
by BTP which is the class 2-BTP . We showed that k-BTP inherits some of
the desirable properties of BTP, such as polynomial solvability using standard
algorithms such as MAC. We also showed that k-BTP strictly generalizes the
class of instances whose tree-width is bounded by a constant and we analyzed
the relationships with the class based on the notion of directional rank recently
introduced by Naanaa. To assess the practical interest of the k-BTP class, an
experimental analysis is presented focusing on the particular case of 3-BTP .
This analysis shows a significant advantage of 3-BTP compared to BTP and to
CSPs of bounded tree-width.
Further research is required to determine if the condition corresponding to
strong k-consistency is actually necessary or whether a weaker condition would
suffice. Indeed, experiments showed that MAC can solve without backtracking
certain instances belonging to 3-BTP even when they do not verify the cor-
responding level of consistency. From a practical point of view, an interesting
challenge is to find the minimum (generally) required level of consistency among
different kinds of local consistencies such as PIC [18], maxRPC [19] or SAC [20].
Note that, from a theoretical point of view, we can easily deduce from Theo-
rem 3 that any local consistency that only performs domain filtering (e.g. PIC,
maxRPC, SAC) cannot be sufficient (assuming P=NP) since ETP is invariant
under domain filtering operations.
Moreover, studying a relaxation of the k-BTP condition needs to be
addressed so as to further expand the class of instances that can be solved in
polynomial time, but along different avenues to the one proposed in [9], even if
further theoretical and experimental research are clearly required to fully appre-
ciate all the consequences of Naanaa’s result. Finally, it could be interesting
to investigate a similar approach to the one introduced in [21] which provides
a novel polynomial-time reduction operation based on the merging of domain
values.
88 M.C. Cooper et al.
References
1. Rossi, F., van Beek, P., Walsh, T.: Handbook of Constraint Programming. Elsevier
(2006)
2. Dechter, R., Pearl, J.: Tree-Clustering for Constraint Networks. Artificial Intelli-
gence 38, 353–366 (1989)
3. Gottlob, G., Leone, N., Scarcello, F.: A Comparison of Structural CSP Decompo-
sition Methods. Artificial Intelligence 124, 243–282 (2000)
4. Cooper, M.C., Jeavons, P., Salamon, A.: Generalizing constraint satisfaction on
trees: hybrid tractability and variable elimination. Artificial Intelligence 174,
570–584 (2010)
5. Sabin, D., Freuder, E.: Contradicting conventional wisdom in constraint satisfac-
tion. In: Proceedings of ECAI, pp. 125–129 (1994)
6. Nadel, B.: Tree Search and Arc Consistency in Constraint-Satisfaction Algorithms.
Search in Artificial Intelligence, pp. 287–342. Springer-Verlag (1988)
7. Jégou, P., Terrioux, C.: The extendable-triple property: a new CSP tractable class
beyond BTP. In: Proceedings of AAAI, pp. 3746–3754 (2015)
8. Freuder, E.: A Sufficient Condition for Backtrack-Free Search. Journal of the ACM
29(1), 24–32 (1982)
9. Naanaa, W.: Unifying and extending hybrid tractable classes of csps. Journal of
Experimental and Theoretical Artificial Intelligence 25(4), 407–424 (2013)
10. Jeavons, P., Cooper, M.: Tractable constraints on ordered domains. Artificial Intel-
ligence 79(2), 327–339 (1995)
11. Robertson, N., Seymour, P.D.: Graph minors II: Algorithmic aspects of treewidth.
Algorithms 7, 309–322 (1986)
12. Cooper, M.C.: Beyond consistency and substitutability. In: O’Sullivan, B. (ed.) CP
2014. LNCS, vol. 8656, pp. 256–271. Springer, Heidelberg (2014)
13. Deville, Y., Barette, O., van Hentenryck, P.: Constraint satisfaction over connected
row convex constraints. Artificial Intelligence 109(1–2), 243–271 (1999)
14. El Mouelhi, A., Jégou, P., Terrioux, C.: Hidden tractable classes: from theory to
practice. In: Proceedings of ICTAI, pp. 437–445 (2014)
15. El Mouelhi, A., Jégou, P., Terrioux, C.: Hidden Tractable Classes: from Theory to
Practice. Constraints (2015)
16. Sabin, D., Freuder, E.: Understanding and Improving the MAC Algorithm. In:
Smolka, G. (ed.) CP 1997. LNCS, vol. 1330, pp. 167–181. Springer, Heidelberg
(1997)
17. Williams, R., Gomes, C.P., Selman, B.: Backdoors to typical case complexity. In:
Proceedings of IJCAI, pp. 1173–1178 (2003)
18. Freuder, E., Elfe, C.D.: Neighborhood inverse consistency preprocessing. In:
Proceedings of AAAI, pp. 202–208 (1996)
19. Debruyne, R., Bessière, C.: From restricted path consistency to max-restricted
path consistency. In: Smolka, G. (ed.) CP 1997. LNCS, vol. 1330, pp. 312–326.
Springer, Heidelberg (1997)
20. Debruyne, R., Bessière, C.: Domain Filtering Consistencies. Journal of Artificial
Intelligence Research 14, 205–230 (2001)
21. Cooper, M.C., El Mouelhi, A., Terrioux, C., Zanuttini, B.: On broken triangles.
In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 9–24. Springer, Heidelberg
(2014)
The Unary Resource with Transition Times
1 Introduction
This work extends the classic unary/disjunctive resource propagation algorithms
to include propagation over sequence-dependent transition times between activ-
ities. A wide range of real-world scheduling problems from the industry involves
transition times between activities. An example is the quay crane scheduling
problem in container terminals [21] where the crane is modeled as a unary
resource and transition times represent the moves of the crane on the rail to
move from one position to another along the vessel to load/unload containers.
We introduce filtering algorithms to tighten the bounds of (non-preemptive)
activities while taking into account the transition times between them. These
filtering algorithms are extensions of the unary resource propagation algo-
rithms (Overload Checking, Detectable Precedences, Not-First/Not-Last, Edge-
Finding) introduced in [18]. All these algorithms rely on an efficient computation
of the earliest completion time (ect) of a group of activities using the so-called
Theta tree and Theta-Lambda tree data structures. We demonstrate the effi-
ciency of the filtering on job-shop with transition times problem instances.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 89–104, 2015.
DOI: 10.1007/978-3-319-23219-5 7
90 C. Dejemeppe et al.
2 Background
In Constraint Programming (CP), a scheduling problem is modeled by associat-
ing three variables to each activity Ai : starti , endi , and durationi representing
respectively the starting time, ending time and processing time of Ai . These
variables are linked together by the following relation:
The unary resource with transition times imposes the following relation:
A CP approach for batch problems with transition times is described in [18]. Sec-
ondly the transition times may be sequence-dependent or sequence-independent.
Transition times are said to be sequence-dependent if their durations depend on
both activities between which they occur. On the other hand, transition times
are sequence-independent if their duration only depend on the activity after
which it takes place. The problem category we study in this article is non-batch
sequence-dependent transition time problems.
Several methods have been proposed to solve such problems. Ant Colony
Optimization (ACO) approaches were used in [9] and [15] while [6], [4], [13] and
[10] propose Local Search and Genetic Algorithm based methods. [13] proposes
a propagation procedure with the Iterative Flattening Constraint-Based Local
Search technique. The existing CP approaches for solving sequence-dependent
problems are [8], [3], [20] and [11].
Focacci et al [8] introduce a propagator for job-shop problems involving
alternative resources with non-batch sequence-dependent transition times. In
this approach a successor model is used to compute lower-bounds on the total
transition time. The filtering procedures are based on a minimum assignment
algorithm (a well known lower bound for the Travelling Salesman Problem). In
this approach the total transition time is a constrained variable involved in the
objective function (the makespan).
In [3], a Travelling Salesman Problem with Time Window (TSPTW) relax-
ation is associated to each resource. The activities used by a resource are rep-
resented as vertices in a graph and edges between vertices are weighted with
corresponding transition times. The TSPTW obtained by adding time windows
to vertices from bounds of corresponding activities is then resolved. If one of the
TSPTW is found un-satisfiable, then the corresponding node of the search tree
is pruned. A similar technique is used in [5] with additional propagation.
In [20], an equivalent model of multi-resource scheduling problem is proposed
to solve sequence-dependent transition times problems. Finally, in [11], a model
with a reified constraint for transition times is associated to a specific search to
solve job-shop with sequence-dependent transition times problems.
To the best of our knowledge, the CP filtering introduced in this article is
the first one proposing to extend all the classic filtering algorithms for unary
resources (Overload Checking [7], Detectable Precedences [17], Not-First/Not-
Last [19] and Edge Finding [19]) by integrating transition times, independently of
the objective function of the problem. This filtering can be used in any problem
involving a unary resource with sequence-dependent transition times.
The earliest starting time of an activity Ai denoted est i , is the time before which
Ai cannot start. The latest starting time of Ai , lst i , is the time after which Ai
cannot start. The domain of starti is thus the interval [est i ; lst i ]. Similarly the
earliest completion time of Ai , ect i , is the time before which Ai cannot end and
the latest completion time of Ai , lct i , is the time after which Ai cannot end.
92 C. Dejemeppe et al.
The domain of endi is thus the interval [ect i ; lct i ]. These definitions can be
extended to a set of activity Ω. For example, est Ω is defined as follows:
A lower bound for the earliest completion time of Ω can then defined as:
ect NP
Ω = max
est Ω + pΩ + min tt π (2)
Ω ⊆Ω π∈ΠΩ
ect Ω = max
{est Ω + pΩ + tt(Ω )}
Ω ⊆Ω
where tt(Ω ) is a lower bound of the total time consumed by transition times
between activities in Ω :
tt(Ω ) ≤ min tt π
π∈ΠΩ
Our goal is to keep the overall O(n log(n)) time complexity of Vilı́m’s algo-
rithms. The lower bound tt(Ω ) must therefore be available in constant time for
a given set Ω . Our approach to obtain constant time lower-bounds for a given
set Ω during search is to base its computation solely on the cardinality |Ω |.
The Unary Resource with Transition Times 93
More precisely, for each possible subset of cardinality k ∈ {1, . . . , n}, we pre-
compute the smallest transition time permutation of size k on Ω:
tt(k) = min min tt π
{Ω ⊆Ω: |Ω |=k} π∈ΠΩ
For each k, the lower bound computation thus requires to solve a resource con-
strained shortest path problem (also NP-hard) with a fixed number of edges k
and with a free origin and destination. The next section proposes several ways
of pre-computing efficient lower bounds tt(k) for k ∈ {1, . . . , n}. Our formula
to compute a lower bound for the earliest completion time of a set of activities
(making use of pre-computed lower-bounds of transition times) becomes:
ectΩ = max
{est Ω + pΩ + tt(|Ω |)} (3)
Ω ⊆Ω
Minimum Weight Forest. A lower bound for tt(k) is a minimal subset of edges
of size k taken from this graph. We propose to strengthen this bound by using
Kruskal’s algorithm [12] to avoid selecting edges forming a cycle. We stop this
algorithm as soon as we have collected k edges. The result is a set of edges
forming a minimum weight forest (i.e. a set of trees) with exactly k edges.
Dynamic Programming. We can build the layered graph with exactly k lay-
ers and each layer containing all the activities. Arcs are only defined between
two successive layers with the weights corresponding to the transition times. A
shortest path on this graph between the first and last layer can be obtain with
Dijkstra. By construction this shortest path will use exactly k transitions, the
relaxation being that a same activity or transition can be used several times.
Minimum Cost Flow. Another relaxation is to keep the degree constraint but
relax the fact that selected edges must form a contiguous connected path. This
relaxation reduces to solving a minimum cost flow problem of exactly k units on
the complete bipartite graph formed by the transitions.
94 C. Dejemeppe et al.
As introduced in [17], the O(n log n) propagation algorithms for unary resource
use the so-called Θ-tree data structure. We propose to extend it in order to
integrate transition times while keeping the same time complexities for all its
operations.
A Θ-tree is a balanced binary tree in which each leaf represents an activity
from a set Θ and internal nodes gather information about the set of (leaf) activ-
ities under this node. For an internal node v, we denote by Leaves(v), the leaf
activities under v. Leaves are ordered in non-decreasing order of the est of the
activities. That is, for two activities i and j, if est i < est j , then i is represented
by a leaf node that is at the left of the leaf node representing j. This ensures the
property:
∀i ∈ Left(v), ∀j ∈ Right(v) : est i ≤ est j
where left(v) and right(v) are respectively the left and right children of v, and
Left(v) and Right(v) denote Leaves(left(v)) and Leaves(right(v)).
A node v contains precomputed values about Leaves(v): ΣPv represents the
sum of the durations of activities in Leaves(v) and ect v is the ect of Leaves(v).
More formally, the values maintained in an internal node v are defined as follows:
ΣPv = pj
j∈Leaves(v)
For a given leaf l representing an activity i, the values of ΣPl and ect l are pi
and ect i , respectively. In [18] Vilı́m has shown that for a node v these values
only depends on the values defined in both its left(v) and right(v) child. The
incremental update rules introduced in [18] are:
As an example, let us consider the set of four activities used in the Θ-tree
example of Figure 1. Let us assume that the associated transition times are as
defined in the matrix M of Figure 2. The lower bounds for set of activities of
different cardinality are reported next to the matrix. With the new update rules
defined above, we obtain the extended Θ-tree presented in Figure 3. Note that
the values of ect ∗ in the internal nodes are larger than the values of ect reported
in the classic Θ-tree (Figure 1).
Fig. 2. Example of transition time matrix and associated lower bounds of transition
times permutations.
Proof. The proof is similar to the proof of Proposition 7 in [18], by also inte-
grating the inequality tt(|Θ |) ≥ tt(|Θ | ∩ Left(v)|) + tt(|Θ | ∩ Right(v)|), which
is itself a direct consequence of the fact that tt(k) is monotonic in k.
Since the new update rules are also executed in constant time for one node, we
keep the time complexities of the initial Θ-tree structure from [18] which are at
worst O(n log(n)) for the insertion of all activities inside the tree.
96 C. Dejemeppe et al.
Fig. 3. Extended Θ-tree for transition times. The ect ∗ values reported in the internal
nodes have been computed using the update rule of the extended Θ-tree.
In addition to ΣPv , ect v , the Θ-Λ-tree structure also maintains ΣPv and ect v ,
respectively corresponding to ΣPv and ect v , if the single gray activity in the
sub-tree rooted by v maximizing ect v were included:
∗ ∗ ∗
ect (Θ,Λ) = max ectΘ , max ectΘ∪{i}
i∈Λ
The update rule for ΣPv remains the same as the one described in [18]. However,
following a similar reasoning as the one used for the extended Θ-tree, we add
the nv value, and update rules are modified for ect v and n v . The rules become:
ΣPv = max ΣPleft(v) + ΣPright(v) , ΣPleft(v) + ΣPright(v)
⎧ ∗ ⎫
⎪ ect
⎨ right(v )
, ⎪
⎬
∗ ∗
ect v = max ect left(v ) + ΣP right(v) + tt(nright(v) + 1),
⎪
⎩ ∗ ⎪
⎭
ectleft(v ) + ΣPright(v) + tt(n right(v) + 1)
nv + 1 if the subtree rooted in v contains a gray node
nv =
nv otherwise
The Unary Resource with Transition Times 97
This extended Θ-Λ-tree allows us to efficiently observe how the ect ∗ of a set of
activities is impacted if a single activity is added to this set. This information
allows the EF algorithm to perform propagation efficiently1 . An example of Θ-
Λ-tree based on the example from Figure 3 and Figure 2 is displayed in Figure 4.
Similarly to the reasoning applied for the Θ-tree, the time complexities
remain the same as the ones for the original Θ-Λ-tree structure from [18], which
are at worst O(n log(n)).
An analogous reasoning can be applied to the update rule of the lct of an activity.
Similarly to the fix point propagation loop proposed in [18] for the unary
resource constraint, the four extended propagation algorithms are combined to
achieve an efficient propagation on transition time constraints. This allows to
obtain a global propagation procedure instead of the conjunction of pairwise
transition constraints described by Equation 1. The approach has however the
∗
disadvantage that the computation of ectΘ integrates a lower bound. This pre-
vents having the guarantee that sufficient propagation is achieved. The loop
must thus also integrate the conjunction of pairwise transition constraints given
in Equation 1. However, experimental results provided in Section 7 exhibits that
the supplementary global constraint reasoning can provide a substantial filtering
gain.
Let us consider a small example (inspired from an example of [18]) with 3 activ-
ities, A, B and C whose domains are illustrated in Figure 5. The corresponding
transition matrix and lower bounds are given in Figure 6.
The Unary Resource with Transition Times 99
Fig. 7. Comparison of classic and extended Θ-tree on the example described in Fig-
ures 5 and 6.
We finally obtain an updated est C , as shown by the red bold bracket in Figure 5.
Notice that the joint use of the constraints given in Equation 1 with the original
unary constraint of [18] would not make this deduction.
7 Evaluation
To evaluate our constraint, we used the OscaR solver [14] and ran instances on
AMD Opteron processors (2.7 GHz). For each considered instance, we used the
3 following filterings for the unary constraint with transition times:
In order to present fair results regarding the benefits that are only provided by
our constraint, we first followed the methodology introduced in [16]. Afterwards,
we made measurements using a static search strategy, as it cannot be influenced
by the additional pruning provided by our constraint.
2
For efficiency reason, dedicated propagators have been implemented instead of post-
ing reified constraint.
3
Available at http://mistic.heig-vd.ch/taillard/problemes.dir/ordonnancement.dir/
ordonnancement.html.
4
Available at http://becool.info.ucl.ac.be/resources/benchmarks-unary-resource-
transition-times
The Unary Resource with Transition Times 101
propagator - and then to replay this search tree using the different studied fil-
tering procedures. The point is to only measure the time gain provided by the
propagation, by decoupling the gain provided by the search strategy (while still
being able to use dynamic ones) from the one provided by the propagation. We
used φb as the baseline filtering, and the SetTimes (st) search strategy to con-
struct the search tree, as this strategy is recognized to provide good performances
in Scheduling. The search tree construction time was limited to 600 seconds. We
then constructed performance profiles as described in [16]. Basically, those are
cumulative distribution functions of a performance metric τ . Here, τ is the ratio
between the solution time (or number of backtracks) of a target approach (i.e.
φb+u or φuTT ) and that of the baseline (i.e. φb ). For time (similar for number of
backtracks), the function is defined as:
1 t(replay(st), M ∪ φi )
Fφi (τ ) = M ∈ M : ≤ τ (4)
|M| t(replay(st), M )
1.00
φuTT
0.75 φb+u
% instances
0.50
0.25
0.00
0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0 0.0 2.5 5.0 7.5 10.0 12.5
τ τ τ
Table 1. Best time results for φuTT compared to φb . The problem is to find the given
makespan m using a binary static search strategy. Time is in seconds.
φuTT φb φb+u
Instance m
Time #Fails Time #Fails Time #Fails
15 15-3 225 50 100-1 2,344 1.12 2,442 117.92 980,330 432.07 911,894
50 15-8 750 50 100-2 6,682 2.11 744 182.27 1,127,272 999.79 1,127,272
20 15-7 300 150 200-2 4,784 0.24 449 17.63 168,466 62.27 168,466
15 15-6 225 50 100-1 2,398 3.90 5,593 187.93 889,079 534.20 602,591
50 20-3 1000 50 150-2 7,387 2.96 1,709 126.61 584,407 829.25 584,407
100 20-4 2000 150 200-1 18,595 11.59 885 340.32 332,412 1225.44 206,470
30 15-3 450 50 200-1 4,643 1.97 1,178 39.23 226,700 314.34 226,700
15 15-5 225 100 150-2 3,320 0.91 2,048 16.40 119,657 63.38 119,657
50 20-2 1000 50 100-1 6,979 3.79 1,680 63.16 878,162 4.63 1,695
30 15-10 450 100 200-1 5,586 0.74 687 9.24 106,683 41.25 106,683
Table 2. Worst time results for φuTT compared to φb . The problem is to find the given
makespan m using a binary static search strategy. Time is in seconds.
φuTT φb φb+u
Instance m
Time #Fails Time #Fails Time #Fails
15 15-10 225 50 200-2 2,804 645.26 546,803 127.38 546,803 572.81 546,803
50 15-9 750 50 200-1 6,699 954.77 164,404 174.63 164,437 1,108.43 164,437
20 20-5 400 100 150-2 4,542 213.54 78,782 38.26 78,968 180.20 78,968
20 20-8 400 100 150-2 4,598 147.55 164,546 26.42 164,576 175.69 164,576
15 15-2 225 50 100-2 2,195 178.37 96,821 31.23 96,821 139.84 96,821
20 20-6 400 100 200-1 4,962 11.15 8,708 1.94 8,745 11.87 8,745
30 20-8 600 50 200-1 5,312 18.63 6,665 3.15 6,687 19.93 6,687
20 15-10 300 50 200-2 3,571 85.84 61,185 14.24 61,185 65.12 61,185
50 20-8 1000 100 200-1 9,186 286.61 88,340 46.17 88,340 180.23 88,340
20 15-1 300 100 150-1 3,557 189.37 208,003 29.55 209,885 157.33 209,885
similar to the results using the classical unary resource (i.e. φb+u ), while they are
at worst around 6.4 times slower than the simple binary decomposition (i.e. φb ).
8 Conclusion
References
1. Ahuja, R.K., Magnanti, T.L., Orlin, J.B.: Network Flows: Theory, Algorithms, and
Applications. Prentice-Hall Inc, Upper Saddle River (1993)
2. Allahverdi, A., Ng, C., Cheng, T.E., Kovalyov, M.Y.: A survey of scheduling prob-
lems with setup times or costs. European Journal of Operational Research 187(3),
985–1032 (2008)
3. Artigues, C., Belmokhtar, S., Feillet, D.: A new exact solution algorithm for the job
shop problem with sequence-dependent setup times. In: Régin, J.-C., Rueher, M.
(eds.) CPAIOR 2004. LNCS, vol. 3011, pp. 37–49. Springer, Heidelberg (2004)
4. Artigues, C., Buscaylet, F., Feillet, D.: Lower and upper bound for the job shop
scheduling problem with sequence-dependent setup times. In: Proceedings of the
Second Multidisciplinary International Conference on Scheduling: Theory and
Applications, MISTA 2005 (2005)
5. Artigues, C., Feillet, D.: A branch and bound method for the job-shop problem with
sequence-dependent setup times. Annals of Operations Research 159(1), 135–159
(2008)
6. Balas, E., Simonetti, N., Vazacopoulos, A.: Job shop scheduling with setup times,
deadlines and precedence constraints. Journal of Scheduling 11(4), 253–262 (2008)
7. Baptiste, P., Le Pape, C., Nuijten, W.: Constraint-based scheduling: applying con-
straint programming to scheduling problems, vol. 39. Springer Science & Business
Media (2001)
104 C. Dejemeppe et al.
8. Focacci, F., Laborie, P., Nuijten, W.: Solving scheduling problems with setup times
and alternative resources. In: AIPS, pp. 92–101 (2000)
9. Gagné, C., Price, W.L., Gravel, M.: Scheduling a single machine with sequence
dependent setup time using ant colony optimization. Faculté des sciences de
l’administration de l’Université Laval, Direction de la recherche (2001)
10. González, M.A., Vela, C.R., Varela, R.: A new hybrid genetic algorithm for the job
shop scheduling problem with setup times. In: ICAPS, pp. 116–123 (2008)
11. Grimes, D., Hebrard, E.: Job shop scheduling with setup times and maximal time-
lags: a simple constraint programming approach. In: Lodi, A., Milano, M., Toth, P.
(eds.) CPAIOR 2010. LNCS, vol. 6140, pp. 147–161. Springer, Heidelberg (2010)
12. Kruskal, J.B.: On the shortest spanning subtree of a graph and the traveling
salesman problem. Proceedings of the American Mathematical society 7(1), 48–50
(1956)
13. Oddi, A., Rasconi, R., Cesta, A., Smith, S.F.: Exploiting iterative flattening search
to solve job shop scheduling problems with setup times. PlanSIG2010, p. 133 (2010)
14. OscaR Team: OscaR: Scala in OR (2012). https://bitbucket.org/oscarlib/oscar
15. Tahar, D.N., Yalaoui, F., Amodeo, L., Chu, C.: An ant colony system minimizing
total tardiness for hybrid job shop scheduling problem with sequence dependent
setup times and release dates. In: Proceedings of the International Conference on
Industrial Engineering and Systems Management, pp. 469–478 (2005)
16. Van Cauwelaert, S., Lombardi, M., Schaus, P.: Understanding the potential of
propagators. In: Proceedings of the Twelfth International Conference on Integra-
tion of Artificial Intelligence and Operations Research techniques in Constraint
Programming (2015)
17. Vilı́m, P.: O (nlog n) filtering algorithms for unary resource constraint. In:
Régin, J.-C., Rueher, M. (eds.) CPAIOR 2004. LNCS, vol. 3011, pp. 335–347.
Springer, Heidelberg (2004)
18. Vilım, P.: Global constraints in scheduling. Ph.D. thesis, Charles University in
Prague, Faculty of Mathematics and Physics, Department of Theoretical Computer
Science and Mathematical Logic, KTIML MFF, Universita Karlova, Praha (2007)
19. Vilı́m, P., Barták, R., Čepek, O.: Extension of o (n log n) filtering algorithms for
the unary resource constraint to optional activities. Constraints 10(4), 403–425
(2005)
20. Wolf, A.: Constraint-based task scheduling with sequence dependent setup times,
time windows and breaks. GI Jahrestagung 154, 3205–3219 (2009)
21. Zampelli, S., Vergados, Y., Van Schaeren, R., Dullaert, W., Raa, B.: The berth
allocation and quay crane assignment problem using a CP approach. In: Schulte, C.
(ed.) CP 2013. LNCS, vol. 8124, pp. 880–896. Springer, Heidelberg (2013)
A Global Constraint for a Tractable Class
of Temporal Optimization Problems
1 Introduction
The study of temporal relations between elements of a process is a very active
topic of research, with a wide range of applications: biomedical informatics [5,20],
law [17], media [2,4,8] etc. Temporal reasoning enables to analyze the content of
a document in order to infer high-level information. In particular, a summary of
a tennis match may be generated from the match recording with Artificial Intel-
ligence techniques [2,4]. The summarization requires to extract some noticeable
time intervals and annotate them with qualitative attributes using signal recog-
nition techniques. Then, the summary generation may be formulated as a Con-
straint Satisfaction Problem (CSP) where variables are the video segments to
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 105–120, 2015.
DOI: 10.1007/978-3-319-23219-5 8
106 A. Derrien et al.
1. For any task in T at least one relation in R is satisfied between this task
and at least one interval in I.
2. Tasks in T are ordered according to their indexes in the vector given as
argument, i.e., for any integer i, 1 ≤ i < n, the task Ti should end before or
at the starting time of Ti+1 .
Symbol Relation
T (1)
T (2)
T (1) p T (2) (T (2) pi T (1) ) T (1) precedes T (2)
T (1)
T (2)
T (1) m T (2) (T (2) mi T (1) ) T (1) meets T (2)
T (1)
T (2)
T (1) o T (2) (T (2) oi T (1) ) T (1) overlaps T (2)
T (1)
T (2)
T (1) s T (2) (T (2) si T (1) ) T (1) starts T (2)
T (1)
T (2)
T (1) d T (2) (T (2) di T (1) ) T (1) during T (2)
T (1)
(2)
T
T (1) f T (2) (T (2) f i T (1) ) T (1) finishes T (2)
T (1)
T (2)
T (1) eq T (2) T (1) equal to T (2)
2 Background
In this section we give some background and fix the notations used in this paper.
Temporal reasoning has been an important research topic for the last thirty
years. One may distinguish qualitative temporal reasoning, based on relations
between intervals and/or time points, from quantitative reasoning where dura-
tion of a given event is represented in a numerical fashion. Allen’s algebra [1]
represents qualitative temporal knowledge by interval constraint networks. An
interval constraint network is a directed graph where nodes represent intervals
and edges are labelled with disjunctions of Allen’s relations. Table 1 details those
relations. Many state-of-the-art papers deal with generic solving techniques and
tractability of temporal networks [6,7,9,18], including temporal problems with
quantified formulas [10,12]. Most of these methods make no strong restriction
on the constraint network to be solved.
A few techniques, more specialized, focus on optimization problems. The two
most related to this paper are the following. Kumar et al. [11] consider temporal
problems with “taboo” regions, minimizing the number of intersections between
108 A. Derrien et al.
tasks and a set of fixed intervals. These problems occur in scheduling applica-
tions, among others. In the context of video summarization, a recent paper [4]
proposes the idea of using global constraints involving a set of ordered intervals.
Each constraint is restricted to one specific relation in the 213 combinations of
Allen’s relations. The propagators are not described.
The basic filtering rule specific to each Allen’s relation can be derived from time-
point logic relations [19], in order to state lower and upper bounds of starting and
ending times of tasks. For instance, consider a task T ∈ T , an interval I ∈ I, and
the relation starts. The relation is satisfied if and only if two conditions are met:
T s I ⇔ sT = sI ∧ eT < eI
The only filtering on the lower bounds of task T induced by the two conditions of
relation starts is sT ≥ sI . On the same basis, we define in Table 2 the conditions
and filtering rules for the 13 Allen’s algebra relations between a task T and an
interval I.
time of the current task. An adjustment of the bound of one such variable is
made in Algorithm 2 if and only if the current relation gives a support which is
less than the lowest previously computed support.
checkCondition(T , s, I) ⇔ sT ≤ sI ∧ sT ≥ sI ∧ eT < eI .
Proof. As the number of Allen’s relations is constant (at most 13), and the call
of the three functions (lines 3, 4 and 5 in Algorithm 2) are in O(1), the whole
filtering of lower bounds is performed in O(n × m) time complexity.
Theorem 1. The propagator based on Algorithm 1 and its symmetric calls for
upper bounds of starting/ending variables in T , ensure bounds(Z)-consistency
if processing times are fixed integers.
Proof. After the execution of Algorithm 1, the optimal update has been done for
each lower bound, according to the current upper bounds. The filtering of upper
bounds is symmetric. Therefore, providing that durations of tasks are fixed, the
propagator ensures bound (Z)-consistency when a fixpoint is reached.
A fixpoint is not necessarily reached after running Algorithm 1 twice, once
to filter lower bounds and once to filter upper bounds. Indeed, the pass on
upper bounds can filter values which were previously supports for lower bounds.
Let’s consider ExistAllen(T , R, I) depicted in Figure 1 wherein: T = {T1 =
sT1 = [0, 2], pT1 = [2, 4], eT1 = [4,6] , T2 = sT2 = [5, 6], pT2 = [4, 5], eT2 = [10, 10] },
R = {d, di} and I = {I 1 = [1, 5], I 2 = [6, 8]}.
0 1 2 3 4 5 6 7 8 9 10
Fig. 1. Several phases may be required to get a fixpoint when the processing times of
tasks are not fixed.
Property 1. An interval I which starts after a support y for the ending time of
a task T cannot provide a support for eT lower than y.
Proof. Consider a task T , R ⊆ {m, mi, o, oi, s, si, d, di, f, f i, eq}, y a support for
eT and I an interval, such that y < sI . From filtering rules in Table 2, col. 3, no
relation in R provides a support lower than y for eT .
Property 2. For any of the relations in {mi, oi, s, si, d, f, eq}, an interval I which
starts after a support y for the ending time of a task T cannot provide a support
for sT lower than y.
Property 3. For any of the relations in {m, o, di, f i}, an interval I which starts
after a support for the ending time of a task T can provide a support for sT . The
lowest support for T is then given by the interval I in I having the lowest sI .
Case 2 (T is not related to I with relation r: ¬(T r I)). Consider the m relation.
Task T can meet interval I only if sI ∈ [eT , eT ] (Table 2 col. 2). As it exists a
support y with a value e∗ < sI and the relation m is not satisfied, we have
eT < sI . Given that all intervals are chronologically ordered, no interval with a
greater index can meet the task T . A similar reasoning can be applied to the
other relations in R.
A Global Constraint for a Tractable Class 113
Property 4. An interval I which ends before the ending time of a task Ti cannot
provide a support for the next task Ti+1 .
Proof. Let Ti be a task and I an interval such that eI < eTi . Then eI < sTi+1 .
Ti+1 cannot be in relation with I.
Property 5. Given a task T , there exists at most one interval between the interval
I i with the highest ending time such that eI i < eT and the interval I j with the
lowest starting time such that sI j > eT .
Proof. Let T be a task, let I i be the interval with the highest eI such that
eI < eT , we have then eI i+1 > eT , and let I j be the interval with the lowest
sI j such that sI j > eT , we have then sI j−1 < eT . Given that all intervals are
chronologically ordered, and that sI j−1 < eI i+1 , we have that j − 1 ≤ i + 1, that
is j − i ≤ 2. As the difference between indices i and j is at most 2, there is at
most one interval between i and j.
3.4 Improvements
4 Evaluation
4.2 Benchmark
100 M1
95
90
85
102
100 M2
98
objective
96
94
92
90
110
105 M3
100
95
90 ad hoc
85 allen(n+m)
80 allen(n.m)
75 decomp
1 10 100 1000
time (sec)
Each of the four models has been implemented in Choco-3.3.0 [16]. Each of
the instances was executed with a 15 minutes timeout, on a Macbook Pro with
8-core Intel Xeon E5 at 3Ghz running a MacOS 10.10, and Java 1.8.0 25. Each
instance was run on its own core, each with up to 4096MB of memory.
In order to compare the efficiency on the four models, we first consider a static
search heuristic: the variables representing the segment bounds are selected in a
lexicographic order and assigned to their lower bounds. In this way, we ensure
that the same search tree is explored, finding the same solutions in the same
220
190
160
130 M1
100
70
40
10
180
170
160
objective
150 M2
140
130
120
240
210
180
150
M3
120 ad hoc
90 allen(n+m)
allen(n.m)
60
decomp
30
1 10 100 1000
time (sec)
order, and that only the running time is evaluated. The comparative evaluations
of the four models are in reported in Figure 2. Each plot is associated with
an instance and indicates the improvement of the objective function over time.
Recall that the x-axis are in logscale. The three plots are similar.
First of all, a strict reformulation (decomp) is clearly not competitive with
the models with specific constraints: decomp is always the slowest. This has to
do with the huge number of constraints and additional variables it requires to
express the ExistAllen constraint. As an example in the match M 1 where there
are 10 tasks, 271 intervals and 4 relations, each triplet T, R, I is expressed by
three new binary constraints, each of them reified by a new boolean variable.
Second, the quadratic propagator improves the filtering of a strict reformulation.
Third, as expected, the performances are even better with the linear propaga-
tor. For information purpose, the results of the ad hoc model (as used in [4])
are reported. allen(n+m), our generic constraint is shown to be the most effec-
tive model, mildly faster than ad hoc. This confirms that our generic linear
propagator, besides being expressive and flexible and offering guarantees on its
complexity and consistency level, is very efficient in practice.
The four models have also been evaluated with the configuration described
in [4], that is, using Activity-based search [13] combined with Propagation-
Guided Large Neighborhood Search [14].1 Due to the intrinsic randomness of
ABS and PGLNS, each resolution was run 30 times. Thus, the average objec-
tive values are reported in Figure 3. Recall that the x-axis are in logscale. The
dynamic strategy offered by the combination of ABS and PGLNS enables to
reduce the differences between the various models. Although to a slightly lesser
extent, the order between efficiency of the four models is preserved when apply-
ing a more aggressive search strategy heuristic.
5 Conclusion
We introduced ExistAllen, a generic constraint defined on a vector of tasks
and a set of disjoint intervals, which applies on any of the 213 combinations
of Allen’s algebra relations. This constraint is useful to tackle many problems
related to time intervals, such as the video-summarization problem [4], used as a
case study. From a technical viewpoint, we proposed a generic propagator that
achieves bound-consistency in O(n + m) worst-case time, where n is the number
of tasks and m the number of intervals, whereas the most natural implemen-
tation requires O(n × m) worst-case time. Our experiments demonstrate that
using our technique is very competitive with the best ad hoc approach, specific
to one particular combination of relations, while being much more expressive.
Future work includes the extension of this approach to several task sets,
in order to tackle problems beyond the context of video-summarization. In the
Satellite Data Download Management Problem [15], Earth observation satellites
acquire data that need to be downloaded to the ground. The download of data
is subject to temporal constraints, such as fitting in visibility windows. Using
1
The configuration for ABS and PGLNS are the default one described in [13] and [14].
A Global Constraint for a Tractable Class 119
ExistAllen constraint, the visibility windows are the intervals, the amount of
acquired data fixes the duration of the download tasks, and the relation required
is during. The tasks can be ordered with respect to the type of acquired data
and their need to be scheduled.
References
1. Allen, J.F.: Maintaining knowledge about temporal intervals. Commun. ACM
26(11), 832–843 (1983)
2. Berrani, S.-A., Boukadida, H., Gros, P.: Constraint satisfaction programming for
video summarization. In: Proceedings of the 2013 IEEE International Symposium
on Multimedia, ISM 2013, Washington, DC, USA, pp. 195–202. IEEE Computer
Society (2013)
3. Bessière, C.: Constraint propagation. Research report 06020. In: Rossi, F.,
van Beek, P., Walsh, T. (eds.) Handbook of Constraint Programming, LIRMM,
chapter 3. Elsevier (2006)
4. Boukadida, H., Berrani, S.-A., Gros, P.: A novel modeling for video summarization
using constraint satisfaction programming. In: Bebis, G., et al. (eds.) ISVC 2014,
Part II. LNCS, vol. 8888, pp. 208–219. Springer, Heidelberg (2014)
5. Bramsen, P., Deshp, P., Lee, Y.K., Barzilay, R.: Finding temporal order in dis-
charge summaries, pp. 81–85 (2006)
6. Choueiry, B.Y., Lin, X.: An efficient consistency algorithm for the temporal con-
straint satisfaction problem. AI Commun. 17(4), 213–221 (2004)
7. Dechter, R., Meiri, I., Pearl, J.: Temporal constraint networks. Artif. Intell.
49(1–3), 61–95 (1991)
8. Ibrahim, Z.A.A., Ferrane, I., Joly, P.: Temporal relation analysis in audiovi-
sual documents for complementary descriptive information. In: Detyniecki, M.,
Jose, J.M., Nürnberger, A., van Rijsbergen, C.J.K. (eds.) AMR 2005. LNCS,
vol. 3877, pp. 141–154. Springer, Heidelberg (2006)
9. Koubarakis, M.: From local to global consistency in temporal constraint networks.
Theor. Comput. Sci. 173(1), 89–112 (1997)
10. Koubarakis, M., Skiadopoulos, S.: Querying temporal and spatial constraint
networks in PTIME. Artif. Intell. 123(1–2), 223–263 (2000)
11. Satish Kumar, T.K., Cirillo, M., Koenig, S.: Simple temporal problems with taboo
regions. In: des Jardins, M., Littman, M.L. (eds.) Proceedings of the Twenty-
Seventh AAAI Conference on Artificial Intelligence, July 14–18, 2013, Bellevue,
Washington, USA. AAAI Press (2013)
12. Ladkin, P.B.: Satisfying first-order constraints about time intervals. In:
Shrobe, H.E., Mitchell, T.M., Smith, R.G. (eds.) Proceedings of the 7th
National Conference on Artificial Intelligence. St. Paul, MN, August 21–26, 1988,
pp. 512–517. AAAI Press/The MIT Press (1988)
13. Michel, L., Van Hentenryck, P.: Activity-based search for black-box constraint
programming solvers. In: Beldiceanu, N., Jussien, N., Pinson, É. (eds.) CPAIOR
2012. LNCS, vol. 7298, pp. 228–243. Springer, Heidelberg (2012)
120 A. Derrien et al.
14. Perron, L., Shaw, P., Furnon, V.: Propagation guided large neighborhood search.
In: Proceedings of the Principles and Practice of Constraint Programming - CP
2004, 10th International Conference, CP 2004, Toronto, Canada, pp. 468–481,
September 27–October 1, 2004
15. Pralet, C., Verfaillie, G., Maillard, A., Hebrard, E., Jozefowiez, N., Huguet, M.-J.,
Desmousceaux, T., Blanc-Paques, P., Jaubert, J.: Satellite data download man-
agement with uncertainty about the generated volumes. In: Chien, S., Do, M.B.,
Fern, A., Ruml, W. (eds.) Proceedings of the Twenty-Fourth International Con-
ference on Automated Planning and Scheduling, ICAPS 2014, Portsmouth, New
Hampshire, USA, June 21–26, 2014. AAAI (2014)
16. Prud’homme, C., Fages, J.-G., Lorca, X.: Choco3 Documentation. http://www.
choco-solver.org. TASC, INRIA Rennes, LINA CNRS UMR 6241, COSLING
S.A.S. (2014)
17. Schilder, F.: Event extraction and temporal reasoning in legal documents. In:
Schilder, F., Katz, G., Pustejovsky, J. (eds.) Annotating, Extracting and Rea-
soning about Time and Events. LNCS (LNAI), vol. 4795, pp. 59–71. Springer,
Heidelberg (2007)
18. van Beek, P., Cohen, R.: Exact and approximate reasoning about temporal rela-
tions. Computational Intelligence 6, 132–144 (1990)
19. Vilain, M., Kautz, H., van Beek, P.: Readings in qualitative reasoning about
physical systems. In: Constraint Propagation Algorithms for Temporal Reasoning:
A Revised Report, pp. 373–381. Morgan Kaufmann Publishers Inc., San Francisco
(1990)
20. Zhou, L., Hripcsak, G.: Methodological review: Temporal reasoning with medical
data-a review with emphasis on medical natural language processing. J. of Biomed-
ical Informatics 40(2), 183–202 (2007)
Exploiting GPUs in Solving (Distributed)
Constraint Optimization Problems
with Dynamic Programming
1 Introduction
This research is partially supported by the National Science Foundation under grant
number HRD-1345232. The views and conclusions contained in this document are
those of the authors and should not be interpreted as representing the official policies,
either expressed or implied, of the sponsoring organizations, agencies, or the U.S.
government.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 121–139, 2015.
DOI: 10.1007/978-3-319-23219-5 9
122 F. Fioretto et al.
variable and its related utility functions with a single new function, derived
by optimizing over the possible values of the replaced variable. The Dynamic
Programming Optimization Protocol (DPOP) [25] is one of the most efficient
DCOP solvers, and it can be seen as a distributed version of BE, where agents
exchange newly introduced utility functions via messages.
The importance of DP-based approaches arises in several optimization fields
including constraint programming [2,28]. For example, several propagators adopt
DP-based techniques to establish constraint consistency; for instance, (1) the
knapsack constraint propagator proposed by Trick applies DP techniques to
establish arc consistency on the constraint [31]; (2) the propagator for the regular
constraint establishes arc consistency using a specific digraph representation of
the DFA, which has similarities to dynamic programming [24]; (3) the context
free grammar constraint makes use of a propagator based on the CYK parser
that uses DP to enforce generalized arc consistency [26].
While DP approaches may not always be appropriate to solve (D)COPs, as
their time and space requirements may be prohibitive, they may be very effective
in problems with particular structures, such as problems where their underlying
constraint graphs have small induced widths or distributed problems where the
number of messages is crucial for performance, despite the size of the messages.
The structure exploited by DP-based approaches in constructing solutions makes
it suitable to exploit a novel class of massively parallel platforms that are based
on the Single Instruction Multiple Thread (SIMT) paradigm—where multiple
threads may concurrently operate on different data, but are all executing the
same instruction at the same time. The SIMT-based paradigm is widely used
in modern Graphical Processing Units (GPUs) for general purpose parallel com-
puting. Several libraries and programming environments (e.g., Compute Unified
Device Architecture (CUDA)) have been made available to allow programmers
to exploit the parallel computing power of GPUs.
In this paper, we propose a design and implementation of a DP-based algo-
rithm that exploits parallel computation using GPUs to solve (D)COPs. Our
proposal aims at employing GPU hardware to speed up the inference process of
DP-based methods, representing an alternative way to enhance the performance
of DP-based constraint optimization approaches. This paper makes the following
contributions: (1) We propose a novel design and implementation of a central-
ized and a distributed DP-based algorithm to solve (D)COPs, which harnesses
the computational power offered by parallel platforms based on GPUs; (2) We
enable the use of concurrent computations between CPU(s) and GPU(s), during
(D)COP resolution; and (3) We report empirical results that show significant
improvements in performance and scalability.
2 Background
2.1 Centralized Constraint Optimization Problems (COPs)
A (centralized) Constraint Optimization Problem (COP) is defined as (X, D, C)
where: X = {x1 , . . . , xn } is a set of variables; D = {D1 , . . . , Dn } is a set of
Exploiting GPUs in Solving (Distributed) Constraint Optimization Problems 123
x1 x2 Utilities x3
x1 for i < j
x1 0 0 max(5+5, 8+8) = 16 1
xi x j Utilities 0 1 max(5+20, 8+3) = 25 0
0 0 5 1 0 max(20+5, 3+8) = 25 0
x2 x2 0 1 8 1 1 max(20+20, 3+3) = 40 0
1 0 20
x1 Utilities x2 x3
1 1 3
x3 0 max(5+16, 8+25) = 33 1 0
x3
1 max(20+25, 3+40) = 45 0 0
(a) (b) (c) (d)
Fig. 1. Example (D)COP (a-c) and UTIL phase computations in DPOP (d).
domains for the variables in X, where Di is the set of possible values for the
variable xi ; C is a finite set of utility functions on variables in X, with fi :
xj ∈xi Dj → R+ ∪ {−∞}, where xi ⊆ X is the set of variables relevant to fi ,
referred to as the scope of fi , and −∞ is used to denote that a given combination
of values for the variables in xi is not allowed.1 A solution is a value assignment
for a subset of variables from X that is consistent
n with their respective domains;
i.e., it is a partial function θ : X → i=1 Di such that, for each xj ∈ X, if
θ(xj ) is defined, then θ(xj ) ∈ Dj . A solution is complete if it assigns a value to
each variable in X. We will use the notation σ to denote a complete solution,
and, for a set of variables V = {xi1 , . . . , xih } ⊆ X, σV = σ(xi1 ), . . . , σ(xih ),
where i1 < · · · < ih . The goal for a COP is to find a complete solution σ ∗
that maximizes the total problem utility expressed by its utility functions, i.e.,
σ ∗ = argmaxσ∈Σ fi ∈C fi (σxi ), where Σ is the state space, defined as the set of
all possible complete solutions.
Given a COP P , GP = (X, EC ) is the constraint graph of P , where {x, y} ∈
EC iff ∃fi ∈ C such that {x, y} ⊆ xi . Fig. 1(a) shows the constraint graph of a
simple COP with three variables, x1 , x2 , and x3 . The domain of each variable is
the set {0, 1}. Fig. 1(c) describes the utility functions of the COP.
In other words, fi|V is constructed from the tuples of fi , removing the values of
the variable that do not appear in V and removing duplicate values by keeping
the maximum utility of the original tuples in fi .
Definition 2 (Concatenation). Let us consider two assignments θ , defined
for variables V , and θ , defined for variables W , such that for each x ∈ V ∩ W
we have that θ (x) = θ (x). Their concatenation is an assignment θ · θ defined
for V ∪ W , such as for each x ∈ V (resp. x ∈ W ) we have that θ · θ (x) = θ (x)
(resp. θ · θ (x) = θ (x)).
1
For simplicity, we assume that tuples of variables are built according to a predefined
ordering.
124 F. Fioretto et al.
Algorithm 1. BE
1 for i ← n downto 1 do
2 Bi ← {fj ∈ C | xi ∈ xj ∧ i = max{k | xk ∈ xj }}
3 fˆi ← π−xi fj
fj ∈Bi
4 X ← X \ {xi }
5 C ← (C ∪ {fˆi }) \ Bi
to binary utility functions and assume that α is a bijection: Each agent con-
trols exactly one variable. Thus, we will use the terms “variable” and “agent”
interchangeably and assume that α(xi ) = ai . This is a common assumption in
the DCOP literature as there exist pre-processing techniques that transform a
general DCOP into this more restrictive DCOP [7,34]. In DCOPs, solutions are
defined as for COPs, and many solution approaches emulate those proposed in
the COP literature. For example, ADOPT [21] is a distributed version of Itera-
tive Deepening Depth First Search, and DPOP [25] is a distributed version of BE.
The main difference is in the way the information is shared among agents. Typi-
cally, a DCOP agent knows exclusively its domain and the functions involving its
variable. It can communicate exclusively with its neighbors (i.e., agents directly
connected to it in the constraint graph2 ), and the exchange of information takes
the form of messages. Given a DCOP P , a DFS pseudo-tree arrangement for GP
is a spanning tree T = X, ET of GP such that if fi ∈ C and {x, y} = xi , then x
and y appear in the same branch of T . Edges of GP that are in (resp. out of)
ET are called tree edges (resp. backedges). The tree edges connect parent-child
nodes, while backedges connect a node with its pseudo-parents and its pseudo-
children. We use N (ai ) = {aj ∈ A|{xi , xj } ∈ ET } to denote the neighbors of agent
ai ; Ci , P Ci , Pi , and PPi to denote the set of children, pseudo-children, parent,
and pseudo-parents of agent ai ; and sep(ai ) to denote the separator of agent
ai , which is the set of ancestor agents that are constrained (i.e., they are linked
in GP ) with agent ai or with one of its descendant agents in the pseudo-tree.
Fig. 1(b) shows one possible pseudo-tree for the problem, where the agent a1
has one pseudo-child a3 (the dotted line is a backedge).
Dynamic Programming Optimization Protocol (DPOP): DPOP [25] is a
dynamic programming based DCOP algorithm that is composed of three phases.
(1) Pseudo-tree generation: Agents coordinate to build a pseudo-tree, realized
through existing distributed pseudo-tree construction algorithms [16]. (2) UTIL
propagation: Each agent, starting from the leaves of the pseudo-tree, computes
the optimal sum of utilities in its subtree for each value combination of variables
in its separator. The agent does so by aggregating the utilities of its functions
with the variables in its separator and the utilities in the UTIL messages received
from its child agents, and then projecting out its own variable. In our example
problem, agent a3 computes the optimal utility for each value combination of
variables x1 and x2 (Fig. 1(d) top), and sends the utilities to its parent agent
a2 in a UTIL message. When the root agent a1 receives the UTIL message from
each of its children, it computes the maximum utility of the entire problem.
(3) VALUE propagation: Each agent, starting from the root of the pseudo-
tree, determines the optimal value for its variable. The root agent does so by
choosing the value of its variable from its UTIL computations—selecting the
value with the maximal utility. It sends the selected value to its children in a
VALUE message. Each agent, upon receiving a VALUE message, determines
the value for its variable that results in the maximum utility given the variable
2
The constraint graph of a DCOP is equivalent to that of the corresponding COP.
126 F. Fioretto et al.
assignments (of the agents in its separator) indicated in the VALUE message.
Such assignment is further propagated to the children via VALUE messages.
The complexity of DPOP is dominated by the UTIL propagation phase, which
is exponential in the size of the largest separator set sep(ai ) for all ai ∈ A. The
other two phases require a polynomial number of linear size messages, and the
complexity of the local operations is at most linear in the size of the domain.
Observe that the UTIL propagation phase of DPOP emulates the BE process
in a distributed context [6]. Given a pseudo-tree and its preorder listing o, the
UTIL message generated by each DPOP agent ai is equivalent to the aggregated
and projected function fˆi in BE when xi is processed according to the ordering o.
Algorithm 2. GPU-(D)BE
(1) Generate pseudo-tree
2 GPU-Initialize( )
3 if Ci = ∅ then
4 UTILxi ⇔ ParallelCalcUtils( )
(5) Send UTIL message (xi , UTILxi ) to Pi
6 else
7 Activate UTILMessageHandler(·)
(8) Activate VALUEMessageHandler(·)
operations. These operations are responsible for the creation of the functions fˆi
in BE (line 3 of Algorithm 1) and the UTIL tables in DPOP (UTIL propagation
phase), and they dominate the complexity of the algorithms. Thus, we focus on
the details of the design and the implementation relevant to such operations.
Due to the equivalence of BE and DPOP, we will refer to the UTIL tables and
to the aggregated and projected functions fˆ of Algorithm 1, as well as variables
and agents, interchangeably. Notice that the computation of the utility for each
value combination in a UTIL table is independent of the computation in the
other combinations. The use of a GPU architecture allows us to exploit such
independence, by concurrently exploring several combinations of the UTIL table,
computed by the aggregation operator, as well as concurrently projecting out
variables.
Algorithm 2 illustrates the pseudocode, where we use the following notations:
Line numbers in parenthesis denote those instructions required exclusively in the
distributed case. Starred line numbers denote those instructions executed concur-
rently by both the CPU and the GPU. The symbols ← and ⇔ denote sequential
and parallel (multiple GPU-threads) operations, respectively. If a parallel oper-
D←H H←D
ation requires a copy from host (device) to device (host), we write ⇔ ( ⇔ ).
Host to device (resp. device to host) memory transfers are performed immedi-
ately before (resp. after) the execution of the GPU kernel. Algorithm 2 shows
the pseudocode of GPU-(D)BE for an agent ai . Like DPOP, also GPU-(D)BE
is composed of three phases; the first and third phase are executed exclusively
in the distributed version. The first phase is identical to that of DPOP (line 1).
In the second phase:
• Each agent ai calls GPU-Initialize() to set up the GPU kernel. For example,
it determines the amount of global memory to be assigned to each UTIL table
and initializes the data structures on the GPU device memory (line 2).
• Each agent ai aggregates the utilities for the functions between its variables
and its separator, projects its variable out (line 4), and sends them to its
parent (line 5). The MessageHandlers of lines 7 and 8 are activated for each
new incoming message.
By the end of the second phase (line 11), the root agent knows the overall utility
for each values of its variable xi . It chooses the value that results in the maximum
128 F. Fioretto et al.
utility (line 13). Then, in the distributed version, it starts the third phase by
sending to each child agent ac the value of its variable xi (lines 14-16). These
operations are repeated by every agent receiving a VALUE message (lines 18-22).
In contrast, in the centralized version, the value assignment for each variable is
set by the root agent directly.
• The domain Di of its variable (for simplicity assumed to be all of equal car-
dinality).
• The set Ci of ai ’s children.
• The separator sets sep(ai ), and sep(ac ), for each ac ∈ Ci .
The GPU-Initialize() procedure of line 2, invoked after the pseudo-tree
construction, stores the data structures above for each agent on the GPU device.
As a technical detail, all the data stored on the GPU global memory is organized
in mono-dimensional arrays, so as to facilitate coalesced memory accesses. In
particular, the identifier and scope of the functions in Si as well as identifiers and
separator sets of child agents in Ci are stored within a single mono-dimensional
array. The utility values stored in the rows of each function are padded to ensures
that a row is aligned to a memory word—thus minimizing the number of memory
accesses.
GPU-Initialize() is also responsible for reserving a portion of the GPU
global memory to store the values for the agent’s UTIL table, denoted by gUtils i ,
and those of its children, denoted by gChUtils c , for each ac ∈ Ci . As a techni-
cal note, an agent’s UTIL table is mapped onto the GPU device to store only
the utility values, not the associated variables values. Its j-th entry is associated
with the j-th permutation of the variable values in sep(ai ), in lexicographic order.
This strategy allows us to employ a simple perfect hashing to efficiently associate
row numbers with variables’ values and vice versa. Note that the agent’s UTIL
table size grows exponentially with the size of its separator set; more precisely,
after projecting out xi , it has |Di |sep(ai ) entries. However, the GPU global mem-
ory is typically limited to a few GB (e.g., in our experiments it is 2GB). Thus,
each agent, after allocating its static entities, checks if it has enough space to
allocate its children’s UTIL tables and a consistent portion (see next subsection
for details) of its own UTIL table. In this case, it sets the project on device flag
to true, which signals that both aggregate and project operations can be done
on the GPU device.3 Otherwise it sets the flag to false and bounds the device
UTIL size table to the maximum storable space on the device. In this case, the
aggregation operations are performed only partially on the GPU device.
Procedure ParallelCalcUtils( )
23 if project on device then
D←H
24 gChUTILac ⇔ UTILac for all ac ∈ Ci
25 R ← 0 ; U T ILai ← ∅
26 while R < |Di |sep(ai ) do
27 if project on device then
H←D
28* UTILai ⇔ GPU-Aggregate-Project(R)
29 else
H←D
30* UTILai ⇔ GPU-Aggregate(R)
31* UTILai ← AggregateCh-Project(ai , UTILai , UTILac ) for all
ac ∈ Ci
32* UTILai ← U T ILai ∪ Compress(UTILai )
33 R ← R + |UTILai |
34 return UTILai
GPU
(Device)
H D Compute U 1 D H Compute U 2 D H
(a) only—the execution of kernel K1 produces the update of the first chunk of
UTILai , denoted by U1 in Fig. 2, which is transferred to the CPU host. The
successive parallel operations are performed asynchronously with respect to the
GPU, that is, the execution of the j-th CUDA kernel Kj (j > 1), returns the con-
trol immediately to the CPU, which concurrently operates a compression opera-
tion on the previously computed UTILai chunk (line 32), referred to as Uk−1 in
Fig. 2. For case (b), the CPU also executes concurrently the AggregateCh-
Project of line 31. We highlight the concurrent operations by marking with a
∗
symbol their respective lines in the procedure ParallelCalcUtils.
Technical Details: We now describe in more detail how we divide the workload
among parallel blocks, i.e., the mapping between the UTIL table rows and the
CUDA blocks. A total of T = 64 · k (1 ≤ k ≤ 16) threads (a block) are associ-
ated to the computation of T permutations of values for sep(ai ). The value k
depends on the architecture and it is chosen to maximize the number of con-
current threads running at the same time. In our experiments, we set k = 3.
The number of blocks is chosen so that the corresponding aggregate number
of threads does not exceed the total number of UTILai permutations currently
stored in the device. Let h be the number of stream multiprocessors of the GPU.
Then, the maximum number of UTIL permutations that can be computed con-
currently is M = h · T . In our experiments h = 14, and thus, M = 2688. Fig. 3
provides an illustration of the UTIL permutations computed in parallel on GPU.
The blocks Bi in each row are executed in parallel on different SMs. Within each
block, a total of (at most) 192 threads operate on as many entries of the UTIL
table.
The GPU kernel procedure is shown in lines 35-49. We surround line numbers
with | · | to denote parts of the procedure executed by case (b). The kernel takes
as input the number R of the UTIL table permutations computed during the
previous kernel calls. Each thread identifies its entry index rid within the table
chunk UTILai (line 35). It then assigns the shared memory allocated to local
arrays to store the static entities Si , Ci , and sep(ac ), for each ac ∈ Ci . In addi-
tion it reserves the space θ to store the assignments corresponding to the UTIL
permutation being computed by each thread, which is retrieved using the thread
entry index and the offset R (line 38). Decode implements a minimal perfect
hash function to convert the entry index of the UTIL table to its associated vari-
ables value permutation. Each thread aggregates the functions in Si (lines 42-44)
and the UTIL tables of ai ’s children (lines 45-47), for each element of its domain
132 F. Fioretto et al.
Procedure GPU-Aggregate-Project(R)
|35| rid ← the thread’s entry index of UTILi
|36| did ← the thread’s value index of Di
|37| |θ, Si |, Ci , sep(xc ) ← AssignSharedMem() for all xc ∈ Ci
|38| θ ← decode(R + rid )
|39| util ← −∞
40 foreach did ∈ Di do
|41| util did ← 0
|42| foreach fj ∈ Si do
|43| ρj ← encode(θxj | xi = did )
|44| util did ← util did + gFunc j [ρj ]
45 foreach ac ∈ Ci do
46 ρc ← encode(θsep(ac ) | xi = did )
47 util did ← util did + gChUtils c [ρc ]
|48| util ← max(util , util did )
|49| gUtils i [rid ] ← util
(lines 40-48). The Encode routine converts a given assignments for the variables
in the scope of a function fj (line 43), or in the separator set of child ac (line 46),
to the corresponding array index, sorted in lexicographic order. The value for
the variable xi within each input, is updated at each iteration of the for loop.
The projection operation is executed in line 48. Finally, the thread stores the
best utility in the corresponding position of the array gUtils i
The GPU-Aggregate procedure (called in line 30), is illustrated in
lines 35-49—line numbers surrounded by | · |. Each thread is in charge of
a value combination in sep(ai ) ∪ {xi }, thus, the foreach loop of lines 40-
48 is operated in parallel by |Di | threads. Lines 45-47 are not executed. The
AggregateCh-Project procedure (line 31), which operates on the CPU, is
similar to the GPU-Aggregate-Project procedure, except that lines 36-37,
and 42-44, are not executed.
The proposed kernel has been the result of several investigations. We exper-
imented with other levels of parallelism, e.g., by unrolling the for-loops among
Exploiting GPUs in Solving (Distributed) Constraint Optimization Problems 133
4 Related Work
The use of GPUs to solve difficult combinatorial problems has been explored
by several proposals in different areas of constraint optimization. For instance,
Meyer et al. [18] proposed a multi-GPU implementation of the simplex tableau
algorithm which relies on a vertical problem decomposition to reduce communi-
cation between GPUs. In constraint programming, Arbelaez and Codognet [3]
proposed a GPU-based version of the Adaptive Search that explores several large
neighborhoods in parallel, resulting in a speedup factor of 17. Campeotto et al. [9]
proposed a GPU-based framework that exploits both parallel propagation and
parallel exploration of several large neighborhoods using local search techniques,
leading to a speedup factor of up to 38. The combination of GPUs with dynamic
programming has also been explored to solve different combinatorial optimiza-
tion problems. For instance, Boyer et al. [5] proposed the use of GPUs to compute
the classical DP recursion step for the knapsack problem, which led to a speedup
factor of 26. Pawlowski et al. [23] presented a DP-based solution for the coalition
structure formation problem on GPUs, reporting up to two orders of magnitude
134 F. Fioretto et al.
of speedup. Differently from other proposals, our approach aims at using GPUs
to exploit SIMT-style parallelism from DP-based methods to solve general COPs
and DCOPs.
5 Experimental Results
We compare our centralized and distributed versions of GPU-(D)BE with BE [10]
and DPOP [25] on binary constraint networks with random, scale-free, and reg-
ular grid topologies. The instances for each topology are generated as follows:
Random: We create an n-node network, whose density p1 produces n (n−1) p1
edges in total. We do not bound the tree-width, which is based on the underlying
graph.
Scale-free: We create an n-node network based on the Barabasi-Albert
model [4]: Starting from a connected 2-node network, we repeatedly add a new
node, randomly connecting it to two existing nodes. In turn, these two nodes
are selected with probabilities that are proportional to the numbers of their
connected edges. The total number of edges is 2 (n − 2) + 1.
Regular grid: We create an n-node network arranged as a rectangular grid,
where each internal node is connected to four neighboring nodes, while nodes
on the grid edges (resp. corners) are connected to two (resp. three) neighboring
nodes.
We generate 30 instances for each topology, ensuring that the underlying graph
is connected. The utility functions are generated using random integer costs in
[0, 100], and the constraint tightness (i.e., ratio of entries in the utility table
different from −∞) p2 is set to 0.5 for all experiments. We set as default param-
eters, |A| = |X| = 10, |Di | = 5 for all variables, and p1 = 0.3 for random networks,
and |A| = |X| = 9 for regular grids. Experiments for GPU-DBE are conducted
using a multi-agent DCOP simulator, that simulates the concurrent activities of
multiple agents, whose actions are activated upon receipt of a message. We use
the publicly-available implementation of DPOP available in the FRODO frame-
work v.2.11 [19], and we use the same framework to run the BE algorithm, in a
centralized setting.
Since all algorithms are complete, our focus is on runtime. Performance of
the centralized algorithms are evaluated using the algorithm’s wallclock runtime,
while distributed algorithms’ performances are evaluated using the simulated
runtime metric [30]. We imposed a timeout of 300s of wallclock (or simulated)
time and a memory limit of 32GB. Results are averaged over all instances and
are statistically significant with p-values < 1.638 e−12 .6 These experiment are
performed on an AMD Opteron 6276, 2.3GHz, 128GB of RAM, which is equipped
with a GPU device GeForce GTX TITAN with 14 multiprocessors, 2688 cores,
and a clock rate of 837MHz.
6
t-test performed with null hypothesis: GPU-based algorithms are faster than non-
GPU ones.
Exploiting GPUs in Solving (Distributed) Constraint Optimization Problems 135
Fig. 4. Runtimes for COPs (top) and DCOPs (bottom) at varying number of vari-
ables/agents.
Fig. 4 illustrates the runtime, in seconds, for random (a), scale-free (b), and
regular grid (c) topologies, varying the number of variables (resp. agents) for the
centralized (resp. distributed) algorithms. The centralized algorithms (BE and
GPU-BE) are shown at the top of the figure, while the distributed algorithms
(DPOP and GPU-DBE) are illustrated at the bottom. All plots are in log-scale.
We make the following observations:
• The GPU-based DP-algorithms (for both centralized and distributed cases)
are consistently faster than the non-GPU-based ones. The speedups obtained
by GPU-BE vs. BE are, on average, and minimum (showed in parenthesis)
69.3 (16.1), 34.9 (9.5), and 125.1 (42.6), for random, scale-free, and regular grid
topologies, respectively. For the distributed algorithms, the speedups obtained
by GPU-DBE vs. DPOP are on average (minimum) 44.7 (14.7), 22.3 (8.2), and
124.2 (38.8), for random, scale-free, and regular grid topologies, respectively.
• In terms of scalability, the GPU-based algorithms scale better than the non-
GPU-based ones. In addition, their scalability increases with the level of struc-
ture exposed by each particular topology. On random graphs, which have
virtually no structure, the GPU-based algorithms reach a timeout for instances
with small number of variables (25 variables—compared to 20 variables for the
non-GPU-based algorithms). On scale-free networks, the GPU-(D)BE algo-
rithms can solve instances up to 50 variables,7 while BE and DPOP reach a
timeout for instances greater than 40 variables. On regular grids, the GPU-
based algorithms can solve instances up to 100 variables, while the non-GPU-
based ones, fail to solve any instance with 36 or more variables.
We relate these observations to the size of the separator sets and, thus, the size
of the UTIL tables that are constructed in each problem. In our experiments,
7
With 60 variables, we reported 12/30 instances solved for GPU-(D)BE.
136 F. Fioretto et al.
Fig. 5. Runtimes for COPs (top) and DCOPs (bottom) at varying number of vari-
ables/agents.
we observe that the average sizes of the separator sets are consistently larger
in random graphs, followed by scale-free networks, followed by regular grids.
• Finally, the trends of the centralized algorithms are similar to those of the
distributed algorithms: The simulated runtimes of the DCOP algorithms are
consistently smaller than the wallclock runtimes of the COP ones.
Fig. 5 illustrates the behavior of the algorithms when varying the graph den-
sity p1 for the random graphs (a), and the domains size for random graphs (b)
and regular grids (c). As for the previous experiments, the centralized (resp. dis-
tributed) algorithms are shown on the top (resp. bottom) of the figure. We can
observe:
• The trends for the algorithms runtime, when varying both p1 and domains
size, are similar to those observed in the previous experiments.
• GPU-(D)BE achieves better speed-up for smaller p1 (Fig. 4 (a)). The result
is explained by observing that small p1 values correspond to smaller induced
width of the underlying constraint graph. In turn, for small p1 values, GPU-
(D)BE agents construct smaller UTIL tables, which increases the probabil-
ity of performing the complete inference process on the GPU, through the
GPU-Aggregate-Project procedure. This observation is also consistent
with what observed in the previous experiments in terms of scalability.
• GPU-(D)BE achieves greater speedups in presence of large domains. This is
due to the fact that large domains correspond to large UTIL tables, enabling
the GPU-based algorithms to exploit a greater amount of parallelism, provided
that the UTIL tables can be stored in the global memory of the GPU.
References
1. Abdennadher, S., Schlenker, H.: Nurse scheduling using constraint logic program-
ming. In: Proceedings of the Conference on Innovative Applications of Artificial
Intelligence (IAAI), pp. 838–843 (1999)
2. Apt, K.: Principles of constraint programming. Cambridge University Press (2003)
3. Arbelaez, A., Codognet, P.: A GPU implementation of parallel constraint-based
local search. In: Proceedings of the Euromicro International Conference on Parallel,
Distributed and network-based Processing (PDP), pp. 648–655 (2014)
138 F. Fioretto et al.
1 Introduction
Backtracking search is a central complete algorithm used to solve combinato-
rial constrained problems. Unfortunately, it suffers from thrashing – repeat-
edly exploring the same fruitless subtrees – during search. Restarts, adaptive
heuristics, and strong consistency algorithms are typical Constraint Program-
ming (CP) techniques used to cope with thrashing.
Last Conflicts (LC) [9] has been shown to be highly profitable to complete
search algorithms, both in constraint satisfaction and in automated artificial
intelligence planning. The principle behind LC is to select in priority the last
conflicting variables as long as they cannot be instantiated without leading to
a failure. Interestingly enough, last conflict search can be combined with any
underlying variable ordering heuristic. In normal mode, the underlying heuristic
selects the variables to branch on, whereas in conflict mode, variables are directly
selected in a conflict set built by last conflict.
While last conflict uses conflicts to repair the search heuristic, we show in this
paper that conflicts can also be used to drive the search process by progressively
replacing the initial variable heuristic. Basically, the idea behind our approach –
namely, Conflict Ordering Search – is to reorder variables according to the most
recent conflict they were involved in. Our experiments highlight that this simple
reordering scheme, while being generic, can outperform domain specific heuristics
for scheduling problems.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 140–148, 2015.
DOI: 10.1007/978-3-319-23219-5 10
Conflict Ordering Search for Scheduling Problems 141
2 Related Works
We start by providing a quick overview of general-purpose search heuristics and
schemes since our approach is definitively one of them. The simple variable
ordering heuristic dom [5] – which selects variables by their domain size – has
long been considered as the most robust backtrack search heuristic. However,
a decade ago, modern adaptive heuristics were introduced. Such heuristics take
into account information related to the part of the search space already explored.
The two first proposed generic adaptive heuristics are impact [16] and wdeg [1].
The former relies on a measure of the effect of any assignment, and the latter
associates a counter with each constraint (and indirectly, with each variable)
indicating how many times any constraint led to a domain wipe-out. Counting-
based heuristics [14] and activity-based search [11] are two recently introduced
additional adaptive techniques to guide the search process.
Interestingly, Last Conflict (LC) [9] is a search mechanism that can be applied
on top of any variable ordering heuristic. Precisely, the generalized form LC(k)
works by recording and assigning first the k variables involved in the k last deci-
sions that provoked a failure after propagation. The underlying search heuristic
is used when all the last k conflicting variables have been assigned. While the
ability of relying on an underlying search heuristic is a strong point of LC, setting
the parameter k can be problematic, as we shall see later. The related scheme
introduced in this paper goes further and orders permanently all conflicting vari-
ables using the time of their last conflicts, eventually becoming independent of
the helper variable ordering heuristic.
3.1 Background
Tree-Search. One can solve CSPs by using backtrack search, a complete depth-
first exploration of the search space, with backtracking when a dead-end occurs.
At each search node, a filtering process φ can be performed on domains by
142 S. Gay et al.
Fig. 1. Conflict numbering and timestamps associated with each variable. Variables
are stamped with the number of their latest conflict (or 0 by default).
heuristic varHeuristic. When a new value has been selected by the heuristic
valHeuristic[x], we recursively call COS . One can observe that the complexity
of selecting a variable is linear in time and space, hence scaling well.1
Example 1. Let us consider a toy CSP with n “white” variables, and m “black”
variables. White variables have a binary domain while black variables have
{1, 2, . . . , m − 1} as domain. We also add a binary difference constraint on each
pair of black variables (thus making the CSP unsatisfiable), but no constraint
at all on the white variables. Let us also assume a variable ordering heuristic
that selects the white variables first, then the black variables. Hence, proving
unsatisfiability using this heuristic requires to prove the “black conflict” for the
2n valuations of the white variables (see left part of Fig. 2). Using COS on top
of this heuristic allows one to detect unsatisfiability quickly. Indeed, the m − 2
first conflicting black variables will be prioritized as a white variable cannot be
involved in a conflict. The number of times the “black conflict” as to be proven
thus becomes linear in the number of white variables n (see right part of Fig. 2).
. . .
Fig. 2. Conflict Ordering Search reorders the variables to reduce the number of times
the inconsistent black subtree has to be explored.
the domain of x, we use interval splitting on it, i.e., we branch with decisions
x ≤ v and x > v, otherwise the value heuristic is solicited. Observe that this
mechanism follows the first-fail/best-first principle.
Example 2. Let us consider the toy CSP described in Example 1. The time
required to prove unfeasibility could be drastically reduced if a restart occurs
after having explored the inconsistent black subtree at least once. Indeed, in this
context, the second restart will directly explore the black search tree without
even considering the white variables that have been “disculpated”.
conflict sets of any size. While setting the parameter k to the number of decision
variables may solve the problem, LC still suffers from resets of its conflict set
that occur each time the conflicting variables have been successfully assigned.
Conversely, COS does not forget conflicting variables and progressively reorders
those variables to give priority to the recently conflicting ones. This is particu-
larly important with restarts as LC is not designed to focus on conflict sets in
such contexts (see Example 2).
4 Experiments
4.1 Branch-and-Bound
The goal of this first experiment is to find an optimal solution using a pure
branch-and-bound search. We compare five search solving methods. The first
is a simple min/min scheme, which selects the variable with the smallest min-
imal value and chooses the smallest value (for assignment). The second one is
the scheduling-specialized SetTimes heuristic with dominances [7], which is a
min/min scheme that simply postpones assignments (instead of making value
refutations) when branching at right, fails when a postponed task can no longer
be woken up, and assigns the tasks that are not postponed and cannot be
disturbed by other tasks. Finally, the last three heuristics correspond to conflict-
based reasoning searches, namely, LC(k) for the best value of k, our main con-
tribution COS, and COSPhase based on the variant presented in Section 15. All
these have a min/min helper heuristic.
We have observed that the ranking of these five search methods is the same
on the four RCPSP benchmarks (J30, J60, J90, J120) from PSPLIB. Results
are represented on the left part of Fig. 3 where the y-axis is the cumulated
number of solved instances and the x-axis is the CPU time. SetTimes is clearly
an improvement on min/min, as it finishes ahead and seems to continue its
course on a better slope than min/min. In turn, the well-parameterized LC
(we empirically chose the best possible value for k) fares better than SetTimes.
Finally, COS allows us to close a higher number of instances, and the variant
COSPhase improves COS even further.
146 S. Gay et al.
COSPhase
235 COSPhase 237
COS
228 COS
211 rst-COSPhase
206 rst-COS
185 LC(k)
175 SetTimes 172 minrnd/min
155 min/min
0 0
0 10 ms 1 sec 1 min 0 10 ms 1 sec 1 min
Fig. 3. On the left, results obtained for pure branch-and-bound, and on the right,
results obtained with branch-and-bound with restarts. Graphs at the top show the
cumulated number of solved RCPSP instances from PSPLIB120. The tables at the
bottom compare branching heuristics at the end of the 60s timeout, giving the number
of closed instances and the sum of makespans.
in this case. The results are similar. We also compared COS to the recently intro-
duced Failure Directed Search [18] by implementing it directly in CP Optimizer.
Unfortunately our COS implementation in CP Optimizer was not able to obtain
results competitive with FDS.
5 Conclusion
References
1. Boussemart, F., Hemery, F., Lecoutre, C., Sais, L.: Boosting systematic search by
weighting constraints. In: Proceedings of ECAI 2004, pp. 146–150 (2004)
2. Gay, S., Hartert, R., Schaus, P.: Simple and scalable time-table filtering for
the cumulative constraint. In: Pesant, G. (ed.) Proceedings of CP 2015. LNCS,
vol. 9255, pp. 149–157. Springer, Heidelberg (2015)
3. Gay, S., Hartert, R., Schaus, P.: Time-table disjunctive reasoning for the cumula-
tive constraint. In: Michel, L. (ed.) CPAIOR 2015. LNCS, vol. 9075, pp. 157–172.
Springer, Heidelberg (2015)
4. Gomes, C., Selman, B., Crato, N., Kautz, H.: Heavy-tailed phenomena in satisfia-
bility and constraint satisfaction problems. Journal of Automated Reasoning 24,
67–100 (2000)
5. Haralick, R.M., Elliott, G.L.: Increasing tree search efficiency for constraint satis-
faction problems. Artificial Intelligence 14, 263–313 (1980)
6. Kolisch, R., Schwindt, C., Sprecher, A.: Benchmark instances for project scheduling
problems. In: Project Scheduling, pp. 197–212. Springer (1999)
7. Le Pape, C., Couronné, P., Vergamini, D., Gosselin, V.: Time-versus-capacity com-
promises in project scheduling (1994)
8. Lecoutre, C., Sais, L., Tabary, S., Vidal, V.: Nogood recording from restarts. In:
Proceedings of IJCAI 2007, pp. 131–136 (2007)
148 S. Gay et al.
9. Lecoutre, C., Sais, L., Tabary, S., Vidal, V.: Reasonning from last conflict(s) in
constraint programming. Artificial Intelligence 173(18), 1592–1614 (2009)
10. Lecoutre, C., Sais, L., Tabary, S., Vidal, V.: Recording and minimizing nogoods
from restarts. Journal on Satisfiability, Boolean Modeling and Computation 1,
147–167 (2007)
11. Michel, L., Van Hentenryck, P.: Activity-based search for black-box constraint
programming solvers. In: Beldiceanu, N., Jussien, N., Pinson, É. (eds.) CPAIOR
2012. LNCS, vol. 7298, pp. 228–243. Springer, Heidelberg (2012)
12. Moskewicz, M.W., Madigan, C.F., Zhao, Y., Zhang, L., Malik, S. Chaff: engineering
an efficient SAT solver. In: Proceedings of DAC 2001, pp. 530–535 (2001)
13. OscaR Team. OscaR: Scala in OR (2012). bitbucket.org/oscarlib/oscar
14. Pesant, G., Quimper, C.-G., Zanarini, A.: Counting-based search: Branching
heuristics for constraint satisfaction problems. Journal of Artificial Intelligence
Research 43, 173–210 (2012)
15. Pipatsrisawat, K., Darwiche, A.: A lightweight component caching scheme for sat-
isfiability solvers. In: Marques-Silva, J., Sakallah, K.A. (eds.) SAT 2007. LNCS,
vol. 4501, pp. 294–299. Springer, Heidelberg (2007)
16. Refalo, P.: Impact-based search strategies for constraint programming. In:
Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 557–571. Springer, Heidelberg
(2004)
17. Vilı́m, P.: Timetable edge finding filtering algorithm for discrete cumulative
resources. In: Achterberg, T., Beck, J.C. (eds.) CPAIOR 2011. LNCS, vol. 6697,
pp. 230–245. Springer, Heidelberg (2011)
18. Vilı́m, P., Laborie, P., Shaw, P.: Failure-directed search for constraint-based
scheduling. In: Michel, L. (ed.) CPAIOR 2015. LNCS, vol. 9075, pp. 437–453.
Springer, Heidelberg (2015)
19. Wolf, A., Schrader, G.: O(n log n) overload checking for the cumulative constraint
and its application. In: Umeda, M., Wolf, A., Bartenstein, O., Geske, U., Seipel, D.,
Takata, O. (eds.) INAP 2005. LNCS (LNAI), vol. 4369, pp. 88–101. Springer,
Heidelberg (2006)
Simple and Scalable Time-Table Filtering
for the Cumulative Constraint
1 Preliminaries
In this paper, we focus on a single cumulative resource with a discrete finite
capacity C ∈ N and a set of n tasks Ω = {1, . . . , n}. Each task i has a start time
si ∈ Z, a fixed duration di ∈ N, and an end time ei ∈ Z such that the equality
si + di = ei holds. Moreover, each task i consumes a fixed amount of resource
ci ∈ N during its processing time. Tasks are non-preemptive, i.e., they cannot be
interrupted during their processing time. In the following, we denote by si and
si the earliest and the latest start time of task i and by ei and ei the earliest and
latest end time of task i (see Fig. 1). The cumulative constraint [1] ensures that
the accumulated resource consumptiondoes not exceed the maximum capacity
C at any time t (see Fig. 2): ∀t ∈ Z : i∈Ω : si ≤t<ei ci ≤ C.
Even tasks that are not fixed convey some information that can be used by
filtering rules. For instance, tasks with a tight execution window must consume
some resource during a specific time interval known as mandatory part.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 149–157, 2015.
DOI: 10.1007/978-3-319-23219-5 11
150 S. Gay et al.
Fig. 3. Task i has a mandatory part [si , ei [ if its latest start time si is smaller than its
earliest end time ei : si < ei . Task i always consumes the resource during its mandatory
part no matter its start time.
Observe that this filtering rule only describes how to update the start time of a
task. End times are updated in a symmetrical way.
Let j be a rectangle denoted aj , bj , hj
with aj ∈ Z (resp. bj ∈ Z) its start
(resp. end) time, hj ∈ N its height, and bj − aj its duration (length). The time-
table TTΩ can be represented as a contiguous sequence of rectangles
T TΩ = −∞, a1 , 0
, a1 , b1 , h1
, . . . , am , bm , hm
, bm , ∞, 0
(3)
∀ aj , bj , hj
∈ T TΩ , ∀t ∈ [aj , bj [ : T TΩ (t) = hj . (4)
We assume that the sequence is minimal, i.e., no consecutive rectangles have the
same height. The maximum number of rectangles is thus limited to 2n + 1.
∀i ∈ Ω, ∀ aj , bj , hj
∈ T TΩ\i : j is in left-conflict with i ⇒ bj ≤ si . (5)
Using the notion of conflicting rectangles, one can design a naive time-tabling
algorithm by confronting every task to every rectangle of the profile. The fol-
lowing algorithms improve on this, mainly by avoiding fruitless confrontations
of rectangles and tasks.
Interval Tree Algorithm. The algorithm of Ouellet and Quimper [14] first builds
the profile, then introduces rectangles and tasks in an interval tree. Rectangles
are introduced by decreasing height, tasks by increasing height. This allows tasks
and rectangles to be confronted only when their heights do conflict. For each
task introduction, the tree structure decides in log n if its time domain conflicts
with some rectangle. Its filtering is weaker, since it pushes a task i only after
left-conflicting rectangles that overlap [si , ei [, as pictured in Figure 4(b). The
algorithm has time complexity O(n log n).
Fig. 4. Filtering obtained for (a) our linear time-tabling (b) Ouellet et al [14] and (c)
Beldiceanu et al [2].
New Algorithms. In this paper, we introduce two new algorithms for time-
tabling. The first one is of theoretical interest and runs in O(n). It uses range-
max-query algorithms to determine whether a task has a conflicting rectangle.
As the algorithm of Ouellet et al [14], it confronts task i only with rectangles
overlapping [si , ei [, but only chooses the one with the largest height instead of
the largest end. Thus, it prunes even less, as depicted in Figure 4(a).
The second algorithm is practical, and runs in O(n2 ). It separates profile
building from task sweeping. To locate tasks on the profile, it exploits residues
from previous computations, and incrementally removes fixed tasks that cannot
lead to any more pruning. It uses sweeping, thus pruning as much as [2] per call,
but it updates both the earliest start and latest end times of the tasks in a single
execution.
Proof. If i has a mandatory part, we only need to look for conflict rectangles
overlapping [si , si [, since the profile already includes the mandatory part of i.
Otherwise, we need to look at [si , ei [. If rectangle j ∗ is not in left-conflict with
i, then no other rectangle can, since it would need to be higher than j ∗ .
To retrieve the index j ∗ , we must answer the question: given a vector of values
and two indices on this vector, what is the index between those two indices that
has the highest value? This kind of query corresponds to the range max query
problem1 , it can be done in constant time, given a linear time preprocessing [7].
Example 1. Assume the vector is values = [5, 4, 2, 1, 4, 3, 0, 8, 2, 3]. The range
max query between index 4 and index 7 is 5, denoted rmq(values, 4, 7) = 5.
This is indeed at index 5 that there is the maximum value on the subvector
[1, 4, 3, 0].
In our case the vector is composed of the heights of the rectangles of the
profile heights = [h1 , h2 , . . . , hm ]. The two indices of the query are respectively:
– j1 (i) is the index j of the rectangle aj , bj , hj
s.t. si ∈ [aj , bj [.
– j2 (i) is the index j of the rectangle aj , bj , hj
s.t. min(ei , si ) − 1 ∈ [aj , bj [
The whole algorithm is given in Algorithm 1. An example of the filtering is
given in Figure 4 (a). Notice that the task is pushed after a highest conflicting
rectangle, which is not as good as the filtering of [14] (Figure 4 (b)).
Algorithm 1. MinLeftTTLinearTime(Ω,C)
Input: A set of tasks Ω, capacity C.
Output: true iff propagation failed, i.e. if the problem is infeasible.
1 initialize TTΩ // aj , bj , hj ∀i ∈ {1 . . . m}
2 if maxj∈[1;m] hj > C then return true
3 heights ← [h1 , h2 , . . . , hm ]
4 ∀i ∈ Ω compute j1 (i), j2 (i)
5 initialize rmq(heights)
6 for i ∈ Ω such that s < s do
7 j ∗ ← rmq(heights, j1 (i), j2 (i))
8 if hj ∗ + ci > C then si ← bj
9 return false
Time Complexity. As in [6], we assume that all the time points are encoded
with w − bit integers and can thus be sorted in linear time. Given the sorted
time points the profile TTΩ can be computed in linear time using a sweep line
algorithm, and all the indices j1 (i), j2 (i) can be computed in linear time as well.
The range min/max query is a well studied problem. Preprocessing in line 5
can be done in linear time, so that any subsequent query at Line 7 executes in
constant time [7]. Thus, the whole algorithm executes in O(n).
1
a straightforward variant of the well-known range min query problem.
154 S. Gay et al.
Computing Profile Indices. Line 4 computes, for all unfixed tasks i, the pro-
file rectangle containing si . This value is saved between consecutive calls in a
residue2 ; most of the time, it is still valid and we do not have to recompute
it, if not, a dichotomic search is performed, at a cost of O(log n). Note that [2]
sorts tasks by s to locate tasks on the profile, at a theoretical cost of O(n log n).
Here we pay O(log n) only for tasks where the residue is invalid. Similarly, line
5 computes the rectangle containing the last point of i, ei − 1.
Per-Task Sweeping. The loop in line 6 looks for left and right-conflicting rect-
angles for i linearly. The main difference with the global sweeping in [2] is that
our method does not factorize sweeping according to height, wagering that the
cost of moving tasks in height-ordered heaps is higher than that of pushing every
task until no conflict remains. This main part has a worst case cost O(n2 ).
Fruitless Fixed Tasks Removal. After the main loop, line 24 removes fixed tasks
at profile extremities that can no longer contribute to pruning. This filtering is
O(n). Note that Ω is kept along the search tree using a reversible sparse-set [5].
2
this is similar to residual supports for AC algorithms [10].
Simple and Scalable Time-Table Filtering for the Cumulative Constraint 155
Algorithm 2. ScalableTimeTable(Ω,C)
Input: A set of tasks Ω, capacity C.
Output: true iff propagation failed, i.e. if the problem is infeasible.
1 Ωu ← {i | si < si } // unfixed tasks
2 initialize TTΩ // aj , bj , hj , ∀j ∈ {1 . . . m}
3 if maxj∈[1;m] hj > C then return true
4 ∀i ∈ Ωu , compute j1 (i) such that si ∈ [aj1 (i) ; bj1 (i) [
5 ∀i ∈ Ωu , compute j2 (i) such that ei − 1 ∈ [aj2 (i) ; bj2 (i) [
6 for i ∈ Ωu do
7 j ← j1 (i)
8 s∗i ← si
9 while j ≤ m and aj < min(s∗i + di , si ) do
10 if C − ci < hj then
11 s∗i ← min(bj , si ) // j in left-conflict
12 j ←j+1
13 if s∗i > si then si ← s∗i
14
15 j ← j2 (i)
16 e∗i ← ei
17 while j ≥ 1 and bj ≥ max(e∗i − di , ei ) do
18 if C − ci < hj then
19 e∗i ← max(aj , ei ) // j in right-conflict
20 j ←j−1
21 if e∗i < ei then ei ← e∗i
u
22 smin ← mini∈Ωu si
u
23 emax ← maxi∈Ωu ei
24 Ω ← Ω \ {i ∈ Omega | ei ≤ sumin ∨ eumax ≤ si }
25 return false
5 Experiments
We have tested our ScalableTimeTable filtering against the time-table filtering
of or-tools [12], Choco3 [4] and Gecode [9] solvers. The algorithm in Choco3
and Gecode solver is the one of [2]. Similarly to our algorithm, or-tools also
builds the time-table structure before filtering. To the best of our knowledge, no
implementation of Letort et al [11] algorithm is publicly available. We have thus
implemented the heap-based variant of the algorithm, faster in practice, with the
same quality standard as our new ScalableTimeTable [13]. In the models used
for this experiment, cumulative propagators enforce only the resource constraint,
precedences are enforced by separate propagators.
We have generated randomly n (ranging from 100 to 12800) tasks with dura-
tion between 200 and 2000 and heights between 1 and 40. The capacity is fixed to
100. The search is a simple greedy heuristic selecting the current tasks with the
smallest earliest possible start, hence there is no backtrack. The search finishes
156 S. Gay et al.
when all the tasks have been placed. This simple experimental setting guarantees
that every solver has exactly the same behavior. The results are given on Figure 5.
As can be seen, the time-table implementation of Choco3 and Gecode are quickly
not able to scale well for more than 1600 tasks. The algorithm of or-tools, Letort
et al and our new algorithm are still able to handle 12800 tasks. Surprisingly, our
algorithm outperforms the one of Letort et al despite its simplicity.
298.2 s Gecode
234.8 s Choco 3
175.6 s OR-Tools
128.8 s OscaR Letort
6 Conclusion
We have introduced an O(n) time-table filtering using range min queries. We
believe that the usage of range min query may be useful for subsequent research
on scheduling, for instance in time-table disjunctive reasoning [8]. We introduced
simple but scalable O(n2 ) filtering for the cumulative constraint. Our results
show that despite its simplicity, it outperforms current implementations of time-
table constraints in some open-source solvers and also the recent synchronized
sweep algorithm. The resources related to this work are available here http://
bit.ly/cumulativett.
References
1. Aggoun, A., Beldiceanu, N.: Extending chip in order to solve complex scheduling
and placement problems. Mathematical and Computer Modelling 17(7), 57–73
(1993)
2. Beldiceanu, N., Carlsson, M.: A New multi-resource cumulatives constraint
with negative heights. In: Van Hentenryck, P. (ed.) CP 2002. LNCS, vol. 2470,
pp. 63–79. Springer, Heidelberg (2002)
3. Bordeaux, L., Hamadi, Y., Vardi, M.Y.: An analysis of slow convergence in inter-
val propagation. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 790–797.
Springer, Heidelberg (2007)
4. Charles Prud’homme, X.L., Fages, J.-G.: Choco3 documentation. TASC, INRIA
Rennes, LINA CNRS UMR 6241, COSLING S.A.S. (2014)
5. de Saint-Marcq, V.C., Schaus, P., Solnon, C., Lecoutre, C.: Sparse-sets for domain
implementation. In: CP Workshop on Techniques for Implementing Constraint
Programming Systems (TRICS), pp. 1–10 (2013)
Simple and Scalable Time-Table Filtering for the Cumulative Constraint 157
6. Fahimi, H., Quimper, C.-G.: Linear-time filtering algorithms for the disjunctive
constraint. In: Twenty-Eighth AAAI Conference on Artificial Intelligence (2014)
7. Fischer, J., Heun, V.: Theoretical and practical improvements on the RMQ-
problem, with applications to LCA and LCE. In: Lewenstein, M., Valiente, G.
(eds.) CPM 2006. LNCS, vol. 4009, pp. 36–48. Springer, Heidelberg (2006)
8. Gay, S., Hartert, R., Schaus, P.: Time-table disjunctive reasoning for the cumula-
tive constraint. In: Michel, L. (ed.) CPAIOR 2015. LNCS, vol. 9075, pp. 157–172.
Springer, Heidelberg (2015)
9. Gecode Team. Gecode: Generic constraint development environment (2006).
http://www.gecode.org
10. Lecoutre, C., Hemery, F., et al.: A study of residual supports in arc consistency.
In: IJCAI, vol. 7, pp. 125–130 (2007)
11. Letort, A., Beldiceanu, N., Carlsson, M.: A Scalable Sweep Algorithm for the cumu-
lative Constraint. In: Milano, M. (ed.) Principles and Practice of Constraint Pro-
gramming. LNCS, pp. 439–454. Springer, Heidelberg (2012)
12. Or-tools Team. or-tools: Google optimization tools (2015). https://developers.
google.com/optimization/
13. OscaR Team. OscaR: Scala in OR (2012). https://bitbucket.org/oscarlib/oscar
14. Ouellet, P., Quimper, C.-G.: Time-Table extended-edge-finding for the cumulative
constraint. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 562–577. Springer,
Heidelberg (2013)
15. Vilı́m, P.: Timetable edge finding filtering algorithm for discrete cumulative
resources. In: Achterberg, T., Beck, J.C. (eds.) CPAIOR 2011. LNCS, vol. 6697,
pp. 230–245. Springer, Heidelberg (2011)
General Bounding Mechanism for Constraint
Programs
1 Introduction
Constraint Programming (CP) is an efficient tool for complex decision problems
arising in industry, such as vehicle routing, scheduling, and resource allocation. CP
solvers essentially solve satisfiability problems, that is, they determine whether or
not there exists a solution to a given model. When applied to optimization prob-
lems, most CP solvers solve a sequence of satisfiability problems, requiring at each
step that the solution found improves on the solution found at the previous step.
The search stops when no feasible solution can be found, proving that the pre-
vious solution was indeed optimal. The ability to compute bounds on the objec-
tive function (the optimization criterion) is crucial. It allows faster termination
of the final subproblem (by proving infeasibility more quickly), and it speeds up
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 158–172, 2015.
DOI: 10.1007/978-3-319-23219-5 12
General Bounding Mechanism for Constraint Programs 159
the solution of all the subproblems (because filtering and pruning become possible
when a good bound on the objective is known). In all cases where CP has success-
fully solved optimization problems, the modeler had to implement good bounding
mechanisms. The lack of a good general-purpose bounding scheme is one of the
main drawbacks of CP in comparison with integer programming (IP).
In CP, the constraints are independent, and information is communicated
solely through the domain store, the set of possible remaining values for each
variable. During the search, each constraint looks at the domain store, determines
whether a solution still exists, and filters out pairs of variables and values that
no longer lead to feasible solutions. This decoupling of the problem in terms of
the independent constraints allows us to use a simple and efficient combinatorial
algorithm for each constraint. A similar concept is used in linear programming
(LP): Lagrangian decomposition (LD) relaxes the link between difficult sets of
constraints and introduces in the objective a penalty vector that acts as the glue
linking the remaining relatively simple subproblems. In CP, we observe that
there is no such glue for the constraints (or subproblems), making any default
bound computation very weak. If we look at CP through LD glasses, we see that
the relaxed constraints are actually a set of implicit constraints stating that
any given variable should have the same value in all the different constraints in
which it appears. Therefore, to apply LD techniques to a CP model, we must
penalize that different constraints assume the same variable can take different
values during search. Our goal is to develop a general bounding mechanism for
CP that is compatible with every CP model and transparent to the user.
This paper is organized as follows. The next section reviews related work on
decomposition techniques and CP, and Section 3 presents our general bounding
approach. Section 4 evaluates the method on two optimization problems: a) the
knapsack problem and b) the simple shift scheduling problem that can be mod-
eled as a combination of many regular constraints. Finally, Section 5 summarizes
our conclusions.
2 Related Work
We present here some background on LD and the global CP constraints investi-
gated in this paper.
problem. They introduce two linear substructures, and they dualize the first and
propagate the second. At convergence, they use the optimal dual information to
propagate the first substructure. Ouaja and Richards [15] embed LR and CP
into a branch-and-bound algorithm for the traffic placement problem. At each
node of the search tree, CP is used to find a solution if one exists and to prove
infeasibility otherwise, and LD indicates how close the solution is to optimality.
Benoist et al. [2] propose hybrid algorithms combining LR and CP for the trav-
eling tournament problem, which includes round-robin assignment and travel
optimization. They show that LR provides not only good bounds to limit the
search but also information to guide new solutions or efficient branching. Sell-
mann [19] investigates the theoretical foundations of CP-based LR and proves
that suboptimal Lagrangian multipliers can have stronger filtering abilities than
optimal ones.
A drawback of LR is that the problem loses its original structure since the
complicated constraints are removed from the constraint set and penalized in the
objective function. Moreover, the penalized constraints must generally be linear.
This seriously restricts the application of LR in the context of CP where most
global constraints have a nonlinear structure. For example, it is not easy to dual-
ize some popular global constraints such as the all-different, global cardinality,
and regular constraints. To overcome this restriction, Fontaine et al. [8] general-
ize LR to arbitrary high-level models using the notion of satisfiability (violation)
degree. In this method, a satisfiability degree (or violation degree) is defined for
each hard constraint and penalized in the objective function instead of in the
constraint itself. The results show that LR coupled with CP can efficiently solve
some classes of graph coloring problems.
Another way to avoid the penalization of nonlinear hard constraints is to
use LD. This was first introduced by Guignard and Kim [10]; it is also called
variable splitting. It creates “copies” of a set of variables responsible for connect-
ing important substructures in the model, using one copy per substructure and
dualizing the equality of a variable and its copy. Since the substructures of the
original problem are retained, LD provides bounds that are always at least as
tight as those from LR. The method is particularly useful if there are no apparent
complicating constraints or the complicating constraints have nonlinear forms.
The research on integrating LD into CP is limited. To the best of our knowl-
edge, only Cronholm and Ajili [5] have studied this. They propose a hybrid
algorithm for the multicast network design problem. Their approach enables the
propagation of all the substructures at every dual iteration and also provides
strong cost-based filtering. We continue their theme with our attempt to use LD
to construct an automatic bounding mechanism, thus making CP tools more effi-
cient for optimization problems. To do this, we consider each global constraint
in the CP model as a substructure, and we connect them through LD to pro-
vide valid bounds. These are used to prune the nodes in the search tree. We
investigate two global constraints: knapsack and regular constraints.
General Bounding Mechanism for Constraint Programs 161
n
Maximize pi xi (1)
i=1
n
subject to wij xi ≤ Cj j = 1, . . . , m (2)
i=1
xi ∈ {0, 1} (3)
where constraints (6) ensure that Cj is equal to pij if and only if Xj = i. This
specifies the profit of each assignment.
3 Proposed Approach
3.1 Lagrangian Decomposition
We first recall the LD approach. Consider the problem of computing max{z =
c x|C1 (x) ∧ C2 (x)}, where x is a set of variables, c is a set of coefficients, and
C1 (x) and C2 (x) are two arbitrary constraints. One can obtain a relaxation, i.e.,
an upper bound on the solution, as follows:
⏐ ⏐
⏐ ⏐
max z = c x⏐C1 (x) ∧ C2 (x) = max c x⏐C1 (x) ∧ C2 (y) ∧ x = y
⏐
⏐
= max c x + u (x − y)⏐C1 (x) ∧ C2 (y) ∧ x = y
⏐
⏐
≤ max c x + u (x − y)⏐C1 (x) ∧ C2 (y)
⏐ ⏐
⏐ ⏐
= max (c + u )x⏐C1 (x) + max −u y ⏐C2 (y)
1⏐ 1 i⏐ i
= max c + u(i) x ⏐C1 (x ) + max −u(i) x ⏐Ci (x )
i=2 i=2
164 M.H. Hà et al.
This decomposition works well for numeric variables, i.e., variables whose
domains contain scalars. In CP, we often encounter domains that contain non-
numeric values. For instance, the regular constraint described in Section 2.2
applies to variables whose domains are sets of characters. In most applications,
it makes no sense to multiply these characters with a Lagrangian multiplier. In
this situation, we do not apply the LD method to the original variables Xi but
instead to a set of binary variables xi,v ∈ {0, 1} where xi,v = 1 ⇐⇒ Xi = v.
Rather than having a Lagrangian multiplier for each variable Xi , we instead
have a multiplier for each binary variable xi,v .
Finding the optimal multipliers is the main challenge in optimizing LD since
it is nondifferentiable. There are several approaches; the most common is the
subgradient method (see Shor et al. [21]). Starting from an arbitrary value of
the multipliers u0 , it solves subproblems iteratively for different values of u.
These are updated as follows:
uk+1 = uk + tk (y k − xk ) (9)
layer j for 0 ≤ j ≤ n. Each node is labeled with a pair of integers: the layer
and the accumulated weight. At layer 0, we have a single node L0 = {(0, 0)}.
At layer j, we have Lj = {(j, k) | 1 ∈ dom(Xj ) ∧ (j − 1, k − wj ) ∈ Lj−1 ∨ 0 ∈
dom(Xj ) ∧ (j − 1, k) ∈ Lj−1 }. There is an edge labeled with value 1 between the
nodes (j − 1, k − wj ) and (j, k) whenever these nodes exist and an edge labeled
with value 0 between the nodes (j − 1, k) and (j, k) whenever these nodes exist.
Trick’s algorithm filters the graph by removing all the nodes and edges that do
not lie on a path connecting the node (0, 0) to a node (n, k) for 0 ≤ k ≤ C. After
the graph has been filtered, if no edges labeled with the value 1 remain between
layer j − 1 and layer j, this value is removed from the domain of xj . Similarly,
if no edges labeled with the value 0 remain between layer j − 1 and layer j, this
value is removed from the domain of xj .
We augment this algorithm by computing costs. We assign m to each edge
connecting node (j − 1, k − wj ) to node (j, k) a cost of cj + l=2 u(l, j) for the
graph representing the first constraint (i = 1), where cj is the value of item j
and m is the number of constraints; and a cost of −u(i, j) where i ≥ 2 is the
index of the constraint for the graph representing the remaining constraints. We
use dynamic programming to compute for each node (j, k) the cost of the longest
path connecting the source node (0, 0) to the node (j, k):
⎧
⎪
⎨0 if k = j = 0
M [j, k] = −∞ if k > j = 0
⎪
⎩
max(M [j − 1, k], M [j − 1, k − wj ] + addedCost) otherwise
m
where addedCost is equal to cj + l=2 u(l, j) if i = 1 and −u(i, j) if i > 1.
The optimal bound for this constraint is given by max0≤j≤W M [n, j]. Indeed,
any path in the filtered graph connecting the source node (0, 0) to a node
(n, k) for 0 ≤ k ≤ C corresponds to a valid assignment. The expression
max0≤j≤W M [n, j] returns the largest cost of such a path and therefore the
maximum cost associated with a solution of the knapsack constraint.
We proceed similarly with the regular constraint. Pesant [16] presents an algo-
rithm also based on a layered graph. The set Lj contains the nodes at layer
j for 0 ≤ j ≤ n. Each node is labeled with an integer representing the layer
and a state of the automaton. The first layer contains a single node, and we
have L0 = {(0, q0 )}. The other layers, for 1 ≤ j ≤ n, contain the nodes
Lj = {(j, q2 ) | (j − 1, q1 ) ∈ Lj−1 ∧ a ∈ dom(Xj ) ∧ (q1 , a, q2 ) ∈ τ }. An edge
is a triplet (n1 , n2 , a) where n1 and n2 are two nodes and a ∈ A is a label. Two
nodes can be connected to each other with multiple edges having distinct labels.
The set of edges is denoted E. There is an edge connecting node (j−1, q1 ) to node
(j, q2 ) with label a whenever these nodes exist and (q1 , a, q2 ) ∈ τ ∧ a ∈ dom(Xj )
holds. As with Trick’s algorithm, Pesant filters the graph by removing all nodes
166 M.H. Hà et al.
and edges that do not lie on a path connecting the source node (0, q0 ) to a node
(n, q) where q ∈ F is a final state. If no edges with label a connecting a node in
Lj−1 to a node in Lj remain, the value a is pruned from the domain dom(Xj ).
This filtering algorithm can be augmented by associating a cost with each
edge. We assume that there is a Lagrangian multiplier u(i, j, a) for each binary
variable xja representing the assignment of variable Xj to character a ∈ A.
Here, i ≥ 1 represents the index of the constraint. An edge (q1 , a, q2 ) has a cost of
m
paj + l=2 u(l, j, a) in the graph induced by the first constraint (i = 1), and a cost
of −u(i, j, a) in the graph induced by the remaining constraints (i > 1). Using
dynamic programming, we can compute the cost of the longest path connecting
node (0, q0 ) to a node (j, q):
0 if j = 0
R[j, q] =
max((j−1,q1 ),(j,q),a)∈E (R[j − 1, q1 ] + addedCost) otherwise
m
where addedCost is equal to paj + l=2 u(l, j, a) if i = 1 and −u(i, j, a) if i > 1.
Since every path from layer 0 to layer n in the graph corresponds to a valid
assignment for the regular constraint, the optimal bound for this constraint is
given by maxq∈F R[n, q], i.e., the greatest cost for a valid assignment.
4 Computational Results
This section reports some experimental results. The goal is not to present state-
of-the-art results for specific problems but to show that LD could make CP tools
General Bounding Mechanism for Constraint Programs 167
more efficient for optimization problems. The algorithms are built around CP
Optimizer 12.6 with depth-first search. All the other parameters of the solver
are set to their default values. The criteria used to evaluate the solutions are the
number of nodes in the search tree, the computational time, and the number of
instances successfully solved to optimality.
We investigate the behavior of the algorithms in two contexts: with and
without initial lower bounds. In case A, we provide the optimal solution to the
model by adding a constraint on the objective function, setting it to be at least
the value of the optimal solution; the goal is then to prove the optimality of
this value. In case B, we start the algorithms without an initial lower bound.
These two tests provide different insights, since the presence of different bound-
ing mechanisms will impact the search and branching decisions of the solver, with
unpredictable outcomes. However, once the solver has found the optimal solu-
tion, it must always perform a last search to demonstrate optimality. A better
bounding mechanism will always contribute to this phase of the overall search.
# CP CP + LD Trick Trick + LD
Instance Nodes
Vars Nodes Time Time Nodes Time Nodes
Time Nodes Time Nodes
Time Nodes Time Nodes
Time
Weing1 28 4424 1.19 3718 860 3.95 218 4424 6.19 715 1100 6.00 183
Weing2 28 5572 1.29 4319 744 3.07 242 5572 11.94 467 744 4.30 173
Weing3 28 8650 0.55 16k 270 0.97 278 8650 15.34 564 280 1.53 183
Weing4 28 4106 1.08 3802 538 2.62 205 4106 19.72 208 538 4.14 130
Weing5 28 13k 0.58 22k 262 1.00 262 12k 21.13 615 262 1.53 171
Weing6 28 9150 1.14 8026 876 3.59 244 9150 20.50 446 1012 4.83 210
Weing7 105 - - - 32k 3410.04 9 - - - - - -
Weing8 105 - - - 19k 147.98 128 - - - 19k 655.46 29
Weish1 30 35k 1.78 20k 1320 37.31 35 35k 910.82 38 1286 59.90 21
Weish2 30 40k 1.64 24k 1280 27.14 47 40k 2481.72 16 1384 57.47 24
Weish3 30 11k 0.83 13k 674 8.47 80 11k 669.01 16 760 24.35 31
Weish4 30 2342 0.80 2927 856 11.91 72 2342 186.47 13 826 29.68 28
Weish5 30 1614 0.90 1793 728 9.19 79 1614 149.78 11 644 23.74 27
Weish6 40 1.2M 12.56 96k 4286 369.13 12 - - - 3368 320.92 10
Weish7 40 901k 15.12 60k 3888 290.79 13 - - - 3482 352.67 10
Weish8 40 1.1M 19.74 56k 4004 256.00 16 - - - 3464 392.57 9
Weish9 40 144k 3.12 46k 2426 46.78 52 - - - 2212 191.83 12
Weish10 50 28M 589.20 48k 4486 264.40 17 - - - 3969 734.65 5
Weish11 50 6M 95.84 63k 3764 159.05 24 - - - 3764 595.38 6
Weish12 50 21M 355.78 59k 4738 307.37 15 - - - 3728 651.90 6
Weish13 50 20M 338.07 59k 4208 250.62 17 - - - 4374 908.53 5
Weish14 60 - - - 8424 645.04 13 - - - 8856 2472.92 4
Weish15 60 35M 720.98 49k 13k 1363.17 10 - - - 12k 3482.11 3
Weish16 60 - - - 14k 1216.45 12 - - - 13k 3324.81 4
Weish17 60 - - - 14k 1600.78 9 - - - - - -
Weish18 70 - - - - - - - - - - - -
Weish19 70 - - - 7750 667.02 12 - - - 8907 3174.07 3
Weish20 70 - - - 18k 2610.74 7 - - - - - -
Weish21 70 - - - 15k 1642.16 9 - - - - - -
Weish22 80 - - - 15k 2905.41 5 - - - - - -
Weish23 80 - - - 12k 2002.74 6 - - - - - -
Table 2 presents the results for case A. Here, the Lagrangian approaches
are even more efficient. The algorithms with LD can successfully solve all 38
instances, and the search tree is relatively small. The computational time of CP
+ LD is still worse than that of CP on a few small instances, but the difference
has decreased significantly. The main reason for this is that the optimal solutions
used to compute the step size make the subgradient procedure more stable and
cause it to converge more quickly. This observation suggests that adding good
lower bounds as soon as possible in the solution process will improve the method.
We computed at the root of the search tree the bound that the LD provides
as well as the bound returned by CPLEX using a linear relaxation (LP) and the
bound that CPLEX computes when the integer variables are not relaxed and all
cuts are added (ILP). Due to lack of space, we do not report the bounds for each
instance. In average, the bounds for LD, LP, and ILP are 1.03%, 0,79%, and 0.22%
greater than the optimal value. Even though LD does not provide the best bound,
it represents a significative improvement to CP whose bound is very weak.
General Bounding Mechanism for Constraint Programs 169
# CP CP + LD Trick Trick + LD
Instance Nodes
Vars Nodes Time Time Nodes Time Nodes
Time Nodes Time Nodes
Time Nodes Time Nodes
Time
Weing1 28 3408 0.21 16k 24 0.62 39 3408 5.25 649 24 0.78 31
Weing2 28 5070 0.21 24k 30 0.48 63 5070 16.36 310 30 0.74 41
Weing3 28 7004 0.55 13k 32 0.32 100 7004 11.78 595 34 0.42 81
Weing4 28 2344 0.14 17k 16 0.37 43 2344 10.45 224 16 0.81 20
Weing5 28 18k 0.33 55k 26 0.32 81 18k 35.30 510 26 0.56 46
Weing6 28 8038 0.22 37k 30 0.44 68 8038 27.62 291 30 0.80 38
Weing7 105 - - - 134 4 - - - 134 174.03 1
Weing8 105 - - - 168 3.54 47 - - - 520 40.95 13
Weish1 30 11k 0.27 41k 54 2.85 19 11k 447.18 25 70 5.72 12
Weish2 30 23k 0.43 53k 66 1.98 33 23k 1679.54 14 62 9.15 7
Weish3 30 8394 0.23 36k 38 2.80 14 8394 476.57 18 46 5.59 8
Weish4 30 632 0.14 4514 34 1.26 27 632 57.19 11 38 4.64 8
Weish5 30 556 0.12 4633 34 0.87 39 556 55.93 10 36 5.67 6
Weish6 40 861k 12.92 67k 56 5.54 10 - - - 72 16.58 4
Weish7 40 456k 7.07 64k 60 8.40 7 - - - 72 17.40 4
Weish8 40 707k 10.38 68k 60 9.05 7 - - - 54 19.52 3
Weish9 40 74k 1.26 59k 48 2.28 21 - - - 74 18.18 4
Weish10 50 8.6M 132.92 65k 134 29.53 5 - - - 192 51.11 4
Weish11 50 1.4M 22.75 62k 86 10.50 8 - - - 82 28.44 3
Weish12 50 9M 135.70 66k 114 24.92 5 - - - 122 38.23 3
Weish13 50 4.1M 60.90 67k 120 17.84 7 - - - 112 35.23 3
Weish14 60 - - - 104 27.97 4 - - - 330 123.89 3
Weish15 60 9.7M 173.65 56k 92 28.20 3 - - - 146 68.70 2
Weish16 60 - - - 128 37.95 3 - - - 450 192.18 2
Weish17 60 156M 3537.25 44k 90 34.36 3 - - - 176 115.41 1.5
Weish18 70 - - - 200 87.97 2 - - - 142 116.60 1.2
Weish19 70 - - - 200 86.98 2 - - - 320 228.97 1.4
Weish20 70 - - - 174 65.84 3 - - - 596 340.87 1.7
Weish21 70 - - - 134 48.17 3 - - - 354 225.53 1.6
Weish22 80 - - - 150 87.39 2 - - - 1068 1083.83 1.0
Weish23 80 - - - 158 83.39 1.9 - - - 177 350.55 0.5
Weish24 80 - - - 146 84.90 1.7 - - - 154 194.55 0.8
Weish25 80 - - - 238 117.47 2 - - - 586 539.24 1.1
Weish26 90 - - - 178 135.75 1.3 - - - 438 567.02 0.8
Weish27 90 - - - 152 94.48 1.6 - - - 258 356.33 0.7
Weish28 90 - - - 152 96.71 1.6 - - - 266 344.16 0.8
Weish29 90 - - - 152 104.87 1.4 - - - 416 601.38 0.7
Weish30 90 - - - 152 126.96 1.2 - - - 138 372.65 0.4
170 M.H. Hà et al.
Pesant Pesant + LD
Instance
Nodes Time Nodes
Time Nodes Time
Nodes
Time
10-20-01 2.2M 1232.72 1785 156k 346.92 450
10-20-02 - - - 298k 741.35 402
10-20-03 1.6M 783.29 2043 158k 332.15 476
Pesant Pesant + LD
Instance
Nodes Time Nodes Nodes
Time Nodes Time Time
10-20-01 87k 42.20 2062 2564 5.94 432
10-20-02 407k 342.43 1189 44k 108.30 406
10-20-03 71k 28.60 2483 4118 7.48 551
i is the instance number. Because SSP instances are more difficult than MKP
instances, the computational time is increased to 2 hours.
The experiment investigates the performance of LD when combined with the
method of Pesant [16] for the SSP. As for the MKP, we test two cases: case A
has initial lower bounds and case B does not. Tables 3 and 4 present the results,
which demonstrate the performance of our approach. The LD method clearly
improves the method of Pesant [16] for all three criteria. More precisely, for case
B, it can solve 6 additional instances, reducing the size of the search tree by a
factor of about 7 and the computational time by a factor of 1.5 on average. In
case A, it works even better, reducing the size of the search tree by a factor of
about 16 and the computational time by a factor of more than 4 on average.
General Bounding Mechanism for Constraint Programs 171
This is because we can reuse the graph constructed by the filtering algorithm to
solve the Lagrangian subproblems.
References
1. Beasley, J.E.: OR-library (2012). http://people.brunel.ac.uk/∼mastjjb/jeb/info.
html
2. Benoist, T., Laburthe, F., Rottembourg, B.: Lagrange relaxation and constraint
programming collaborative schemes for travelling tournament problems. In: CP-
AI-OR 2001, pp. 15–26. Wye College (2001)
3. Chapados, N., Joliveau, M., L’Ecuyer, P., Rousseau, L.-M.: Retail store schedul-
ing for profit. European Journal of Operational Research 239(3), 609–624 (2014).
doi:10.1016/j.ejor.2014.05.033
4. Côté, M.-C., Gendron, B., Quimper, C.-G., Rousseau, L.-M.: Formal languages for
integer programming modeling of shift scheduling problems. Constraints 16(1),
54–76 (2011). doi:10.1007/s10601-009-9083-2
5. Cronholm, W., Ajili, F.: Strong cost-based filtering for lagrange decomposition
applied to network design. In: Wallace, M. (ed.) CP 2004. LNCS, vol. 3258,
pp. 726–730. Springer, Heidelberg (2004). http://www.springerlink.com/index/
ur3uvyqbp0216btd.pdf
6. Demassey, S., Pesant, G., Rousseau, L.-M.: A cost-regular based hybrid column
generation approach. Constraints 11(4), 315–333 (2006). http://dblp.uni-trier.de/
db/journals/constraints/constraints11.html#DemasseyPR06
172 M.H. Hà et al.
7. Fahle, T., Sellmann, M.: Cost based filtering for the constrained knapsack problem.
Annals of OR 115(1–4), 73–93 (2002). doi:10.1023/A:1021193019522
8. Fontaine, D., Michel, L.D., Van Hentenryck, P.: Constraint-based lagrangian relax-
ation. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 324–339. Springer,
Heidelberg (2014)
9. Guignard, M.: Lagrangean relaxation. Top 11(2), 151–200 (2003). doi:10.1007/
BF02579036. ISSN: 1134–5764
10. Guignard, M., Kim, S.: Lagrangean decomposition: A model yielding stronger
Lagrangean bounds. Mathematical Programming 39(2), 215–228 (1987). doi:10.
1007/BF02592954. ISSN: 00255610
11. Katriel, I., Sellmann, M., Upfal, E., Van Hentenryck, P.: Propagating knapsack
constraints in sublinear time. In: Proceedings of the Twenty-Second AAAI Confer-
ence on Artificial Intelligence, Vancouver, British Columbia, Canada, July 22–26,
pp. 231–236 (2007). http://www.aaai.org/Library/AAAI/2007/aaai07-035.php
12. Kellerer, H., Pferschy, U., Pisinger, D.: Knapsack Problems. Springer, Berlin (2004)
13. Malitsky, Y., Sellmann, M., Szymanek, R.: Filtering bounded knapsack constraints
in expected sublinear time. In: Proceedings of the Twenty-Fourth AAAI Conference
on Artificial Intelligence, AAAI 2010, Atlanta, Georgia, USA, July 11–15, 2010.
http://www.aaai.org/ocs/index.php/AAAI/AAAI10/paper/view/1855
14. Menana, J., Demassey, S.: Sequencing and counting with the multicost-regular
constraint. In: van Hoeve, W.-J., Hooker, J.N. (eds.) CPAIOR 2009. LNCS, vol.
5547, pp. 178–192. Springer, Heidelberg (2009). doi:10.1007/978-3-642-01929-6 14.
ISBN: 3642019285
15. Ouaja, W., Richards, B.: A hybrid multicommodity routing algorithm for traf-
fic engineering. Networks 43(3), 125–140 (2004). http://dblp.uni-trier.de/db/
journals/networks/networks43.html#OuajaR04
16. Pesant, G.: A regular language membership constraint for finite sequences of vari-
ables. In: Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 482–495. Springer,
Heidelberg (2004). http://www.springerlink.com/content/ed24kyhg561jjthj
17. Quimper, C.-G., Rousseau, L.-M.: A large neighbourhood search approach to the
multi-activity shift scheduling problem. J. Heuristics 16(3), 373–392 (2010). doi:10.
1007/s10732-009-9106-6
18. Sellmann, M.: Approximated consistency for knapsack constraints. In: Rossi, F.
(ed.) CP 2003. LNCS, vol. 2833, pp. 679–693. Springer, Heidelberg (2003). doi:10.
1007/978-3-540-45193-8 46
19. Sellmann, M.: Theoretical foundations of CP-based lagrangian relaxation. In: Wal-
lace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 634–647. Springer, Heidelberg (2004).
http://dblp.uni-trier.de/db/conf/cp/cp/2004.html#sellmann.ISBN:3-540-23241-9
20. Sellmann, M., Fahle, T.: Constraint programming based Lagrangian relaxation
for the automatic recording problem. Annals of Operations Research 118, 17–33
(2003). doi:10.1023/A:1021845304798. ISBN: 0254-5330
21. Shor, N.Z., Kiwiel, K.C., Ruszcayński, A., Ruszcayński, A.: Minimization methods
for non-differentiable functions. Springer-Verlag New York Inc., New York (1985).
ISBN: 0-387-12763-1
22. Trick, M.A.: A dynamic programming approach for consistency and prop-
agation for knapsack constraints. Annals of OR 118(1–4), 73–84 (2003).
http://dblp.uni-trier.de/db/journals/anor/anor118.html#Trick03
23. van Hoeve, W.J., Pesant, G., Rousseau, L.-M.: On global warming: Flow-
based soft global constraints. J. Heuristics 12(4–5), 347–373 (2006). doi:10.1007/
s10732-006-6550-4
Smallest MUS Extraction
with Minimal Hitting Set Dualization
1 Introduction
This paper shows how recent work on iterative enumeration of hitting sets can
be adapted to computing the smallest MUS of unsatisfiable formulae, improving
upon state-of-the-art algorithms. The approach is implemented and tested on
Boolean Satisfiability instances, but the technique applies equally well to com-
puting SMUSes of any constraint system for which the satisfiability of all subsets
is well-defined.
The paper is organized as follows. In Section 2 basic definitions are provided.
Section 3 introduces an algorithm for the extraction of an SMUS. In Section 4
some optimizations are presented. Finally, Section 5 is dedicated to the presen-
tation of the experimental results, and Section 6 concludes the paper.
2 Preliminaries
This section provides common definitions that will be used throughout the paper.
Additional standard definitions are assumed (e.g. see [3]). In what follows, F
denotes a propositional formula expressed in Conjunctive Normal Form (CNF).
A formula in CNF is a conjunction of clauses, where each clause is a disjunction
of literals. A literal is either a Boolean variable or its complement. Also, we may
refer to formulae as sets of clauses and clauses as sets of literals. An assignment
to variables that satisfies formula F is said to be a model of F. A formula is
unsatisfiable when no model exists. Unless specified explicitly, F is assumed to
be unsatisfiable. The following definitions also apply.
Definition 1. A subset U ⊆ F is a minimal unsatisfiable subset (MUS) if U is
unsatisfiable and ∀U ⊂ U, U is satisfiable. An MUS U of F of the smallest size
is called a smallest MUS (SMUS).
Definition 2. A subset C of F is a minimal correction subset (MCS) if F \ C
is satisfiable and ∀C ⊆ C ∧ C = ∅, (F \ C) ∪ C is unsatisfiable.
Definition 3. A satisfiable subset S ⊆ F is a maximal satisfiable subset (MSS)
if ∀S ⊆ F s.t. S ⊂ S , S is unsatisfiable.
An MSS can also be defined as the complement of an MCS (and vice versa).
If C is an MCS, then S = F \ C represents an MSS. On the other hand, MUSes
and MCSes are related by the concept of minimal hitting set.
Definition 4. Given a collection Γ of sets from a universe U, a hitting set h
for Γ is a set such that ∀S ∈ Γ, h ∩ S = ∅.
A hitting set h is minimal if none of its subset is a hitting set. The minimal
hitting set duality between MUSes and MCSes is well-known (e.g. see [15,17]):
Proposition 1. Given a CNF formula F, let MUSes(F) and MCSes(F) be the
set of all MUSes and MCSes of F, respectively. Then the following holds:
1. A subset U of F is an MUS iff U is a minimal hitting set of MCSes(F).
2. A subset C of F is an MCS iff C is a minimal hitting set of MUSes(F).
The duality relating MUSes and MCSes is a key aspect of the algorithm
presented below. In the next section, we will describe how the smallest MUS can
be computed by exploiting this observation.
Smallest MUS Extraction with Minimal Hitting Set Dualization 175
3 Basic Algorithm
This section describes the new SMUS algorithm. We start by providing the
definition of a minimum size hitting set:
Definition 5. Let Γ be a collection of sets and MHS(Γ ) the set of all minimal
hitting sets on Γ . Then a hitting set h ∈ M HS(Γ ) is said to be a minimum
hitting set if ∀ h ∈ M HS(Γ ) we have that |h| ≤ |h |.
c1 = ¬s c2 = s ∨ ¬p c3 = p
c5 = ¬m ∨ n c6 = ¬n
c4 = ¬p ∨ m
c7 = ¬m ∨ l
c8 = ¬l
it is a minimum hitting set for K ⊆ MCSes(F) and no other added MCS can
make it grow in size. Moreover, all the other hitting sets can either grow in size
or remain the same. Thus, by Proposition 2 U must be an SMUS.
Lemma 1 states that it is not necessary to enumerate all MCSes of formula F.
Instead, it is enough to compute only those whose minimum hitting set is an
MUS. Therefore, Algorithm 1 terminates once the first MUS is computed, which
is by construction guaranteed to be of the smallest size.
It is worth noting that nothing in Algorithm 1 is specific to Boolean CNF,
and in fact the algorithm can be applied to any type of constraint system for
which the satisfiability of constraint subsets can be checked. The algorithm and
all following additions to it are constraint agnostic.
An example of a run of Algorithm 1 is shown in Table 1 (Figure 1 illustrates
the input formula). The first column contains the formula F induced by the
minimum hitting set on H. Whenever F is satisfiable (second column), the grow
procedure (see line 9 of Algorithm 1) returns an MCS (third column). The last
Smallest MUS Extraction with Minimal Hitting Set Dualization 177
column shows the current H, the collected set of MCSes from which a minimum
hitting set will be found in the next iteration. In the last row, F = {c1 , c2 , c3 }
and since the call SAT(F ) returns false, set {c1 , c2 , c3 } represents an SMUS.
Notice that MinimumHS(H) could have returned {c3 , c4 , c5 } instead of {c1 , c2 , c3 }.
In this case, further iterations would be necessary in order to find an SMUS.
4 Additional Details
This section describes some essential details of the approach being proposed.
These include computing a minimum hitting set with at most one SAT call,
enumerating disjoint MCSes, and reporting an upper bound within a reasonably
short time.
Our approach based on the minimum hitting set duality [15,17] between
MCSes and MUSes of an unsatisfiable CNF formula F can also make use of dis-
joint MCSes. Indeed, since each MCS must be hit by any MUS of a CNF formula,
disjoint MCSes must be hit by the smallest MUS of the formula. Therefore, given
a set of disjoint MCSes D, one can initialize set H with D instead of the empty
set (see line 2 of Algorithm 1) in order to boost the performance of Algorithm 1.
Note that this also simplifies the computation of the first minimum hitting set,
which for a set of disjoint MCSes of size k is exactly of size k. According to the
experimental results described in Section 5, this improvement has a huge impact
on the overall performance of the proposed approach.
Although the approach being proposed performs better than the known alter-
native approaches to SMUS, this problem is computationally much harder than
extracting any MUS of a CNF formula (the decision version of the SMUS problem
is known to be Σ2P -complete, e.g. see [8,12]). One may find this complexity char-
acterization a serious obstacle for using SMUS algorithms in practice. Indeed, a
user may prefer to find an MUS close to the smallest size within a reasonable
amount of time instead of waiting until the smallest MUS is found.
In order to resolve this issue and following the ideas of [10], Algorithm 1
can be extended for computing a “good” upper bound on the exact solution of
the SMUS problem. Any MUS can be considered as an upper bound on the
smallest MUS. Therefore and since extracting one MUS is a relatively simple
task, enumerating MUSes within a given time limit and choosing the smallest
one among them can be satisfactory for a user. MUS enumeration can be done in
a way similar to the one proposed in [14]. Observe that Algorithm 1 iteratively
refines a lower bound of the SMUS, and so can serve to measure the quality of
approximate upper bounds.
This pragmatic policy of computing an upper bound before computing the
exact solution provides a user with a temporary approximate answer within a
short period of time and continues with computing the exact solution, if needed
(i.e. if the user is not satisfied with the quality of the upper bound). Otherwise,
the upper bound is enough and the user can stop the process.
5 Experimental Results
This section evaluates the approach to the smallest MUS problem proposed
in this paper. The experiments were performed in Ubuntu Linux on an Intel
Xeon E5-2630 2.60GHz processor with 64GByte of memory. The time limit was
set to 800s and the memory limit to 10GByte. The approach proposed above was
implemented in a prototype called forqes (FORmula QuintESsence extractor ).
The underlying SAT solver of forqes is Glucose 3.01 [1]. A weakened version
1
Available from http://www.labri.fr/perso/lsimon/glucose/
Smallest MUS Extraction with Minimal Hitting Set Dualization 179
800
vbs
700 forqes
minuc
600
digger
500 forqes-w
CPU time (s)
400
300
200
100
0
300 350 400 450 500
instances
Fig. 2. Cactus plot showing the performance of forqes, minuc, and digger
of forqes, which does not use disjoint MCS enumeration and implements Algo-
rithm 1, is referred to as forqes-w.
The performance of forqes was compared to the state-of-the-art approach
to the SMUS problem that uses the quantified MaxSAT formulation of SMUS [9].
The most efficient version of the tool described in [9] performs core-guided
QMaxSAT solving; in the following it is referred to as minuc. Additionally,
a well-known branch-and-bound SMUS extractor called digger (see [13]) was
also considered. Note that the versions of minuc and digger participating in
the evaluation make use of disjoint MCS enumeration.
Several sets of benchmarks were used to assess the efficiency of the new algo-
rithm, all used in the evaluation in [9] as well. This includes a collection of
instances from automotive product configuration benchmarks [18] and two sets
of circuit diagnosis instances. Additionally, we selected instances from the com-
plete set of the MUS competitions benchmarks2 as follows. Because extracting a
smallest MUS of a CNF formula is computationally much harder than extracting
any MUS of the formula, the instances that are difficult for a state-of-the-art
MUS extractor were excluded. Instead, we considered only formulae solvable by
the known MUS extractor muser-2 (e.g. see [2]) within 10 seconds. The total
number of instances considered in the evaluation is 682.
Figure 2 shows a cactus plot illustrating the performance of the tested solvers
on the total set of instances. forqes exhibits the best performance, being able
to solve 483 instances. minuc comes second with 448 instances solved. Thus,
forqes solves 7.8% more instances than minuc. digger and forqes-w have
almost the same performance solving 371 and 367 instances, respectively.
2
See http://www.satcompetition.org/2011/
180 A. Ignatiev et al.
103 103
800 sec. timeout 800 sec. timeout
102 102
101 101
digger
minuc
100 100
10−1 10−1
10−3 −3 10−3 −3
10 10−2 10−1 100 101 102 103 10 10−2 10−1 100 101 102 103
forqes forqes
More details on the solvers’ performance can be found in Figure 3a, Figure 3b,
and Figure 4a. Also note that the virtual best solver (vbs) among all the con-
sidered solvers is able to solve 485 instances, which is only 2 more than what
forqes can solve on its own. Interestingly, neither minuc nor digger contribute
to the vbs. Although the weakened version of forqes (forqes-w) performs
quite poorly, it is the only solver (besides the normal version of forqes) that
contributes to the vbs. This can be also seen in Figure 4a.
As it was described in Section 4.3, the approach being proposed can report
an upper bound, which can be used as an approximation of the SMUS if finding
the exact solution is not efficient and requires too much time. The following
evaluates the quality of the upper bound reported by this pragmatic solving
strategy. Given an upper bound U B computed within some time limit and the
optimal value opt ≤ U B, the closer value Uopt B
is to 1 the better the quality of
U B is. Since it is often hard to find the exact optimal value, one can consider
a lower bound on the exact solution instead of the optimal value in order to
estimate the quality of the upper bound. Indeed, any set of disjoint MCSes found
within a given timeout can be seen as a lower bound on the exact solution.
Given a CNF formula, an upper bound on its smallest MUS reported by
forqes within a time limit is computed with an external call to a known MUS
enumerator called marco [14]. Several timeout values were tested, namely 5,
10, and 20 seconds. Figure 4b shows a cactus plot illustrating the quality of the
upper bounds computed this way. It is not surprising that generally the more
time is given to the solver, the better upper bound is computed. For about 400
instances, value U B
LB is extremely close to 1 meaning that the upper bound is
usually almost equal to the lower bound. As one can see, the upper bound is
less than an order of magnitude larger than the lower bound for about 550, 585,
and 620 instances if computed within 5, 10, and 20 seconds, respectively. Also
Smallest MUS Extraction with Minimal Hitting Set Dualization 181
103 103
800 sec. timeout
t = 20s
2
t = 10s
10
t = 5s
100
10−1 101
10−3 −3 100
10 10−2 10−1 100 101 102 103 400 450 500 550 600 650
forqes instances
note that both lower and upper bounds are relatively easy to compute, e.g. both
of them can be computed almost for 650 instances (out of 682). Moreover, they
give an idea of how large the interval is between them. Given this information,
a user can decide how critical it is to compute the exact solution.
In summary, the experimental results indicate that the proposed approach
pushes the state of the art in SMUS solving, outperforming all the previous
approaches in terms of the number of solved instances. Moreover, the scatter
plots indicate that in most of the cases the proposed approach is also the fastest
in comparison to others. Moreover, a pragmatic policy to report an upper bound
within a short period of time can be helpful when it is hard to compute the exact
solution and provide a user with an approximate solution of the SMUS problem
of reasonable size.
6 Conclusion
This paper adapts recent algorithms for implicit set problems [4,6,11,19] to the
case of computing the smallest MUS. A number of enhancements are developed
and added to the new algorithm. Experimental results, obtained on represen-
tative problems instances, show clear gains over what currently represents the
state of the art. A natural line of research is to apply the novel SMUS algorithm
in concrete practical applications of SMUSes, e.g. finding smallest equivalent
subformulae of smallest size.
182 A. Ignatiev et al.
References
1. Audemard, G., Lagniez, J.-M., Simon, L.: Improving glucose for incremental
SAT solving with assumptions: application to MUS extraction. In: Järvisalo, M.,
Van Gelder, A. (eds.) SAT 2013. LNCS, vol. 7962, pp. 309–317. Springer,
Heidelberg (2013)
2. Belov, A., Lynce, I., Marques-Silva, J.: Towards efficient MUS extraction. AI Com-
mun. 25(2), 97–116 (2012)
3. Biere, A., Heule, M., van Maaren, H., Walsh, T. (eds.): Handbook of Satisfiability.
Frontiers in Artificial Intelligence and Applications, vol. 185. IOS Press (2009)
4. Chandrasekaran, K., Karp, R.M., Moreno-Centeno, E., Vempala, S.: Algorithms
for implicit hitting set problems. In: SODA, pp. 614–629 (2011)
5. Cimatti, A., Griggio, A., Schaafsma, B.J., Sebastiani, R.: A modular approach
to MaxSAT modulo theories. In: Järvisalo, M., Van Gelder, A. (eds.) SAT 2013.
LNCS, vol. 7962, pp. 150–165. Springer, Heidelberg (2013)
6. Davies, J., Bacchus, F.: Solving MAXSAT by solving a sequence of simpler SAT
instances. In: Lee, J. (ed.) CP 2011. LNCS, vol. 6876, pp. 225–239. Springer,
Heidelberg (2011)
7. Davies, J., Bacchus, F.: Exploiting the power of mip solvers in maxsat. In:
Järvisalo, M., Van Gelder, A. (eds.) SAT 2013. LNCS, vol. 7962, pp. 166–181.
Springer, Heidelberg (2013)
8. Gupta, A.: Learning Abstractions for Model Checking. PhD thesis, Carnegie Mel-
lon University, June 2006
9. Ignatiev, A., Janota, M., Marques-Silva, J.: Quantified maximum satisfiability: a
core-guided approach. In: Järvisalo, M., Van Gelder, A. (eds.) SAT 2013. LNCS,
vol. 7962, pp. 250–266. Springer, Heidelberg (2013)
10. Ignatiev, A., Janota, M., Marques-Silva, J.: Towards efficient optimization in pack-
age management systems. In: ICSE, pp. 745–755 (2014)
11. Karp, R.M.: Implicit hitting set problems and multi-genome alignment. In: Amir,
A., Parida, L. (eds.) CPM 2010. LNCS, vol. 6129, pp. 151–151. Springer, Heidelberg
(2010)
12. Liberatore, P.: Redundancy in logic I: CNF propositional formulae. Artif. Intell.
163(2), 203–232 (2005)
13. Liffiton, M.H., Mneimneh, M.N., Lynce, I., Andraus, Z.S., Marques-Silva, J.,
Sakallah, K.A.: A branch and bound algorithm for extracting smallest minimal
unsatisfiable subformulas. Constraints 14(4), 415–442 (2009)
14. Liffiton, M.H., Previti, A., Malik, A., Marques-Silva, J.: Fast, flexible MUS enu-
meration. Constraints (2015). http://dx.doi.org/10.1007/s10601-015-9183-0
15. Liffiton, M.H., Sakallah, K.A.: Algorithms for computing minimal unsatisfiable
subsets of constraints. J. Autom. Reasoning 40(1), 1–33 (2008)
16. Marques-Silva, J., Planes, J.: Algorithms for maximum satisfiability using unsat-
isfiable cores. In: DATE, pp. 408–413 (2008)
17. Reiter, R.: A theory of diagnosis from first principles. Artif. Intell. 32(1), 57–95
(1987)
18. Sinz, C., Kaiser, A., Küchlin, W.: Formal methods for the validation of automotive
product configuration data. AI EDAM 17(1), 75–97 (2003)
19. Stern, R.T., Kalech, M., Feldman, A., Provan, G.M.: Exploring the duality in
conflict-directed model-based diagnosis. In: AAAI, pp. 828–834 (2012)
Upper and Lower Bounds on the Time
Complexity of Infinite-Domain CSPs
1 Introduction
complexity in the number of variables. Historically, this has been the most com-
mon way of measuring time complexity. One reason is that an instance may be
massively larger than the number of variables — a SAT instance with n variables
may contain up to 22n distinct clauses if repeated literals are disallowed — and
measuring in the instance size may give far too optimistic figures, especially since
naturally appearing test examples tend to contain a moderate number of con-
straints. Another reason is that in the finite-domain case, the size of the search
space is very closely related to the number of variables. We show that one can
reason in a similar way when it comes to the complexity of many infinite-domain
CSPs.
The relations in finite-domain CSPs are easy to represent by simply listing
the allowed tuples. When considering infinite-domain CSPs, the relations need to
be implicitly represented. A natural way is to consider disjunctive formulas over
a finite set of basic relations. Let B denote some finite set of basic relations such
that CSP(B) is tractable. Let B ∨∞ denote the closure of B under disjunctions,
and let B ∨k be the subset of B ∨∞ containing only disjunctions of length at
most k. Consider the following example: let D = {true, f alse} and let B =
{B1 , B2 } where B1 = {true} and B2 = {f alse}. It is easy to see that CSP(B ∨∞ )
corresponds to the Boolean SAT problem while CSP(B ∨k ) corresponds to the
k-SAT problem.
CSPs in certain applications such as AI are often based on binary basic rela-
tions and unions of them (instead of free disjunctive formulas). Clearly, such
relations are a subset of the relations in B ∨k and we let B ∨= denote this set
of relations. We do not explicitly bound the length of disjunctions since they
are bounded by |B|. The literature on such CSPs is voluminous and we refer
the reader to Renz and Nebel [29] for an introduction. The languages B ∨∞ and
B ∨k have been studied to a smaller extent in the literature. There are both
works studying disjunctive constraints from a general point of view [9,11] and
application-oriented studies; examples include temporal reasoning [19,31], inter-
active graphics [27], rule-based reasoning [25], and set constraints (with applica-
tions in descriptive logics) [4]. We also note (see Section 2.2 for details) that there
is a connection to constraint languages containing first-order definable relations.
Assume Γ is a finite constraint language containing relations that are first-order
definable in B, and that the first order theory of B admits quantifier elimina-
tion. Then, upper bounds on CSP(Γ ) can be inferred from results such as those
that will be presented in Sections 3 and 4. This indicates that studying the time
complexity of CSP(B ∨∞ ) is worthwhile, especially since our understanding of
first-order definable constraint languages is rapidly increasing [3].
To solve infinite-domain CSPs, backtracking algorithms are usually employed.
Unfortunately, such algorithms can be highly inefficient in the worst case. Let
p denote the maximum arity of the relations in B, let m = |B|, and let |V |
denote the number of variables in a given CSP instance. We show (in Section 3.1)
m·|V |p
·log(m·|V |p )
that the time complexity ranges from O(22 · poly(||I||)) (which
is doubly exponential with respect to the number of variables) for CSP(B ∨∞ )
m p
to O(22 ·|V | ·log m · poly(||I||)) time for B ∨= (and the markedly better bound
Upper and Lower Bounds on the Time Complexity of Infinite-Domain CSPs 185
p
of O(2|V | log m · poly(||I||)) if B consists of pairwise disjoint relations.) The use
of heuristics can probably improve these figures in some cases, but we have
not been able to find such results in the literature and it is not obvious how
to analyse backtracking combined with heuristics. At this stage, we are mostly
interested in obtaining a baseline: we need to know the performance of simple
algorithms before we start studying more sophisticated ones. However, some of
these bounds can be improved by combining backtracking search with methods
for reducing the number of constraints. We demonstrate this with sparsifica-
tion [18] in Section 3.2.
In Section 4 we switch strategy and show that disjunctive CSP problems can
be solved significantly more efficiently via a method we call structure enumera-
tion. This method is inspired by the enumerative method for solving finite-domain
p
CSPs. With this algorithm, we obtain the upper bound O(2|V | ·m · poly(||I||)) for
∨∞
CSP(B ). If we additionally assume that B is jointly exhaustive and pairwise dis-
p
joint then the running time is improved further to O(2|V | ·log m · poly(||I||)). This
bound beats or equals every bound presented in Section 3. We then proceed to
show even better bounds for certain choices of B. In Section 4.2 we consider equal-
ity constraint languages over a countably infinite domain and show that such CSP
problems are solvable in O(|V |B|V | · poly(||I||) time, where B|V | is the |V |-th Bell
number. In Section 4.3 we focus on three well-known temporal reasoning problems
and obtain significantly improved running times.
We tackle the problem of determining lower bounds for CSP(B ∨∞ ) in
Section 5, i.e. identifying functions f such that no algorithm for CSP(B ∨∞ )
has a better running time than O(f (|V |)). We accomplish this by relating CSP
problems and certain complexity-theoretical conjectures, and obtain strong lower
bounds for the majority of the problems considered in Section 4. As an exam-
ple, we show that the temporal CSP({<, >, =}∨∞ ) problem is solvable in time
O(2|V | log |V | ·poly(||I||)) but, assuming a conjecture known as the strong exponen-
tial time hypothesis (SETH), not solvable in O(c|V | ) time for any c > 1. Hence,
even though the algorithms we present are rather straightforward, there is, in
many cases, very little room for improvement, unless the SETH fails.
2 Preliminaries
We begin by defining the constraint satisfaction problem and continue by dis-
cussing first-order definable relations.
R1 , . . . , Rm are JEPD. Then there exists a k such that (1) CSP(Γ ) is polynomial-
time reducible to CSP({R1 , . . . , Rm }∨k ) and (2) if CSP({R1 , . . . , Rm }∨k ) is solvable
in O(f (|V |)·poly(||I||)) time then CSP(Γ ) is solvable in O(f (|V |)·poly(||I||)) time.
As we will see in Section 4, this result is useful since we can use upper
bounds for CSP(B ∨k ) to derive upper bounds for CSP(Γ ), where Γ consists
of first-order definable relations over B. There is a large number of structures
admitting quantifier elimination and interesting examples are presented in every
standard textbook on model theory, cf. Hodges [15]. A selection of problems that
are highly relevant for computer science and AI are discussed in Bodirsky [3].
3 Fundamental Algorithms
In this section we investigate the complexity of algorithms for CSP(B ∨∞ ) and
CSP(B ∨k ) based on branching on the disjuncts in constraints (Section 3.1) and
the sparsification method (Section 3.2.) Throughout this section we assume that
B is a set of basic relations such that CSP(B) is in P.
time by enumerating all possible choices of one disjunct out of every disjunctive
constraint. The satisfiability of the resulting sets of constraints can be checked
in polynomial time due to our initial assumptions. How does such an enumer-
ative approach compare to a branching search algorithm? In the worst case,
188 P. Jonsson and V. Lagerkvist
a branching algorithm without heuristic aid will go through all of these cases so
the bound above is valid for such algorithms. Analyzing the time complexity of
branching algorithms equipped with powerful heuristics is a very different (and
presumably very difficult) problem.
Assume instead that we have an instance I of CSP(B ∨k ) with variable
set V . There are at most m · |V |p different disjuncts which leads to at most
k p i p k
i=0 (m|V | ) ≤ k · (m|V | ) distinct constraints. We can thus solve instances
k·(m|V |p )k p k
with |V | variables in O(k · poly(||I||)) = O(2k·log k·(m|V | ) · poly(||I||))
time.
Finally, let I be an instance of CSP(B ∨= ) with variable set V . It is not hard to
see that I contains at most 2m · |V |p distinct constraints, where each constraint
has length at most m. Non-deterministic guessing gives that instances of this
kind can be solved in
m
·|V |p m
·|V |p ·log m
O(m2 · poly(||I||)) = O(22 · poly(||I||))
time. This may appear to be surprisingly slow but this is mainly due to the
fact that we have not imposed any additional restrictions on the set B of basic
relations. Hence, assume that the relations in B are PD. Given two relations
R1 , R2 ∈ B ∨= , it is now clear that R1 ∩ R2 is a relation in B ∨= , i.e. B ∨=
is closed under intersection. Let I = (V, C) be an instance of CSP(B ∨= ). For
any sequence of variables (x1 , . . . , xp ), we can assume that there is at most
one constraint R(x1 , . . . , xp ) in C. This implies that we can solve CSP(B ∨= ) in
p p
O(m|V | · poly(||I||)) = O(2|V | log m · poly(||I||)) time. Combining everything so
far we obtain the following upper bounds.
Lemma 3. Let B be a set of basic relations with maximum arity p and let m =
|B|. Then
m·|V |p p
– CSP(B ∨∞ ) is solvable in O(22 ·log(m·|V | )
· poly(||I||)) time,
∨k k·log k·(m|V |p )k
– CSP(B ) is solvable in O(2 · poly(||I||)) time,
m p
– CSP(B ∨= ) is solvable in O(22 ·|V | ·log m · poly(||I||)) time, and
∨= |V |p log m
– CSP(B ) is solvable in O(2 · poly(||I||)) time if B is PD.
A bit of fine-tuning is often needed when applying highly general results like
Lemma 3 to concrete problems. For instance, Renz and Nebel [29] show that
|V |2
the RCC-8 problem can be solved in O(c 2 ) for some (unknown) c > 1. This
problem can be viewed as CSP(B ∨= ) where B contains JEPD binary relations
2
and |B| = 8. Lemma 3 implies that CSP(B ∨= ) can be solved in O(23|V | ) which
is significantly slower if c < 82 . However, it is well known that B is closed under
converse. Let I = ({x1 , . . . , xn }, C) be an instance of CSP(B ∨= ). Since B is
closed under converse, we can always assume that if R(xi , xj ) ∈ C, then i ≤ j.
|V |2 |V |2
Thus, we can solve CSP(B ∨= ) in O(m 2 ·poly(||I||)) = O(2 2 log m ·poly(||I||))
time. This figure matches the bound by Renz and Nebel better when c is small.
Upper and Lower Bounds on the Time Complexity of Infinite-Domain CSPs 189
3.2 Sparsification
The complexity of the algorithms proposed in Section 3 is dominated by the
number of constraints. An idea for improving these running times is therefore
to reduce the number of constraints within instances. One way of accomplishing
this is by using sparsification [18]. Before presenting this method, we need a
few additional definitions. An instance of the k-Hitting Set problem consists of
a finite set U (the universe) and a collection C = {S1 , . . . , Sm } where Si ⊆ U
and |Si | ≤ k, 1 ≤ i ≤ m. A hitting set for C is a set C ⊆ U such that C ∩ Si = ∅
for each Si ∈ C. Let σ(C) be the set of all hitting sets of C. The k-Hitting Set
problem is to find a minimal size hitting set. T is a restriction of C if for each
S ∈ C there is a T ∈ T with T ⊆ S. If T is a restriction of C, then σ(T ) ⊆ σ(C).
We then have the following result1 .
Theorem 4 (Impagliazzo et al. [18]). For all ε > 0 and positive k, there
is a constant K and an algorithm that, given an instance C of k-Hitting Set on
a universe ofsize n, produces a list of t ≤ 2ε·n restrictions T1 , . . . , Tt of C so
t
that σ(C) = i=1 σ(Ti ) and so that for each Ti , |Ti | ≤ Kn. Furthermore, the
algorithm runs in time poly(n) · 2ε·n .
Lemma 5. Let B be a set of basic relations with maximum arity p and let m =
p
|B|. Then CSP(B ∨k ) is solvable in O(2(ε+K log k)·|V | ·m ·poly(||I||)) time for every
ε > 0, where K is a constant depending only on ε and k.
since t ≤ 2ε·n .
This procedure can be implemented using only polynomial space, just as the
enumerative methods presented in Section 3.1. This follows from the fact that the
restrictions T1 , . . . , Tt of C can be computed one after another with polynomial
delay [10, Theorem5.15]. Although this running time still might seem excessively
p k
slow observe that it is significantly more efficient than the 2k·log k·(m|V | ) algo-
∨k
rithm for CSP(B ) in Lemma 3.
1
We remark that Impagliazzo et al. [18] instead refer to the k-Hitting set problem as
the k-Set cover problem.
190 P. Jonsson and V. Lagerkvist
Theorem 6. Let B be a set of basic relations with maximum arity p and let
p
m = |B|. Then CSP(B∨∞ ) is solvable in O(2m|V | · poly(||I||)) time.
Theorem 7. Let B be a set of basic relations with maximum arity p and let
m = |B|. Then
p
1. CSP(B∨∞ ) solvable in O(2|V | ·log m · poly(||I||))) time if B is JEPD, and
p
2. CSP(B ∨∞ ) is solvable in O(2|V | ·log(m+1) · poly(||I||))) time if B is PD.
2
Observe that this algorithm is much more efficient than the O(2|V | ·
poly(||I||)) algorithm in Theorem 7. It is well known that equality constraint
languages admit quantifier elimination [5]. Hence, we can use Lemma 2 to
extend Theorem 8 to cover arbitrary equality constraint languages.
Corollary 9. Let Γ be a finite set of relations first-order definable over (D, =).
Then CSP(Γ ) is solvable in O(|V |2|V |·log L(|V |) · poly(||I||)) time.
192 P. Jonsson and V. Lagerkvist
It is well known that the first-order theory of (Q, <) admits quantifier elimi-
nation [6,15]. Hence, we can exploit Lemma 2 to obtain the following corollary.
Corollary 11. Let Γ be a finite temporal constraint language over (Q, <). If
CSP(Γ ) is NP-complete, then it is solvable in O(2|V | log |V | · poly(||I||)) time.
We can also obtain strong bounds for Allen’s interval algebra, which is a well-
known formalism for temporal reasoning. Here, one considers relations between
intervals of the form [x, y], where x, y ∈ R is the starting and ending point,
respectively. Let Allen be the 213 = 8192 possible unions of the set of the thirteen
relations in Table 1. For convenience we write constraints such as (p ∨ m)(x, y)
as x{p, m}y, using infix notation and omitting explicit disjunction signs. The
problem CSP(Allen) is NP-complete and all tractable fragments have been iden-
tified [22].
Given an instance I = (V, C) of CSP(Allen) we first create two fresh variables
xsi and xei for every x ∈ V , intended to represent the startpoint and endpoint of
the interval x. Then observe that a constraint x{r1 , . . . , rm }y ∈ C, where each
ri is a basic relation, can be represented as a disjunction of temporal constraints
over xs , xe , y s and y e by using the definitions of each basic relation in Table 1.
Applying Theorem 10 to the resulting instance gives the following result.
Table 1. The thirteen basic relations in Allen’s interval algebra. The endpoint relations
xs < xe and y s < y e that are valid for all relations have been omitted.
These four basic relations are known as the point algebra for branching time.
We let P = {||, <, >, =}. The problem CSP(P ∨∞ ) is NP-complete and many
tractable fragments have been identified [8].
1. enumerate all directed forests over V where the in-degree of each node is at
most one,
2. for every forest F , if at least one disjunct in every constraint in C is satisfied
by F , answer yes,
3. answer no.
It is readily seen that this algorithm is sound and complete for CSP(P ∨∞ ). As
for the time complexity, recall that the number of directed labelled trees with
|V | vertices is equal to |V ||V |−2 by Cayley’s formula. These can be efficiently
enumerated by e.g. enumerating all Prüfer sequences [28] of length |V | − 2. To
enumerate all forests instead of trees, we can enumerate all labelled trees with
|V | + 1 vertices and only consider the trees where the extra vertex is connected
to all other vertices. By removing this vertex we obtain a forest with |V | vertices.
Hence, there are at most 2|V | |V ||V |−1 directed forests over V . The factor 2|V |
stems from the observation that each forest contains at most |V | edges, where
each edge has two possible directions. We then filter out the directed forests
containing a tree where the in degree of any vertex is more than one. Last, for
each forest, we enumerate all |V ||V | functions from V to the forest, and check
in poly(||I||) time whether it satisfies I. Put together this gives a complexity of
O(2|V | |V ||V |−1 |V ||V | · poly(||I||)) ⊆ O(2|V |+2|V | log |V | · poly(||I||)).
Branching time does not admit quantifier elimination [3, Section 4.2] so
Lemma 2 is not applicable. However, there are closely connected constraint lan-
guages on trees that have this property. Examples include the triple consistency
problem with important applications in bioinformatics [7].
194 P. Jonsson and V. Lagerkvist
5 Lower Bounds
The algorithms presented in Section 4 give new upper bounds for the complexity
of CSP(B ∨∞ ). It is natural to also ask, given reasonable complexity theoretical
assumptions, how much room there is for improvement. This section is divided
into Section 5.1, where we obtain lower bounds for CSP(B ∨∞ ) and CSP(B ∨k ) for
B that are JEPD, and in Section 5.2, where we obtain lower bounds for Allen’s
interval algebra.
Even though this theorem does not rule out the possibility that CSP(B ∨k )
can be solved significantly faster for some k it is easy to see that CSP(B ∨k )
cannot be solved in subexponential time for any k ≥ 3(|B| − 1). First assume
Upper and Lower Bounds on the Time Complexity of Infinite-Domain CSPs 195
that the ETH holds. By following the proof of Theorem 14 we can reduce 3-SAT
to CSP(B ∨3(|B|−1) ), which implies that CSP(B ∨3(|B|−1) ) cannot be solved in 2δn
time either. The bound k = 3(|B| − 1) might obviously feel a bit unsatisfactory
and one might wonder if this can be improved. We can in fact make this much
more precise by adding further restrictions to the set B. As in the case of the
equality constraint languages in Section 4.2 we let = denote the equality relation
on a given countably infinite domain.
m First observe that the binary inequality relation = over D can be defined
Proof.
as i=1 Ri since m B is JEPD. In the the proof we therefore use = as an abbre-
viation for i=1 Ri . Let I = (V, C) be an instance of SAT with variables
V = {x1 , . . . , xn } and the set of clauses C. Let K be an integer such that
K > log c. Assume without loss of generality that n is a multiple of K. We
n n
will construct an instance of CSP(B ∨∞ ) with K + 2K = K + O(1) variables.
K
First, introduce 2 fresh variables v1 , . . . , v2K and make them different by impos-
n
ing = constraints. Second, introduce K fresh variables y1 , . . . , y Kn , and for each
n
i ∈ {1, . . . , K } impose the constraint (yi = v1 ∨ yi = v2 ∨ · · · ∨ yi = v2k ). Let
V1 , . . . , V Kn be a partition of V such that each |Vi | = K. We will represent each set
Vi of Boolean variables by one yi variable over D. To do this we will interpret each
auxiliary variable zi as a K-ary Boolean tuple. Let h : {v1 , . . . , v2K } → {0, 1}K
be an injective function which assigns a Boolean K-tuple for every variable
vi . Let g+ be a function from {1, . . . , K} to subsets of {v1 , . . . , v2K } such that
vi ∈ g(j) if and only if the j-th element in h(vi ) is equal to 1. Define g− in the
analogous way. Observe that |g+ (j)| = |g− (j)| = 2K−1 for each j ∈ {1, . . . , K}.
For the reduction, let ( i1 ∨. . .∨ in ), ij = xij or ij = ¬xij , be a clause in C.
We assume that n ≤ n since the clause contains repeated literals otherwise. For
each literal ij let Vi ⊆ V be the set of variables such that xij ∈Vi . Each literal
ij is then replaced by z∈g+ (ij ) yi = z if ij = xij , and with z∈g− (ij ) yi = z
if ij = ¬xij . This reduction can be done in polynomial time since a clause with
n literals is replaced by a disjunctive constraint with n 2K−1 disjuncts (since K
is a constant depending only on c). It follows that SAT can be solved in
n n
O(c K +O(1) · poly(||I||)) = O(2( K +O(1))·log c · poly(||I||)) = O(2δ·n · poly(||I||))
for some δ < 1, since K > log c . Thus, the SETH does not hold.
Theorems 14, 15 and 16 gives lower bounds for all the problems considered in
Sections 4.2 and 4.3 except for CSP(Allen) since unlimited use of disjunction is
not allowed in this language. It is however possible to relate the complexity of
CSP(Allen) to the Chromatic Number problem, i.e. the problem of computing
the number of colours needed to colour a given graph.
Upper and Lower Bounds on the Time Complexity of Infinite-Domain CSPs 197
√ |V |
Theorem 17. If CSP(Allen) can be solved in O( c ) time for some c < 2,
then Chromatic Number can be solved in O((c+)|V | ) time for arbitrary > 0.
Proof. We first present a polynomial-time many-one reduction from k-
Colourability to CSP(Allen) which introduces k fresh variables. Given an
undirected graph G = ({v1 , . . . , vn }, E), introduce the variables z1 , . . . , zk and
v1 , . . . , vn , and:
Consulting Table 1, we see that for each vi , it holds that its right endpoint
must equal the right endpoint of some zi , and its left endpoint must equal the
left endpoint of z1 . It is now obvious that the resulting instance has a solution if
and only if G is k-colourable. The result then follows since there is a polynomial-
time Turing reduction from Chromatic Number to CSP(Allen) by combining
binary search (that will evaluate log n Allen instances) with the reduction above
(recall that O(log n · cn ) ⊆ O((c + )n ) for every > 0) . Observe that if k =√n
then the reduction introduces n fresh variables, which is where the constant c
√ |V |
in the expression O( c ) stems from. CSP(Allen).
The exact complexity of Chromatic Number has been analysed and dis-
cussed in the literature. Björklund et al. [2] have shown that the problem is
solvable in 2|V | · poly(||I||) time. Impagliazzo and Paturi [17] poses the following
question: “Assuming SETH, can we prove a 2n−o(n) lower bound for Chromatic
√ |V |
Number?”. Hence, an O( c ), c < 2, algorithm for CSP(Allen) would also be
a major breakthrough for Chromatic Number.
6 Discussion
We have investigated several novel algorithms for solving disjunctive CSP prob-
lems, which, with respect to worst-case time complexity, are much more efficient
than e.g. backtracking algorithms without heuristics. These bounds can likely
be improved, but, due to the lower bounds in Section 5, probably not to a great
degree. Despite this, algorithms for solving infinite domain constraint satisfaction
problems are in practice used in many non-trivial applications. In light of this the
following research direction is particularly interesting: how to formally analyse
the time complexity of branching algorithms equipped with (powerful) heuristics?
In the case of finite-domain CSPs and, in particular, DPLL-like algorithms for
the k-SAT problem there are numerous results to be found in the literature,
cf. the survey by Vsemirnov et al. [35]. This is not the case for infinite-domain
CSPs, even though there is a considerable amount of empirical evidence that
infinite-domain CSPs can be efficiently solved by such algorithms, so one ought
to be optimistic about the chances of actually obtaining non-trivial bounds. Yet,
sharp formal analyses appear to be virtually nonexistent in the literature.
198 P. Jonsson and V. Lagerkvist
References
1. Berend, D., Tassa, T.: Improved bounds on Bell numbers and on moments of
sums of random variables. Probability and Mathematical Statistics 30(2), 185–205
(2010)
2. Björklund, A., Husfeldt, T., Koivisto, M.: Set partitioning via inclusion-exclusion.
SIAM Journal on Computing 39(2), 546–563 (2009)
3. Bodirsky, M.: Complexity classification in infinite-domain constraint satisfaction.
Mémoire d’habilitation à diriger des recherches, Université Diderot - Paris 7.
arXiv:1201.0856 (2012)
4. Bodirsky, M., Hils, M.: Tractable set constraints. Journal of Artificial Intelligence
Research 45, 731–759 (2012)
5. Bodirsky, M., Kára, J.: The complexity of equality constraint languages. Theory
of Computing Systems 43(2), 136–158 (2008)
6. Bodirsky, M., Kára, J.: The complexity of temporal constraint satisfaction prob-
lems. Journal of the ACM 57(2), 9:1–9:41 (2010)
7. Bodirsky, M., Mueller, J.K.: The complexity of rooted phylogeny problems. Logical
Methods in Computer Science 7(4) (2011)
8. Broxvall, M., Jonsson, P.: Point algebras for temporal reasoning: Algorithms and
complexity. Artificial Intelligence 149(2), 179–220 (2003)
9. Broxvall, M., Jonsson, P., Renz, J.: Disjunctions, independence, refinements. Arti-
ficial Intelligence 140(1–2), 153–173 (2002)
10. Calabro, C.: The Exponential Complexity of Satisfiability Problems. PhD thesis,
University of California, San Diego, CA, USA (2009)
11. Cohen, D., Jeavons, P., Jonsson, P., Koubarakis, M.: Building tractable disjunctive
constraints. Journal of the ACM 47(5), 826–853 (2000)
12. Dantsin, E., Goerdt, A., Hirsch, E.A., Kannan, R., Kleinberg, J.M., Papadimitriou,
C.H., Raghavan, P., Schöning, U.: A deterministic (2 − 2/(k + 1))n algorithm for
k-SAT based on local search. Theoretical Computer Science 289(1), 69–83 (2002)
13. Djokic, B., Miyakawa, M., Sekiguchi, S., Semba, I., Stojmenovic, I.: A fast iterative
algorithm for generating set partitions. The Computer Journal 32(3), 281–282
(1989)
14. Gaspers, S.: Exponential Time Algorithms - Structures, Measures, and Bounds.
VDM (2010)
15. Hodges, W.: A Shorter Model Theory. Cambridge University Press, New York
(1997)
16. Impagliazzo, R., Paturi, R.: On the complexity of k-SAT. Journal of Computer
and System Sciences 62(2), 367–375 (2001)
Upper and Lower Bounds on the Time Complexity of Infinite-Domain CSPs 199
17. Impagliazzo, R., Paturi, R.: Exact complexity and satisfiability. In: Gutin, G.,
Szeider, S. (eds.) IPEC 2013. LNCS, vol. 8246, pp. 1–3. Springer, heidelberg (2013)
18. Impagliazzo, R., Paturi, R., Zane, F.: Which problems have strongly exponential
complexity? Journal of Computer and System Sciences 63(4), 512–530 (2001)
19. Jonsson, P., Bäckström, C.: A unifying approach to temporal constraint reasoning.
Artificial Intelligence 102(1), 143–155 (1998)
20. Jonsson, P., Lagerkvist, V., Nordh, G., Zanuttini, B.: Complexity of SAT prob-
lems, clone theory and the exponential time hypothesis. In: Proceedings of
the 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA-2013),
pp. 1264–1277 (2013)
21. Kanj, I., Szeider, S.: On the subexponential time complexity of CSP. In: Proceed-
ings of the Twenty-Seventh AAAI Conference on Artificial Intelligence (AAAI-
2013) (2013)
22. Krokhin, A., Jeavons, P., Jonsson, P.: Reasoning about temporal relations: The
tractable subalgebras of Allen’s interval algebra. Journal of the ACM 50(5),
591–640 (2003)
23. Ligozat, G.: Qualitative Spatial and Temporal Reasoning. Wiley-ISTE (2011)
24. Ligozat, G., Renz, J.: What Is a qualitative calculus? a general framework. In:
Zhang, C., W. Guesgen, H., Yeap, W.-K. (eds.) PRICAI 2004. LNCS (LNAI), vol.
3157, pp. 53–64. Springer, Heidelberg (2004)
25. Liu, B., Jaffar, J.: Using constraints to model disjunctions in rule-based reasoning.
In: Proceedings of the Thirteenth National Conference on Artificial Intelligence,
AAAI 1996, Portland, Oregon, vol. 2, pp. 1248–1255 (1996)
26. Lokshtanov, D., Marx, D., Saurabh, S.: Lower bounds based on the exponential
time hypothesis. Bulletin of EATCS 3(105) (2013)
27. Marriott, K., Moulder, P., Stuckey, P.J.: Solving disjunctive constraints for interac-
tive graphical applications. In: Walsh, T. (ed.) CP 2001. LNCS, vol. 2239, p. 361.
Springer, Heidelberg (2001)
28. Prüfer, H.: Neuer beweis eines satzes über permutationen. Archiv der Mathematik
und Physik 27, 742–744 (1918)
29. Renz, J., Nebel, B.: Efficient methods for qualitative spatial reasoning. Journal of
Artificial Intelligence Research 15(1), 289–318 (2001)
30. Rossi, F., van Beek, P., Walsh, T. (eds.) Handbook of Constraint Programming.
Elsevier (2006)
31. Stergiou, K., Koubarakis, M.: Backtracking algorithms for disjunctions of temporal
constraints. Artificial Intelligence 120(1), 81–117 (2000)
32. Stojmenović, I.: An optimal algorithm for generating equivalence relations on a
linear array of processors. BIT Numerical Mathematics 30(3), 424–436 (1990)
33. Traxler, P.: The time complexity of constraint satisfaction. In: Grohe, M.,
Niedermeier, R. (eds.) IWPEC 2008. LNCS, vol. 5018, pp. 190–201. Springer,
Heidelberg (2008)
34. Vilain, M.B., Kautz, H.A.: Constraint propagation algorithms for temporal rea-
soning. In: Proceedings of the 5th National Conference on Artificial Intelligence
(AAAI 1986), pp. 377–382 (1986)
35. Vsemirnov, M., Hirsch, E., Dantsin, E., Ivanov, S.: Algorithms for SAT and upper
bounds on their complexity. Journal of Mathematical Sciences 118(2), 4948–4962
(2003)
36. Woeginger, G.: Exact algorithms for NP-hard problems: a survey. In: Juenger, M.,
Reinelt, G., Rinaldi, G. (eds.) Combinatorial Optimization - Eureka! You Shrink!.
LNCS, vol. 2570, pp. 185–207. Springer, Heidelberg (2000)
Generalized Totalizer Encoding
for Pseudo-Boolean Constraints
1 Introduction
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 200–209, 2015.
DOI: 10.1007/978-3-319-23219-5 15
Generalized Totalizer Encoding for Pseudo-Boolean Constraints 201
(O : o2 , o3 , o5 , o6 : 6)
(A : a2 , a3 , a5 : 5) (B : b3 , b6 : 6)
(C : l1 : 2) (D : l2 : 3) (E : l3 : 3) (F : l4 : 3)
wi li ≤ k (1)
would need one variable corresponding to every distinct weighted sum that the
input literals under A can produce. Input literals are at the leaves, represented
as (node name : literal name : literal weight) with each of the terms being self
explanatory.
For any node P with children Q and R, to ensure that weighted sum is
propagated from Q and R to P , the following formula is built for P :
⎛ ⎞
⎛ ⎞
⎜ ⎟
⎜ ⎟ ⎜ ⎟
⎜ q (¬qw1 ∨ ¬rw2 ∨ pw3 )⎟
⎜ w1 ∈ Q.node vars ⎟ ∧ ⎝ sw ∈ (Q.node vars ∪ R.node vars) (¬sw ∨ pw )⎠ (2)
⎝ rw2 ∈ R.node vars ⎠ w=w
w3 = w1 + w2 pw ∈ P.node vars
pw3 ∈ P.node vars
The left part of Eqn. (2) ensures that, if node Q has witnessed a weighted
sum of w1 and R has witnessed a weighted sum of w2 , then P must be considered
to have witnessed the weighted sum of w3 = w1 + w2 . The right part of Eqn. (2)
just takes care of the boundary condition where weighted sums from Q and R
are propagated to P without combining it with their siblings. This represents
that Q (resp. R) has witnessed a weighted sum of w but R (resp. Q) may not
have witnessed any positive weighted sum.
Note that node O in Fig. 1 does not have variables for the weighted sums
larger than 6. Once the weighted sum goes above the threshold of k, we represent
it with k + 1. Since all the weighted sums above k would result in the constraint
being not satisfied, it is sound to represent all such sums as k + 1. This is in some
sense a generalization of k-simplification described in [9,17]. For k-simplification,
w3 in Eqn. (2) would change to w3 = min(w1 + w2 , k + 1).
Finally, to enforce that the weighted sum does not exceed the given threshold
k, we add the following constraint at the root node O :
¬ok+1 (3)
Encoding Properties: Let AIw represent the multiset of weights of all the
input literals in the
subtree rooted at node A. For any given multiset S of weights,
let W eight(S) = e∈S e. For a given multiset S, let unique(S) denote the set
with all the multiplicity removed from S. Let |S| denote the cardinality of the
set S. Hence, the total number of node variables required at node A is:
Note that unlike some other encodings [7,14] the number of auxiliary vari-
ables required for GTE does not depend on the magnitudes of the weights.
Instead, it depends on how many unique weighted sums can be generated. Thus,
we claim that for pseudo-Boolean constraints where the distinct weighted sum
combinations are low, GTE should perform better. We corroborate our claim in
Section 4 through experiments.
Nevertheless, in the worst case, GTE can generate exponentially many auxil-
iary variables and clauses. For example, if the weights of input literals l1 , . . . , ln
Generalized Totalizer Encoding for Pseudo-Boolean Constraints 203
3 Related Work
The idea of encoding a PBC into a SAT formula is not new. One of the first such
encoding is described in [11,30] which uses binary adder circuit like formulation
to compute the weighted sum and then compare it against the threshold k.
This encoding creates O(n log2 k) auxiliary clauses, but it is not arc-consistent.
Another approach to encode PBCs into SAT is to use sorting networks [11].
This encoding produces O(N log22 N ) auxiliary clauses, where N is bounded by
log2 w1
+ . . . + log2 wn
. This encoding is also not arc-consistent for PBCs, but
it preserves more implications than the adder encoding, and it maintains GAC
for cardinality constraints.
The Watchdog encoding [7] scheme uses the Totalizer encoding, but in a
completely different manner than GTE. It uses multiple Totalizers, one for each
bit of the binary representation of the weights. The Watchdog encoding was the
first polynomial sized encoding that maintains GAC for PBCs and it only gen-
erates O(n3 log2 n log2 wmax ) auxiliary clauses. Recently, the Watchdog encoding
has been generalized to a more abstract framework with the Binary Merger
204 S. Joshi et al.
#PB denotes the average number of PBCs per instance. #lits, k, max wi , wi
and #diff wi denote the per constraint per instance average of input literals,
bound, the largest weight, maximum possible weighted sum and the number
of distinct weights. PB’12 benchmarks are a mix of crafted as well as industrial
benchmarks, whereas all of the pedigree benchmarks are from the same biological
problem [13]. The PB’12 benchmarks have on average several PBCs, however,
they are relatively small in magnitude. In contrast, the pedigree benchmarks
contain one large PB constraint with very large total weighted sum. pedigree
benchmarks have only two distinct values of weights, thus making them good
candidates for using GTE.
Results: Tab. 2 shows the number of instances solved using different encodings.
sorter, adder and swc perform worse than the remaining encodings for both sets of
benchmarks. The first two are not arc-consistent therefore the SAT solver is not
2
Available at http://sat.inesc-id.pt/∼ruben/benchmarks/pb12-subset.zip
3
http://www.maxsat.udl.cat/14/
4
Available at http://sat.inesc-id.pt/∼ruben/benchmarks/pedigrees.zip
206 S. Joshi et al.
·107 ·107
1.2
swc
sorter
watchdog 1 swc
3 watchdog
gte
bin-merger sorter
0.8
bdd bin-merger
adder bdd
#Vars
#Vars
2 0.6 gte
adder
0.4
1
0.2
0 0
170 180 190 200 210 0 20 40 60 80 100 120 140 160
instances instances
#Clauses
bdd bdd
2 1 adder
1 0.5
0 0
150 160 170 180 190 200 210 0 20 40 60 80 100 120 140 160
instances instances
seconds
gte gte
1,000 1,000
500 500
0 0
100 120 140 160 0 20 40 60 80 100 120 140 160
instances instances
5 Conclusion
References
1. Abı́o, I., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E., Mayer-Eichberger,
V.: A New Look at BDDs for Pseudo-Boolean Constraints. Journal of Artificial
Intelligence Research 45, 443–480 (2012)
2. Aloul, F., Ramani, A., Markov, I., Sakallah, K.: Generic ILP versus specialized
0–1 ILP: an update. In: International Conference on Computer-Aided Design,
pp. 450–457. IEEE Press (2002)
3. Argelich, J., Berre, D.L., Lynce, I., Marques-Silva, J., Rapicault, P.: Solving linux
upgradeability problems using boolean optimization. In: Workshop on Logics for
Component Configuration, pp. 11–22 (2010)
4. Ası́n, R., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E.: Cardinality Net-
works: a theoretical and empirical study. Constraints 16(2), 195–221 (2011)
5. Bailleux, O., Boufkhad, Y.: Efficient CNF encoding of boolean cardinality con-
straints. In: Rossi, F. (ed.) CP 2003. LNCS, vol. 2833, pp. 108–122. Springer,
Heidelberg (2003)
6. Bailleux, O., Boufkhad, Y., Roussel, O.: A Translation of Pseudo Boolean Con-
straints to SAT. Journal on Satisfiability, Boolean Modeling and Computation
2(1–4), 191–200 (2006)
7. Bailleux, O., Boufkhad, Y., Roussel, O.: New encodings of pseudo-boolean con-
straints into CNF. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 181–194.
Springer, Heidelberg (2009)
8. Barth, P.: Logic-based 0–1 Constraint Programming. Kluwer Academic Publishers
(1996)
9. Büttner, M., Rintanen, J.: Satisfiability planning with constraints on the number
of actions. In: International Conference on Automated Planning and Scheduling,
pp. 292–299. AAAI Press (2005)
10. Eén, N., Sörensson, N.: An extensible SAT-solver. In: Giunchiglia, E., Tacchella, A.
(eds.) SAT 2003. LNCS, vol. 2919, pp. 502–518. Springer, Heidelberg (2004)
11. Eén, N., Sörensson, N.: Translating Pseudo-Boolean Constraints into SAT. Journal
on Satisfiability, Boolean Modeling and Computation 2(1–4), 1–26 (2006)
12. Gent, I.P.: Arc consistency in SAT. In: European Conference on Artificial Intelli-
gence, pp. 121–125. IOS Press (2002)
13. Graça, A., Lynce, I., Marques-Silva, J., Oliveira, A.L.: Efficient and accurate haplo-
type inference by combining parsimony and pedigree information. In: Horimoto, K.,
Nakatsui, M., Popov, N. (eds.) ANB 2010. LNCS, vol. 6479, pp. 38–56. Springer,
Heidelberg (2012)
14. Hölldobler, S., Manthey, N., Steinke, P.: A compact encoding of pseudo-boolean
constraints into SAT. In: Glimm, B., Krüger, A. (eds.) KI 2012. LNCS, vol. 7526,
pp. 107–118. Springer, Heidelberg (2012)
15. Ignatiev, A., Janota, M., Marques-Silva, J.: Towards efficient optimization in pack-
age management systems. In: International Conference on Software Engineering,
pp. 745–755. ACM (2014)
16. Janota, M., Lynce, I., Manquinho, V.M., Marques-Silva, J.: PackUp: Tools for
Package Upgradability Solving. JSAT 8(1/2), 89–94 (2012)
17. Koshimura, M., Zhang, T., Fujita, H., Hasegawa, R.: QMaxSAT: A Partial Max-
SAT Solver. Journal on Satisfiability, Boolean Modeling and Computation 8,
95–100 (2012)
18. Le Berre, D., Parrain, A.: The Sat4j library, release 2.2. Journal on Satisfiability,
Boolean Modeling and Computation 7(2–3), 59–64 (2010)
Generalized Totalizer Encoding for Pseudo-Boolean Constraints 209
19. Manquinho, V., Marques-Silva, J., Planes, J.: Algorithms for weighted boolean
optimization. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 495–508.
Springer, Heidelberg (2009)
20. Manthey, N., Philipp, T., Steinke, P.: A more compact translation of pseudo-
boolean constraints into cnf such that generalized arc consistency is maintained.
In: Lutz, C., Thielscher, M. (eds.) KI 2014. LNCS, vol. 8736, pp. 123–134. Springer,
Heidelberg (2014)
21. Manthey, N., Steinke, P.: npSolver - A SAT based solver for optimization problems.
In: Pragmatics of SAT (2012)
22. Marques-Silva, J.: Integer programming models for optimization problems in test
generation. In: Asia and South Pacific Design Automation, pp. 481–487. IEEE
Press (1998)
23. Martins, R., Joshi, S., Manquinho, V., Lynce, I.: Incremental cardinality con-
straints for MaxSAT. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656,
pp. 531–548. Springer, Heidelberg (2014)
24. Miranda, M., Lynce, I., Manquinho, V.: Inferring phylogenetic trees using pseudo-
Boolean optimization. AI Communications 27(3), 229–243 (2014)
25. Ogawa, T., Liu, Y., Hasegawa, R., Koshimura, M., Fujita, H.: Modulo based CNF
encoding of cardinality constraints and its application to MaxSAT solvers. In:
International Conference on Tools with Artificial Intelligence, pp. 9–17. IEEE Press
(2013)
26. Prestwich, S., Quirke, C.: Boolean and pseudo-boolean models for scheduling. In:
International Workshop on Modelling and Reformulating Constraint Satisfaction
Problems (2003)
27. Ribas, B.C., Suguimoto, R.M., Montaño, R.A.N.R., Silva, F., de Bona, L., Castilho,
M.A.: On modelling virtual machine consolidation to pseudo-boolean constraints.
In: Pavón, J., Duque-Méndez, N.D., Fuentes-Fernández, R. (eds.) IBERAMIA
2012. LNCS, vol. 7637, pp. 361–370. Springer, Heidelberg (2012)
28. Sinz, C.: Towards an optimal CNF encoding of boolean cardinality constraints. In:
van Beek, P. (ed.) CP 2005. LNCS, vol. 3709, pp. 827–831. Springer, Heidelberg
(2005)
29. Steinke, P., Manthey, N.: PBLib-A C++ Toolkit for Encoding Pseudo-Boolean
Constraints into CNF. Tech. rep., Technische Universität Dresden (2014). http://
tools.computational-logic.org/content/pblib.php
30. Warners, J.: A Linear-Time Transformation of Linear Inequalities into Conjunctive
Normal Form. Information Processing Letters 68(2), 63–69 (1998)
Smaller Selection Networks for Cardinality
Constraints Encoding
1 Introduction
Comparator networks are probably the simplest data-oblivious model for sorting-
related algorithms. The most popular construction is due to Batcher [4] and
it’s called odd-even sorting network. For all practical values, this is the best
known sorting network. However, in 1992 Parberry [10] introduced the serious
competitor to Batcher’s construction, called pairwise sorting network. In context
of sorting, pairwise network is not better than odd-even network, in fact it has
been proven that they have exactly the same size and depth. As Parberry said
himself: ”It is the first sorting network to be competitive with the odd-even sort
for all values of n“. There is a more sophisticated relation between both types
of network and their close resemblance. For overview of sorting networks, see
Knuth [8] or Parberry [9].
In recent years new applications for sorting networks have been found, for
example in encoding of pseudo Boolean constraints and cardinality constraints
for SAT-solvers. Cardinality constraints take the form x1 + x2 + . . . + xn ∼ k,
where x1 , x2 , . . . , xn are Boolean variables, k is a natural number, and ∼ is a
relation from the set {=, <, ≤, >, ≥}. Cardinality constraints are used in many
applications, the significant ones worth mentioning arise in SAT-solvers. Using
cardinality constraints with cooperation of SAT-solvers we can handle many
practical problems, for example, cumulative scheduling [11] and timetabling [3],
that are proven to be hard. Works of Ası́n et al. [1,2] describe how to use odd-
even sorting network to encode cardinality constraints into Boolean formulas. In
[7] authors do the same with pseudo Boolean constraints.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 210–225, 2015.
DOI: 10.1007/978-3-319-23219-5 16
Smaller Selection Networks for Cardinality Constraints Encoding 211
It has already been observed that using selection networks instead of sort-
ing networks is more efficient for the encoding of cardinality constraints. Codish
and Zazon-Ivry [6] introduced pairwise cardinality networks, which are networks
derived from pairwise sorting networks that express cardinality constraints. Two
years later, same authors [5] reformulated the definition of pairwise selection net-
works and proved that their sizes are never worse than the sizes of corresponding
odd-even selection networks. To show the difference they plotted it for selected
values of n and k.
In this paper we give a new construction of smaller selection networks that
are based on the pairwise selection ones and we prove that the construction is
correct. We also estimate the size of our networks and compute the difference in
sizes between our selection networks and the corresponding pairwise ones. The
difference can be as big as n log n/2 for k = n/2. Finally, we analyze the standard
3(6)-clause encoding of a comparator and prove that such CNF encoding of
any selection network preserves arc-consistency with respect to a corresponding
cardinality constraint.
The rest of the paper is organized in the following way: in Section 2 we give
definitions and notations used in this paper. In Section 3 we recall the definition
of pairwise selection networks and define auxiliary bitonic selection networks
that we will use to estimate the sizes of our networks. In Section 4 we present
the construction of our selection networks and prove its correctness. In Section
5 we analyze the sizes of the networks and, finally, in Section 6 we examine the
arc-consistency of selection networks.
2 Preliminaries
In this section we will introduce definitions and notations used in the rest of the
paper.
Definition 1 (Input Sequence). Input sequence of length n is a sequence of
natural numbers x̄ = x1 , . . . , xn , where xi ∈ N (for all i = 1..n). We say that
x̄ ∈ Nn is sorted if xi ≥ xi+1 (for each i = 1..n − 1). Given x̄ = x1 , . . . , xn ,
ȳ = y1 , . . . , yn we define concatenation as x̄ :: ȳ = x1 , . . . , xn , y1 , . . . , yn .
We will use the following functions from Nn to Nn/2 :
x̄ ȳ ⇐⇒ ∀i∈{1,...,n} ∀j∈{1,...,m} xi ≥ yj
Definition 2 (Comparator). Let x̄ ∈ Nn and let i, j ∈ N, where 1 ≤ i < j ≤ n.
A comparator is a function ci,j defined as:
Two types of sorting networks are of interest to us: odd-even and pairwise.
Based on their ideas, Knuth [8] (for odd-even network) and Codish and Zazon-
Ivry [5,6] (for pairwise network) showed how to transform them into selection
networks (we name them oe selkn and pw selkn respectively).
f comp(a, b, c, d) ⇔ (c ⇔ a ∨ b) ∧ (d ⇔ a ∧ b)
Smaller Selection Networks for Cardinality Constraints Encoding 213
hcomp(a, b, c, d) ⇔ (a ⇒ c) ∧ (b ⇒ c) ∧ (a ∧ b ⇒ d) (1)
(c1) (c2) (c3)
Now we present two constructions for selection networks. First, we recall the def-
inition of pairwise selection networks by Codish and Zazon-Ivry [5,6]. Secondly,
we give the auxiliary construction of a bitonic selection network bit selkn , that
we will use to estimate the sizes of our improved pairwise selection network in
Section 5.
Observation 1. We can construct splitter splitn by joining inputs i, n/2 + i,
for i = 1..n/2, with a comparator. The size of a splitter is |splitn | = n/2.
Lemma 1. If b̄ ∈ Nn is bitonic and ȳ = splitn (b̄), then lef t(ȳ) and right(ȳ)
are bitonic and lef t(ȳ) right(ȳ).
Proof. Let x̄ ∈ Nn be the input to bit selkn . After step one we get sorted sequences
B1 , . . . , Bl , where l = n/k. Let lm be the value of l after m iterations. Let
B1m , . . . , Blmm
be the blocks after m iterations. We will prove by induction that:
P (m): if B1 , . . . , Bl are sorted contain k largest elements of x̄, then after m-
th iteration of the second step: lm = l/2m , B1m , . . . , Blmm
are sorted and contain
k largest elements of x̄.
If m = 0, then l0 = l, so P (0) holds. We show that ∀m≥0 (P (m) ⇒ P (m + 1)).
Consider (m+1)-th iteration of step two. By the induction hypothesis lm = l/2m ,
Smaller Selection Networks for Cardinality Constraints Encoding 215
B1m , . . . , Blm
m
are sorted and contain k largest elements of x̄. We will show that
(m + 1)-th iteration does not remove any element from k largest elements of x̄.
To see this, notice that if y¯i = bit split2k (Bim :: Bi+1 m
) (for i ∈ {1, 3, . . . , lm − 1}),
then lef t(y¯i ) right(y¯i ) and that lef t(y¯i ) is bitonic (by Definition 10). Because
of those two facts, right(y¯i ) is discarded and lef t(y¯i ) is sorted using bit mergek .
After this, lm+1 = lm /2 = l/2m+1 and blocks B1m+1 , . . . , Blm+1 m+1
are sorted. Thus
P (m + 1) is true.
Since l = n/k, then by P (m) we see that the second step will terminate after
m = log nk iterations and that B1 is sorted and contains k largest elements of
x̄.
n n
|bit selkn | =|oe sortk | + − 1 (|bit split2k | + |bit mergek |)
k k
1 1 1 n
= n log k + n log k + 2n − k log k − k −
2
(2)
4 4 2 k
As mentioned in the previous section, only the first k/2 elements from the second
half of the input are relevant when we get to the merging step in pw selkn . We
will exploit this fact to create a new, smaller merger. We will use the concept
of bitonic sequences, therefore the new merger will be called pw bit mergenk and
the new selection network: pw bit selkn . The network pw bit selkn is generated by
substituting the last step of pw selkn with pw bit mergenk . The new merger is
constructed by the procedure Network 3.
Proof. We have to prove two things: (1) b̄ is bitonic and (2) b̄ consists of k largest
elements from ¯l :: r̄.
216 M. Karpiński and M. Piotrów
(1) Let j be the last index in the sequence k/2 + 1, . . . , k, for which lj >
rk−j+1 . If such j does not exist, then y1 , . . . , yk/2 is nondecreasing, hence b̄
is bitonic (nondecreasing). Assume that j exists, then yj−k/2+1 , . . . , yk/2 is
nondecreasing and y1 , . . . , yk−j is nonincreasing. Adding the fact that lk/2 ≥
lk/2+1 = y1 proves, that b̄ is bitonic (v-shaped).
(2) By Observation 2, it is sufficient to prove that b̄ yk/2+1 , . . . , yk .
Since ∀k/2<j≤k lk/2 ≥ lj ≥ min{lj , rk−j+1 } = y3k/2−j+1 , then l1 , . . . , lk/2
yk/2+1 , . . . , yk and by Definition 10: y1 , . . . , yk/2 yk/2+1 , . . . , yk . Therefore
b̄ consists of k largest elements from ¯l :: r̄.
The bitonic merger in step 2 receives a bitonic sequence, so it outputs a
sorted sequence, which completes the proof.
The first step of improved pairwise merger is illustrated in Figure 1. We
use k/2 comparators in the first step and k log k/2 comparators in the second
step. We get a merger of size k log k/2 + k/2, which is better than the previous
approach. In the following it is shown that we can do even better and eliminate
k/2 term.
Fig. 1. Making the bitonic sequence. Arrows on the right picture show directions of
inequalities. Sequence on the right is v-shaped s-dominating at point i.
The main observation is that the result of the first step of pw bit merge oper-
ation: b1 , b2 , . . . , bk is not only bitonic, but what we call v-shaped s-dominating.
Proof. Assume that b̄ is not nonincreasing. Then ∃1≤j<k bj < bj+1 . Assume that
j ≤ k/2. Since b̄ is v-shaped, bj+1 must be in nondecreasing part of b̄. If follows
that bj < bj+1 ≤ . . . ≤ bk/2 ≤ . . . ≤ bk−j+1 . That means that bj < bk−j+1 . On
the other hand, b̄ is s-dominating, thus bj ≥ bk−j+1 – a contradiction.
Proof. (1) Let ȳ = lef t(half splitk (b̄)). First we show that ȳ is v-shaped. If ȳ is
nonincreasing, then it is v-shaped. Otherwise, let j be the first index from the
range {1, . . . , k/2}, where yj−1 < yj . Since yj = max{bj , bj+k/2 } and yj−1 ≥
bj−1 ≥ bj , thus bj < bj+k/2 . Since b̄ is v-shaped, element bj+k/2 must be in
nondecreasing part of b̄. It follows that bj ≥ . . . ≥ bk/2 and bj+k/2 ≤ . . . ≤ bk .
From this we can see that ∀j≤j ≤k/2 yj = max{bj , bj +k/2 } = bj +k/2 , so yj ≤
. . . ≤ yk/2 . Therefore ȳ is v-shaped.
Next we show that ȳ is s-dominating. Consider any j, where 1 ≤ j ≤ k/4.
By Definition 4 and 11: bj ≥ bk/2−j+1 and bj ≥ bk−j+1 , therefore yj = bj ≥
max{bk/2−j+1 , bk−j+1 } = yk/2−j+1 , thus proving that ȳ is s-dominating. Con-
cluding: ȳ is v-shaped s-dominating.
(2) Let z̄ = right(half splitk (b̄)). By Lemma 4: z̄ = right(splitk (b̄)). We
know that b̄ is a special case of bitonic sequence, therefore using Lemma 1 we
get that z̄ is bitonic.
(3) Let w̄ = half splitk (b̄). By Lemma 4: w̄ = splitk (b̄). We know that b̄ is
a special case of bitonic sequence, therefore using Lemma 1 we get lef t(w̄)
right(w̄).
218 M. Karpiński and M. Piotrów
Using both half split and Batcher’s bit merge and successively applying
Lemma 5 to the resulting v-shaped s-dominating half of the output, we have
all the tools needed to construct the improved pairwise merger pw hbit mergenk
(Network 4) using half splitters and then to prove that the construction is correct.
Theorem 3. The output of Network 4 consists of sorted k largest elements from
input ¯l :: r̄, assuming that ¯l ∈ Nn/2 is top k sorted and r̄ ∈ Nn/2 is top k/2
sorted and l1 , . . . , lk/2 dominates r1 , . . . , rk/2 . Moreover, |pw hbit mergenk | =
k log k/2.
Proof. Since step 1 in Network 4 is the same as in Network 3, we can reuse
the proof of Theorem 2 to deduce, that b̄ is v-shaped and contains k largest
elements from ¯l :: r̄. Also, since ∀1≤j≤k/2 lj ≥ lk−j+1 and lj ≥ rj , then bj = lj ≥
max{lk−j+1 , rj } = bk−j+1 , so b̄ is s-dominating.
We prove by the induction on k, that if b̄ is v-shaped s-dominating, then the
sequence half bit mergek (b̄) is sorted. For the base case, consider k = 2 and a v-
shaped s-dominating sequence b1 , b2 . By Definition 11 this sequence is already
sorted and we are done. For the induction step, consider b¯ = half splitk (b̄). By
Lemma 5 we get that lef t(b¯ ) is v-shaped s-dominating and right(b¯ ) is bitonic.
Using the induction hypothesis we sort lef t(b¯ ) and using bitonic merger we
sort right(b¯ ). By Lemma 5: lef t(b¯ ) right(b¯ ), which completes the proof of
correctness.
As mentioned in Definition 12: half splitk is just splitk with the first k/4
comparators removed. So half bit mergek is just bit mergek with some com-
parators removed. Let’s count them: in each level of recursion step we take half
of comparators from splitk and additional one comparator from the base case
(k = 2). We sum them together to get:
log k−1
log k−2
k k 1
i
2 k 2 2 k
1+ =1+ − =1+ 2− − =
i=0
2i+2 4 i=0
2 k 4 k k 2
Therefore we have:
|pw hbit mergenk | = k/2 + k log k/2 − k/2 = k log k/2
Smaller Selection Networks for Cardinality Constraints Encoding 219
The only difference between pw sel and our pw hbit sel is the use of improved
merger pw hbit merge rather than pw merge. By Theorem 3, we conclude that
|pw mergenk | ≥ |pw hbit mergenk |, so it follows that:
Remark 1. |pw hbit selkn | ≤ |pw selkn |
⎧ n/2 n/2
⎪
⎪ |pw hbit selk | + |pw hbit selk/2 |+
⎨
|pw hbit selkn | = +|split k| + |pw hbit merge |
n k
if k < n (3)
⎪
⎩ |oe sort
⎪ | if k = n
|maxn | if k = 1
Lemma 6. |pw hbit selkn | ≤ |bit selkn |.
Proof. Let aux selkn be the comparator network that is generated by substituting
recursive calls in pw hbit selkn by calls to bit selkn . Size of this network (for 1 <
k < n) is:
n/2 n/2
|aux selkn | = |bit selk | + |bit selk/2 | + |splitn | + |pw hbit mergek | (4)
Lemma 6 follows from Lemma 7 and Lemma 8 below, where we show that:
Lemma 7. For 1 < k < n (both powers of 2), |aux selkn | ≤ |bit selkn |.
Proof. We compute both values from Equation 2 and 4:
1 5 1 5 3n
|aux selkn | = n log2 k + n − k log k − k −
4 2 4 4 2k
1 1 1 n
|bit selk | = n log k + n log k + 2n − k log k − k −
n 2
4 4 2 k
We simplify both sides to get the following inequality:
1 n 1
n − k − ≤ (n − k) log k
2 k 2
which can be easily proved by induction.
220 M. Karpiński and M. Piotrów
Lemma 8. For 1 ≤ k < n (both powers of 2), |pw hbit selkn | ≤ |aux selkn |.
Proof. By induction. For the base case, consider 1 = k < n. If follows by defi-
nitions that |pw hbit selkn | = |aux selkn | = n − 1. For the induction step assume
that for each (n , k ) ≺ (n, k) (in lexicographical order) the lemma holds, we get:
Lemma 9. Let:
i
m
m−1
i m
P (n, k, m) = (k − j)2k−j−1
+2n−i−1
+ P (n − m, k − i).
i=0 j=0
j i=0
i
Proof. Due to space restriction we only present schema of the proof. The lemma
can be proven directly from the inequality below, which is a consequence of
Lemma 9 and 6.
i
m
m−1
i m
P (n, k, m) ≤ (k − j)2k−j−1
+2n−i−1
+ B(n − m, k − i)
i=0 j=0
j i=0
i
7 2
Theorem 4. For m = min(k, n−k), P (n, k) ≤ 2n−2 k− m
2 − 4 + 9k
2 + 79
16
m k m
n−k 3 m
+2k 32 2 − 6 − 2 (k + 1) − 2
k
2 .
Smaller Selection Networks for Cardinality Constraints Encoding 221
⎧
⎪
⎪ 0 if n = k
⎨
0 if k = 0
SD(n, k) = (5)
⎪
⎪ 2k−1
k − 2 k
+ 1+
⎩
+SD(n − 1, k) + SD(n − 1, k − 1) if 0 < k < n
k k−j
Theorem 5. Let Sn,k = j=0 n−k+j j 2 . Then:
n n+1 n − 2k + 1
SD(n, k) = − Sn,k − 2k (k − 1) − 1
k 2 2
Proof. By straightforward calculation
one can verify that Sn,0 = 1, Sn,n =
2n+1 − 1, Sn−1,k−1 = 12 (Sn,k − nk ) and Sn−1,k−1 + Sn−1,k = Sn,k . It follows that
the theorem is true for k = 0 and k = n. We prove the theorem by induction
on pairs (k, n). Take any (k, n), 0 < k < n, and assume that theorem holds for
every (k , n ) ≺ (k, n) (in lexicographical order). Then we have:
−4
Corollary 1. |pw selN/2
N
|−|pw hbit selN/2
N
| = N log N
2 +log N +2, for N = 2n .
Plots in Figure 2 show how much pw sel and the upper bound from The-
orem 4 are worse than pw hbit sel. Lines labeled pw sel are plotted from
(|pw selKN
| − |pw hbit selK
N
|)/|pw hbit selK
N
| and the ones labeled upper are plot-
ted from the formula (|upperK |−|pw hbit selK
N N
|)/|pw hbit selK
N
|, where |upperKN
|
is the upper bound from Theorem 4. Both |pw selK | and |pw hbit selK | were
N N
computed directly from recursive formulas. We can see that we save the most
number of comparators when k is larger than n/2, nevertheless for small values
of n superiority of our network is apparent for any k. As for the upper bound,
it gives a good approximation of |pw hbit selK N
| when n is small, but for larger
values of n it becomes less satisfactory.
222 M. Karpiński and M. Piotrów
60 % 60 % 60 %
40 % 40 % 40 %
20 % 20 % 20 %
0% 0% 0%
0 1 2 3 4 5 6 7 0 2 4 6 8 10 12 14 0 5 10 15 20 25 30
log(K) log(K) log(K)
In this section we prove that half encoding of any selection network preserves
arc-consistency with respect to “less-than” cardinality constraints. The proof
can be generalized to other types of cardinality constraints.
We introduce the convention, that x1 , . . . , xn will denote the input and
y1 , . . . , yn will denote the output of some order n comparator network. We
would also like to view them as sequences of Boolean variables, that can be set
to either true (1), false (0) or undefined (X).
From now on we assume that every network f is half encoded and when we
say “comparator” or “network”, we view it in terms of CNF formulas. We denote
V [φ(f )] to be the set of variables in encoding φ(f ).
Lemma 11. Let fkn be a selection network. Assume that k − 1 inputs are set
to 1, and rest of the variables are undefined. Unit propagation will set variables
y1 , . . . , yk−1 to 1.
For each undefined input variable x and propagation path z̄x = z1 , . . . , zm
we define a directed graph Px = {zi , zi+1 : 1 ≤ i < m}.
Lemma 14. Let {xi1 , . . . , xit } (t > 0) be the set of undefined input variables.
Then T = Pxi1 ∪ . . . ∪ Pxit is the tree rooted at yk .
Proof. By induction on t. If t = 1, then T = Pxi1 and by Lemma 12, Pxi1 ends
in yk , so the lemma holds. Let t > 0 and assume that the lemma is true for t.
We will show that it is true for t + 1. Consider T = Pxi1 ∪ . . . ∪ Pxit ∪ Pxit+1 .
By the induction hypothesis T = Pxi1 ∪ . . . ∪ Pxit is a tree rooted at yk . By
Lemma 12, V (Pxit+1 ) ∩ V (T ) = ∅. Let z ∈ V (Pxit+1 ) be the first variable, such
that z ∈ V (T ). Since z ∈ V (T ), there exists j (1 ≤ j ≤ t) such that z ∈ Pxij .
By Lemma 13, starting from variable z, paths Pxit+1 and Pxij are identical.
224 M. Karpiński and M. Piotrów
Theorem 6. If we set yk = 0, then unit propagation will set all undefined input
variables to 0.
7 Conclusions
We have constructed a new family of selection networks, which are based on the
pairwise selection ones, but require less comparators to merge subsequences. The
difference in sizes grows with k and is equal to n log 2n−4 + log n + 2 for k = n/2.
In addition, we have shown that any selection network encoded in a standard
way to a CNF formula preserves arc-consistency with respect to a corresponding
cardinality constraint. This property is important, as many SAT-solvers take
advantage of the unit-propagation algorithm, making the computation signifi-
cantly faster.
It’s also worth noting that using encodings based on selection networks give
an extra edge in solving optimization problems for which we need to solve a
sequence of problems that differ only in the decreasing bound of a cardinality
constraint. In this setting we only need to add one more clause ¬yk for a new
value of k, and the search can be resumed keeping all previous clauses as it is.
This works because if a comparator network is a k-selection network, then it is
also a k -selection network for any k < k. This property is called incremental
strengthening and most state-of-the-art SAT-solvers provide a user interface for
doing this.
We are expecting that our smaller encodings of cardinality constraints should
improve the performance of SAT solvers, but the statement needs an experimen-
tal evaluation. We start doing the evaluation and the results will be presented
in the near future.
Smaller Selection Networks for Cardinality Constraints Encoding 225
References
1. Ası́n, R., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E.: Cardinality
networks and their applications. In: Kullmann, O. (ed.) SAT 2009. LNCS,
vol. 5584, pp. 167–180. Springer, Heidelberg (2009)
2. Ası́n, R., Nieuwenhuis, R., Oliveras, A., Rodrı́guez-Carbonell, E.: Cardinality
networks: a theoretical and empirical study. Constraints 16(2), 195–221 (2011)
3. Ası́n, R., Nieuwenhuis, R.: Curriculum-based course timetabling with SAT and
MaxSAT. Annals of Operations Research 218(1), 71–91 (2014)
4. Batcher, K.E.: Sorting networks and their applications. In: Proc. of the April
30-May 2, 1968, Spring Joint Computer Conference, AFIPS 1968 (Spring),
pp. 307–314. ACM, New York (1968)
5. Codish, M., Zazon-Ivry, M.: Pairwise networks are superior for selection. http://
www.cs.bgu.ac.il/∼mcodish/Papers/Sources/pairwiseSelection.pdf
6. Codish, M., Zazon-Ivry, M.: Pairwise cardinality networks. In: Clarke, E.M.,
Voronkov, A. (eds.) LPAR-16 2010. LNCS, vol. 6355, pp. 154–172. Springer,
Heidelberg (2010)
7. Eén, N., Sörensson, N.: Translating pseudo-boolean constraints into sat. Journal
on Satisfiability, Boolean Modeling and Computation 2, 1–26 (2006)
8. Knuth, D.E.: The Art of Computer Programming, Sorting and Searching, vol. 3,
2nd edn. Addison Wesley Longman Publishing Co. Inc., Redwood City (1998)
9. Parberry, I.: Parallel complexity theory. Pitman, Research notes in theoretical
computer science (1987)
10. Parberry, I.: The pairwise sorting network. Parallel Processing Letters 2, 205–211
(1992)
11. Schutt, A., Feydy, T., Stuckey, P.J., Wallace, M.G.: Why Cumulative decompo-
sition is not as bad as it sounds. In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732,
pp. 746–761. Springer, Heidelberg (2009)
PREFIX-PROJECTION Global Constraint
for Sequential Pattern Mining
1 Introduction
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 226–243, 2015.
DOI: 10.1007/978-3-319-23219-5 17
PREFIX-PROJECTION Global Constraint for Sequential Pattern Mining 227
2 Preliminaries
This section presents background knowledge about sequential pattern mining
and constraint satisfaction problems.
sid Sequence
1 ABCBC
2 BABC
3 AB
4 BCD
The cover of a sequence p in SDB is the set of all tuples in SDB in which
p is contained. The support of a sequence p in SDB is the number of tuples in
SDB which contain p.
Definition 3 (coverage, support). Let SDB be a sequence database and
p a sequence. coverSDB (p)={(sid, s) ∈ SDB | p s} and supSDB (p) = #
coverSDB (p).
Definition 4 (sequential pattern). Given a minimum support threshold
minsup, every sequence p such that supSDB (p) ≥ minsup is called a sequen-
tial pattern [1]. p is said to be frequent in SDB.
3 Related Works
This section provides a critical review of ad hoc methods and CP approaches for
SPM.
GSP [17] was the first algorithm proposed to extract sequential patterns. It uses
a generate-and test approach. Later, two major classes of methods have been
proposed:
- Depth-first search based on a vertical database format e.g. cSpade incorporat-
ing contraints (max-gap, max-span, length) [21], SPADE [22] or SPAM [2].
- Projected pattern growth such as PrefixSpan [14] and its extensions, e.g.
CloSpan for mining closed sequential patterns [19] or Gap-BIDE [10] tackling the
gap constraint.
In [7], the authors proposed SPIRIT based on GSP for SPM with regular
expressions. Later, [18] introduces Sequence Mining Automata (SMA), a new
approach based on a specialized kind of Petri Net. Two variants of SMA were
proposed: SMA-1P (SMA one pass) and SMA-FC (SMA Full Check). SMA-1P pro-
cesses by means of the SMA all sequences one by one, and enters all resulting
valid patterns in a hash table for support counting, while SMA-FC allows fre-
quency based pruning during the scan of the database. Finally, [15] provides a
PREFIX-PROJECTION Global Constraint for Sequential Pattern Mining 231
survey for other constraints such as regular expressions, length and aggregates.
But, all these proposals, though efficient, are ad hoc methods suffering from a
lack of genericity. Adding new constraints often requires to develop new imple-
mentations.
1
A wildcard is a special symbol that matches any item of I including itself.
232 A. Kemmar et al.
Proof: Suppose that value d ∈ D(Pi+1 ) occurs in SDB|σ more than minsup.
From proposition 1, we have supSDB (concat(σ, d)) = supSDB|σ (d). Hence,
the assignment σ ∪ d satisfies the constraint, so d ∈ D(Pi+1 ) participates in a
solution. 2
Anti-monotonicity of the Frequency Measure. If a pattern p is not fre-
quent, then any pattern p satisfying p p is not frequent. From proposition 3
and according to the anti-monotonicity property, we can derive the following
pruning rule:
The key issue of our approach lies in the construction of the projected databases.
When projecting a prefix, instead of storing the whole suffix as a projected sub-
sequence, one can represent each suffix by a pair (sid, start) where sid is the
sequence identifier and start is the starting position of the projected suffix in
the sequence sid. For instance, let us consider the sequence database of Table 1.
234 A. Kemmar et al.
11 return SDB|α ;
4.4 Filtering
3
A sequential pattern p is maximal if there is no sequential pattern q such that pq.
PREFIX-PROJECTION Global Constraint for Sequential Pattern Mining 235
12 return True;
22 return F ;
5 Experimental Evaluation
This section reports experiments on several real-life datasets from [3,6,18] of
large size having varied characteristics and representing different application
domains (see Table 2). Our objective is (1) to compare our approach to existing
CP methods as well as to state-of-the-art methods for SPM in terms of scalability
which is a major issue of existing CP methods, (2) to show the flexibility of our
approach allowing to handle different constraints simultaneously.
Experimental Protocol. The implementation of our approach was carried
out in the Gecode solver4 . All experiments were conducted on a machine with a
processor Intel X5670 and 24 GB of memory. A time limit of 1 hour has been
used. For each dataset, we varied the minsup threshold until the methods are
not able to complete the extraction of all patterns within the time limit. was
set to the length of the longest sequence of SDB. The implementation and the
datasets used in our experiments are available online5 . We compare our approach
(indicated by PP) with:
1. two CP encodings [12], the most efficient CP methods for SPM: global-p.f
and decomposed-p.f;
2. state-of-the-art methods for SPM : and cSpade;
3. SMA [18] for SPM under regular expressions.
We used the author’s cSpade implementation 6 for SPM, the publicly avail-
able implementations of by Y. Tabei 7 and the SMA implementation 8 for SPM
under regular expressions. The implementation 9 of the two CP encodings was
4
http://www.gecode.org
5
https://sites.google.com/site/prefixprojection4cp/
6
http://www.cs.rpi.edu/∼zaki/www-new/pmwiki.php/Software/
7
https://code.google.com/p/prefixspan/
8
http://www-kdd.isti.cnr.it/SMA/
9
https://dtai.cs.kuleuven.be/CP4IM/cpsm/
238 A. Kemmar et al.
Fig. 1. Comparing PP with global-p.f for SPM on real-life datasets: CPU times.
carried out in the Gecode solver. All methods have been executed on the same
machine.
(a) Comparing with CP Methods for SPM. First we compare PP with
the two CP encodings global-p.f and decomposed-p.f (see Section 3.2). CPU
times (in logscale for BIBLE, Kosarak and PubMed) of the three methods are
shown on Fig. 1. First, decomposed-p.f is the least performer method. On all
the datasets, it fails to complete the extraction within the time limit for all
values of minsup we considered. Second, PP largely dominates global-p.f on
all the datasets: PP is more than an order of magnitude faster than global-p.f.
The gains in terms of CPU times are greatly amplified for low values of minsup.
On BIBLE (resp. PubMed), the speed-up is 84.4 (resp. 33.5) for minsup equal
to 1%. Another important observation that can be made is that, on most of
the datasets (except BIBLE and Kosarak), global-p.f is not able to mine for
patterns at very low frequency within the time limit. For example on FIFA, PP is
able to complete the extraction for values of minsup up to 6% in 1, 457 seconds,
while global-p.f fails to complete the extraction for minsup less than 10%.
To complement the results given by Fig. 1, Table 3 reports for different
datasets and different values of minsup, the number of calls to the propagate
routine of Gecode (column 5), and the number of nodes of the search tree (column
6). First, PP explores less nodes than global-p.f. But, the difference is not huge
(gains of 45% and 33% on FIFA and BIBLE respectively). Second, our approach
is very effective in terms of number of propagations. For PP, the number of
propagations remains small (in thousands for small values of minsup) compared
to global-p.f (in millions). This is due to the huge number of reified constraints
used in global-p.f to encode the subsequence relation. On the contrary, our
Prefix-Projection global constraint does not require any reified constraints
nor any extra variables to encode the subsequence relation.
PREFIX-PROJECTION Global Constraint for Sequential Pattern Mining 239
(b) Comparing with ad hoc Methods for SPM. Our second experiment
compares PP with state-of-the-art methods for SPM. Fig. 2 shows the CPU times
of the three methods. First, cSpade obtains the best performance on all datasets
(except on Protein). However, PP exhibits a similar behavior as cSpade, but it is
less faster (not counting the highest values of minsup). The behavior of cSpade
on Protein is due to the vertical representation format that is not appropriated
in the case of databases having large sequences and small number of distinct
items, thus degrading the performance of the mining process. Second, PP which
also uses the concept of projected databases, clearly outperforms on all datasets.
This is due to our filtering algorithm combined together with incremental data
structures to manage the projected databases. On FIFA, is not able to complete
the extraction for minsup less than 12%, while our approach remains feasible
until 6% within the time limit. On Protein, fails to complete the extraction for
all values of minsup we considered. These results clearly demonstrate that our
approach competes well with state-of-the-art methods for SPM on large datasets
and achieves scalability while it is a major issue of existing CP approaches.
(c) SPM under size and item constraints. Our third experiment aims at
assessing the interest of pushing simultaneously different types of constraints. We
impose on the PubMed dataset usual constraints such as the minimum frequency
and the minimum size constraints and other useful constraints expressing some
linguistic knowledge such as the item constraint. The goal is to retain sequential
patterns which convey linguistic regularities (e.g., gene - rare disease relation-
ships) [3]. The size constraint allows to remove patterns that are too small w.r.t.
the number of items (number of words) to be relevant patterns. We tested this
constraint with min set to 3. The item constraint imposes that the extracted
patterns must contain the item GENE and the item DISEASE. As no ad hoc
240 A. Kemmar et al.
Fig. 3. Comparing PP with global-p.f under minimum size and item constraints on
PubMed.
200k), and one real-life dataset (Protein). For data-200k, we used two RE: RE10 ≡
A∗ B(B|C)D∗ EF ∗ (G|H)I ∗ and RE14 ≡ A∗ (Q|BS ∗ (B|C))D∗ E(I|S)∗ (F |H)G∗ R.
For Protein, we used RE2 ≡ (S|T ) . (R|K) (where . represents any symbol).
Fig. 4 reports CPU-times comparison. On the synthetic dataset, our approach is
very effective. For RE14, our method is more than an order of magnitude faster
than SMA. On Protein, the gap between the 3 methods shrinks, but our method
remains effective. For the particular case of RE2, the Regular constraint can be
substituted by restricting the domain of the first and third variables to {S, T }
and {R, K} respectively (denoted as PP-SRE), thus improving performances.
6 Conclusion
Acknowledgments. The authors would like to thank the anonymous referees for
their valuable comments. This work is partly supported by the ANR (French Research
National Agency) funded projects Hybride ANR-11-BS002-002.
References
1. Agrawal, R., Srikant, R.: Mining sequential patterns. In: Yu, P.S., Chen, A.L.P.
(eds.) ICDE, pp. 3–14. IEEE Computer Society (1995)
2. Ayres, J., Flannick, J., Gehrke, J., Yiu, T.: Sequential pattern mining using a
bitmap representation. In: KDD 2002, pp. 429–435. ACM (2002)
3. Béchet, N., Cellier, P., Charnois, T., Crémilleux, B.: Sequential pattern mining to
discover relations between genes and rare diseases. In: CBMS (2012)
4. Beldiceanu, N., Contejean, E.: Introducing global constraints in CHIP. Journal of
Mathematical and Computer Modelling 20(12), 97–123 (1994)
5. Coquery, E., Jabbour, S., Saı̈s, L., Salhi, Y.: A SAT-based approach for discovering
frequent, closed and maximal patterns in a sequence. In: ECAI, pp. 258–263 (2012)
6. Fournier-Viger, P., Gomariz, A., Gueniche, T., Soltani, A., Wu, C., Tseng, V.:
SPMF: A Java Open-Source Pattern Mining Library. J. of Machine Learning Resea.
15, 3389–3393 (2014)
7. Garofalakis, M.N., Rastogi, R., Shim, K.: Mining sequential patterns with regular
expression constraints. IEEE Trans. Knowl. Data Eng. 14(3), 530–552 (2002)
8. Guns, T., Nijssen, S., Raedt, L.D.: Itemset mining: A constraint programming
perspective. Artif. Intell. 175(12–13), 1951–1983 (2011)
9. Kemmar, A., Ugarte, W., Loudni, S., Charnois, T., Lebbah, Y., Boizumault, P.,
Crémilleux, B.: Mining relevant sequence patterns with cp-based framework. In:
ICTAI, pp. 552–559 (2014)
10. Li, C., Yang, Q., Wang, J., Li, M.: Efficient mining of gap-constrained subsequences
and its various applications. ACM Trans. Knowl. Discov. Data 6(1), 2:1–2:39 (2012)
11. Métivier, J.P., Loudni, S., Charnois, T.: A constraint programming approach for
mining sequential patterns in a sequence database. In: ECML/PKDD Workshop
on Languages for Data Mining and Machine Learning (2013)
12. Negrevergne, B., Guns, T.: Constraint-based sequence mining using constraint
programming. In: Michel, L. (ed.) CPAIOR 2015. LNCS, vol. 9075, pp. 288–305.
Springer, Heidelberg (2015)
13. Novak, P.K., Lavrac, N., Webb, G.I.: Supervised descriptive rule discovery: A uni-
fying survey of contrast set, emerging pattern and subgroup mining. Journal of
Machine Learning Research 10 (2009)
14. Pei, J., Han, J., Mortazavi-Asl, B., Pinto, H., Chen, Q., Dayal, U., Hsu, M.:
PrefixSpan: Mining sequential patterns by prefix-projected growth. In: ICDE,
pp. 215–224. IEEE Computer Society (2001)
15. Pei, J., Han, J., Wang, W.: Mining sequential patterns with constraints in large
databases. In: CIKM 202, pp. 18–25. ACM (2002)
PREFIX-PROJECTION Global Constraint for Sequential Pattern Mining 243
16. Pesant, G.: A regular language membership constraint for finite sequences of vari-
ables. In: Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 482–495. Springer,
Heidelberg (2004)
17. Srikant, R., Agrawal, R.: Mining sequential patterns: Generalizations and perfor-
mance improvements. In: EDBT, pp. 3–17 (1996)
18. Trasarti, R., Bonchi, F., Goethals, B.: Sequence mining automata: A new tech-
nique for mining frequent sequences under regular expressions. In: ICDM 2008,
pp. 1061–1066 (2008)
19. Yan, X., Han, J., Afshar, R.: CloSpan: mining closed sequential patterns in large
databases. In: Barbará, D., Kamath, C. (eds.) SDM. SIAM (2003)
20. Yang, G.: Computational aspects of mining maximal frequent patterns. Theor.
Comput. Sci. 362(1–3), 63–85 (2006)
21. Zaki, M.J.: Sequence mining in categorical domains: Incorporating constraints. In:
Proceedings of the 2000 ACM CIKM International Conference on Information and
Knowledge Management, McLean, VA, USA, November 6–11, pp. 422–429 (2000)
22. Zaki, M.J.: SPADE: An efficient algorithm for mining frequent sequences. Machine
Learning 42(1/2), 31–60 (2001)
On Tree-Preserving Constraints
1 Introduction
Constraint satisfaction problems (CSPs) have been widely used in many areas,
such as scene labeling [10], natural language parsing [15], picture processing [16],
and spatial and temporal reasoning [5,14]. Since deciding consistency of CSP
instances is NP-hard in general, lots of efforts have been devoted to identify
tractable subclasses. These subclasses are usually obtained by either restricting
the topology of the underlying graph of the constraint network (being a tree or
having treewidth bounded by a constant) or restricting the type of the allowed
constraints between variables (cf. [17]).
In this paper, we are mainly interested in the second type of restriction.
Montanari [16] shows that path-consistency is sufficient to guarantee that a
network is globally consistent if the relations are all monotone. Van Beek and
Dechter [17] generalise monotone constraints to a larger class of row convex
constraints, which are further generalised to tree convex constraints by Zhang
and Yap [20]. These constraints also have the nice property that every path-
consistent constraint network is globally consistent.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 244–261, 2015.
DOI: 10.1007/978-3-319-23219-5 18
On Tree-Preserving Constraints 245
However, neither row convex constraints nor tree convex constraints are
closed under composition and intersection, the main operations of path-consistent
algorithms. This means enforcing path-consistency may destroy row and tree-
convexity. Deville et al. [6] propose a tractable subclass of row convex constraints,
called connected row convex (CRC) constraints, which are closed under composi-
tion and intersection. Zhang and Freuder [18] also identify a tractable subclass for
tree convex constraints, called locally chain convex and strictly union closed con-
straints. They also propose the important notion of consecutive constraints. Kumar
[13] shows that the subclass of arc-consistent consecutive tree convex (ACCTC)
constraints is tractable by providing a polynomial time randomised algorithm. But,
for the ACCTC problems, “it is not known whether there are efficient deterministic
algorithms, neither is it known whether arc- and path-consistency ensures global
consistency on those problems.” [18]
In this paper, we study and compare three subclasses of tree convex con-
straints which are called, respectively, chain-, path- and tree-preserving con-
straints. Chain-preserving constraints are exactly “locally chain convex and
strictly union closed” constraints and ACCTC constraints are strictly contained
in the subclass of tree-preserving constraints. We first show that every chain-
or path-preserving constraint network is in essence the disjoint union of several
independent CRC constraint networks and then prove that enforcing arc- and
path-consistency on a tree-preserving constraint network ensures global consis-
tency. This provides an affirmative answer to the above open problem raised
in [18]. Note also that our result is more general than that of Kumar [13] as
we do not require the constraint network to be arc-consistent. Moreover, when
enforcing arc- and path-consistent on a tree-preserving constraint network, in
each step, the network remains tree-preserving. This guarantees the applicabil-
ity of the partial path-consistency algorithm [2] to tree-preserving constraint
networks, which is usually more efficient than the path-consistency algorithm
for large sparse networks. We further show that a large subclass of the trihedral
scene labelling problem [10,12] can be modelled by tree-preserving constraints.
In the next section, we introduce basic notations and concepts that will be
used throughout the paper. Chain-, path-, and tree-preserving constraints are
discussed in Sections 3, 4, and 5, respectively. Application of tree-preserving
constraints in the scene labelling problem is shown in Section 6. Section 7 briefly
discusses the connection with majority operators [11] and concludes the paper.
2 Preliminaries
In this paper, we distinguish between tree and rooted tree. Standard notions
from graph theory are assumed. In particular, the degree of a node a in a graph
G, denoted by deg(a), is the number of neighbors of a in G.
Throughout this paper, we always associate a subtree with its node set.
Definition 2. A binary constraint has the form (xδy), where x, y are two vari-
ables with domains Dx and Dy and δ is a binary relation from Dx to Dy , or
δ ⊆ Dx × Dy . For simplicity, we often denote by δ this constraint. A value
u ∈ Dx is supported if there exists a value v in Dy s.t. (u, v) ∈ δ. In this case,
we say v is a support of u. We say a subset F of Dx is unsupported if every
value in F is not supported. Given A ⊆ Dx , the image of A under δ is defined
as δ(A) = {b ∈ Dy : (∃a ∈ A)(a, b) ∈ δ}. For A = {a} that contains only one
value, without confusion, we also use δ(a) to represent δ({a}).
A binary constraint network consists of a set of variables V = {x1 , x2 , ..., xn }
with a finite domain Di for each variable xi ∈ V , and a set Δ of binary constraints
over the variables of V . The usual operations on relations, e.g., intersection (∩),
composition (◦), and inverse (−1 ), are applicable to constraints. As usual, we
assume that there is at most one constraint for any ordered pair of variables
(x, y). Write δxy for this constraint if it exists. In this paper, we always assume
δxy is the inverse of δyx , and if there is no constraint for (x, y), we assume δxy is
the universal constraint.
- tree convex if the image of every value a in Dx (i.e. δ(a)) is a (possibly empty)
subtree of Ty ;
- consecutive if the image of every edge in Tx is a subtree in Ty ;
- path-preserving if the image of every path in Tx is a path in Ty .
- tree-preserving if the image of every subtree in Tx is a subtree in Ty .
On Tree-Preserving Constraints 247
3 Chain-Preserving Constraints
Zhang and Freuder [18] have proved that any consistent chain-preserving network
can be transformed to an equivalent globally consistent network by enforcing arc-
and path-consistency. This implies that the class of chain-preserving constraints
is tractable. We next show that every chain-preserving constraint network Δ can
be uniquely divided into a small set of k CRC constraint networks Δ1 , ..., Δk s.t.
Δ is consistent iff at least one of Δi is consistent.
We first recall the following result used in the proof of [18, Theorem 1].
248 S. Kong et al.
By the result we have proved so far, we know δxy (δyx ([u, v])) = [u, v] and
δyx ([u, v]) is contained in an ip-chain in Tx . Because [a, a∗ ] = δyx ([b, b∗ ]) ⊆
δyx ([u, v]) is an ip-chain, we know δyx ([u, v]) is exactly [a, a∗ ]. Therefore, we
have [u, v] = δxy (δyx ([u, v])) = δxy ([a, a∗ ]) = [b, b∗ ]. This proves that [b, b∗ ] is an
ip-chain in Ty .
Using the above result, we can break Tx into a set of ip-chains by deleting
the edges from each node a to its children if a has two or more children. Write
Ix for the set of ip-chains of Tx . Similar operation and notation apply to Ty . It
is clear that two different ip-chains in Ix are disjoint and δxy naturally gives rise
to a bijection from Ix to Iy .
Lemma 4. Suppose Δ is an arc-consistent and chain-preserving constraint net-
work over tree domains Tx (x ∈ V ). Fix a variable x ∈ V and let Ix = {Ix1 , ..., Ixl }
be the set of ip-chains of Tx . Then, for every y = x in V , the set of ip-chains
in Ty is {δxy (Ix1 ), δxy (Ix2 ), ..., δxy (Ixl )}. Write Δi for the restriction of Δ to Ixi .
Then each Δi is a CRC constraint network and Δ is consistent iff at least one
Δi is consistent.
The following result asserts that the class of chain-preserving constraints is
tractable.
Theorem 2. Let Δ be a chain-preserving constraint network. If no inconsis-
tency is detected, then enforcing arc- and path-consistency determines the con-
sistency of Δ and transforms Δ into a globally consistent network.
Proof. First, by Proposition 2, we transform Δ into an arc-consistent and
chain-preserving constraint network if no inconsistency is detected. Second, by
Lemma 4, we reduce the consistency of Δ to the consistency of the CRC con-
straint networks Δ1 , ..., Δl . By [6], we know enforcing path-consistency trans-
forms a CRC constraint network into a globally consistent one if no inconsistency
is detected. If enforcing arc- and path-consistency does not detect any inconsis-
tency, then the result is a set of at most l globally consistent CRC networks Δi ,
the union of which is globally consistent and equivalent to Δ.
Lemma 4 also suggests that we can use the variable elimination algorithm for
CRC constraints [19] to more efficiently solve chain-preserving constraints.
4 Path-Preserving Constraints
At first glance, path-preserving constraints seem to be more general than chain-
preserving constraints, but Fig. 1(a,b) show that they are in fact incomparable.
We show the class of path-preserving constraints is also tractable by estab-
lishing its connection with CRC constraints.
We have the following simple results.
Lemma 5. Suppose δxy and δyx are path-preserving (tree-preserving) w.r.t. tree
domains Tx and Ty . Let t be a subtree of Tx and δxy and δyx the restrictions of
δxy and δyx to t. Then both δxy and δyx are path-preserving (tree-preserving).
250 S. Kong et al.
Fig. 1. (a) A chain- but not path-preserving constraint; (b) A path- but not chain-
preserving constraint; (c) A tree-preserving but neither path- nor chain-preserving
constraint.
It is worth noting that this lemma does not require δyx to be path- or tree-
preserving.
The following result then follows directly.
Proposition 3. Let Δ be a path-preserving (tree-preserving) constraint network
over tree domains Tx (x ∈ V ). If no inconsistency is detected, then Δ remains
path-preserving (tree-preserving) after enforcing arc-consistency.
Lemma 8. Suppose δxy and δyx are arc-consistent and path-preserving w.r.t. Tx
and Ty . Assume a is a node in Tx with deg(a) > 2. Then there exists a unique
node b ∈ Ty s.t. (a, b) ∈ δxy . Moreover, deg(a) = deg(b).
Proof. Suppose π = a0 a1 ...ak is a maximal path in Tx and π ∗ = b0 b1 ...bl is its
image under δxy in Ty . W.l.o.g. we assume k, l ≥ 1. Suppose ai is a node in π
s.t. deg(ai ) > 2 and a ∈ π is another node in Tx s.t. {ai , a } is an edge in Tx .
Suppose δxy (ai ) = [bj , bj ] and j > j.
Because π is a maximal path and π ∗ is its image, we know δxy (a ) ∩ π ∗ = ∅.
Consider the edge {a , ai }. Since δxy ({a , ai }) is a path in Ty , there exists a
node b ∈ δxy (a ) s.t. either {b , bj } or {b , bj } is an edge in Ty . Suppose w.l.o.g.
{b , bj } is in Ty . Note that π ∗ = [b0 , bl ] is contained in the union of δxy ([a , a0 ])
and δxy ([a , ak ]). In particular, bl is in either δxy ([a , a0 ]) or δxy ([a , ak ]). Let
us assume bl ∈ δxy ([a , a0 ]). Then bl , bj , bj , b (which are not on any path) are
contained in the path δxy ([a , a0 ]), a contradiction. Therefore, our assumption
that δxy (ai ) = [bj , bj ] and j > j is incorrect. That is, the image of ai under δxy
is a singleton, say, {bj }. We next show deg(bj ) = deg(ai ).
Because δxy (ai ) = {bj }, the image of each neighbor of ai in Tx must contain
a neighbor of bj , as δxy is path-preserving. Moreover, two different neighbors
ai , ai of ai cannot map to the same neighbor bj of bj . This is because the image
of bj under δyx , which is a path in Tx , contains ai and ai , and hence also
contains ai . This contradicts the assumption δxy (ai ) = {bj }. This shows that
deg(ai ) = deg(bj ).
Definition 9. Let T be a tree. A path π from a to a∗ in T is called an irreducible
perfect path (ip-path) if (i) every node on path π has degree 1 or 2; and (ii) any
neighbour of a (or a∗ ) that is not on π has degree 3 or more.
Let Fx = {a ∈ Tx : deg(a) > 2} and Fy = {b ∈ Ty : deg(b) > 2}. Then δxy ,
when restricted to Fx , is a bijection from Fx to Fy . Removing all edges incident
to a node in Fx , we obtain a set of pairwise disjoint paths in Tx . These paths are
precisely the ip-paths of Tx . Write Px for this set. Then δxy induces a bijection
from Px to Py .
Lemma 9. Suppose Δ is an arc-consistent and path-preserving constraint net-
work over tree domains Tx (x ∈ V ). Fix a variable x ∈ V and let Px =
{πx1 , ..., πxl } be the set of ip-paths in Tx . Then, for every y = x, the set of ip-
paths in Ty is {δxy (πx1 ), ..., δxy (πxl )}. Write Δi for the restriction of Δ to πxi .
Then each Δi is a CRC constraint network and Δ is consistent iff at least one
Δi is consistent.
Thus the class of path-preserving constraints is tractable.
Theorem 3. Let Δ be a path-preserving constraint network. If no inconsistency
is detected, then enforcing arc- and path-consistency determines the consistency
of Δ and transforms Δ into a globally consistent network.
The proof is analogous to that of Theorem 2. Lemma 9 suggests that we can use
the variable elimination algorithm for CRC constraints [19] to more efficiently
solve path-preserving constraints.
252 S. Kong et al.
5 Tree-Preserving Constraints
It is easy to see that every arc-consistent chain- or path-preserving constraint is
tree-preserving, but Fig. 1(c) shows that the other direction is not always true.
In this section, we show that the class of tree-preserving constraints is
tractable. Given a tree-preserving constraint network Δ, we show that, when
enforcing arc- and path-consistency on Δ, in each step, the network remains
tree-preserving. Hence, enforcing arc- and path-consistency on Δ will transform
it to an equivalent globally consistent network if no inconsistency is detected.
Moreover, we show that the partial path-consistency algorithm (PPC) of [2] is
applicable to tree-preserving constraint networks. PPC is more efficient than
path-consistency algorithm for large sparse constraints.
Definition 10. Suppose a = b are two nodes of a tree T that are not neighbors.
The trunk between a, b, written Mab , is defined as the connected component of
T \{a, b} which contains all internal nodes of πa,b (see Fig.2). The M-contraction
of T by Ma,b , denoted by T Ma,b , is the tree obtained by removing nodes in
Ma,b and adding an edge {a, b} to T .
Lemma 10. Suppose δxy and δyx are arc-consistent and tree-preserving w.r.t.
tree domains Tx and Ty . Suppose a, b are two nodes in Tx s.t. δxy (a) ∪ δxy (b)
is not connected in Ty . Then there exist r, s ∈ Ty s.t. r ∈ δxy (a), s ∈ δxy (b),
and δyx (Mr,s ) ⊆ Ma,b . Let Ty∗ be the domain obtained by deleting from Ty all
nodes v s.t. δyx (v) ⊆ Ma,b . Then Ty∗ becomes a tree if we add the edge {r, s}.
Moreover, δxy and δyx remain arc-consistent and tree-preserving when restricted
to Tx Ma,b and Ty∗ .
On Tree-Preserving Constraints 253
Proof. Choose r ∈ δxy (a) and s ∈ δxy (b) such that the path πr,s from r to s in
Ty is a shortest one among {πr ,s : r ∈ δxy (a), s ∈ δxy (b)}. In particular, we
have πr,s ∩ (δxy (a) ∪ δxy (b)) = {r, s}. We assert that the image of every node v
in Mr,s under δyx is contained in Ma,b . Suppose otherwise and there exists u in
Tx \ Ma,b s.t. (u, v) ∈ δxy . Assume that u is in the same connected component as
a. Since the subtree δyx (πv,s ) contains u and b, it also contains a. This implies
that there is a node v on πv,s which is in δxy (a). This is impossible as v ∈ Mr,s
and δxy (a) ∩ πr,s = {r}. Therefore δyx (v) ⊆ Ma,b for any v ∈ Mr,s . Hence
δyx (Mr,s ) ⊆ Ma,b holds.
It is clear that, when restricted to Tx Ma,b and Ty Mr,s , δxy ({a, b})
is connected and so is δyx ({r, s}). For any other edge {a , b } in Tx Ma,b , by
δyx (Mr,s ) ⊆ Ma,b , δxy ({a , b }) ∩ Mr,s = ∅ and the image of {a , b } is unchanged
(hence connected) after the M-contraction of Ty . This shows that δxy is consec-
utive when restricted to Tx Ma,b . Furthermore, since every node in Tx Ma,b
is supported in Ty Mr,s , we know δxy is also tree-preserving when restricted
to Tx Ma,b .
It is possible that there is a node v ∈ Ty Mr,s s.t. δyx (v) ⊆ Ma,b . We assert
that any v like this has at most one branch in Ty \Mr,s s.t. there is a node v in the
branch which is supported under δyx by a node in Tx \ Ma,b . Because δxy is tree-
preserving when restricted to Tx Ma,b , this follows immediately from Lemma 6.
This implies that, if we remove all these nodes v s.t. δyx (v) ⊆ Ma,b from Ty Mr,s ,
the domain is still connected. As a consequence, the two constraints remain arc-
consistent and tree preserving when restricted to Tx Ma,b and Ty∗ .
In general, we have
Proof (Sketch). The result follows from Lemmas 10 and 5. One issue we need
to take care of is how two trunks interact. Suppose x, y, z are three different
variables and M , M are trunks to be contracted from Tx and Ty respectively.
Applying Lemma 10 to the constraints between x and z and, separately, to the
constraints between y and z, we get two different trunks, say Ma,b and Mc,d ,
to be contracted from the same tree domain Tz . Can we do this (i.e. applying
Lemma 10) one by one? Does the order of the contractions matter? To answer
these questions, we need to know what is exactly the union of two trunks. There
are in essence ten configurations as shown in Fig. 3. The union of two trunks can
be the whole tree, a branch, a trunk, or two disjoint trunks. If the union is the
whole tree, then the network is inconsistent; if it is a branch, then we can remove
it directly; if it is a trunk or two disjoint trunks, then we can use Lemma 10 to
contract them one by one in either order.
254 S. Kong et al.
Lemma 12. Assume δxy and δxy are two arc-consistent and tree-preserving
∗
constraints w.r.t. trees Tx and Ty . Let δxy = δxy ∩ δxy . Suppose u ∈ Tx and
∗
δxy (u) ∩ δxy (u) = ∅. Then the supported values of δxy in Tx are in at most two
branches of u.
∗
Proof. Suppose u1 , u2 , u3 are three supported values of δxy in Tx that are in
three different branches of u. Take wi ∈ δxy (ui ) ∩ δxy (ui ). For each i, we have
either wi ∈ δxy (u) or wi ∈ δxy (u). Recall that πwi ,wj denotes the unique path
πwi ,wj that connects wi to wj (1 ≤ i = j ≤ 3). There are two subcases. (1) One
node is on the path that connects the other two. Suppose w.l.o.g. w3 is between
w1 and w2 . If w3 ∈ δxy (u), then there exist v1 ∈ πw1 ,w3 and v2 ∈ πw3 ,w2 s.t.
v1 , v2 ∈ δxy (u). This is because the image of πw1 ,w3 and the image of πw3 ,w2
(under δyx ) both contain u. That is, v1 , v2 ∈ δxy (u) but w3 ∈ δxy (u). Since
δxy (u) is a subtree and w3 is on the path πv1 ,v2 , this is impossible. The case when
w3 ∈ δxy (u) is analogous. (2) The three nodes are in three different branches
of a node w. In this case, we note there exists a node between any path πwi ,wj
which is a support of u under δxy . It is easy to see that w itself is a support of u
under δxy . Similarly, we can show w is also a support of u under δxy . Since both
∗
subcases lead to a contradiction, we know the supported values of δxy are in at
most two branches of u.
Lemma 13. Suppose δxy and δxy are arc-consistent and tree-preserving con-
∗
straints w.r.t. trees Tx and Ty and so are δyx and δyx . Let δxy = δxy ∩ δxy .
∗ ∗
Assume {u, v} is an edge in Tx s.t. δxy (u) ∪ δxy (v) is disconnected in Ty . Then
∗ ∗
there exist r ∈ δxy (u) and s ∈ δxy (v) s.t. every node in Mr,s is unsupported
∗
under δyx .
∗ ∗
Proof. Write Tr = δxy (u) and Ts = δxy (v). Clearly, Tr and Ts are nonempty
subtrees of Ty . Since they are disconnected, there exist r ∈ Tr , s ∈ Ts s.t.
πr,s ∩ (Tr ∪ Ts ) = {r, s} (see Fig. 4 for an illustration). Write A = δxy (u),
B = δxy (v), C = δxy (u) and D = δxy (v). We show every node in Mr,s is not
∗
supported under δyx .
Suppose w is an arbitrary internal node on πr,s . We first show w is not
∗
supported under δyx . Note w ∈ A ∪ B, w ∈ C ∪ D, w ∈ A ∩ C, and w ∈ B ∩ D.
There are two cases according to whether w ∈ A. If w ∈ A, then we have w ∈ C,
w ∈ D, and w ∈ B. If w ∈ A, then we have w ∈ B, w ∈ D, and w ∈ C. Suppose
w.l.o.g. w ∈ A. By w ∈ A = δxy (u), we have u ∈ δyx (w); by w ∈ B = δxy (v), we
have v ∈ δyx (w). Similarly, we have u ∈ δyx (w) and v ∈ δyx (w). Thus subtree
∗
δyx (w) is disjoint from subtree δyx (w). This shows δyx (w) = ∅ and hence w is
∗
not supported under δyx .
Second, suppose w1 is an arbitrary node in Mr,s s.t. w1 is in a different branch
of w to r and s, i.e. πw,w1 ∩ (Tr ∪ Ts ) = ∅. We show w1 is not supported under
∗
δyx either.
Again, we assume w ∈ A. In this case, we have u ∈ δyx (w) ⊆ δyx (πw,w1 )
and v ∈ δyx (w) ⊆ δyx (πw,w1 ). As πw,w1 ∩ (Tr ∪ Ts ) = ∅, we have πw,w1 ∩ Tr =
πw,w1 ∩ A ∩ C = ∅. As πw,w1 ∩ A = ∅ and A ∩ C = ∅, by Lemma 1, we must
have πw,w1 ∩ δxy (u) = ∅. This shows u ∈ δyx (πw,w1 ). Similarly, we can show
v ∈ δyx (πw,w1 ). Thus subtree δyx (πw,w1 ) is disjoint from subtree δyx (πw,w1 ) and,
∗ ∗
hence, δyx (πw,w1 ) = ∅. This proves that w1 is not supported under δyx either.
In summary, every node in Mr,s is unsupported.
Proposition 4. [18] Assume δxz and δzy are two tree-preserving constraints
w.r.t. trees Tx , Ty , and Tz . Then their composition δxz ◦ δzy is tree-preserving.
256 S. Kong et al.
Proof. If we can show that Δ is still tree-preserving after enforcing arc and
path-consistency, then by Theorem 1 the new network is globally consistent if
no inconsistency is detected.
By Proposition 3, Δ remains tree-preserving after enforcing arc-consistency.
To enforce path-consistency on Δ, we need to call the following updating rule
The partial path-consistency (PPC) algorithm was first proposed by Bliek and
Sam-Haroud [2]. The idea is to enforce path consistency on sparse graphs by
triangulating instead of completing them. Bliek and Sam-Haroud demonstrated
that, as far as CRC constraints are concerned, the pruning capacity of path
consistency on triangulated graphs and their completion are identical on the
common edges.
An undirected graph G = (V, E) is triangulated or chordal if every cycle of
length greater than 3 has a chord, i.e. an edge connecting two non-consecutive
vertices of the cycle. For a constraint network Δ = {vi δij vj : 1 ≤ i, j ≤ n}
over V = {v1 , ..., vn }, the constraint graph of Δ is the undirected graph G(Δ) =
(V, E(Δ)), for which we have (vi , vj ) ∈ E(Δ) iff δij is not a universal constraint.
On Tree-Preserving Constraints 257
Given a constraint network Δ and a graph G = (V, E), we say Δ is partial path-
consistent w.r.t. G iff for any 1 ≤ i, j, k ≤ n with (vi , vj ), (vj , vk ), (vi , vk ) ∈ E
we have δik ⊆ δij ◦ δjk [2].
Theorem 5. Let Δ be a tree-preserving constraint network. Suppose G = (V, E)
is a chordal graph such that E(Δ) ⊆ E. Then enforcing partial path-consistency
on G is equivalent to enforcing path-consistency on the completion of G, in the
sense that the relations computed for the constraints in G are identical.
Proof. The proof is similar to the one given for CRC constraints [2, Theorem 3].
This is because, (i) when enforcing arc- and path-consistency on a tree-preserving
constraint network, in each step, we obtain a new tree-preserving constraint
network; and (ii) path-consistent tree convex constraint networks are globally
consistent.
Remark 1. Note that our definition and results of tree-preserving constraints
can be straightforwardly extended to domains with acyclic graph structures
(which are connected or not). We call such a structure a forest domain. Given a
tree-preserving constraint network Δ over forest domains F1 , ..., Fn of variables
v1 , ..., vn . Suppose Fi consists of trees ti,1 , ..., ti,ki . Note that the image of each
tree, say ti,1 , of Fi under constraint Rij is a subtree t of Fj . Assume t is con-
tained in the tree tj,s of forest Fj . Then the image of tj,s under constraint Rji
is a subtree of ti,1 . This establishes, for any 1 ≤ i = j ≤ n, a 1-1 correspondence
between trees in Fi and trees in Fj if the image of each tree is nonempty. In
this way, the consistency of Δ is reduced to the consistency of several parallel
tree-preserving networks over tree domains.
Fig. 5. Possible labelled line configurations of a junction in a picture and their corre-
sponding forest structures.
In this section, we show that (i) every instance of the trihedral scene labelling
problem can be modelled by a tree convex constraint network; (ii) a large sub-
class of the trihedral scene labelling problem can be modelled by tree-preserving
constraints; (iii) there exists a scene labelling instance which can be modelled
by tree-preserving constraints but not by chain- or CRC constraints.
A CSP for the scene labelling problem can be formulated as follows. Each
junction in the line-drawing picture is a variable. The domains of the vertices are
the possible configurations as shown in Fig. 5. The constraints between variables
are simply that, if two variables share an edge, then the edge must be labeled
the same at both ends.
Proposition 5. Every instance of the trihedral scene labelling problem can be
modelled by a tree convex constraint network. Furthermore, there are only 39
possible configurations of two neighbouring nodes in 2D projected pictures of 3D
trihedral scenes, and 29 out of these can be modelled by tree-preserving con-
straints.
Proof. The complete list of these configurations and their corresponding tree
convex or tree-preserving constraints is attached as an appendix. Note that we
do not consider T-junctions in line drawing pictures since they decompose into
unary constraints.
In this paper, when formulating a CSP, we allow different variables have different
tree domains. Feder and Vardi [7] and many other authors (see e.g. [1,11]) also
considered CSPs which have a common domain D for all variables. These CSPs
are called one-sorted in [3]. For one-sorted tree-preserving CSPs, we could also
define a majority operator [11] under which the set of tree-preserving constraints
is closed. This implies that the class of one-sorted tree-preserving CSPs has
bounded strict width [7] and hence tractable. Indeed, such a majority operator ρ
is defined as follows: for any three nodes a, b, c in a tree domain T , define ρ(a, b, c)
as the node d which is the intersection of paths πa,b , πa,c , and πb,c . Following [3],
it is straightforward to extend this result to multi-sorted tree-preserving CSPs.
In this paper, we identified two new tractable subclasses of tree convex con-
straint which are called path- and tree-preserving constraints, and proved that
a chain- or path-preserving constraint network is in essence the disjoint union
of several independent CRC constraint networks, and hence (re-)established the
tractability of these constraints. More importantly, we proved that when enforc-
ing arc- and path-consistency on a tree-preserving constraint network, in each
step, the network remains tree-preserving. This implies that enforcing arc- and
260 S. Kong et al.
References
1. Barto, L., Kozik, M.: Constraint satisfaction problems solvable by local consistency
methods. Journal of ACM 61(1), 3:1–3:19 (2014)
2. Bliek, C., Sam-Haroud, D.: Path consistency on triangulated constraint graphs.
In: IJCAI 1999, pp. 456–461 (1999)
3. Bulatov, Andrei A., Jeavons, Peter G.: An algebraic approach to multi-sorted
constraints. In: Rossi, Francesca (ed.) CP 2003. LNCS, vol. 2833, pp. 183–198.
Springer, Heidelberg (2003)
4. Conitzer, V., Derryberry, J., Sandholm, T.: Combinatorial auctions with structured
item graphs. In: AAAI 2004, pp. 212–218 (2004)
5. Dechter, R., Meiri, I., Pearl, J.: Temporal constraint networks. Artificial Intelli-
gence 49(1–3), 61–95 (1991)
6. Deville, Y., Barette, O., Hentenryck, P.V.: Constraint satisfaction over connected
row convex constraints. Artificial Intelligence 109(1–2), 243–271 (1999)
7. Feder, T., Vardi, M.Y.: The computational structure of monotone monadic snp and
constraint satisfaction: A study through datalog and group theory. SIAM Journal
on Computing 28(1), 57–104 (1998)
8. Freuder, E.C.: Synthesizing constraint expressions. Communications of the ACM
21(11), 958–966 (1978)
9. Freuder, E.C.: A sufficient condition for backtrack-free search. Journal of the ACM
29(1), 24–32 (1982)
10. Huffman, D.A.: Impossible objects as nonsense sentences. Machine Intelligence
6(1), 295–323 (1971)
11. Jeavons, P., Cohen, D.A., Cooper, M.C.: Constraints, consistency and closure.
Artificial Intelligence 101(1–2), 251–265 (1998)
12. Kirousis, L.M., Papadimitriou, C.H.: The complexity of recognizing polyhedral
scenes. In: FOCS 1985, pp. 175–185 (1985)
13. Kumar, T.K.S.: Simple randomized algorithms for tractable row and tree convex
constraints. In: AAAI 2006, pp. 74–79 (2006)
14. Li, S., Liu, W., Wang, S.: Qualitative constraint satisfaction problems: An extended
framework with landmarks. Artificial Intelligence 201, 32–58 (2013)
15. Maruyama, H.: Structural disambiguation with constraint propagation. In: ACL
1990, pp. 31–38 (1990)
16. Montanari, U.: Networks of constraints: Fundamental properties and applications
to picture processing. Information Sciences 7, 95–132 (1974)
On Tree-Preserving Constraints 261
17. Van Beek, P., Dechter, R.: On the minimality and global consistency of row-convex
constraint networks. Journal of the ACM 42(3), 543–561 (1995)
18. Zhang, Y., Freuder, E.C.: Properties of tree convex constraints. Artificial Intelli-
gence 172(12–13), 1605–1612 (2008)
19. Zhang, Y., Marisetti, S.: Solving connected row convex constraints by variable
elimination. Artificial Intelligence 173(12), 1204–1219 (2009)
20. Zhang, Y., Yap, R.H.C.: Consistency and set intersection. In: IJCAI 2003,
pp. 263–270 (2003)
Modeling and Solving Project Scheduling
with Calendars
1 Introduction
The resource-constrained project scheduling problem with general temporal and
calendar constraints (RCPSP/max-cal) is an extension of the well-known RCPSP
and RCPSP/max (see, e.g., [14, Chap. 2]) through calendars. The RCPSP/max-
cal can be given as follows. For a set of activities, which require time and renew-
able resources for their execution, execution time intervals must be determined
in a way that minimum and maximum time lags between activities are satisfied,
the prescribed resource capacities are not exceeded, and the project duration is
minimized. The difference with RCPSP/max is that a calendar is given for each
renewable resource type that describes for each time period whether the resource
type is available or unavailable. Time periods of unavailability can occur, e.g.,
due to weekends or public holidays. The activities and time lags are dependent
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 262–278, 2015.
DOI: 10.1007/978-3-319-23219-5 19
Modeling and Solving Project Scheduling with Calendars 263
resource 3
3 1 6 @
- @
1 2 3 @ 3
@
{1, 2, 3} {3}
@ 2 @
@
0 @ 0 @
R
@ 1
@ -t
0 5 1 2 3 4 5 6 7 8 9 10
∅ @ ∅ resource 2
@ 3 2
R 3 - 4
6 @ @ 4
@ 3
@ @
@ @ 3
@ @
{1, 2, 3} {1, 2} @ @
@ @
(a) Logic diagram of the example project 1 @ @
@ @ -t
1 2 3 4 5 6 7 8 9 10
resource 1
6 J
6 4
Cal3
JJ
J
3
Cal2
JJ
JJ
Cal1 -t
1
-t
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
on the resource calendars, too, and some activities can be interrupted for the
duration of a break while others cannot be interrupted due to technical reasons.
For the interruptible activities a start-up phase is given during which the activ-
ity is not allowed to be paused. Concerning the renewable resource types one
distinguishes resource types that stay engaged or are blocked, respectively, dur-
ing interruptions of activities that require it and resource types that are released
and can be used to carry out other activities during interruptions.
Our motivation for developing CP models for the RCPSP/max-cal and using
lazy clause generation to solve it lies in the very good results obtained by
[18,19,20] solving RCPSP and RCPSP/max by lazy clause generation.
Example 1. Figure 1 shows an illustrative example with six activities and three
renewable resource types. The project start (activity 0) and the project end
(activity 5) are fictitious activities, i.e., they do not require time or resources. A
logic diagram of the project is given in Fig. 1(a) where each activity is represented
by a node with the duration given above and the set of resource types used by
the activity below the node. The arcs between the nodes represent time lags.
The calendars of the three renewable resource types are depicted in Fig. 1(b).
If there is a box with an X for a resource type k and time t, then resource type k
is not available at time t. Resource type 1 is always available and can be thought
of as a machine. Resource types 2 and 3 can be thought of as different kinds of
staff where resource type 2 (3) has a five-day (six-day) working week. In addition,
assume that resource type 1 stays engaged or is blocked, respectively, during a
264 S. Kreter et al.
break of an activity that requires resource type 1 for its execution while resource
types 2 and 3 are released during interruptions of activities.
A possible resource allocation of the three renewable resource types is shown
in Fig. 1(c). Activity 3 requires all renewable resource types for its execution.
Since resource type 2 is not available in periods 6 and 7, activity 3 is interrupted
during these periods. While resource type 1 stays engaged during the interrup-
tion, resource type 3 can be used to carry out activity 2 in period 6.
Few authors have dealt with calendars in project scheduling so far. A time
planning method for project scheduling with the same calendar for each resource
type is introduced in [23]. In [6] the RCPSP/max with different calendars for
each renewable resource type is investigated for the first time but the start-
up phase of the interruptible activities are not taken into account. [6] proposes
methods to determine the earliest and latest start and completion times for the
project activities and priority rule methods. Procedures to determine the earliest
and latest start times if a start-up phase is taken into account are presented in
[7] and [14, Sect. 2.11]. In addition, they sketch how priority-rule methods for
the RCPSP/max can be adapted for calendars. In the approach in [7] and [14,
Sect. 2.11] all resources stay engaged during interruptions of activities. Within
the priority-rule methods in [6,7], and [14, Sect. 2.11] the procedures to deter-
mine the earliest and latest start times must be carried out in each iteration.
Recently, a new time planning method, three binary linear model formulations,
and a scatter search procedure for the RCPSP/max-cal were developed in [9].
Moreover, Kreter et al. [9] introduce a benchmark test set which is based on
the UBO test set for RCPSP/max [8]. The time planning method determines all
time and calendar feasible start times for the activities and absolute time lags
depending on the start times of the activities once in advance and then uses this
throughout the scatter search.
In CP, the works [3,4] respectively propose calendar constraints/rules for
ILOG Schedule and Cosytech CHIP. The former [3] was generalized to intensity
functions of activities in IBM ILOG CP Optimizer, while breaks of activities
extend the length between their start and end times, only resource types that
stay engaged can be modeled directly. The latter [4] introduces constraint rules
in the global constraint diffn for parallel machine scheduling.
A practical application where calendars must be considered as well as other
additional constraints can be found in batch scheduling [21]. Problems that are
related to the RCPSP/max-cal are treated in [22,5]. An alternative approach to
include calendars into project scheduling that makes use of calendar independent
start-start, start-end, end-start, and end-end time lags is proposed in [22] and [5]
studies the RCPSP with non-preemptive activity splitting, where an activity in
process is allowed to pause only when resource levels are temporarily insufficient.
2 Problem Description
In this section we describe the RCPSP/max-cal formally and give an example
instance. We use identifiers and definitions from [9]. In what follows, we assume
Modeling and Solving Project Scheduling with Calendars 265
is satisfied.
With Ri := {k ∈ R | rik > 0} indicating the set of resource types that is used
to carry out activity i ∈ V , an activity calendar Ci (·) : [0, d) → {0, 1} can be
determined from the resource calendars as follows:
mink∈Ri Calk (t), if Ri
= ∅
Ci (t) :=
1, otherwise.
When calendars are present, we have to distinguish activities that can be inter-
rupted for the duration of a break in the underlying activity calendar and activ-
ities that are not allowed to be interrupted. The set of (break-)interruptible
activities is denoted by V bi ⊂ V and the set of non-interruptible activities is
given by V ni = V \ V bi , where V f ⊆ V ni holds. The execution of an activity
i ∈ V bi must be interrupted at times t with Ci (t) = 0, and the execution must
be continued at the next point in time τ > t with Ci (τ ) = 1. Si ∈ T indicates the
start time and Ei ∈ T represents the end of activity i ∈ V . Since the jump points
in the calendars Calk , k ∈ R, are all integer valued, the points in time where an
activity is interrupted or continued are integer valued, too. The completion time
266 S. Kreter et al.
t−1
of activity i ∈ V can be determined by Ei (Si ) := min{t | τ =Si Ci (τ ) = pi }.
For each activity i ∈ V a start-up phase εi ∈ N0 is given during which activity
i is not allowed to be interrupted. For all activities i ∈ V ni εi := pi holds. We
assume that the underlying project begins at time 0, i.e., S0 := 0. Then, the
project duration equals Sn+1 . In addition, we assume that no activity i ∈ V can
be in execution before the project start, i.e., Si ≥ 0, or after the project end,
i.e., Ei ≤ Sn+1 .
Between the activities a set A of minimum and maximum time lags is given.
W.l.o.g. these time lags are defined between the start times of the activities (see
[6,9]). For each time lag i, j ∈ A, a resource set Rij ⊆ R and a length δij ∈ Z
are given, from which we can compute a calendar Cij (·) : [0, d) → {0, 1} for each
time lag by
mink∈Rij Calk (t), if Rij
= ∅
Cij (t) :=
1, otherwise
i.e., at least tu time units mustelapse after the start of activity i before activity j
t−1
can start where tu = min{t | τ =Si Cij (τ ) = δij }.
With parameter ρk we indicate whether renewable resource types k ∈ R
stay engaged or are blocked, respectively, during interruptions of activities that
require it (ρk = 1) or are released and can be used to carry out other activities
during interruptions (ρk = 0). A vector S = (S0 , S1 , . . . , Sn+1 ) of all activity
start times is called a schedule. Given a schedule S and point in time t the set
of all real activities i ∈ V r that are started before but not completed at time
t is called the active set and can be determined by A(S, t) := {i ∈ V r | Si ≤
t < Ei (Si )}. Then, the resource utilization rkcal (S, t) of resource k ∈ R at time t
according to schedule S can be computed by
rkcal (S, t) := rik + rik ρk .
i∈A(S,t)|Ci (t)=1 i∈A(S,t)|Ci (t)=0
With the introduced notation the following mathematical formulation for the
RCPSP/max-cal can be given (cf. [6]):
The aim of the RCPSP/max-cal is to find a schedule that minimizes the project
makespan (1) and satisfies the calendar constraints (2), time lags (3), and
resource capacities (4).
Each project can be represented by an activity-on-node network where each
activity i ∈ V is represented by a node and each time lag i, j ∈ A is given by
an arc from node i to node j with weights δij and Rij . The activity duration as
Modeling and Solving Project Scheduling with Calendars 267
6 s rs 6 s rs
3 3
2 s sr3 s sr 2 3 s rs s rs
1 1 s sr 4 1 s sr 3 3 s sr
s rs 3 s- t s rs 1 s sr 4 s- t
5 10 5 10
r3cal (S, t)
6 s rs s rs
3
2 s sr3
1 1 s sr2 s sr
s rs 3 s rs3 s -t
5 10
W4 = {3, 7, 8}, and W5 = {5, 6, 7, 8, 9, 10}. For example, activity 4 cannot start
at times 5 or 6 since there is a break in calendar C4 from 5 to 7. Moreover, activ-
ity 4 cannot start at time 4 because it has to be executed without interruptions.
Due to the time lag between activities 3 and 4, activity 3 cannot start at time
1, because if activity 3 started at time 1 activity 4 must start at time 4.
For the time- and calendar-feasible schedule S = (0, 1, 5, 3, 8, 10) the resource
profiles are given in Fig. 3. As already mentioned in the introduction resource
type 1 stays engaged during interruptions (ρ1 = 1) while resource types 2 and
3 are released during interruptions (ρ2 = ρ3 = 0). If the inequality Rk ≥ 3 is
fullfilled for each k ∈ R, schedule S is resource feasible and therefore a feasible
solution for the given example. 2
Thereby, dij is an array that contains for all Si ∈ Wi the corresponding dij (Si )
value. Then, the constraints modelling time lags are
Absolute durations of the activities i ∈ V are used and the correct assignment
is ensured again by element constraints, where pi is an array containing for all
Si ∈ Wi the coresponding pi (Si ) value.
Model timeidx can now be given by: Minimize Sn+1 subject to (6) − (11).
In addition, some decomposed constraints from (10) and (11) are required to
enforce non-overload of resource k at times Rtimes
k .
bit ↔ Si ≤ t ∧ t < Si + pi i ∈ V r, t ∈ Rtimes
k (14)
k∈R:ρk =0
bit rik Ci (t) ≤ Rk k ∈ R : ρk = 0, t ∈ Rtimes
k (15)
i∈V r
Rtimes
k := {t ∈ T | ∃ i, j ∈ V : rik > 0 ∧ rjk > 0 ∧ min Wi ≤ t < Ei (max Wi )∧
min Wj ≤ t < Ej (max Wj ) ∧ Ci (t)
= Cj (t)}
Model 2cap can be achieved by deleting constraints (10) and (11) from model
timeidx and adding constraints (12)–(15) instead.
Example 3. Regarding the example project from Fig. 2 on page 267, resource 3
is the only resource where Rtimes
k
= ∅. We can see in Fig. 3 on page 268 that
in time period 6 activity 2 is in execution and activity 3 is interrupted. Hence
Rtimes
3 = {5}. The solution presented in Fig. 3 is resource feasible for R3 = 3 but
cumulative does not know that activity 3 is interrupted and detects a resource
overload if resource limit R3 = 3 is used. By doubling the resource capacity and
introducing a set V3d of dummy activities requiring 3 resources in all periods
but 6, the cumulative of (13) does not detect a resource overload. The reason
for the decomposed constraint (15) for time point 5 is clear when we imagine
another activity 2 that requires resource type 3 for its execution and could be
in execution in time period 6 just like activity 2, then for any solution where
both activities 2 and 2 are in execution in time period 6 there is a resource
overload, which the cumulative does not detect when the resource capacity is
doubled.
Sai1 = Si i ∈ V bi (16)
Saij = next starti (Saij−1 ) i ∈ V bi , j ∈ {2, . . . , |Addi |} (17)
j−1
paij = min(next breaki (Saij ), pi − paih ) i ∈ V bi , j ∈ {1, . . . , |Addi |} (18)
h=1
raij ,k = rik i ∈ V bi , j ∈ {1, . . . , |Addi |} (19)
Modeling and Solving Project Scheduling with Calendars 271
Thereby, next breaki (t) gives the start time of the next break after time t in
calendar Ci and next starti (t) gives the end time of the next break as defined
in Sect. 2. Finally, the resource requirement of each additional activity aij ∈ Addi
is set equal to rik and the global cumulative propagator can be used:
cumulative(S, p , rk , Rk ) k ∈ R : ρk = 1 (20)
cumulative(S a , pa , rka , Rk ) k ∈ R : ρk = 0 (21)
In constraints (21), the vectors S a , pa , and rka contain not only the start times,
durations, and resource requirements of the additional activities aij , i ∈ V bi , j ∈
{1, . . . , |Addi |}, but also the start times, durations, and resource requirements
of the non-interruptible activities i ∈ V ni .
Model addtasks can be achieved by deleting constraints (10) and (11) from
model timeidx as well as adding constraints (16)–(21) instead.
In a lazy clause generation solver integer domains are represented using Boolean
variables. Each variable x with initial domain D0 (x) = {l, . . . , u} is represented
by two sets of Boolean variables x = d, l ≤ d ≤ u and x ≤ d, l ≤ d < u which
define which values are in D(x). A lazy clause generation solver keeps the two
representations of the domain in sync. In order to explain the resource overload,
we use a pointwise explanation [18] at T imeD, which is the nearest integer to
the mid-point of [s, e).
∀i ∈ Ω : back(i, T imeD + 1) ≤ Si ∧ Si ≤ T imeD → f alse
t−1
max{τ ∈ T | z=τ Ci (z) = pi } if Ci (t − 1) = 1
back(i, t) := t−1
max{τ ∈ T | z=τ Ci (z) = pi − 1} if Ci (t − 1) = 0.
The definition by cases for back(i, t) is necessary to guarantee the execution of
activity i at time t−1, if Si = t−back(i, t) holds. If for a time t with Ci (t−1) = 0
back(i, t) would be calculated with the first case, then Ei (t − back(i, t)) < t and
the explanation would be incorrect.
If there exists a proper subset of activities Ω ⊂ Ω with i∈Ω rik > Rk , the
explanation of the resource overload is done on set Ω . Sometimes more than
one such subset exists. In this situation the lexicographic least set of activities
is chosen as was done in [18].
Time-table filtering is also based on the resource profile of calendar com-
pulsory parts of all activities. In a filtering without explanations the height of
the calendar compulsory parts concerning one time period or a time interval
is given. For an activity the profile is scanned through to detect time intervals
where it cannot be executed. The lower (upper) bound of an activity’s start
time is updated to the first (last) possible time period with respect to those
time intervals and the activity calendar. If we want to explain the new lower
(upper) bound we need to know additionally which activities have the calendar
compulsory parts of those time intervals.
A profile is a triple (A, B, C) where A = [s, e) is a time interval, B the set of
all activities that have a calendar compulsory part in the time interval A, and
C the sum of the resource requirements rik of all activities in B. Here, we only
consider profiles with a maximal time interval A with respect to B and C, i.e.,
no other profile ([s , e ), B, C) exists where s = e or e = s.
Let us consider the case when the lower bound of the start time variable
for activity i can be maximally increased from its current value lb(Si ) to a new
value LB(i) using time-table filtering (the case of decreasing upper bounds is
analogous and omitted). Then there exists a sequence of profiles [D1 , . . . , Dp ]
where Dh = ([sh , eh ), Bh , Ch ) with e0 = lb(Si ) and ep = LB(i) such that
∀h : 1 ≤ h ≤ p; Ch + rik > Rk ∧ sh < eh−1 + pi (eh−1 )
In Sect. 2, we introduced pi (t) only for t ∈ Wi . Note that pi (t) can be calculated
in the same way for t ∈ / Wi , where pi (t) takes the value d − t if less than pi
working periods are following after t in calendar Ci . In addition, if ρk = 0 is
satisfied then
∀h : 1 ≤ h ≤ p; ∃ t ∈ [sh , eh ) : Ci (t) = 1
Modeling and Solving Project Scheduling with Calendars 273
cmp(179) all(180)
model search #opt #feas #inf #un avg. rt avg. #cp avg. rt avg. #cp
cumucal alt 161 0 19 0 1.13 3847 1.71 5236
cumucal ff 160 1 19 0 7.54 16401 10.83 16310
cumucal hs 161 0 19 0 1.33 5358 1.80 6349
cumucal vsids 161 0 19 0 4.27 18495 4.79 19445
cmp(140) all(180)
model search #opt #feas #inf #un avg. rt avg. #cp avg. rt avg. #cp
cumucal alt 158 11 11 0 7.58 11498 56.18 25170
cumucal ff 150 16 10 4 13.73 14305 82.51 16420
cumucal hs 152 17 11 0 20.33 34900 85.20 45109
cumucal vsids 133 36 11 0 76.87 146172 185.61 122457
Tables 1 and 2 show the results of chuffed on the cumucal model using dif-
ferent search strategies on instances with 50 and 100 activities, respectively. The
search strategies behave similar with the other models. We show the number of
instances proven optimal (#opt), not proven optimal but where feasible solutions
were found (#feas), proven infeasible (#inf), and where nothing was determined
(#un). We compare the average runtime in seconds (avg. rt) and average number
of choice points to solve (avg. #cp), on two subsets of each benchmark. The cmp
subset are all the benchmarks where all solvers proved optimality or infeasibility,
and all is the total set of benchmarks.
The alt search is clearly the fastest, also leading to the lowest average number
of nodes explored in comparison to the rest. Interestingly, the performance of
vsids significantly decays from instances with 50 activities to those ones with
100 activities in proportion to alt and ff. This decay also affects hs, but not
so dramatically. The strength of the alt method is the combination of integer
based search in ff which concentrates on activities that have little choice left,
with the robustness of vsids which is excellent for proving optimality once a
good solution is known.
276 S. Kreter et al.
cmp(177) all(180)
model search #opt #feas #inf #un avg. rt avg. #cp avg. ft avg. rt avg. #cp
addtasks alt 160 1 19 0 9.10 14232 0.84 15.39 17924
cumucal alt 161 0 19 0 0.92 3203 0.48 1.71 5236
timeidx alt 158 3 19 0 22.20 3484 18.65 31.82 3426
2cap alt 161 0 19 0 1.55 5341 0.72 3.12 9619
cmp(138) all(180)
model search #opt #feas #inf #un avg. rt avg. #cp avg. ft avg. rt avg. #cp
addtasks alt 139 28 10 3 25.88 26344 4.05 139.47 35525
cumucal alt 158 11 11 0 3.24 5037 2.45 56.18 25170
timeidx alt 131 38 10 1 83.37 4947 78.24 196.63 4031
2cap alt 153 16 11 0 6.13 8798 4.05 78.96 30728
cmp(170) all(180)
model search #opt #feas #inf #un avg. rt avg. #cp avg. ft avg. rt avg. #cp
cumucal chuffed+alt 161 0 19 0 0.59 2198 0.48 1.71 5236
timeidx chuffed+alt 158 3 19 0 10.45 1662 18.65 31.82 3426
timeidx ocpx+free 159 2 19 0 69.95 13383 19.97 83.92 14155
mip 153 7 18 2 222.42 — — 750.25 —
(mip), which is solved using CPLEX 12.6 on an Intel Core i7 CPU 990X with
3.47 GHz and 24GB RAM under Windows 7. For mip the runtime limit was
set to 3 hours and 8 threads were used. To get an idea of the impact of the
machine used, we also ran ocpx with the deterministic search ff on the same
Windows machine. ocpx was more than 3 times faster on that machine. It can
be seen that chuffed and ocpx clearly outperform the state-of-the-art solution
approach, which is mip, and that the machine we used is even slower than the
machine used in [9].
Overall the cumucal model closes all open benchmarks of size 50 and 75 of
size 100, and clearly, we significantly advance the state of the art.
References
1. Aggoun, A., Beldiceanu, N.: Extending CHIP in order to solve complex scheduling
and placement problems. Mathematical and Computer Modelling 17(7), 57–73
(1993)
2. Ahuja, R., Magnanti, T., Orlin, J.: Network Flows. Prentice Hall, Englewood Cliffs
(1993)
3. Baptiste, P.: Constraint-Based Scheduling: Two Extensions. Master’s thesis, Uni-
versity of Strathclyde, Glasgow, Scotland, United Kingdom (1994)
4. Beldiceanu, N.: Parallel machine scheduling with calendar rules. In: International
Workshop on Project Management and Scheduling (1998)
5. Cheng, J., Fowler, J., Kempf, K., Mason, S.: Multi-mode resource-constrained
project scheduling problems with non-preemptive activity splitting. Computers &
Operations Research 53, 275–287 (2015)
6. Franck, B.: Prioritätsregelverfahren für die ressourcenbeschränkte Projektplanung
mit und ohne Kalender. Shaker, Aachen (1999)
7. Franck, B., Neumann, K., Schwindt, C.: Project scheduling with calendars. OR
Spektrum 23, 325–334 (2001)
8. Franck, B., Neumann, K., Schwindt, C.: Truncated branch-and-bound, schedule-
construction, and schedule-improvement procedures for resource-constrained
project scheduling. OR Spektrum 23, 297–324 (2001)
9. Kreter, S., Rieck, J., Zimmermann, J.: Models and solution procedures for the
resource-constrained project scheduling problem with general temporal constraints
and calendars. Submitted to European Journal of Operational Research (2014)
10. Lahrichi, A.: Scheduling: The notions of hump, compulsory parts and their use in
cumulative problems. Comptes Rendus de l’Académie des Sciences. Paris, Série 1,
Matématique 294(2), 209–211 (1982)
11. Luby, M., Sinclair, A., Zuckerman, D.: Optimal speedup of Las Vegas algorithms.
Information Processing Letters 47, 173–180 (1993)
12. Moskewicz, M.W., Madigan, C.F., Zhao, Y., Zhang, L., Malik, S.: Chaff: engineer-
ing an efficient SAT solver. In: Proceedings of Design Automation Conference -
DAC 2001, pp. 530–535. ACM, New York (2001)
278 S. Kreter et al.
13. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc:
towards a standard CP modelling language. In: Bessière, C. (ed.) CP 2007. LNCS,
vol. 4741, pp. 529–543. Springer, Heidelberg (2007)
14. Neumann, K., Schwindt, C., Zimmermann, J.: Project Scheduling with Time Win-
dows and Scarce Resources, 2nd edn. Springer, Berlin (2003)
15. Ohrimenko, O., Stuckey, P.J., Codish, M.: Propagation via lazy clause generation.
Constraints 14(3), 357–391 (2009)
16. Schutt, A.: Improving Scheduling by Learning. Ph.D. thesis, The University of
Melbourne (2011). http://repository.unimelb.edu.au/10187/11060
17. Schutt, A., Feydy, T., Stuckey, P.J.: Explaining time-table-edge-finding propaga-
tion for the cumulative resource constraint. In: Gomes, C., Sellmann, M. (eds.)
CPAIOR 2013. LNCS, vol. 7874, pp. 234–250. Springer, Heidelberg (2013)
18. Schutt, A., Feydy, T., Stuckey, P.J., Wallace, M.G.: Explaining the cumulative
propagator. Constraints 16(3), 250–282 (2011)
19. Schutt, A., Feydy, T., Stuckey, P.J., Wallace, M.G.: Solving RCPSP/max by lazy
clause generation. Journal of Scheduling 16(3), 273–289 (2013)
20. Schutt, A., Feydy, T., Stuckey, P.J., Wallace, M.G.: A satisfiability solving app-
roach. In: Schwindt, C., Zimmermann, J. (eds.) Handbook on Project Management
and Scheduling, vol. 1, pp. 135–160. Springer International Publishing (2015)
21. Schwindt, C., Trautmann, N.: Batch scheduling in process industries: An applica-
tion of resource-constrained project scheduling. OR Spektrum 22, 501–524 (2000)
22. Trautmann, N.: Calendars in project scheduling. In: Fleischmann, B., Lasch, R.,
Derigs, U., Domschke, W., Rieder, U. (eds.) Operations Research Proceedings 2000,
pp. 388–392. Springer, Berlin (2001)
23. Zhan, J.: Calendarization of timeplanning in MPM networks. ZOR - Methods and
Models of Operations Research 36, 423–438 (1992)
Deterministic Estimation of the Expected
Makespan of a POS Under Duration Uncertainty
1 Introduction
A Partial Order Schedule (POS) is an acyclic graph G = A, E, where A is a set
of activities ai , and E is a set of directed edges (ai , aj ) representing end-to-start
precedence relations. A POS is a flexible solution to a scheduling problem: some
of the edges derive from the original Project Graph, while the remaining ones are
added by an optimization approach so as to prevent potential resource conflicts.
A POS is very well suited as a solution format in the presence of dura-
tion uncertainty. Before the execution starts, each activity has a candidate start
time. During execution, whenever a duration becomes known, the start times
are updated (in O(n2 ) time) so that no precedence relation is violated: this
guarantees that the schedule remains resource feasible.
In the presence of duration uncertainty, the quality of a POS should be
evaluated via a stochastic metric, which in this paper is the expected value of
the makespan: this is far from being a perfect choice, but still a fair one in many
settings (in particular when the POS should be repeatedly executed, such as in
stream processing applications).
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 279–294, 2015.
DOI: 10.1007/978-3-319-23219-5 20
280 M. Lombardi et al.
Finding the worst-case distribution This makes it possible to model the con-
struction of a worst-case distribution as an optimization problem. Formally, let
us introduce for each scenario a decision variable pωk ∈ [0, 1] representing the
value of P (ωk ). The assignment of the pωk variables must be such that the known
values of the expected durations are respected:
⎛ ⎞
d˜i − di
di p ωk + d i ⎝ 1 − pωk ⎠ = d˜i and hence: p ωk = (2)
di − di
ωk :Di =di ωk :Di =di ωk :Di =di
p ωk ≥ 0 ∀ωk ∈ Ω (6)
where Ω = ai ∈A di , di . Equation (3) is the makespan definition (D(ωk ) are
the durations in ωk ), Equation (4) corresponds to Equation (2), and Equation (5)
ensures that the total probability mass does not exceed one. It is safe to use a
≤ sign in Equation (4) and (5), because increasing a pωk can only improve the
problem objective and therefore all constraints are tight in any optimal solution.
P0 is linear, but has unfortunately an exponential number of variables.
Most of the terms in Equation (7) are constants that can be computed via a
pre-processing step. The only input terms that change at search time are T
and T , which are simplified notations for T (di ) and T (di ): both values can be
efficiently made available as decision variables in a PCP approach via (e.g.)
the methods from the Constraint Programming approach in [10]. The estimator
formula is non-linear, but it is not difficult to embed in a CP model by using
widely available building blocks: the resulting encoding is propagated in O(|A|).
The estimator is obtained via a non-trivial process that is discussed in detail
in the remainder of this section. Its accuracy and robustness are discussed in
Section 3.3.
Evaluating the Model: The effectiveness of using a layered graph as a model for
more complex POSs is difficult to assess in a theoretical fashion, but can be
checked empirically. Basically, if the model works, it should lead to reasonably
accurate predictions of (e.g.) the value of E [T (D)] with worst-case distribution.
This evaluation can be done by: 1) generating graphs with different number
of activities, different width values, and different durations parameters; then 2)
using Algorithm 1 to obtain the expected makespan with worst-case distribution.
Then the results should be compared with the results obtained for a set of POSs
representing solutions to real scheduling problems: if the results are similar, it
will be an indication of the model quality. In the remainder of this section, we
will use this approach to investigate the impact of changing the width on the
value of Ewc [T (D)].
Measuring the Width: The width w of a layered graph is (by definition) the
number of activities in each layer. The width of a real POS is instead a much
fuzzier concept. In our evaluation, an approximate width value is computed as:
|A| T 1
w= with: nL = and: avg(di ) = di (8)
nL avg(di ) |A|
ai ∈A
Intuitively, we estimate the width as the ratio between the number of activities
|A| and the (estimated) number of layers nL . The number of layers is obtained by
dividing the makespan with maximal durations T by the average di . By applying
algebraic simplifications, we obtain the compact formula:
di
w = ai ∈A (9)
T
We use the same symbol (i.e. w) for both layered graphs and real POSs, because
Equation (9) returns the “true” width when applied to our simplified model.
i.e. by dividing the original value by the sum of the maximal durations. This
normalization allows to compare on a uniform scale the expected makespan of
graphs with widely different durations and number of activities. For our simpli-
fied model, the calculation makes the value of d completely irrelevant, which is
the reason for fixing the maximal duration to 1 in the experimentation.
Some Results: We have obtained plots reporting the value of Ewc [T (D)] over
the graph width. Figure 1 shows the plots for the simplified model (with 64
activities) on the left, and for all the real POSs on the right. The values of d˜i in
both cases have been generated uniformly at random between di (which is always
0) and 0.5 di . The colors represent the data point density, which is benchmark
dependent and unfortunately not very informative.
The results are very interesting. First, the general shape of the plots does
not appear to depend on the number of activities: this can be inferred by the
Deterministic Estimation of the Expected Makespan of a POS 287
Fig. 1. Value of Ewc [T (D)] over the graph width for the simplified model (left) and
the real POSs (right)
plot for the real POSs, for which the number of activities ranges from 30 to 600.
For the simplified model the plots with 16 and 32 activities (not reported) are
almost indistinguishable from the plot with 64.
The most important result, however, is that the behavior of the simplified
model and of the real graphs is remarkably similar, in terms of both shape and
scale. This is particularly striking given the wide range of graph structures con-
tained in our benchmark, and suggests that our simplified model is indeed well
suited for studying the behavior of real POSs.
A necessary condition for the similarity to show up is that the values of
the expected durations d˜i must be obtained using the same random generation
scheme. This is not surprising, as it simply means that the characteristics of
the uncertainty change the degree by which the value of w affects the expected
makespan: this aspect will be tackled in the next section.
layers), but not to the location of each activity within the graph1 . Therefore,
we will assume that the layer where each activity appears is determined at
random. This is a stochastic process and we are interested in the expected value
of Ewc [T (D)] w.r.t. the random mapping: i.e., we are dealing with a double
expectation in the form Emap [Ewc [T (D)]].
Single-layer Ewc [T (D)]: As a first step, we will focus on the inner expectation,
i.e. on the computation of E [T (D)] with worst case duration. At this stage, we
can assume the activity positions to be known so that the expected makespan
can be obtained by running Algorithm 1 (or solving P0). Since adjacent layers
are fully connected, processing each layer separately is equivalent to processing
the POS as whole. Now, consider the problem objective in P0:
max z = pωk T (ωk ) (11)
ωk ∈Ω
where we have exploited the fact that ∀ai ∈ A : di = δ, di = δ, and therefore the
single-layer makespan is equal to δ unless at least one activity takes maximal
duration. Therefore, the whole problem can be rewritten for a single-layer as:
P1 : max z = δ + (δ − δ) p ωk (13)
ωk :∃Di =δ
d˜i − di
subject to: p ωk ≤ ∀ai ∈ A (14)
Di − Di
ωk :Di =di
p ωk ≤ 1 (15)
ωk ∈Ω
p ωk ≥ 0 ∀ωk ∈ Ω (16)
where A is the set of activities in the layer and Ω = ai ∈A {di , di }. As already
mentioned, we have not replaced di , di with δ, δ unless it was strictly necessary
to obtain an important simplification.
Problem P1 is simple enough to admit a closed form solution. In particular, all
scenarios where at least one activity takes the maximal duration are symmetrical.
Moreover, it is always worthwhile to increase the probability of such scenarios
as much as possible. Therefore the solution of P1 is always given by:
d˜i − d
∗ i
z = δ + (δ − δ) min 1, (17)
a ∈A
Di − Di
i
where (d˜i − di )/ Di − Di is the probability that ai takes maximal duration.
1
If we had access to this, we could use Algorithm 1.
Deterministic Estimation of the Expected Makespan of a POS 289
As the number of activities grows, Ewc [T (D)] gets closer to T (d): intuitively,
since we are reasoning with a worst-case distribution, more activities mean more
things that can go wrong. This trend reflects on the performance of T (d) (which
gets better), and appears to have a adverse effect on the accuracy of τ and T (d). ˜
When the minimal durations tend to be higher (i.e. when αd ≥ 1 and βd < 0),
the range of the random durations is reduced and all predictions are more precise.
The T (d)˜ estimator benefits the most from this situation.
In general, the τ estimator tends to outperform the other estimators: the
accuracy is much better than T (d), and significantly better than T (d) ˜ in most
cases. It must be said that using T (d)˜ as an estimator for Ewc [T (D)] lead to sur-
prisingly good results, especially in terms of standard deviation: this is consistent
with our findings form [2], and deserves further investigation. The τ estimator
really shines when the d˜i values are small, i.e. for αd˜ < 0: this is the situation
that models the presence of machine faults, which is also the best suited for
reasoning in terms of worst-case distribution (since a fault tends to affect all the
activities in the system).
4 Concluding Remarks
5 Appendix A
This appendix contains the proof to Theorem 1.
Theorem 1. There exists a worst-case distribution such that, in each scenario
with non-zero probability, every Di takes either the value di or the value di .
Proof (By contradiction and induction). Let us assume that the worst case distri-
bution contains a scenario ωk such that one Di is equal to some value vk ∈ (di , di )
and P (ωk ) > 0. Let ω k and ω k be two scenarios that are identical to ωk in all
assignments, except that Di takes respectively its minimal and maximal value.
Let us consider shifting the probability P (ωk ) from ωk to ω k and ω k , and let
ΔP (ω k ) ≥ 0 and ΔP (ω k ) ≥ 0 be the two probability variations. Then it must
hold:
ΔP (ωk ) + ΔP (ωk ) = P (ωk ) (24)
in order to preserve the total probability mass, and:
di ΔP (ωk ) + di ΔP (ωk ) = vk P (ωk ) (25)
to keep the expected value d˜i unchanged. We recall that in each scenario the
makespan is given by the length of the critical path, and that the expected
makespan is given by the integral (or sum) of T (D(ωk ))P (ωk ). Now, let us
distinguish some cases:
1) ai is on the critical path in ωk . This implies that ai is on the critical
path also in ω k , and therefore shifting the probability causes the expected
makespan to increase by (di − vk )ΔP (ω k ) units. Then:
– If ai is on the critical path in ωk , then the expected makespan is also
decreased by (vk − di )ΔP (ω k ) units. However, by combining Equa-
tions (24) and (25) we obtain that:
(di − vk )ΔP (ω k ) − (vk − di )ΔP (ω k ) = 0 (26)
i.e. the net change of the expected makespan is zero.
– If ai is not on the critical path in ω k , then the expected makespan is
decreased by less than (vk − di )ΔP (ω k ) units, and the net change is
positive (i.e. the expected makespan is increased).
2) ai is not on the critical path in ωk . This implies that ai is not on the
critical path also in ω k , and therefore that shifting probability to ω k leaves
the expected makespan unchanged. Then:
– If ai is on the critical path in ω k , the expected makespan is increased by
a quantity in the range [0, (di − vk )ΔP (ω k )).
– If ai is not on the critical path in ω k , the expected makespan is again
unchanged.
Therefore, by reducing to zero the probability P (ωk ), the expected makespan
either is increased or stays unchanged. This procedure can be repeated until
there is no scenario with non-zero probability where Di takes a value different
from di or di .
Deterministic Estimation of the Expected Makespan of a POS 293
J30
(ad̃i , bd̃i ) −→ (0.3,0.3) (0.3,3) (1,1) (3,3)
(adi , bdi ) τ T(d̃) T(d) τ T(d̃) T(d) τ T(d̃) T(d) τ T(d̃) T(d)
Err -1.08 5.06 -37.19 -3.91 9.37 -148.18 -7.75 11.32 -31.82 -12.23 15.87 -27.92
(0.3,0.3)
Std 7.77 2.72 13.38 5.36 4.57 32.46 6.94 3.79 10.29 6.51 3.99 8.27
Err 1.55 7.54 -52.16 2.44 24.83 -352.00 -6.83 17.14 -41.85 -13.18 24.20 -35.18
(0.3,3.0)
Std 10.07 3.87 19.37 6.77 8.80 113.50 8.32 4.87 13.75 8.06 4.61 10.57
Err -1.62 2.66 -26.68 -3.22 3.54 -85.42 -6.38 6.22 -23.62 -9.90 9.33 -21.15
(3.0,0.3)
Std 5.55 1.67 8.54 3.38 2.19 10.22 4.85 2.59 7.03 4.82 2.97 6.01
Err -0.70 5.14 -37.30 -3.02 10.13 -153.98 -7.04 11.33 -32.04 -11.91 16.20 -27.98
(1.0,1.0)
Std 7.71 2.66 13.60 4.79 4.52 30.28 6.42 3.64 10.17 6.28 3.88 8.10
Err -0.03 5.29 -38.33 -2.17 10.25 -160.43 -6.95 11.54 -32.73 -11.72 16.46 -28.09
(3.0,3.0)
Std 7.42 2.75 13.65 4.53 4.39 29.59 6.59 3.62 10.15 6.44 3.75 8.09
J60
Err -2.92 6.16 -33.85 -7.35 12.62 -133.52 -11.11 13.10 -27.88 -16.20 18.25 -23.59
(0.3,0.3)
Std 6.66 2.45 10.35 5.12 4.32 23.12 5.81 3.25 7.72 5.33 3.38 6.15
Err 0.07 8.82 -44.82 -0.34 33.56 -268.74 -11.47 19.79 -35.42 -18.73 27.21 -29.12
(0.3,3.0)
Std 8.10 3.39 14.08 6.30 7.83 66.40 7.54 4.06 9.63 6.62 3.68 7.42
Err -3.19 3.32 -25.27 -6.40 4.93 -81.94 -9.31 7.54 -21.56 -13.37 10.95 -18.81
(3.0,0.3)
Std 4.90 1.61 7.01 3.52 2.32 8.50 4.46 2.32 5.54 4.27 2.57 4.81
Err -2.34 6.10 -33.65 -6.61 13.79 -139.56 -10.83 13.31 -28.08 -16.30 18.50 -23.87
(1.0,1.0)
Std 6.57 2.47 10.04 4.82 4.53 22.94 5.77 3.21 7.57 5.50 3.32 6.21
Err -1.84 6.22 -34.20 -5.66 14.53 -145.00 -10.48 13.52 -28.10 -16.10 18.69 -23.90
(3.0,3.0)
Std 6.63 2.46 10.24 4.85 4.61 22.46 5.72 3.16 7.41 5.37 3.17 6.14
J90
Err -3.94 6.59 -32.30 -9.82 14.67 -125.92 -12.44 13.87 -26.23 -17.41 19.20 -22.03
(0.3,0.3)
Std 6.28 2.35 9.03 5.20 4.16 19.42 5.43 2.92 6.54 4.93 3.17 5.54
Err -1.16 9.62 -42.30 -1.25 38.04 -233.89 -13.54 20.81 -33.02 -20.17 28.48 -26.67
(0.3,3.0)
Std 7.39 3.19 11.32 6.35 6.83 52.10 6.77 3.74 8.34 6.04 3.35 6.54
Err -3.71 3.62 -24.17 -8.44 5.78 -79.91 -10.55 8.16 -20.61 -14.43 11.71 -17.88
(3.0,0.3)
Std 4.59 1.55 6.08 3.70 2.42 8.03 4.26 2.25 5.03 3.88 2.51 4.24
Err -3.46 6.67 -32.51 -8.80 15.97 -131.57 -12.31 14.23 -26.29 -17.24 19.42 -21.97
(1.0,1.0)
Std 5.85 2.36 8.44 5.08 4.33 19.47 5.53 2.95 6.59 4.86 3.02 5.40
Err -2.73 6.83 -32.88 -7.77 17.12 -136.15 -12.12 14.35 -26.59 -17.36 19.80 -22.28
(3.0,3.0)
Std 5.84 2.36 8.55 5.07 4.54 19.52 5.47 2.91 6.63 5.00 2.92 5.47
Taillard
Err -7.34 11.16 -27.74 -14.69 27.53 -94.63 -12.85 20.99 -17.84 -12.29 26.59 -12.63
(0.3,0.3)
Std 4.16 2.36 5.69 3.69 3.77 10.76 3.51 2.64 4.09 3.42 2.26 3.50
Err -5.74 15.93 -34.45 -6.04 55.75 -134.53 -14.01 29.17 -20.96 -13.88 36.39 -14.33
(0.3,3.0)
Std 4.66 3.04 6.73 4.14 3.54 17.82 4.07 2.97 4.90 3.69 2.43 3.79
Err -6.97 6.92 -22.08 -13.61 13.95 -66.55 -11.20 13.85 -14.98 -10.62 17.87 -10.87
(3.0,0.3)
Std 3.35 1.76 4.15 3.18 2.68 6.65 2.94 2.14 3.29 2.92 2.10 2.98
Err -7.17 11.29 -28.19 -13.26 29.75 -96.61 -12.84 21.31 -17.97 -12.31 26.88 -12.65
(1.0,1.0)
Std 3.95 2.44 5.27 3.73 3.46 11.00 3.44 2.54 4.00 3.36 2.34 3.46
Err -6.49 11.45 -28.09 -11.98 31.37 -98.08 -12.72 21.43 -17.98 -12.28 27.13 -12.62
(3.0,3.0)
Std 3.92 2.45 5.34 3.81 3.39 11.24 3.51 2.56 4.05 3.35 2.24 3.44
294 M. Lombardi et al.
References
1. Baptiste, P., Le Pape, C., Nuijten, W.: Constraint-based scheduling. Kluwer Aca-
demic Publishers (2001)
2. Bonfietti, A., Lombardi, M., Milano, M.: Disregarding duration uncertainty in
partial order schedules? yes, we can!. In: Simonis, H. (ed.) CPAIOR 2014. LNCS,
vol. 8451, pp. 210–225. Springer, Heidelberg (2014)
3. Cesta, A., Oddi, A., Smith, S.F.: Iterative flattening: a scalable method for solving
multi-capacity scheduling problems. In: AAAI/IAAI, pp. 742–747 (2000)
4. Kellerer, H., Pferschy, U., Pisinger, D.: Knapsack problems. Springer Science &
Business Media (2004)
5. Kleywegt, A.J., Shapiro, A., Homem-de Mello, T.: The sample average approxima-
tion method for stochastic discrete optimization. SIAM Journal on Optimization
12(2), 479–502 (2002)
6. Kolisch, R., Sprecher, A.: Psplib-a project scheduling problem library: Or software-
orsep operations research software exchange program. European Journal of Oper-
ational Research 96(1), 205–216 (1997)
7. Laborie, P.: Complete MCS-based search: application to resource constrained
project scheduling. In: Proc. of IJCAI, pp. 181–186. Professional Book Center
(2005)
8. Laborie, P., Godard, D.: Self-adapting large neighborhood search: application to
single-mode scheduling problems. In: Proc. of MISTA (2007)
9. Le Pape, C., Couronné, P., Vergamini, D., Gosselin, V.: Time-versus-capacity com-
promises in project scheduling. AISB Quarterly, 19 (1995)
10. Lombardi, M., Milano, M., Benini, L.: Robust scheduling of task graphs under
execution time uncertainty. IEEE Trans. Computers 62(1), 98–111 (2013)
11. Morris, P., Muscettola, N., Vidal, T.: Dynamic control of plans with temporal
uncertainty. In: Proc. of IJCAI, pp. 494–499. Morgan Kaufmann Publishers Inc.
(2001)
12. Policella, N., Cesta, A., Oddi, A., Smith, S.F.: From precedence constraint posting
to partial order schedules: A CSP approach to Robust Scheduling. AI Communi-
cations 20(3), 163–180 (2007)
13. Policella, N., Smith, S.F., Cesta, A., Oddi, A.: Generating robust schedules through
temporal flexibility. In: Proc. of ICAPS, pp. 209–218 (2004)
14. Tarim, S.A., Manandhar, S., Walsh, T.: Stochastic constraint programming: A
scenario-based approach. Constraints 11(1), 53–80 (2006)
15. Vidal, T.: Handling contingency in temporal constraint networks: from consistency
to controllabilities. Journal of Experimental & Theoretical Artificial Intelligence
11(1), 23–45 (1999)
A Parallel, Backjumping Subgraph Isomorphism
Algorithm Using Supplemental Graphs
1 Introduction
The subgraph isomorphism family of problems involve “finding a copy of” a
pattern graph inside a larger target graph; applications include bioinformatics
[3], chemistry [31], computer vision [12,37], law enforcement [7], model check-
ing [33], and pattern recognition [9]. These problems have natural constraint
programming models: we have a variable for each vertex in the pattern graph,
with the vertices of the target graph being the domains. The exact constraints
vary depending upon which variation of the problem we are studying (which we
discuss in the following section), but generally there are rules about preserving
adjacency, and an all-different constraint across all the variables.
This constraint-based search approach dates back to works by Ullmann [39]
and McGregor [25], and was improved upon in the LV [20] and VF2 [11] algo-
rithms. More recently, ILF [41], LAD [36] and SND [1] are algorithms which take
a “deep thinking” approach, using strong inference at each stage of the search.
This is powerful, but we observe LAD or SND sometimes make less than one
recursive call per second with larger target graphs, and cannot always explore
enough of the search space to find a solution in time. This motivates an alter-
native approach: on the same hardware, we will be making 104 to 106 recursive
calls per core per second. The main features of our algorithm are:
used to generate implied constraints: we may now look for a mapping which
is simultaneously a subgraph isomorphism between several carefully selected
pairs of graphs.
2. We use weaker inference than LAD and SND: we do not achieve or maintain
arc consistency. We introduce a cheaper, counting-based all-different prop-
agator which has better scalability for large target graphs, and which has
very good constant factors on modern hardware thanks to bitset encodings.
3. We describe a clone-comparing variation of conflict-directed backjumping,
which does not require conflict sets. We show that an all-different propagator
can produce reduced conflict explanations, which can improve backjumping.
4. We use thread-parallel preprocessing and search, to make better use of mod-
ern multi-core hardware. We explain how parallel search may interact safely
with backjumping. We use explicit, non-randomised work stealing to offset
poor early heuristic choices during search.
Although weaker propagation and backjumping have fallen out of fashion in gen-
eral for constraint programming, here this approach usually pays off. In section 4
we show that over a large collection of instances commonly used to compare sub-
graph isomorphism algorithms, our solver is the single best.
Throughout, our graphs are finite, undirected, and do not have multiple edges
between pairs of vertices, but may have loops (an edge from a vertex to itself).
We write V(G) for the vertex set of a graph G, and N(G, v) for the neighbours
of a vertex v in G (that is, the vertices adjacent to v). The degree of v is the
cardinality of its set of neighbours. The neighbourhood degree sequence of v,
denoted S(G, v), is the sequence consisting of the degrees of every neighbour
of v, from largest to smallest. A vertex is isolated if it has no neighbours. By
v ∼G w we mean vertex v is adjacent to vertex w in graph G. We write G[V ]
for the subgraph of G induced by a set of vertices V .
A non-induced subgraph isomorphism is an injective mapping i : P T
from a graph P to a graph T which preserves adjacency—that is, if v ∼P w
then we require i(v) ∼T i(w) (and thus if v has a loop, then i(v) must have a
loop). The non-induced subgraph isomorphism problem is to find such a mapping
from a given pattern graph P to a given target graph T . (The induced subgraph
isomorphism problem additionally requires that if v ∼P w then i(v) ∼T i(w),
and variants also exist for directed and labelled graphs; we discuss only the
non-induced version in this paper. All these variants are NP-complete.)
If R and S are sequences of integers, we write R S if there exists a subse-
quence of S with length equal to that of R, such that each element in R is less
than or equal to the corresponding element in S. For a set U and element v, we
write U − v to mean U \ {v}, and U + v to mean U ∪ {v}.
A path in a graph is a sequence of distinct vertices, such that each successive
pair of vertices are adjacent; we also allow a path from a vertex to itself, in which
A Parallel, Backjumping Subgraph Isomorphism Algorithm 297
case the first and last vertices in the sequence are the same (and there is a cycle).
The distance between two vertices is the length of a shortest path between them.
We write Gd for the graph with vertex set V(G), and edges between v and w
if the distance between v and w in G is at most d. We introduce the notation
G[c,l] for the graph with vertex set V(G), and edges between vertices v and w
(not necessarily distinct) precisely if there are at least c paths of length exactly
l between v and w in G. The following proposition may easily be verified by
observing that injectivity means paths are preserved:
The (contrapositive of the) first of these facts is used by SND, which dynamically
performs distance-based filtering during search. We will instead use the second
fact, at the top of search, to generate implied constraints.
3 A New Algorithm
Algorithm 1 describes our approach. We begin (line 3) with a simple check that
there are enough vertices in the pattern graph for an injective mapping to exist.
We then (line 4) discard isolated vertices in the pattern graph—such vertices may
be greedily assigned to any remaining target vertices after a solution is found.
This reduces the number of variables which must be copied when branching. Next
we construct the supplemental graphs (line 5) and initialise domains (line 6).
We then (line 7) use a counting-based all-different propagator to reduce these
domains further. Finally, we perform a backtracking search (line 8). Each of
these steps is elaborated upon below.
16 return Fail F
none of the assignments are possible, we return with a nogood of the current
variable (line 5) combined with the union of the nogoods of each failed assignment
(line 9) or subsearch (line 15).
For assignment and inference, Algorithm 5 gives the value v to the domain
Dv (line 3), and then infers which values may be eliminated from the remaining
domains. Firstly, no other domain may now be given the value v (line 5). Sec-
ondly, for each supplemental graph pair, any domain for a vertex adjacent to v
may only be mapped to a vertex adjacent to v (line 7). If any domain gives a
wipeout, then we fail with that variable as the nogood (line 8).
To enforce the all-different constraint, it suffices to remove the assigned value
from every other domain, as we did in line 5. However, it is often possible to
do better. We can sometimes detect that an assignment is impossible even if
values remain in each variable’s domain (if we can find a set of n variables whose
domains include strictly less than n values between them, which we call a failed
Hall set), and we can remove certain variable-value assignments that we can
prove will never occur (if we can find a set of n variables whose domains include
only n values between them, which we call a Hall set, then those values may be
removed from the domains of any other variable). The canonical way of doing
this is to use Régin’s matching-based propagator [30].
However, matching-based filtering is expensive and may do relatively little,
particularly when domains are large, and the payoff may not always be worth the
cost. Various approaches to offsetting this cost while maintaining the filtering
power have been considered [15]. Since we are not maintaining arc consistency in
general, we instead use an intermediate level of inference which is not guaranteed
to identify every Hall set: this can be thought of as a heuristic towards the
matching approach. This is described in Algorithm 6.
The algorithm works by performing a linear pass over each domain in turn,
from smallest cardinality to largest (line 4). The H variable contains the union
of every Hall set detected so far; initially it is empty. The A set accumulates the
union of domains seen so far, and n contains the number of domains contributing
to A. For each new domain we encounter, we eliminate any values present in
previous Hall sets (line 6). We then add that domain’s values to A and increment
A Parallel, Backjumping Subgraph Isomorphism Algorithm 301
n (line 7). If we detect a failed Hall set, we fail (line 8). If we detect a Hall set,
we add those values to H, and reset A and n, and keep going (line 9).
It is important to note that this approach may fail to identify some Hall
sets, if the initial ordering of domains is imperfect. However, the algorithm runs
very quickly in practice: the sorting step is O(v log v) (where v is the number of
remaining variables), and the loop has complexity O(vd) (where d is the cost of
a bitset operation over a target domain, which we discuss below). We validate
this trade-off experimentally in the following section.
In case a failure is detected, the F set of nogoods we return need only include
the variables processed so far, not every variable involved in the constraint. This
is because an all-different constraint implies an all-different constraint on any
subset of its variables. A smaller set of nogoods can increase the potential for
backjumping (and experiments verified that this is beneficial in practice).
We have been unable to find this algorithm described elsewhere in the liter-
ature, although a sort- and counting-based approach has been used to achieve
bounds consistency [28] (but our domains are not naturally ordered) and as a
preprocessing step [29]. Bitsets (which we discuss below) have also been used to
implement the matching algorithm [19].
The use of bitset encodings for graph algorithms to exploit hardware parallelism
dates back to at least Ullmann’s algorithm [39], and remains an active area of
research [32,40]. We use bitsets here: our graphs are stored as arrays of bit vec-
tors, our domains are bit vectors, the neighbourhood intersection in Algorithm 5
is a bitwise-and operation, the unions in Algorithm 4 and Algorithm 6 are bitwise-
or operations, and the cardinality check in Algorithm 6 is a population count
(this is a single instruction in modern CPUs).
In addition to the SIMD-like parallelism from bitset encodings, we observed
two opportunities for multi-core thread parallelism in the algorithm:
302 C. McCreesh and P. Prosser
Graph and domain construction. We may parallelise the outer for loops involved
in calculating neighbourhood degree sequences and in initialising the domains
of variables in Algorithm 3. Similarly, constructing each supplemental graph in
Algorithm 2 involves an outer for loop, iterating over each vertex in the input
graph. These loops may also be parallelised, with one caveat: we must be able
to add edges to (but not remove edges from) the output graph safely, in parallel.
This may be done using an atomic “or” operation.
Search. Viewing the recursive calls made by the search function in Algorithm 4
as forming a tree, we may explore different subtrees in parallel. The key points
are:
4 Experimental Evaluation
Our algorithm was implemented1 in C++ using C++11 native threads, and was
compiled using GCC 4.9.0. We performed our experiments on a machine with
dual Intel Xeon E5-2640 v2 processors (for a total of 16 cores, and 32 hardware
threads via hyper-threading), running Scientific Linux 6.6. For the comparison
with SND in the following section, we used Java HotSpot 1.8.0 11. Runtimes
include preprocessing and thread launch costs, but not the time taken to read
in the graph files from disk (except in the case of SND, which we were unable
to instrument).
For evaluation, we used the same families of benchmark instances that were
used to evaluate LAD [36] and SND [1]. The “LV” family [20] contains graphs
with various interesting properties from the Stanford Graph Database, and
the 793 pattern/target pairs give a mix of satisfiable and unsatisfiable queries.
The “SF” family contains 100 scale-free graph pairs, again mixing satisfiable
and unsatisfiable queries. The remainder of these graphs come from the Vflib
database [11]: the “BVG” and “BVGm” families are bounded degree graphs (540
pairs all are satisfiable), “M4D” and “M4Dr” are four-dimensional meshes (360
pairs, all satisfiable), and the “r” family is randomly generated (270 pairs, all
satisfiable). We expanded this suite with 24 pairs of graphs representing image
pattern queries [12] (which we label “football”), and 200 randomly selected pairs
from each of a series of 2D image (“images”) and 3D mesh (“meshes”) graph
queries [37]. The largest number of vertices is 900 for a pattern and 5,944 for a
target, and the largest number of edges is 12,410 for a pattern and 34,210 for a
target; some of these graphs do contain loops. All 2,487 instances are publicly
available in a simple text format2 .
Fig. 1. Cumulative number of benchmark instances solved within a given time, for
different algorithms: at time t, the value is the size of the set of instances whose
runtime is at most t for that algorithm. Parallel results are using 32 threads on a 16
core hyper-threaded system.
which, individually, were solved in at most that amount of time. Our sequential
implementation beats VF2 for times over 0.2s, LAD for times over 0.6s, and
always beats SND. Our parallel implementation beats VF2 for times over 0.06s,
LAD for times over 0.02s, and always beats SND; parallelism gives us an overall
benefit from 12ms onwards. Finally, removing the supplemental graphs from
our sequential algorithm gives an improvement below 10s (due to the cost of
preprocessing), but is beneficial for longer runtimes.
Fig. 2 presents an alternative perspective of these results. Each point repre-
sents an instance, and the shape of a point shows its family. For the y position
for an instance, we use our sequential (top graph) or parallel (bottom graph) run-
time. For the x position, we use the runtime from the virtual best other solver;
the colour of a point indicates which solver this is. For any point below the x = y
diagonal line, we are the best solver. A limit of 108 ms was used—points along
the outer axes represent timeouts.
Although overall ours is the single best solver, VF2 is stronger on triv-
ial instances. This is not surprising: we must spend time constructing supple-
mental graphs. Thus it may be worth using either VF2 or our own algorithm
A Parallel, Backjumping Subgraph Isomorphism Algorithm 305
108
LAD
107
VF2
SND
106
Our sequential runtime (ms)
LV (sat)
5 LV (unsat)
10
BVG / BVGm
M4D / M4Dr
104
SF (sat)
SF (unsat)
103 r
football
102 images (sat)
images (unsat)
meshes (sat)
101
meshes (unsat)
100
100 101 102 103 104 105 106 107 108
Virtual best other solver runtime (ms)
8
10
107
106
Our parallel runtime (ms)
105
104
103
102
101
100
100 101 102 103 104 105 106 107 108
Virtual best other solver runtime (ms)
Fig. 2. Above, our sequential runtime compared to the virtual best other sequential
solver, for each benchmark instance; below, the same, with our parallel runtimes and
including parallel solvers. For points below the diagonal line, ours is the best solver for
this instance; for points above the diagonal, the point colour indicates the best solver.
306 C. McCreesh and P. Prosser
4.2 Parallelism
Fig. 3 shows, for each instance, the speedup obtained from parallelism. Except
at very low sequential runtimes, we see a reasonable general improvement. For
some satisfiable instances, we see strongly superlinear speedups. These instances
are exceptionally hard problems [35]: we would have found a solution quickly,
except for a small number of wrong turns at the top of search. Our work stealing
strategy was able to avoid strong commitment to early value-ordering heuristic
choices, providing an alternative to using more complicated sequential search
strategies to offset this issue. (Some of these results were also visible in Fig. 2,
where we timed out on satisfiable instances which another solver found trivial.)
Some non-trivial satisfiable instances exhibited a visible slowdown. This is
because we were using 32 software threads, to match the advertised number of
hardware hyper-threads, but our CPUs only have 16 “real” cores between them.
For these instances parallelism did not reduce the amount of work required to
find a solution, but did result in a lower rate of recursive calls per second on
the sequential search path—this is similar to the risk of introducing a slower
processing element to a cluster [38]. Even when experimenting with 16 threads,
we sometimes observed a small slowdown due to worse cache and memory bus
performance, and due to the overhead of modifying the code to allow for work
stealing (recall that we are benchmarking against a dedicated sequential imple-
mentation).
In a small number of cases, we observe low speedups for non-trivial unsatisfi-
able instances. These are from cases where backjumping has a substantial effect
on search, making much of our speculative parallelism wasted effort. (Addition-
ally, if cancellation were not to be used, some of these instances would exhibit
large absolute slowdowns.)
108
107
LV (sat)
106 LV (unsat)
BVG / BVGm
Parallel Runtime (ms)
100
100 101 102 103 104 105 106 107 108
Sequential Runtime (ms)
108
107
LV (sat)
Runtime with Backjumping (ms)
106 LV (unsat)
BVG / BVGm
105 M4D / M4Dr
SF (sat)
SF (unsat)
104
r
football
103 images (sat)
images (unsat)
102 meshes (sat)
meshes (unsat)
101
100
100 101 102 103 104 105 106 107 108
Runtime without Backjumping (ms)
Fig. 4. The effects of backjumping. Each point is one benchmark instance; points below
the diagonal line indicate a speedup.
308 C. McCreesh and P. Prosser
109
Recursive calls with matching-based all-different
108
LV (sat)
107
LV (unsat)
BVG / BVGm
106
M4D / M4Dr
SF (sat)
105
SF (unsat)
r
104
football
images (sat)
103
images (unsat)
meshes (sat)
102
meshes (unsat)
101
100
100 101 102 103 104 105 106 107 108 109
Recursive calls with counting-based all-different
9
10
Recursive calls with counting-based all-different
108
107
106
105
104
103
102
101
100
100 101 102 103 104 105 106 107 108 109
Recursive calls with value-deleting all-different
Fig. 5. Above, the improvement to the search space size which would be given by
Régin’s matching-based all-different propagator. Below, the improvement given by
using counting all-different rather than simple deletion. Each point is one benchmark
instance; the point style shows the benchmark family. Points below the diagonal line
indicate a reduction in the search space size.
A Parallel, Backjumping Subgraph Isomorphism Algorithm 309
5 Conclusion
Going against conventional wisdom, we saw that replacing strong inference with
cheaper surrogates could pay off, and that backjumping could be implemented
cheaply enough to be beneficial. We also saw parallelism give a substantial bene-
fit. This was true even for relatively low runtimes, due to us exploiting parallelism
for pre-processing as well as for search. Parallel backjumping has only been given
limited attention [8,10,17]. However, a simple approach has worked reasonably
well here (in contrast to stronger clause-learning systems, where successes in
parallelism appear to be rare).
There is also plenty of scope for extensions of and improvement to our algo-
rithm. We have yet to deeply investigate the possibility of constructing domain-
or instance-specific supplemental graphs. Nor did we discuss directed graphs
or induced isomorphisms: supplemental graphs can be taken further for these
variations of the problem. In particular, composing transformations for induced
isomorphisms would allow us to reason about “paths of non-edges”, which may
be very helpful. Finally, we have yet to consider exploiting the symmetries and
dominance relations which we know are present in many graph instances.
Acknowledgments. The authors wish to thank Christine Solnon for discussions, pro-
viding the graph instances and the LAD implementation, Christophe Lecoutre for dis-
cussion and the SND implementation, and Lars Kotthoff and Alice Miller for their
comments.
310 C. McCreesh and P. Prosser
References
1. Audemard, G., Lecoutre, C., Samy-Modeliar, M., Goncalves, G., Porumbel, D.:
Scoring-based neighborhood dominance for the subgraph isomorphism problem. In:
O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 125–141. Springer, Heidelberg
(2014). http://dx.doi.org/10.1007/978-3-319-10428-7 12
2. Bessière, C., Régin, J.: MAC and combined heuristics: two reasons to forsake
FC (and CBJ?) on hard problems. In: Proceedings of the Second International
Conference on Principles and Practice of Constraint Programming, Cambridge,
Massachusetts, USA, August 19–22, 1996, pp. 61–75 (1996). http://dx.doi.org/10.
1007/3-540-61551-2 66
3. Bonnici, V., Giugno, R., Pulvirenti, A., Shasha, D., Ferro, A.: A subgraph iso-
morphism algorithm and its application to biochemical data. BMC Bioinformatics
14(Suppl 7), S13 (2013). http://www.biomedcentral.com/1471-2105/14/S7/S13
4. de Bruin, A., Kindervater, G.A.P., Trienekens, H.W.J.M.: Asynchronous par-
allel branch and bound and anomalies. In: Ferreira, A., Rolim, J.D.P. (eds.)
IRREGULAR 1995. LNCS, vol. 980, pp. 363–377. Springer, Heidelberg (1995).
http://dx.doi.org/10.1007/3-540-60321-2 29
5. Chen, X., van Beek, P.: Conflict-directed backjumping revisited. J. Artif. Intell.
Res. (JAIR) 14, 53–81 (2001). http://dx.doi.org/10.1613/jair.788
6. Chu, G., Schulte, C., Stuckey, P.J.: Confidence-based work stealing in parallel con-
straint programming. In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 226–241.
Springer, Heidelberg (2009). http://dx.doi.org/10.1007/978-3-642-04244-7 20
7. Coffman, T., Greenblatt, S., Marcus, S.: Graph-based technologies for intel-
ligence analysis. Commun. ACM 47(3), 45–47 (2004). http://doi.acm.org/
10.1145/971617.971643
8. Conrad, J., Mathew, J.: A backjumping search algorithm for a distributed memory
multicomputer. In: International Conference on Parallel Processing, ICPP 1994,
vol. 3, pp. 243–246, August 1994
9. Conte, D., Foggia, P., Sansone, C., Vento, M.: Thirty years of graph match-
ing in pattern recognition. International Journal of Pattern Recognition and
Artificial Intelligence 18(03), 265–298 (2004). http://www.worldscientific.com/
doi/abs/10.1142/S0218001404003228
10. Cope, M., Gent, I.P., Hammond, K.: Parallel heuristic search in Haskell. In:
Selected Papers from the 2nd Scottish Functional Programming Workshop
(SFP00), University of St Andrews, Scotland, July 26–28, 2000, pp. 65–76 (2000)
11. Cordella, L.P., Foggia, P., Sansone, C., Vento, M.: A (sub)graph isomorphism algo-
rithm for matching large graphs. IEEE Trans. Pattern Anal. Mach. Intell. 26(10),
1367–1372 (2004). http://doi.ieeecomputersociety.org/10.1109/TPAMI.2004.75
12. Damiand, G., Solnon, C., de la Higuera, C., Janodet, J.C., Samuel, É.:
Polynomial algorithms for subisomorphism of nD open combinatorial maps.
Computer Vision and Image Understanding 115(7), 996–1010 (2011).
http://www.sciencedirect.com/science/article/pii/S1077314211000816, special
issue on Graph-Based Representations in Computer Vision
13. Geelen, P.A.: Dual viewpoint heuristics for binary constraint satisfaction problems.
In: ECAI, pp. 31–35 (1992)
14. Gent, I.P., Miguel, I., Moore, N.C.A.: Lazy explanations for constraint propagators.
In: Carro, M., Peña, R. (eds.) PADL 2010. LNCS, vol. 5937, pp. 217–233. Springer,
Heidelberg (2010). http://dx.doi.org/10.1007/978-3-642-11503-5 19
A Parallel, Backjumping Subgraph Isomorphism Algorithm 311
15. Gent, I.P., Miguel, I., Nightingale, P.: Generalised arc consistency for the alldif-
ferent constraint: An empirical survey. Artificial Intelligence 172(18), 1973–2000
(2008). http://www.sciencedirect.com/science/article/pii/S0004370208001410,
special Review Issue
16. Giugno, R., Bonnici, V., Bombieri, N., Pulvirenti, A., Ferro, A., Shasha, D.: Grapes:
A software for parallel searching on biological graphs targeting multi-core architec-
tures. PLoS ONE 8(10), e76911 (2013) http://dx.doi.org/10.1371%2Fjournal.pone.
0076911
17. Habbas, Z., Herrmann, F., Merel, P.P., Singer, D.: Load balancing strategies for
parallel forward search algorithm with conflict based backjumping. In: Proceed-
ings of the 1997 International Conference on Parallel and Distributed Systems,
pp. 376–381, December 1997
18. Harvey, W.D., Ginsberg, M.L.: Limited discrepancy search. In: IJCAI (1),
pp. 607–615. Morgan Kaufmann, San Francisco (1995)
19. Kessel, P.V., Quimper, C.: Filtering algorithms based on the word-RAM model. In:
Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, July
22–26, 2012, Toronto, Ontario, Canada. (2012). http://www.aaai.org/ocs/index.
php/AAAI/AAAI12/paper/view/5135
20. Larrosa, J., Valiente, G.: Constraint satisfaction algorithms for graph pattern
matching. Mathematical Structures in Computer Science 12(4), 403–422 (2002).
http://dx.doi.org/10.1017/S0960129501003577
21. Lobachev, O.: Parallel computation skeletons with premature termination property.
In: Schrijvers, T., Thiemann, P. (eds.) FLOPS 2012. LNCS, vol. 7294, pp. 197–212.
Springer, Heidelberg (2012). http://dx.doi.org/10.1007/978-3-642-29822-6 17
22. MacIntyre, E., Prosser, P., Smith, B.M., Walsh, T.: Random constraint satis-
faction: theory meets practice. In: Maher, M.J., Puget, J.-F. (eds.) CP 1998.
LNCS, vol. 1520, p. 325. Springer, Heidelberg (1998). http://dx.doi.org/10.1007/
3-540-49481-2 24
23. Malitsky, Y.: Instance-Specific Algorithm Configuration. Springer (2014). http://
dx.doi.org/10.1007/978-3-319-11230-5
24. McCreesh, C., Prosser, P.: The shape of the search tree for the maximum clique
problem and the implications for parallel branch and bound. ACM Trans. Parallel
Comput. 2(1), 8:1–8:27 (2015). http://doi.acm.org/10.1145/2742359
25. McGregor, J.J.: Relational consistency algorithms and their application in
finding subgraph and graph isomorphisms. Inf. Sci. 19(3), 229–250 (1979).
http://dx.doi.org/10.1016/0020-0255(79)90023–9
26. Prosser, P.: Domain filtering can degrade intelligent backtracking search. In: Pro-
ceedings of the 13th International Joint Conference on Artifical Intelligence, IJCAI
1993 ,vol. 1, pp. 262–267. Morgan Kaufmann Publishers Inc., San Francisco (1993).
http://dl.acm.org/citation.cfm?id=1624025.1624062
27. Prosser, P.: Hybrid algorithms for the constraint satisfaction problem. Com-
putational Intelligence 9, 268–299 (1993). http://dx.doi.org/10.1111/j.1467-8640.
1993.tb00310.x
28. Puget, J.: A fast algorithm for the bound consistency of alldiff constraints. In: Pro-
ceedings of the Fifteenth National Conference on Artificial Intelligence and Tenth
Innovative Applications of Artificial Intelligence Conference, AAAI 1998, IAAI
1998, July 26–30, 1998, Madison, Wisconsin, USA, pp. 359–366 (1998). http://
www.aaai.org/Library/AAAI/1998/aaai98-051.php
312 C. McCreesh and P. Prosser
29. Quimper, C.-G., Walsh, T.: The all different and global cardinality constraints
on set, multiset and tuple variables. In: Hnich, B., Carlsson, M., Fages, F., Rossi,
F. (eds.) CSCLP 2005. LNCS (LNAI), vol. 3978, pp. 1–13. Springer, Heidelberg
(2006). http://dx.doi.org/10.1007/11754602 1
30. Régin, J.: A filtering algorithm for constraints of difference in CSPs. In: Proceed-
ings of the 12th National Conference on Artificial Intelligence, Seattle, WA, USA,
July 31– August 4, 1994, vol. 1, pp. 362–367 (1994). http://www.aaai.org/Library/
AAAI/1994/aaai94-055.php
31. Régin, J.C.: Développement d’outils algorithmiques pour l’Intelligence Artificielle.
Application à la chimie organique. Ph.D. thesis, Université Montpellier 2 (1995)
32. San Segundo, P., Rodriguez-Losada, D., Galan, R., Matia, F., Jimenez, A.: Exploit-
ing CPU bit parallel operations to improve efficiency in search. In: 19th IEEE
International Conference on Tools with Artificial Intelligence, ICTAI 2007, vol. 1,
pp. 53–59, October 2007
33. Sevegnani, M., Calder, M.: Bigraphs with sharing. Theoretical Computer
Science 577, 43–73 (2015). http://www.sciencedirect.com/science/article/pii/
S0304397515001085
34. Slater, N., Itzchack, R., Louzoun, Y.: Mid size cliques are more common
in real world networks than triangles. Network Science 2, 387–402 (2014).
http://journals.cambridge.org/article S2050124214000228
35. Smith, B.M., Grant, S.A.: Modelling exceptionally hard constraint satisfaction
problems. In: Smolka, G. (ed.) CP 1997. LNCS, vol. 1330, pp. 182–195. Springer,
Heidelberg (1997). http://dx.doi.org/10.1007/BFb0017439
36. Solnon, C.: Alldifferent-based filtering for subgraph isomorphism. Artif. Intell.
174(12–13), 850–864 (2010). http://dx.doi.org/10.1016/j.artint.2010.05.002
37. Solnon, C., Damiand, G., de la Higuera, C., Janodet, J.C.: On the com-
plexity of submap isomorphism and maximum common submap problems.
Pattern Recognition 48(2), 302–316 (2015). http://www.sciencedirect.com/
science/article/pii/S0031320314002192
38. Trienekens, H.W.: Parallel Branch and Bound Algorithms. Ph.D. thesis, Erasmus
University Rotterdam (1990)
39. Ullmann, J.R.: An algorithm for subgraph isomorphism. Journal of the ACM
(JACM) 23(1), 31–42 (1976)
40. Ullmann, J.R.: Bit-vector algorithms for binary constraint satisfaction and
subgraph isomorphism. J. Exp. Algorithmics 15, 1.6:1.1–1.6:1.64 (2011).
http://doi.acm.org/10.1145/1671970.1921702
41. Zampelli, S., Deville, Y., Solnon, C.: Solving subgraph isomorphism prob-
lems with constraint programming. Constraints 15(3), 327–353 (2010).
http://dx.doi.org/10.1007/s10601-009-9074-3
Automated Auxiliary Variable Elimination
Through On-the-Fly Propagator Generation
1 Introduction
Constraint-based modelling languages such as Essence [6] and MiniZinc [12]
enable the modelling of problems at a higher level of abstraction than is sup-
ported by most constraint solvers. The transformation from a high-level model
to a low-level model supported by a solver is often called flattening and has
been the subject of intense research in order to produce good low-level, or flat-
tened, models (see, e.g., [14]). By decomposing complex expressions into a form
accepted by a solver, flattening often introduces many auxiliary variables into
the flattened model. Those auxiliary variables and the propagators of the con-
straints in which they appear may have a large negative impact on the efficiency
of solving (as we will show in Section 5).
In this paper, we propose a fully automated way to address this problem
by removing from the flattened model some auxiliary variables that appear in
exactly two constraints and replacing those two constraints by a new equivalent
constraint for which a propagator is generated. Given a flattened model, our
approach is fully automated and online. It can be summarised as follows:
1. Identify frequent patterns in the flattened model consisting of two constraints
sharing an auxiliary variable.
2. For a pattern, define a new constraint predicate that involves all variables
appearing in the pattern except for the shared auxiliary variable.
3. For a pattern, replace all its occurrences in the flattened model by instanti-
ating the new constraint predicate.
4. For each new predicate, generate a propagator description in the indexical
language of [11] and compile it for the targeted constraint solver.
5. Solve the modified flattened model using the constraint solver extended with
the new indexical-based propagators.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 313–329, 2015.
DOI: 10.1007/978-3-319-23219-5 22
314 J.-N. Monette et al.
Our experiments in Section 5 show that our approach is useful for instances that
are hard to solve, reducing the average time by 9% for those taking more than
one minute and sometimes more than doubling the search speed.
The rest of the paper assumes that the low-level language is FlatZinc [1] and
that the constraint solver is Gecode [7], as our current implementation is based
on FlatZinc and Gecode. However, the ideas presented here are applicable to
other low-level modelling languages and other constraint solvers.
The paper is organised as follows. We start with some preliminaries in
Section 2. Then we describe our approach in Section 3 and present a complete
example in Section 4. In Section 5, we show that this approach is effective in
practice. In Section 6, we discuss the merits and limitations of our approach as
well as some alternatives. Finally, we conclude in Section 7.
2 Preliminaries
A constraint-based model is a formal way to describe a combinatorial problem.
It is composed of a set of variables, each with a finite domain in which it must
take its value, a set of constraints, and an objective. A solution is an assignment
to all variables so that all constraints are satisfied. The objective is either to find
a solution, or to find a solution in which a given variable is minimised, or to find
a solution in which a given variable is maximised.
A constraint predicate, or simply predicate, is defined by a name and a sig-
nature that lists the formal arguments of the predicate. The arguments can be
constants, variables, or arrays thereof. For simplicity, we identify a predicate
with its name and we often do not give the types of its arguments. We specify
the semantics of a predicate P by a logic formula involving the arguments of
P and constants. For example, one could write PLUS(X, Y, Z) X = Y + Z,
for the predicate PLUS with formal arguments X, Y , and Z. A predicate whose
signature has arrays of variables is said to be of unfixed arity, or n-ary. Unfixed-
arity predicates are usually referred to as global constraints [2] in constraint
programming. Each constraint in a constraint-based model is the instantiation
of a constraint predicate to some actual arguments. We denote formal arguments
in upper case and actual arguments inside a model in lower case.
Fig. 1. MiniZinc model (1a) and FlatZinc model resulting from its flattening (1b)
For example, the MiniZinc model of Figure 1a is flattened into the FlatZinc
model of Figure 1b, modulo editorial changes. The single constraint expression
of the MiniZinc model (line 7 in Figure 1a) is flattened by introducing three aux-
iliary variables (lines 4–6 in Figure 1b) and posting four primitive constraints:
the constraints in lines 7–9 functionally define the auxiliary variables represent-
ing parts of the original constraint expression, and the disjunction of line 10
corresponds to the top-level expression.
For 75 of the 488 benchmark instances we used (see Section 5 for details),
no auxiliary variables are introduced by flattening. For 264 instances, flattening
multiplies the number of variables in the model by more than 5. For 7 instances,
flattening even multiplies the number of variables by more than 100.
2.3 Indexicals
3 Our Approach
Given a FlatZinc model, our approach, whose implementation is referred to
as var-elim-idxs, adds a preprocessing step before solving the model. This
preprocessing is summarised in Algorithm 1. We do not describe lines 1, 5, and 6,
as they involve purely mechanical and well-understood aspects. The core of the
algorithm iteratively identifies frequent patterns (line 2), replaces them in the
Automated Auxiliary Variable Elimination 317
model (line 3), and generates propagators (line 4). Sections 3.1 to 3.3 describe
this core.
The loop of lines 2 to 4 ends when no pattern occurs often enough, which
is when the number of occurrences of a most frequent pattern (if any) is less
than 10 or less than 5% of the number of variables in the model: under those
thresholds, the effort of preprocessing is not worth it. To save further efforts, if
the number of auxiliary variables is less than 10 or less than 5% of the number
of variables in the model (this criterion can be checked very fast with Unix
utilities such as grep), then the preprocessing is not performed at all. The two
thresholds, 10 and 5%, have been set arbitrarily after some initial experiments.
The purpose of the third rule is to allow a better handling of some special
constants, which may simplify the generated propagators. For example, linear
(in)equalities can be propagated more efficiently with unit coefficients.
In general, there might be other shared variables between PA (a1 , . . . , ap ) and
PB (b1 , . . . , bq ) besides x but, to keep things simple, we consider them separately,
i.e., a new argument Yk with an unused k is created for each occurrence of another
shared variable. Ignoring other shared variables does not affect the correctness
of our approach, but the generated propagators may achieve less filtering than
possible otherwise. We will revisit this issue in Section 6.
In order to avoid the creation of symmetric patterns, we sort the elements of
an array when their order is not relevant: we do this currently only for the n-ary
Boolean disjunction and conjunction constraints.
For example, both (x∨y)∧(x ≡ 1 ≤ z) and (w∨u)∧(u ≡ 1 ≤ v) are considered
occurrences of P (Y1 , Y2 ) (X ∨ Y1 ) ∧ (X ≡ 1 ≤ Y2 ), although, syntactically,
the shared variables (x and u, respectively) occur in different positions in their
respective disjunctions.
Finally, we count the occurrences of each created pattern. In doing so, we
ignore the following patterns, expressed here in terms of criteria that are specific
to FlatZinc and Gecode:
– Patterns involving an n-ary predicate with at least five variables among
its arguments: currently, our approach considers only fixed-arity patterns.
Hence n-ary constraints with different numbers of variables are considered
as fixed-arity constraints with different arities. We only want to keep those
of small arities for efficiency reasons. The threshold is set to 5 because no
fixed-arity predicate in FlatZinc has more than four variable arguments.
– Patterns involving a predicate for which an indexical-based propagator is
expected to perform poorly with respect to a hand-written propagator: this
includes all the global constraint predicates from the MiniZinc standard
library, as well as the element, absolute value, division, modulo, and multi-
plication predicates of FlatZinc.
– Patterns involving a bool2int predicate in which the Boolean variable is the
shared variable, and another predicate that is not a pattern itself: this case
is ignored as, in some cases, the Gecode-FlatZinc parser takes advantage of
bool2int constraints and we do not want to lose that optimisation.
The two first criteria partially but not completely overlap: for example, the
constraint all different([X, Y, Z, W ]) is not ruled out by the first criterion as
it has fewer than five variables, but it is ruled out by the second one; conversely,
int lin eq(coeffs, [X, Y, Z, W, U ], k) is ruled out by the first criterion but not
by the second one.
The result of pattern identification is a pattern that occurs most in the model.
The generation of a propagator for a pattern uses our indexical compiler [11]
and performs the following steps:
Step 1 only involves a change of syntax, and Step 4 has already been described
in [11]. Hence, we will focus here on Steps 2 and 3.
Let X be the variable to eliminate in Step 2. Here, variable elimination can
take two forms. First, if X is constrained to be equal to some expression φ in one
of the two conjuncts, i.e., if the checker can be written as P (. . . , X, . . . ) ∧ X = φ
for some predicate P , then all occurrences of X in the checker are replaced by
320 J.-N. Monette et al.
Hence the propagator for X ≡ (Y1 ∧Y2 ∧Y3 ) in the original flattened model needs
to watch both when all conjuncts become true to set X to true and when some
conjunct becomes false to set X to false. In contrast, the propagator of Figure 3
is only interested in the falsity of the conjuncts to restrict Y4 to 0. The generated
C++ code of the indexical-based propagators for Gecode is 579 lines long.
While the unmodified Gecode-FlatZinc interpreter solves the flattened model
in 111.5 seconds, var-elim-idxs solves it in 89.1 seconds, divided into 4.9 sec-
onds of preprocessing and 84.2 seconds of actual solving.
5 Experimental Evaluation
Table 2. Results for the 223 modified instances, aggregated per MiniZinc model, with
the following columns: name of the model; number of instances; mean and standard
deviation of the percentage of auxiliary variables; mean and standard deviation of the
percentage of variables eliminated by var-elim-idxs (over all variables of the model);
geometric mean and geometric standard deviation of the node rate ratio including
preprocessing; as well as geometric mean and geometric standard deviation of the
node rate ratio excluding preprocessing. The models are ordered by decreasing ratio
excluding preprocessing (column ‘ratio search’).
Table 3. Results for the 172 unmodified instances, with the columns of Table 2
inst. % aux. % elim. ratio total ratio search
Total 172 80 (20) 0 (0) 0.82 (1.80) 1.00 (1.08)
Total (> 1 s.) 159 79 (20) 0 (0) 0.95 (1.13) 1.00 (1.01)
Total (> 60 s.) 110 76 (20) 0 (0) 1.00 (1.02) 1.00 (1.01)
refers to Gecode and ‘v’ to var-elim-idxs. We use node rates in order to have
a meaningful measure for both the instances that are solved before time-out and
those that are not. This assumes that the explored search trees are the same,
which is discussed in Section 6. A ratio larger than 1 means that var-elim-idxs
is faster than Gecode. We do not consider ratios between 0.97 and 1.03 to rep-
resent a significant change.
The percentage of auxiliary variables is generally very high, with an average
of 83%, but on average only 70% of all the variables are auxiliary and appear
in exactly two constraints. The percentage of eliminated variables varies a lot,
from as little as 5% to 96%, effectively eliminating all auxiliary variables in the
case of the openshop model. On average, var-elim-idxs extends Gecode with
2.3 new propagators, with a maximum of 9 propagators for an instance of the
cyclic-rcpsp model.
The column ratio search shows that preprocessing generally either improves
the node rate during search (ratio larger than 1.03) or leaves it almost unchanged
(ratio between 0.97 and 1.03). The node rate can be more than doubled: see the
l2p model. For the four models at the bottom of the table, however, the perfor-
mance is worse after preprocessing. On average, the node rate during search is
1.12 times higher. The geometric standard deviation is generally low, i.e., close to
1.0, for instances of the same MiniZinc model, except when some of the instances
are solved very fast, partly due to measurement errors.
The column ratio total shows that, when also counting the time for prepro-
cessing, the results are still promising. On average, the node rate is 0.81 times
lower using preprocessing. This number is strongly affected by instances that are
solved very fast. If we take into account only the 207 instances that originally
take more than one second to solve, then the node rate of var-elim-idxs is
on average identical to the one of Gecode. If we take into account only the 174
instances that originally take more than one minute to solve, then the node rate
of var-elim-idxs is on average 1.09 times higher.
Interestingly, Table 2 also shows that there is no strong correlation between
the number of eliminated variables and the node rate ratio. For instance, nearly
all auxiliary variables of the rcpsp model are eliminated but the node rate ratio
is close to 1, despite the fact that the number of propagator calls is divided
by two. This probably indicates that the generated indexical-based propagator
suffers from some inefficiencies.
The median preprocessing time for the 223 modified instances is 4.4 seconds,
roughly equally divided between the time spent by our code in Scala and the
time spent by the g++ compiler. The minimum time is 2.9 seconds, of which a
Automated Auxiliary Variable Elimination 325
closer analysis shows that more than 2.5 seconds are actually spent in the set-up,
such as loading classes or parsing header files, independently of the size of the
instance or the number of identified patterns. It is important to note that neither
the g++ compiler nor our indexical compiler were developed for such a use-case,
as compilation is usually performed offline. The median preprocessing time for
the 172 instances unmodified by preprocessing is 0.9 seconds. The minimum time
is 0.7 seconds, again mostly spent in loading classes. The largest preprocessing
time observed is 30 seconds, in the case of a very large nmseq instance. Table 3
reports aggregated results for the 172 unmodified instances: the cost of uselessly
running the preprocessing is largely unnoticeable for unmodified instances that
take more than 60 seconds to be solved.
6 Discussion
In the light of the experimental results, this section discusses more thoroughly
the merits and limitations of our approach.
Variable Views. The initial purpose of variable views [3,16] and domain
views [19] is to reduce the number of implemented propagators in a solver, but
they can also be used to eliminate some auxiliary variables. A view allows one
to post a constraint on an argument that is a function of a variable instead of
a variable. If a constraint is of the form x = f (y), where x and y are variables,
then one can introduce a view v = f (y) and replace the variable x by the view v.
Compared with our approach, views have the benefits that they are not limited
to variables appearing in two constraints and that they do not require generat-
ing new propagators, hence that they can eliminate variables that appear, for
example, in global constraints. Views are however in general limited to unary
functions, except in [3]. More importantly, to the best of our knowledge, no solver
automatically transforms a flattened constraint into a view.
Search Tree Shape. Given a search strategy and enough time, the search
trees explored by Gecode on the original model and by var-elim-idxs on the
modified model are the same if all the following conditions are respected:
– The search strategy does not depend on the propagation order.
– The search strategy does not need to branch on the auxiliary variables.
– The generated propagators do the same filtering as the replaced propagators.
Except in the case of the roster model, where the search strategy is incompletely
specified, the two first conditions are respected for all the instances we used
in Section 5. The third condition is more difficult to check, but seems generally
respected: out of the 84 modified instances that did not time out, only 7 instances
had a different and always larger search tree, namely one fjsp instance, two league
instances, one roster instance, and three still-life-wastage instances.
Domains. Our approach assumes that the domains of the eliminated variables
are non-constraining because the shared variable X is existentially quantified
without specifying a domain. This is why we restricted ourselves to variables
introduced by the MiniZinc flattener, annotated with var is introduced, as
the domains proved to be non-constraining for those variables. However, auxil-
iary variables may also be introduced manually to simplify a model. A sound
way to extend our approach to such variables while retaining correctness is to
verify that the domain is non-constraining before considering a variable x for
replacement, by only considering how the propagators of the two constraints in
which x appears reduce the domain of x given the domains of their other vari-
ables. This would also let us apply our approach to other modelling languages
that do not have the var is introduced annotation, such as, e.g., XCSP [15].
Automated Auxiliary Variable Elimination 327
Increased Filtering. When identifying patterns, if more than one shared vari-
able is identified, then it is possible to generate propagators achieving more
filtering. Our approach can be extended to multiple shared variables. However,
for it to be worthwhile, it is necessary to ensure that the propagator genera-
tion takes advantage of multiple occurrences of a variable other than X in the
checker. This is currently not the case but an interesting line of future work.
7 Conclusion
We presented a new approach to eliminate many of the auxiliary variables
introduced into a flattened constraint-based model. Our approach adds a
preprocessing step that modifies the flattened model and extends the solver
with propagators generated on the fly for new constraint predicates. This is
made possible through the generation of indexical-based propagators from log-
ical formulas. Experiments with our prototype implementation show that our
approach makes a solver about 9% faster on average, and sometimes more than
2 times faster, for instances that take more than one minute to solve. This indi-
cates that our preprocessing should be activated for instances that are difficult
to solve, which are the ones for which it is important to decrease solving time.
References
1. Becket, R.: Specification of FlatZinc. http://www.minizinc.org/downloads/doc-1.
6/flatzinc-spec.pdf
2. Beldiceanu, N., Carlsson, M., Demassey, S., Petit, T.: Global constraint catalogue:
Past, present, and future. Constraints 12(1), 21–62 (2007). The catalogue is at
http://sofdem.github.io/gccat
3. Correia, M., Barahona, P.: View-based propagation of decomposable constraints.
Constraints 18(4), 579–608 (2013)
4. Dao, T.B.H., Lallouet, A., Legtchenko, A., Martin, L.: Indexical-based solver learn-
ing. In: Van Hentenryck, P. (ed.) CP 2002. LNCS, vol. 2470, pp. 541–555. Springer,
Heidelberg (2002)
5. Feydy, T., Somogyi, Z., Stuckey, P.J.: Half reification and flattening. In: Lee, J.
(ed.) CP 2011. LNCS, vol. 6876, pp. 286–301. Springer, Heidelberg (2011)
6. Frisch, A.M., Grum, M., Jefferson, C., Martinez Hernandez, B., Miguel, I.: The
design of ESSENCE: a constraint language for specifying combinatorial problems.
In: IJCAI 2007, pp. 80–87. Morgan Kaufmann (2007)
7. Gecode Team: Gecode: A generic constraint development environment (2006).
http://www.gecode.org
8. Gent, I.P., Jefferson, C., Linton, S., Miguel, I., Nightingale, P.: Generating custom
propagators for arbitrary constraints. Artificial Intelligence 211, 1–33 (2014)
9. Hassani Bijarbooneh, F.: Constraint Programming for Wireless Sensor Networks.
Ph.D. thesis, Department of Information Technology, Uppsala University, Sweden
(2015). http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-241378
10. Leo, K., Mears, C., Tack, G., Garcia de la Banda, M.: Globalizing constraint
models. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 432–447. Springer,
Heidelberg (2013)
11. Monette, J.-N., Flener, P., Pearson, J.: Towards solver-independent propagators.
In: Milano, M. (ed.) CP 2012. LNCS, vol. 7514, pp. 544–560. Springer, Heidelberg
(2012)
12. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc:
towards a standard CP modelling language. In: Bessière, C. (ed.) CP 2007. LNCS,
vol. 4741, pp. 529–543. Springer, Heidelberg (2007). The MiniZinc toolchain is
available at http://www.minizinc.org
13. Nightingale, P., Akgün, Ö., Gent, I.P., Jefferson, C., Miguel, I.: Automatically
improving constraint models in savile row through associative-commutative com-
mon subexpression elimination. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656,
pp. 590–605. Springer, Heidelberg (2014)
14. Rendl, A., Miguel, I., Gent, I.P., Jefferson, C.: Automatically enhancing constraint
model instances during tailoring. In: Bulitko, V., Beck, J.C. (eds.) SARA 2009.
AAAI Press (2009)
15. Roussel, O., Lecoutre, C.: XML representation of constraint networks: Format
XCSP 2.1. CoRR abs/0902.2362 (2009). http://arxiv.org/abs/0902.2362
16. Schulte, C., Tack, G.: View-based propagator derivation. Constraints 18(1), 75–107
(2013)
17. Scott, J.D.: Rapid prototyping of a structured domain through indexical compila-
tion. In: Schaus, P., Monette, J.N. (eds.) Domain Specific Languages in Combina-
torial Optimisation (CoSpeL workshop at CP 2013) (2013). http://cp2013.a4cp.
org/workshops/cospel
Automated Auxiliary Variable Elimination 329
18. Sidebottom, G., Havens, W.S.: Nicolog: A simple yet powerful cc(FD) language.
Journal of Automated Reasoning 17, 371–403 (1996)
19. Van Hentenryck, P., Michel, L.: Domain views for constraint programming. In:
O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 705–720. Springer, Heidelberg
(2014)
20. Van Hentenryck, P., Saraswat, V., Deville, Y.: Design, implementation, and eval-
uation of the constraint language cc(FD). Tech. Rep. CS-93-02, Brown University,
Providence, USA (January 1993), revised version in Journal of Logic Program-
ming 37(1–3), 293–316 (1998). Based on the unpublished manuscript Constraint
Processing in cc(FD) (1991)
Automatically Improving SAT Encoding
of Constraint Problems Through Common
Subexpression Elimination in Savile Row
1 Introduction
The first step is to recursively traverse the model (by calling Algorithm 2)
to collect sets of identical expressions. Algorithm 2 collects only expressions
that are candidates for CSE. Atomic variables and constants are not candidates.
Compound expressions are CSE candidates by default, however when the target
is a SAT encoding we exclude all compound expressions that can be encoded as
a single SAT literal. This avoids creating a redundant SAT variable that is equal
to (or the negation of) another SAT variable, thus improving the encoding. The
following expressions are not candidates: x = c, x = c, x ≤ c, x < c, x ≥ c,
x > c, ¬x (where x is a decision variable and c is a constant).
The second step of Identical CSE is to iterate through sets of expressions
in decreasing size order (line 4). When an expression e is eliminated by CSE,
the number of occurrences of any expressions contained in e is reduced. There-
fore eliminating long expressions first may obviate the need to eliminate short
expressions. For each set (of size greater than one) of identical expressions a new
decision variable aux is created, and each of the expressions is replaced with aux.
One of the expressions e in the set is used to create a new constraint e = aux .
Crucially the new constraint contains the original object e so it is possible to
extract further CSEs from within e.
Prior to running Identical CSE the model is simplified by evaluating all con-
stant expressions and placing it into negation normal form. In addition some
type-specific simplifications are performed (eg x ↔ true rewrites to x). Commu-
tative expressions (such as sums) are sorted to make some equivalent expressions
syntactically identical.
In our previous work we investigated Associative-Commutative CSE (AC-
CSE) for constraint solvers [19] and in that context Identical CSE was always
enabled. Identical CSE is complementary to AC-CSE.
Active CSE. Active CSE extends Identical CSE by allowing non-identical
expressions to be extracted using a single auxiliary variable. For example, sup-
pose we have x = y and x = y in the model. We can introduce a single Boolean
variable a and a new constraint a ↔ (x = y), then replace x = y with a and
x = y with ¬a. For solvers that support negation (such as SAT solvers) ¬a can
be expressed in the solver input language with no further rewriting, so we have
avoided encoding both x = y and x = y.
The Active CSE algorithm implemented in Savile Row is an extension
of Algorithm 1. The algorithm works as follows: for each candidate expres-
sion e a simple transformation is applied to it (for example producing ¬e). The
transformed expression is placed into the normal form and commutative subex-
pressions are sorted. The algorithm then queries map to discover expressions
matching the transformed expression.
Active CSE as implemented in Savile Row 1.6.3 applies four transforma-
tions: Boolean negation, arithmetic negation, multiply by 2, and multiply by -2.
Rendl implemented Boolean negation active CSE in her Tailor system, along
with active reformulations based upon De Morgan’s laws and Horn clauses [20].
In Savile Row, the use of negation normal form obviates the use of the latter
two. To our knowledge MiniZinc [13,26] does not implement Active CSE.
334 P. Nightingale et al.
3 Experimental Evaluation
Fig. 1. Identical CSE vs Basic (upper left), Active & Identical CSE vs Identical CSE
(upper right), Identical, Active & AC-CSE vs Identical & Active CSE (lower left), same
vs Basic (lower right).
[11] and car sequencing [6] as well as less common problems such as Black Hole
solitaire [9]. In total there are 492 problem instances.
Experiments were run with 32 processes in parallel on a machine with two
16-core AMD Opteron 6272 CPUs at 2.1 GHz and 256 GB RAM. We used
the SAT solver Lingeling [12] which was winner of the Sequential, Application
SAT+UNSAT track of the SAT competition 2014. We downloaded lingeling-ayv-
86bf266-140429.zip from http://fmv.jku.at/lingeling/. We used default options
for Lingeling so inprocessing was switched on. All times reported include Savile
Row time and Lingeling’s reported time, and are a median of 10 runs with 10
different random seeds given to Lingeling. A time limit of one hour was applied.
We used a clause limit of 100 million, and for instances that exceeded the clause
limit we treated them as if they timed out at 3600s (to allow comparison with
others). Of 492 instances, 7 reached the clause limit with Basic and 6 with the
other configurations.
Summary Plots for Full Set of Benchmarks. In Figures 1–2 we present a
summary view of the performance of our CSE methods over our full set of 49
benchmark problem classes. Figure 1 (upper left) compares the basic encoding
with identical CSE. On easier problem instances CSE has a limited effect, but
as problem difficulty increases so does the potential of identical CSE to reduce
search effort very significantly - in some cases by over 20 times. There are a small
number of outliers among the harder instances where identical CSE degrades
overall performance. We conjecture that this is due to the change in problem
336 P. Nightingale et al.
Fig. 2. Identical, Active & AC-CSE vs Identical & Active CSE plotted against reduc-
tion in SAT variables. The plot on the right is a subset of the left.
Fig. 3. Identical & Active CSE vs Basic: Car Sequencing (left) and SONET (right).
quotient and reduction of SAT variables, indicating that the number of SAT
variables alone is a very coarse measure of difficulty.
Case Study 1: Car Sequencing Our Essence model of Car Sequencing [24]
uses a sequence of integer variables x[1 . . . n] to represent the sequence of cars on
a production line. For each option (to be fitted at a station on the production
line) we have a limit on the proportion of cars: at most p of any q adjacent
cars may have the option installed so as not to overload the station. To model
this we employ overlapping sums of length q containing x[i] ∈ S, where S is the
set of car classes that have the option installed, and i is an index within the
subsequence of length q.
The number of each car class to build is enforced with a global cardinality
constraint [17] on x. Also, for each option we know how many cars require
n
that option in total (t) thus we add a further implied constraint: i=1 (x[i] ∈
S) = t. We experiment with the 80 instances used in Nightingale [17]. Identical
and Active CSE are both able to extract the expressions x[i] ∈ S that appear
in several sum constraints, avoiding multiple SAT encodings of the same set-
inclusion constraint. Figure 3 (left) plots the time improvement of Active CSE
compared with the Basic encoding. The improvement is substantial and increases
with the difficulty of the problem instances.
AC-CSE is able to extract common subexpressions among the sum con-
straints for a given option. The p of q constraints overlap with each other and also
with the implied constraint for the option. Figure 1 (lower left) plots the time
improvement of adding AC-CSE to identical and active CSE. The additional
improvement is substantial, with many instances becoming solvable within one
hour and a peak speed up of over 100 times. With the Basic encoding 13 of
the 80 instances time out at one hour. In contrast, when combining Identical,
Active and AC-CSE we found that only two instances timed out. The other 11
are solved within one hour, most with very substantial speed-ups.
Case Study 2: SONET The SONET problem [16,25] is a network design
problem where each node is installed on a set of rings (fibre-optic connections).
If two nodes are required to be connected, there must exist a ring on which
they are both installed. We use the simplified SONET problem where each ring
338 P. Nightingale et al.
4 Conclusion
Common Subexpression Elimination has proven to be a valuable tool in the
armoury of reformulations applied to constraint models, however hitherto there
has only been limited success in applying CSE to SAT formulations [29]. We
have shown how CSE can be used to improve SAT formulations derived through
an automated encoding process from constraint models. Our approach has the
advantage that it can identify and exploit structure present in a constraint model
that is subsequently obscured by the encoding process, while still taking advan-
tage of powerful SAT solvers. The result is a method that, when applicable, can
produce a very significant reduction in search effort.
We have evaluated our approach on a wide range of benchmark problems. On
some instances we observed improvements of SAT solver speed of over 50 times.
On the car sequencing problem, for example, the peak speed increase is over 100
times. With the basic approach, 13 of 80 car sequencing instances could not be
solved in one hour, whereas with the full CSE approach only two instances could
not be solved.
Acknowledgments. We wish to thank the EPSRC for funding this work through
grants EP/H004092/1 and EP/M003728/1, and Christopher Jefferson for helpful dis-
cussions.
References
1. Araya, I., Neveu, B., Trombettoni, G.: Exploiting common subexpressions in
numerical CSPs. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 342–357.
Springer, Heidelberg (2008)
2. Audemard, G., Katsirelos, G., Simon, L.: A restriction of extended resolution for
clause learning sat solvers. In: Proceedings of the Twenty-Fourth AAAI Conference
on Artificial Intelligence (2010)
Automatically Improving SAT Encoding of Constraint Problems 339
3. Barrett, C., Conway, C.L., Deters, M., Hadarean, L., Jovanović, D., King, T.,
Reynolds, A., Tinelli, C.: CVC4. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV
2011. LNCS, vol. 6806, pp. 171–177. Springer, Heidelberg (2011)
4. Biere, A., Heule, M., van Maaren, H.: Handbook of Satisfiability, vol. 185. IOS
Press (2009)
5. Cocke, J.: Global common subexpression elimination. ACM Sigplan Notices 5(7),
20–24 (1970)
6. Dincbas, M., Simonis, H., Van Hentenryck, P.: Solving the car-sequencing problem
in constraint logic programming. In: Proceedings of the 8th European Conference
on Artificial Intelligence (ECAI 1988), pp. 290–295 (1988)
7. Eén, N., Biere, A.: Effective preprocessing in SAT through variable and clause
elimination. In: Bacchus, F., Walsh, T. (eds.) SAT 2005. LNCS, vol. 3569,
pp. 61–75. Springer, Heidelberg (2005)
8. Gent, I.P.: Arc consistency in SAT. In: Proceedings of the 15th European Confer-
ence on Artificial Intelligence (ECAI 2002), pp. 121–125 (2002)
9. Gent, I.P., Jefferson, C., Kelsey, T., Lynce, I., Miguel, I., Nightingale, P., Smith,
B.M., Tarim, S.A.: Search in the patience game ‘black hole’. AI Communications
20(3), 211–226 (2007)
10. Gent, I.P., Miguel, I., Rendl, A.: Tailoring solver-independent constraint models:
a case study with Essence and Minion. In: Miguel, I., Ruml, W. (eds.) SARA
2007. LNCS (LNAI), vol. 4612, pp. 184–199. Springer, Heidelberg (2007)
11. Huczynska, S., McKay, P., Miguel, I., Nightingale, P.: Modelling equidistant fre-
quency permutation arrays: an application of constraints to mathematics. In: Gent,
I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 50–64. Springer, Heidelberg (2009)
12. Järvisalo, M., Heule, M.J.H., Biere, A.: Inprocessing rules. In: Gramlich, B.,
Miller, D., Sattler, U. (eds.) IJCAR 2012. LNCS, vol. 7364, pp. 355–370. Springer,
Heidelberg (2012)
13. Leo, K., Tack, G.: Multi-pass high-level presolving. In: Proceedings of the 24th
International Joint Conference on Artificial Intelligence (IJCAI) (to appear, 2015)
14. Marques-Silva, J.: Practical applications of boolean satisfiability. In: 9th Interna-
tional Workshop on Discrete Event Systems (WODES 2008), pp. 74–80 (2008)
15. Moskewicz, M.W., Madigan, C.F., Zhao, Y., Zhang, L., Malik, S.: Chaff: engineer-
ing an efficient SAT solver. In: Proceedings of the 38th Annual Design Automation
Conference, pp. 530–535. ACM (2001)
16. Nightingale, P.: CSPLib problem 056: Synchronous optical networking (SONET)
problem. http://www.csplib.org/Problems/prob056
17. Nightingale, P.: The extended global cardinality constraint: An empirical survey.
Artificial Intelligence 175(2), 586–614 (2011)
18. Nightingale, P.: Savile Row, a constraint modelling assistant (2015). http://
savilerow.cs.st-andrews.ac.uk/
19. Nightingale, P., Akgün, Ö., Gent, I.P., Jefferson, C., Miguel, I.: Automatically
improving constraint models in Savile Row through associative-commutative com-
mon subexpression elimination. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656,
pp. 590–605. Springer, Heidelberg (2014)
20. Rendl, A.: Effective Compilation of Constraint Models. Ph.D. thesis, University of
St Andrews (2010)
21. Rossi, F., van Beek, P., Walsh, T. (eds.) Handbook of Constraint Programming.
Elsevier (2006)
22. Shang, Y., Wah, B.W.: A discrete lagrangian-based global-search method for solv-
ing satisfiability problems. Journal of Global Optimization 12(1), 61–99 (1998)
340 P. Nightingale et al.
23. Shlyakhter, I., Sridharan, M., Seater, R., Jackson, D.: Exploiting subformula shar-
ing in automatic analysis of quantified formulas. In: Sixth International Conference
on Theory and Applications of Satisfiability Testing (SAT 2003) (2003), poster
24. Smith, B.: CSPLib problem 001: Car sequencing. http://www.csplib.org/
Problems/prob001
25. Smith, B.M.: Symmetry and search in a network design problem. In: Barták,
R., Milano, M. (eds.) CPAIOR 2005. LNCS, vol. 3524, pp. 336–350. Springer,
Heidelberg (2005)
26. Stuckey, P.J., Tack, G.: MiniZinc with functions. In: Gomes, C., Sellmann, M.
(eds.) CPAIOR 2013. LNCS, vol. 7874, pp. 268–283. Springer, Heidelberg (2013)
27. Subbarayan, S., Pradhan, D.K.: NiVER: non-increasing variable elimination reso-
lution for preprocessing SAT instances. In: Hoos, H.H., Mitchell, D.G. (eds.) SAT
2004. LNCS, vol. 3542, pp. 276–291. Springer, Heidelberg (2005)
28. Tamura, N., Taga, A., Kitagawa, S., Banbara, M.: Compiling finite linear CSP into
SAT. Constraints 14(2), 254–272 (2009)
29. Yan, Y., Gutierrez, C., Jeriah, J.C., Bao, F.S., Zhang, Y.: Accelerating SAT solving
by common subclause elimination. In: Proceedings of the Twenty-Ninth AAAI
Conference on Artificial Intelligence (AAAI 2015), pp. 4224–4225 (2015)
Exact Sampling for Regular and Markov
Constraints with Belief Propagation
1 Introduction
Generating novel sequences, such as text or music, that imitate a given style is
usually achieved by replicating statistical properties of a corpus. This inherently
stochastic process can be typically performed by sampling a probability distri-
bution. In practice, we often need to impose additional properties on sequences,
such as syntactic patterns for text, or meter for music, that are conveniently
stated using constraint satisfaction approaches. However, typical constraint sat-
isfaction procedures are not concerned with the distribution of their solutions.
On the other hand, traditional sampling algorithms are generally not suited to
satisfy hard constraints, since they can suffer from high rejection rates or lack
coverage of the solution space. Both issues can be avoided, in some cases, by
taking advantage of constraint programming techniques.
In this paper, we show how to sample Markov sequences subject to a conjunc-
tion of Regular constraints [22], i.e., constraints stated with an automaton,
as well as additional unary constraints. Regular grammars can express parts-
of-speech patterns on text. In music, Meter [26] constrains Markov temporal
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 341–350, 2015.
DOI: 10.1007/978-3-319-23219-5 24
342 A. Papadopoulos et al.
The combination of statistical and logical methods has been an active research
direction in artificial intelligence in the last few years. In constraint program-
ming, stochastic techniques are often used for guiding search, but less for charac-
terising solutions. Some work studies the impact of search heuristics on solution
diversity [27], but such endeavours tend to use optimisation techniques [11,13].
Conversely, introducing constraints to probabilistic graphical models is prob-
lematic since hard constraints introduce many zero probabilities, and this causes
typical sampling algorithms to suffer from high rejection rates. To overcome such
issues, Gogate and Dechter proposed SampleSearch [10], with a guaranteed uni-
form sampling of the solutions of a CSP, using a complete solver to reduce rejec-
tion rates. Likewise, Ermon et. al [8] use a constraint solver in a blackbox scheme,
and sample the solution space uniformly, often with better performance. In SAT,
Markov logic networks is a well established formalism that unifies probabilistic
and deterministic properties [7,25]. MC-SAT [24] samples from a non-uniform
distribution of the satisfying assignments of a SAT formula. Such methods, with
applications in verification, model checking, or counting problems, are general
but expensive. The solution we propose, which focuses on a specific setting, is
not derivable from such general methods, and is both tractable and exact.
whose alphabet is the set of words of the corpus, to generate new sentences in
the style of its author.
Markov generation can be controlled using Markov constraints. This allows
us to specify additional properties that a sequence should verify. For example,
Meter [26] imposes that sequences of notes are metrically correct. Often, such
constraints can be conveniently stated using a Regular constraint [22], defined
with an automaton A = Q, Σ, δ, q0 , F , where Q is a set of states, Σ an alphabet
defining labels on transitions, δ the transition function linking a state q ∈ Q and
a label a ∈ Σ to the successor state q = δ(q, a), q0 ∈ Q the initial state,
and F ⊆ Q the set of accepting states. In this case, we have Σ = X , i.e.
transitions are labelled using states of the Markov chain, so that the automaton
recognises admissible Markov sequences. Combining Markov constraints with
other constraints, we can restrict the solution space in any desirable way [15],
but without any guarantee that the generated sequences will reflect the original
distribution in any way. In the specific case of unary constraints, we can have this
guarantee [2]. The result presented here can be seen as a further generalisation
of this result to a set of Regular constraints. A specific implementation of this
idea was used to generate non-plagiaristic sequences [18].
X1 f1 X2 f2 X3 f4
f3
Fig. 1. The factor graph for the function p(X1 , X2 , X3 ) = f1 (X1 , X2 ) · f2 (X2 , X3 ) ·
f3 (X1 , X3 ) · f4 (X3 ).
⎧
⎨P (X2 |X1 ) · · · P (Xn |Xn−1 ) · if X1 · · · Xn ∈ L(A)
ptarget (X1 , . . . , Xn ) ∝ P (X ) · · · Pn (Xn )
⎩ 1 1
0 otherwise
We use the symbol ∝ to indicate that the equality holds after normalisation,
so that ptarget defines a probability function. P (X2 |X1 ) · · · P (Xn |Xn−1 ) gives
the typical order 1 Markov probability of the sequences X1 , . . . , Xn , provided
it is accepted by the automaton. Additionally, we add unary constraints Pi , i.e.
factors biasing each variable Xi individually. Implicitly, there is a big factor
holding on the full sequence X1 , . . . , Xn taking value 1 when X1 · · · Xn ∈ L(A),
and value 0 otherwise, corresponding to a hard global constraint. Consequently,
the factor graph of ptarget is not a tree.
We propose a reformulation of ptarget (X1 , . . . , Xn ) into a new function preg of
Y1 , . . . , Yn , where the new Yi variables take values (a, q) ∈ X ×Q, where a ∈ X is
a state of the Markov chain, and q ∈ Q is a state of the automaton. Recall that
transitions of the automaton are also labelled with elements of X . This function
preg is composed of simple binary factors, and its factor graph, which is tree
structured, is shown on Figure 2.
g1 g2 gn−1 gn
Y1 f1 Y2 Yn−1 fn−1 Yn
In order to sample sequences from this factor graph, we adapt the general
sum-product algorithm [21], and simplify it for the following reasons: the factor
graph has no cycle (removing any issue for converging to a fixed point), the
factor graph is almost a linear graph (induced by the sequence), factors are
only unary and binary, and the procedure is used only for sampling individual
sequences. This algorithm is shown on Algorithm 1 for self-containedness. It
computes the backward messages mi← , the forward messages mi→ , and the
346 A. Papadopoulos et al.
5 Examples
If no automaton is imposed, our model, which imposes only unary constraints,
is equivalent to the model in [16]. We compared the new model with our old
model, and observed it behaves equivalently, with the benefit of an improved
efficiency. We generated sequences of 16 notes with a Markov order 1 in the
style of Bill Evans, with two unary constraints constraining the first and last
Exact Sampling for Regular and Markov Constraints with BP 347
note. Our old model could sample an average of 450 sequences per second, while
our new model produces an average of 1200 sequences per second, almost three
times more.
Automata can be handy for expressing patterns on text or music. For exam-
ple, in music, a semiotic structure is a symbolic description of higher level pat-
terns, from manual annotation or using pattern discovery techniques [4]. Semiotic
structures can be easily stated using automata. In text, automata can be used
to state syntactic rules over sequences of words.
Meter [26], in its most basic form, imposes that a sequence of variables
have a fixed total duration D, assuming each value has a specific duration, and
assuming the existence of a special padding value with a null duration, which
is used only at the end of the sequence. Meter can also be encoded using
Regular. We build an automaton Q, X , δ, q0 , F where each state represents
a partial duration between 0 and D, i.e. Q = {q0 , . . . , qD }. For every element
e ∈ X of the Markov chain, we add a transition from qo1 to qo2 labelled by e iff
o2 = o1 + d(e), where d(e) is the duration of e. Finally, we set F = {qD }. This
ensures that any accepting sequence will have a total duration of D exactly.
By imposing this automaton to the Markov model, we can sample metrically
correct Markov sequences with their correct probabilities. We tested this with a
toy problem: produce sequences of a variable number of words, but with fixed
number of syllables equal to 36, i.e. the duration of a word is its number of
syllables. We are able to sample around in average 1100 sequences per second,
against 230 sequences per second produced by a CP model with a single Meter
constraint, almost five times more.
In previous work, we introduced MaxOrder, which limits the maximum
order of generated sequences, i.e. the length of exact copies made from the input
corpus [19]. This constraint was filtered by computing a particular automaton
and propagating it using Regular. We can use this automaton with the model
of this paper, in order to sample Markov sequences with a maximum order
guarantee. Furthermore, by computing the intersection between the Meter and
the MaxOrder automaton, we can also impose meter on such sequences.
6 Evaluation
baseline random walk procedure generated an average of 5500 sequences per sec-
ond (counting only non-rejected sequences), while the belief propagation-based
method generated an average of 3500 sequences per second. For comparison, our
Regular-based CP model produced only about 50 sequences per second. We
filtered those that were generated over 50 times, of which there were about 47000
with random walk, and about 35000 with belief propagation. We estimated the
probability of a sequence by computing the sum of the probability of all unique
sequences found by either method, and use this for normalising.
We plot our results on Figure 3. Each point on either graph corresponds
to a sequence. Its value on the x-axis is its probability, estimated as described
previously, while the values on the y-axis is the empirical probability, i.e. the
frequency at which the specific sequence has been sampled compared to the
total number of sequences. Figure 3(a) shows that the baseline sampling app-
roach performs poorly: many sequences, even of similar probability, are over or
under-represented. On the other hand, Figure 3(b) provides a striking empirical
confirmation of the correctness of the belief propagation model.
0.0005 0.0005
probability (random walk automaton)
0.0004 0.0004
probability (belief propagation)
0.0003 0.0003
0.0002 0.0002
0.0001 0.0001
0 0
01 02 03 04 05 01 02 03 04 05
0 0.00 0.00 0.00 0.00 0.00 0 0.00 0.00 0.00 0.00 0.00
probability (estimated) probability (estimated)
Fig. 3. Sampling with random walk in the automaton compared to belief propagation.
7 Conclusion
We defined a belief propagation model for sampling Markov sequences that are
accepted by a given automaton. To this aim, we introduced a tree-structured
factor graph, on which belief propagation is polynomial and exact. This fac-
tor graph uses binary factors, which encode a type of conjunction between the
underlying Markov model and the given automaton. We showed that this pro-
cedure allows us to sample sequences faster than equivalent CP models, and
demonstrated that such sequences are sampled with their exact probabilities.
This result can be used for sequence generation problems in which users want
a set of solutions that are both probable in a given statistical model, and satisfy
hard regular constraints. More generally, we believe that this approach offers an
interesting bridge between statistical inference and constraint satisfaction.
Exact Sampling for Regular and Markov Constraints with BP 349
References
1. Proceedings, The Twenty-First National Conference on Artificial Intelligence and
the Eighteenth Innovative Applications of Artificial Intelligence Conference, July
16–20, 2006, Boston, Massachusetts, USA. AAAI Press (2006)
2. Barbieri, G., Pachet, F., Roy, P., Esposti, M.D.: Markov constraints for generating
lyrics with style. In: Raedt, L.D., Bessière, C., Dubois, D., Doherty, P., Frasconi, P.,
Heintz, F., Lucas, P.J.F. (eds.) Frontiers in Artificial Intelligence and Applications,
ECAI, vol. 242, pp. 115–120. IOS Press (2012)
3. Beeri, C., Fagin, R., Maier, D., Yannakakis, M.: On the Desirability of Acyclic
Database Schemes. J. ACM 30(3), 479–513 (1983)
4. Bimbot, F., Deruty, E., Sargent, G., Vincent, E.: Semiotic structure labeling of
music pieces: Concepts, methods and annotation conventions. In: Gouyon, F.,
Herrera, P., Martins, L.G., Müller, M. (eds.) Proceedings of the 13th Interna-
tional Society for Music Information Retrieval Conference, ISMIR 2012, Mosteiro
S.Bento Da Vitória, Porto, Portugal, October 8–12, 2012, pp. 235–240. FEUP
Edições (2012). http://ismir2012.ismir.net/event/papers/235-ismir-2012.pdf
5. Brooks, F.P., Hopkins, A., Neumann, P.G., Wright, W.: An experiment in musical
composition. IRE Transactions on Electronic Computers 6(3), 175–182 (1957)
6. Dechter, R., Pearl, J.: Tree Clustering for Constraint Networks. Artif. Intell. 38(3),
353–366 (1989)
7. Domingos, P.M., Kok, S., Poon, H., Richardson, M., Singla, P.: Unifying logical and
statistical AI. In: Proceedings, The Twenty-First National Conference on Artificial
Intelligence and the Eighteenth Innovative Applications of Artificial Intelligence
Conference, July 16–20, 2006, Boston, Massachusetts, USA [1], pp. 2–9. http://
www.aaai.org/Library/AAAI/2006/aaai06-001.php
8. Ermon, S., Gomes, C.P., Selman, B.: Uniform solution sampling using a
constraint solver as an oracle. In: de Freitas, N., Murphy, K.P. (eds.)
Proceedings of the Twenty-Eighth Conference on Uncertainty in Artificial
Intelligence, Catalina Island, CA, USA, August 14–18, 2012, pp. 255–264.
AUAI Press (2012). https://dslpitt.org/uai/displayArticleDetails.jsp?mmnu=1&
smnu=2&article id=2288&proceeding id=28
9. Freuder, E.C.: A Sufficient Condition for Backtrack-Free Search. J. ACM 29(1),
24–32 (1982)
10. Gogate, V., Dechter, R.: Studies in solution sampling. In: Fox, D., Gomes, C.P.
(eds.) Proceedings of the Twenty-Third AAAI Conference on Artificial Intelligence,
AAAI 2008, Chicago, Illinois, USA, July 13–17, 2008, pp. 271–276. AAAI Press
(2008). http://www.aaai.org/Library/AAAI/2008/aaai08-043.php
11. Hebrard, E., Hnich, B., O’Sullivan, B., Walsh, T.: Finding diverse and similar
solutions in constraint programming. In: Veloso, M.M., Kambhampati, S. (eds.)
Proceedings, The Twentieth National Conference on Artificial Intelligence and the
Seventeenth Innovative Applications of Artificial Intelligence Conference, July 9–
13, 2005, Pittsburgh, Pennsylvania, USA, pp. 372–377. AAAI Press / The MIT
Press (2005). http://www.aaai.org/Library/AAAI/2005/aaai05-059.php
350 A. Papadopoulos et al.
12. Mezard, M., Montanari, A.: Information, physics, and computation. Oxford
University Press (2009)
13. Nadel, A.: Generating diverse solutions in SAT. In: Sakallah, K.A., Simon, L. (eds.)
SAT 2011. LNCS, vol. 6695, pp. 287–301. Springer, Heidelberg (2011)
14. Nierhaus, G.: Algorithmic composition: paradigms of automated music generation.
Springer (2009)
15. Pachet, F., Roy, P.: Markov constraints: steerable generation of markov sequences.
Constraints 16(2), 148–172 (2011)
16. Pachet, F., Roy, P., Barbieri, G.: Finite-length markov processes with constraints.
In: Walsh, T. (ed.) IJCAI, pp. 635–642. IJCAI/AAAI (2011)
17. Pachet, F., Roy, P.: Imitative leadsheet generation with user constraints. In:
Schaub, T., Friedrich, G., O’Sullivan, B. (eds.) ECAI 2014–21st European Con-
ference on Artificial Intelligence, 18–22 August 2014, Prague, Czech Republic -
Including Prestigious Applications of Intelligent Systems (PAIS 2014). Frontiers in
Artificial Intelligence and Applications, vol. 263, pp. 1077–1078. IOS Press (2014).
http://dx.doi.org/10.3233/978-1-61499-419-0-1077
18. Papadopoulos, A., Pachet, F., Roy, P.: Generating non-plagiaristic markov
sequences with max order sampling. In: Degli Esposti, M., Altmann, E., Pachet,
F. (eds.) Universality and Creativity in Language (forthcoming). Lecture Notes in
Morphogenesis. Springer (2015)
19. Papadopoulos, A., Roy, P., Pachet, F.: Avoiding plagiarism in markov sequence
generation. In: Brodley, C.E., Stone, P. (eds.) Proceedings of the Twenty-Eighth
AAAI Conference on Artificial Intelligence, July 27–31, 2014, Québec City, Québec,
Canada, pp. 2731–2737. AAAI Press (2014). http://www.aaai.org/ocs/index.php/
AAAI/AAAI14/paper/view/8574
20. Pearl, J.: Reverend bayes on inference engines: A distributed hierarchical approach.
In: Waltz, D.L. (ed.) Proceedings of the National Conference on Artificial Intel-
ligence. Pittsburgh, PA, August 18–20, 1982, pp. 133–136. AAAI Press (1982).
http://www.aaai.org/Library/AAAI/1982/aaai82-032.php
21. Pearl, J.: Probabilistic reasoning in intelligent systems - networks of plausible infer-
ence. Morgan Kaufmann series in representation and reasoning. Morgan Kaufmann
(1989)
22. Pesant, G.: A regular language membership constraint for finite sequences of vari-
ables. In: Wallace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 482–495. Springer,
Heidelberg (2004)
23. Pinkerton, R.C.: Information theory and melody. Scientific American (1956)
24. Poon, H., Domingos, P.M.: Sound and efficient inference with probabilistic and
deterministic dependencies. In: Proceedings, The Twenty-First National Confer-
ence on Artificial Intelligence and the Eighteenth Innovative Applications of Arti-
ficial Intelligence Conference, July 16–20, 2006, Boston, Massachusetts, USA [1],
pp. 458–463. http://www.aaai.org/Library/AAAI/2006/aaai06-073.php
25. Richardson, M., Domingos, P.: Markov logic networks. Machine Learning 62(1–2),
107–136 (2006). http://dx.doi.org/10.1007/s10994-006-5833-1
26. Roy, P., Pachet, F.: Enforcing meter in finite-length markov sequences. In: des-
Jardins, M., Littman, M.L. (eds.) Proceedings of the Twenty-Seventh AAAI Con-
ference on Artificial Intelligence, July 14–18, 2013, Bellevue, Washington, USA.
AAAI Press (2013). http://www.aaai.org/ocs/index.php/AAAI/AAAI13/paper/
view/6422
27. Schreiber, Y.: Value-ordering heuristics: search performance vs. solution diversity.
In: Cohen, D. (ed.) CP 2010. LNCS, vol. 6308, pp. 429–444. Springer, Heidelberg
(2010)
Randomness as a Constraint
1 Introduction
For some applications we require a list of numbers, or some other data struc-
ture, that is (or appears to be) random, while also satisfying certain constraints.
Examples include the design of randomised experiments to avoid statistical bias
[13], the generation of random phylogenetic trees [14], quasirandom (low dis-
crepancy) sequences for efficient numerical integration and global optimisation
[24], randomised lists without repetition for use in experimental psychology [10],
random programs for compiler verification [6], and the random scheduling of
inspections for the sake of unpredictability [30].
An obvious approach to obtaining a random-looking solution is simply to
use a randomised search strategy, such as stochastic local search or backtrack
search with a randomised value ordering. In some cases this works, for example
it can generate a random permutation of a list, but in general there are several
drawbacks with the randomised search approach:
– If only random-looking solutions are acceptable then the constraint model
is not correct, as it permits solutions that are unacceptable. The correctness
of a constraint model should be independent of the search strategy used to
solve it.
– Randomised search can not prove that a random-looking solution does not
exist, or prove that a solution is as random-looking as possible.
– Unless the randomised search is carefully designed (see [9] for example) it is
likely to make a biased choice of solution.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 351–366, 2015.
DOI: 10.1007/978-3-319-23219-5 25
352 S.D. Prestwich et al.
2 Entropy Constraints
We require constraints to exclude low-entropy solutions, which we shall call
entropy constraints. This raises several practical questions: what types of pattern
can be excluded by constraints, how the constraints can be implemented, and
what filtering algorithms are available? We address these problems below. In our
experiments we use the Eclipse constraint logic programming system [1].
Randomness as a Constraint 353
compress, V.24 bis, GIF, PKZip, Zip, LHarc, PNG, gzip and ARJ [31] and use
algorithms described in [34–36]. These methods detect repeated k-grams (blocks
of k adjacent symbols) and replace them by pointers to dictionary entries. For
example the string 011101011100 contains two occurrences of the 5-gram 01110,
which can be stored in a dictionary and both its occurrences replaced by a
pointer to that entry.
We could generalise the freq constraint to limit the number of occurrences
of every possible k-gram, but as there are mk of them this is impractical unless
k is small. A more scalable approach is as follows. Given an integer k ≥ 2 and
an upper bound t on the number of occurrences of all k-grams over symbols
{0, . . . , m − 1} in a vector v of variables, we define a constraint dict(v, m, k, t).
We shall call this a dictionary entropy constraint. It can be implemented by
the Multi-Inter-Distance(x, t, p) global constraint [20] with p = n − k + 1
k−1
(the number of x variables), x = x0 , . . . , xn−k , and the xi = j=0 mj vi+j are
auxiliary integer variables representing k-grams, where n is the sequence length.
This global constraint enforces an upper bound t on the number of occurrences
of each value within any p consecutive x variables. In the special case t = 1 we
can instead use alldifferent(x) [28].
To test this idea on the artificial problem of Section 2.1 we add
dict(v, 10, k, 1) dictionary constraints for various k-values (but not the fre-
quency constraints of Section 2.1). The results in Table 1 show that as we reduce
k the solution contains fewer obvious patterns, and k = 2 gives a solution that
(to gzip) is indistinguishable from a purely random sequence, as 80 bytes is
within the range of for random sequences of this form.
k lex-least solution
50 00000000000000000000000000000000000000000000000001
00000000000000000000000000000000000000000000000000 29
25 00000000000000000000000001000000000000000000000000
20000000000000000000000003000000000000000000000000 35
12 00000000000010000000000020000000000030000000000040
00000000005000000000006000000000007000000000008000 48
6 00000010000020000030000040000050000060000070000080
00009000011000012000013000014000015000016000017000 60
3 00010020030040050060070080090110120130140150160170
18019021022023024025026027028029031032033034035036 71
2 00102030405060708091121314151617181922324252627282
93343536373839445464748495565758596676869778798890 80
In this example there are sufficient digrams (2-grams) to avoid any repetition,
but for smaller m this will not be true, and in the general case we might need
to use larger t or larger k. Note that we must choose tk ≥ n/mk otherwise the
problem will be unsatisfiable.
Randomness as a Constraint 355
3 Applications
We consider two applications. Section 3.1 describes a known problem from exper-
imental psychology, and Section 3.2 describes an artificial factory inspection
problem where the inspection schedule must be unpredictable.
(but backtracking to other variables does not occur). If the new set of choices
assign no fewer variables than the defaults then they become the new defaults. If
all variables are assigned in an iteration then the algorithm has found a feasible
solution and it halts.
The solution we found after a few tens of seconds is shown in Figure 1, with
= 118. In further tests local search achieved in the range 114–124, whereas
without entropy constraints it achieved of 100–115.
CBDCDCADCBDBCBCABCDCBDCDBCABADCBCDCABDCBCADCDCDCACADAD
CDADCBDABDCDCBCDCDCDABCABDCDBCDBADCABDBDCACDCACDBCACDC
ADCDCACDCBDACDCADCDCBDCABCDBDBDACACDCDCDBDCACDBCDCADBD
CDCDADCACDACDCDCDCBDCDBDBDBDCDCACDBDBCDBCADCADADCDCADC
BCDBCDCDACACBCDCBCDBDCDCDCBCADCDCADCBDADCADACABDADBDAD
[10] noted a systematic bias in the A:C ratio between fifths of the sequence:
approximately 0.59, 0.58, 0.53, 0.49, 0.32. In ours we have 0.47, 0.50, 0.47, 0.44
and 0.59. Our approach has much in common with the Mix system used by
psychologists but also important differences (see the discussion in Section 4).
with differences
1111111111111111111
All the inspections take place in the first 20 days, as is clearer if we visualise the
schedule using two rows of 100 days each, the dark colour indicating scheduled
inspections, the light colour indicating days in which an inspection could be
scheduled, and white indicating days in which no inspection could be scheduled:
Randomness as a Constraint 359
We could simply randomise the value ordering in each variable assignment during
backtrack search, but this is unlikely to find the highest-entropy solutions. A
typical solution found in this way is
73 139 142 144 146 147 148 149 150 180
181 182 183 184 185 186 187 188 189 190
with differences
66 3 2 2 1 1 1 1 30 1 1 1 1 1 1 1 1 1 1
This solution also looks non-random. Because the variables are ordered, choos-
ing each value randomly in turn causes clustering in the high values. We could
randomise the search in a more clever way, for example by biasing earlier assign-
ments to lower values, or branching under a different variable ordering. For
such a simple problem this would not be hard to do, but the more complicated
the constraint network is the harder this task becomes. Stochastic local search
might typically find a high-entropy solution but, as pointed out in Section 1,
randomised search alone is not enough so we shall apply entropy constraints.
As the vi are all different we use difference variables. Applying entropy con-
straints freq(v (1) , 198, 0, 2) and freq(v (2) , 395, 0, 1) gives the lex-least solution
1 2 3 5 9 11 16 20 28 31 39 70 73 82 87 99 130 136 150 180
analyse medical data [23] but has since found many applications. We use the
definition given in [2] for a sequence n symbols from an alphabet of size m:
H(k) − H(k − 1) if k > 1
ApEn(k) =
H(1) if k = 1
where
k
m
H(k) = − pi log2 pi
i=1
ApEn(k)
solution k=1k=2k=3
(i) 29 0.47 0.03 0.03
(ii) 39 0.47 0.28 0.24
(iii) 54 0.47 0.46 0.42
(iv) 56 0.47 0.46 0.45
Without entropy constraints local search now finds a lower-entropy solution with
= 44, ApEn(1)=0.47, ApEn(2)=0.46 and ApEn(3)=0.31, but with entropy
constraints it finds this schedule:
4 Related Work
the next inspection with reasonable certainty. The pattern is caused by the
deterministic search strategy used. It might be important to find an inspection
schedule that is not predictable by visual inspection, or by a machine learning
algorithm. In this case statistical tests are not enough and we must also enforce
randomness.
In the field of hardware verification SAT solvers have been induced to gener-
ate random stimuli: see for example [16] for a survey of methods such as adding
randomly-chosen XOR constraints. Constraint solvers have also been used for
the same purpose, a recent example being [19]. These approaches aim to gener-
ate an unbiased set of solutions, as do the methods of [6,8,9,11,12], whereas we
aim to maximise the algorithmic entropy of a single solution. But (as pointed
out in Section 2.4) we could obtain a similar result by defining a new problem P
whose solution is a set of solutions to the original problem P, and add entropy
constraints to P .
[3] describes a software system called Mix for generating constrained ran-
domised number sequences. It implements a hand-coded local search algorithm
with several types of constraint that are useful for psychologists, including con-
straints that are very similar to our freq and dict constraints (maximum repe-
tition and pattern constraints respectively). However, no connection is made to
Kolmogorov complexity or data compression, Mix does not use a generic con-
straint solver or metaheuristic, it does not use differential constraints (though
it has other constraints we do not have), and it is designed for a special class of
problem.
The SPREAD constraint [22] has something in common with our frequency
constraints but with a different motivation. It balances distributions of values,
for example spreading the load between periods in a timetable. It has efficient
filtering algorithms but it does not aim to pass compression-based randomness
tests.
Markov Constraints [21] express the Markov condition as constraints, so that
constraint solvers can generate Markovian sequences. They have been applied to
the generation of musical chord sequences.
5 Discussion
We proposed several types of entropy constraint to eliminate different types
of pattern in a solution, leading to high-entropy solutions as estimated by
Randomness as a Constraint 363
compression algorithms and the Approximate Entropy function. These are com-
plementary to statistical tests of the kind explored in [30]. All our constraints are
based on well-known global constraints and can also be implemented in MIP or
SAT. Note that instead of specifying bounds on the occurrences of symbols and
k-grams we could allow the user to specify bounds on the Approximate Entropy
ApEn(k) for various k. However, we believe that the former approach is more
intuitive.
Using constraints to represent randomness makes it easy to generate random-
looking solutions with special properties: we simply post constraints for random-
ness and for the desired properties, then any solution is guaranteed to satisfy
both. However, applying entropy constraints is something of an art involving a
compromise between achieving high entropy, satisfying the problems constraints
and possibly optimising an objective function. Even with few or no problem
constraints we must take care not to exclude so many patterns that no solutions
remain, as Ramsey theory [25] shows that any sufficiently large object must
contain some structure. In fact adding entropy constraints does not necessarily
preserve satisfiability. If a problem has no sufficiently random-looking solutions
then entropy constraints might eliminate all solutions. However, an advantage
of this is that (as mentioned in Section 1) we can prove that no such solutions
exist: this cannot be done with the randomised search approach. Alternatively
we could take an optimisation approach by treating entropy constraints as soft
constraints, and searching for the most random-looking solution.
Of course our solutions are only pseudorandom, not truly random. They were
generated by restricting repeated symbols and k-grams in order to be incompress-
ible to a certain class of data compression algorithms. It could be objected that
they might fail other tests of randomness that are important to applications. Our
response to this argument is: we can turn these other tests into additional con-
straints. For example if our solution in Section 3.2 had failed the Wald-Wolfowitz
runs test, we could have added a constraint to ensure that it passed the test, as
follows. Suppose we have a sequence of n binary numbers, with n0 zeroes and
n1 ones (n0 + n1 = n). Under a normal approximation (valid for n0 , n1 ≥ 10)
the expected number of runs is
2n0 n1
μ=1+
n
and the variance of this number is
2n0 n1 (2n0 n1 − n) (μ − 1)(μ − 2)
σ2 = =
n (n − 1)
2 n−1
To test for randomness with 95% confidence we require that the observed number
of runs R is within μ ± 1.96σ. To implement this test as a constraint on binary
variables v1 , . . . , vn we define new binary variables bi = reify(vi = vi+1 ) and post
a constraint
n−2
μ − 1.96σ ≤ 1 + bi ≤ μ + 1.96σ
i=0
364 S.D. Prestwich et al.
3
http://www.stat.fsu.edu/pub/diehard/
4
http://www.phy.duke.edu/∼rgb/General/dieharder.php
Randomness as a Constraint 365
References
1. Apt, K.R., Wallace, M.: Constraint Logic Programming Using Eclipse. Cambridge
University Press (2007)
2. Beltrami, E.: What Is Random? Chance and Order in Mathematics and Life.
Copernicus (1999)
3. van Casteren, M., Davis, M.H.: Mix, a Program for Pseudorandomization.
Behaviour Research Methods 38(4), 584–589 (2006)
4. Cilibrasi, R., Vitányi, P.M.B.: Clustering by Compression. IEEE Transactions on
Information Theory 51(4), 1523–1545 (2005)
5. Chaitin, G.J.: Algorithmic Information Theory. Cambridge University Press (1987)
6. Claessen, K., Duregård, J., Palka, M.H.: Generating constrained random data with
uniform distribution. In: Codish, M., Sumii, E. (eds.) FLOPS 2014. LNCS, vol.
8475, pp. 18–34. Springer, Heidelberg (2014)
7. Cutler, C.C.: Differential Quantization for Television Signals. U. S. Patent 2, 605,
361, July 1952
8. Dechter, R., Kask, K., Bin, E., Emek, R.: Generating random solutions for con-
straint satisfaction problems. In: Proceedings of the 18th National Conference on
Artificial Intelligence, pp. 15–21 (2002)
9. Ermon, S., Gomes, C.P., Selman, B.: Uniform solution sampling using a constraint
solver as an oracle. In: Proceedings of the Twenty-Eighth Conference on Uncer-
tainty in Artificial Intelligence, pp. 255–264. AUAI Press (2012)
10. French, R.M., Perruchet, P.: Generating Constrained Randomized Sequences: Item
Frequency Matters. Behaviour Research Methods 41(4), 1233–1241 (2009)
11. Hebrard, E., Hnich, B., O’Sullivan, B., Walsh, T.: Finding diverse and similar solu-
tions in constraint programming. In: Proceedings of the 20th National Conference
on Artificial Intelligence (2005)
12. Van Hentenryck, P., Coffrin, C., Gutkovich, B.: Constraint-based local search for
the automatic generation of architectural tests. In: Gent, I.P. (ed.) CP 2009. LNCS,
vol. 5732, pp. 787–801. Springer, Heidelberg (2009)
13. Hinkelmann, K., Kempthorne, O.: Design and Analysis of Experiments I and II.
Wiley (2008)
14. Housworth, E.A., Martins, E.P.: Random Sampling of Constrained Phylogenies:
Conducting Phylogenetic Analyses When the Philogeny is Partially Known. Syst.
Biol. 50(5), 628–639 (2001)
15. Huffman, D.A.: A Method for the Construction of Minimum Redundancy Codes.
Proceedings of the IRE 40, 1098–1101 (1951)
16. Kitchen, N., Kuehlmann, A.: Stimulus generation for constrained random sim-
ulation. In: Proceedings of the 2007 IEEE/ACM International Conference on
Computer-Aided Design, pp. 258–265. IEEE Press (2007)
17. Knuth, D.E.: The Art of Computer Programming. Seminumerical Algorithms, 2nd
edn., vol. 2, p. 89. Addison-Wesley (1981)
18. Marsaglia, G., Tsang, W.W.: Some Difficult-to-pass Tests of Randomness. Journal
of Statistical Software 7(3) (2002)
19. Naveh, R., Metodi, A.: Beyond feasibility: CP usage in constrained-random func-
tional hardware verification. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124,
pp. 823–831. Springer, Heidelberg (2013)
20. Ouellet, P., Quimper, C.-G.: The multi-inter-distance constraint. In: Proceedings
of the 22nd International Joint Conference on Artificial Intelligence, pp. 629–634
(2011)
366 S.D. Prestwich et al.
21. Pachet, F., Roy, P.: Markov Constraints: Steerable Generation of Markov
Sequences. Constraints 16(2), 148–172 (2011)
22. Pesant, G., Régin, J.-C.: SPREAD: a balancing constraint based on statistics. In:
van Beek, P. (ed.) CP 2005. LNCS, vol. 3709, pp. 460–474. Springer, Heidelberg
(2005)
23. Pincus, S.M., Gladstone, I.M., Ehrenkranz, R.A.: A Regularity Statistic for Medical
Data Analysis. Journal of Clinical Monitoring and Computing 7(4), 335–345 (1991)
24. Press, W.H., Flannery, B.P., Teukolsky, S.A., Vetterling, W.T.: Numerical Recipes
in C, 2nd edn. Cambridge University Press, UK (1992)
25. Ramsey, F.P.: On a Problem of Formal Logic. Proceedings London Mathematical
Society s2 30(1), 264–286 (1930)
26. Refalo, P.: Impact-based search strategies for constraint programming. In: Wallace,
M. (ed.) CP 2004. LNCS, vol. 3258, pp. 557–571. Springer, Heidelberg (2004)
27. Régin, J.-C.: Generalized Arc Consistency for Global Cardinality Constraint.
In: 14th National Conference on Artificial Intelligence, pp. 209–215 (1996)
28. Régin, J.-C.: A filtering algorithm for constraints of difference in CSPs.
In: Proceedings of the 12th National Conference on Artificial Intelligence,
Vol. 1, pp. 362–367 (1994)
29. Rissanen, J.J., Langdon, G.G.: Arithmetic Coding. IBM Journal of Research and
Development 23(2), 149–162 (1979)
30. Rossi, R., Prestwich, S., Tarim, S.A.: Statistical constraints. In: 21st European
Conference on Artificial Intelligence (2014)
31. Sayood, K.: Introduction to Data Compression. Morgan Kaufmann (2012)
32. Shannon, C.E.: A Mathematical Theory of Communication. Bell System Technical
Journal 27(3), 379–423 (1948)
33. Wallace, G.K.: The JPEG Still Picture Compression Standard. Communications
of the ACM 34, 31–44 (1991)
34. Welch, T.A.: A Technique for High-Performance Data Compression. IEEE Com-
puter, 8–19, June 1984
35. Ziv, J., Lempel, A.: A Universal Algorithm for Data Compression. IEEE Transac-
tions on Information Theory IT 23(3), 337–343 (1977)
36. Ziv, J., Lempel, A.: Compression of Individual Sequences via Variable-Rate Coding.
IEEE Transactions on Information Theory IT 24(5), 530–536 (1978)
Quasipolynomial Simulation of DNNF
by a Non-determinstic Read-Once
Branching Program
Igor Razgon(B)
1 Introduction
Decomposable Negation Normal Forms (dnnfs) [3] is a well known formalism in
the area of propositional knowledge compilation notable for its efficient represen-
tation of cnfs with bounded structural parameters. The dnnfs lower bounds
are much less understood. For example, it has been only recently shown that
dnnfs can be exponentially large on (monotone 2-) cnfs [2]. Prior to that, it
was known that on monotone functions dnnfs are not better than monotone
dnnfs [6]. Hence all the lower bounds for monotone circuits apply for dnnfs.
However, using monotone circuits to obtain new dnnf lower bounds is hardly an
appropriate methodology because, in light of [2], on monotone functions, dnnfs
are much weaker than monotone circuits.
In this paper we show that dnnfs are strongly related to Non-deterministic
Read-Once Branching Programs (nrobps) that can be thought as Free Binary
Decision Diagrams (fbdds) with or-nodes. In particular, we show that a dnnf
can be transformed into a nrobp with a quasi-polynomial increase of size. That
is, all the exponential lower bounds known for nrobps (see e.g. [5,8]) apply for
dnnfs. As nrobps can be linearly simulated by dnnfs (using a modification
of the simulation of fbdds by dnnfs proposed in [4]), we believe that the pro-
posed result makes a significant progress in our understanding of complexity of
dnnfs. Indeed, instead of trying to establish exponential lower bounds directly
for dnnfs, we can now do this for nrobps , which are much better understood
from the lower bound perspective.
In the proposed simulation, we adapt to unrestricted dnnfs the approach
that was used in [1] for quasi-polynomial simulation of decision dnnfs by fbdds.
For the adaptation, we find it convenient to represent nrobps in a form where
variables carry no labels and edges are labelled with literals. In particular, each
input node u of the dnnf is represented in the resulting nrobp as an edge
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 367–375, 2015.
DOI: 10.1007/978-3-319-23219-5 26
368 I. Razgon
labelled with the literal of u and these are the only edges that are labelled (com-
pare with [1] where the labelling is ‘pertained’ to or nodes, which is impossible
for unrestricted dnnfs where the or nodes can have an arbitrary structure).
The most non-trivial aspect of the simulation is the need to transform an
and of two nrobps Z1 and Z2 into a single nrobp. Following [1], this is done by
putting Z1 ‘on top’ of Z2 . However, this creates the problem that Z1 becomes
unusable ‘outside’ this construction (see Section 4.1. and, in particular, Figure
2 of [1] for illustration of this phenomenon). Similarly to [1], we address this
problem by introducing multiple copies of Z1 .
Formal Statement of the Result. A dnnf Z ∗ is a directed acyclic graph
(dag) with many roots (nodes of in-degree 0) called input nodes and one leaf
(node of out-degree 0) called the output node. The input nodes are labelled
with literals, the rest are and, and or nodes such that each and node has the
decomposability property defined as follows. Let us define V ar(u) for a node u of
Z ∗ as the set of variables x such that Z ∗ has a path from a node labelled by x to
u. Then, if u is an and node of Z ∗ and v and w are two different in-neighbours
of u then V ar(v) ∩ V ar(w) = ∅. Let Zu∗ be the subgraph of Z ∗ induced by a
node u and all the nodes from which u can be reached. Then the function F [Zu∗ ]
computed by Zu∗ is defined as follows. If u is an input node then F [Zu∗ ] = x,
where x is the literal labelling u. If u is an or or an and node with in-neighbours
v1 , . . . vq then F [Zu∗ ] = F [Zv∗1 ] ∨ · · · ∨ F [Zv∗q ], or F [Zu∗ ] = F [Zv∗1 ] ∧ · · · ∧ F [Zv∗q ],
respectively. The function F [Z ∗ ] computed by Z ∗ is F [Zout ∗
], where out is the
∗
output node of Z . In the rest of the paper we assume that the and nodes of
Z ∗ are binary. This assumption does not restrict generality of the result since
an arbitrary dnnf can be transformed into one with binary and nodes with a
quadratic increase of size.
A Non-deterministic Read-once Branching Program (nrobp) is a dag Z with
one root (and possibly many leaves). Some edges of Z are labelled with literals of
variables in the way that each variable occurs at most once on each path P of Z.
We denote by A(P ) the set of literals labelling the edges of a path P of Z. To define
a function F [Z] computed by Z, let us make a few notational agreements. First, we
define a truth assignment to a set of variables as the set of literals of these variables
that become true as result of the assignment. For example, the assignment {x1 ←
true, x2 ← f alse, x3 ← true} is represented as {x1 , ¬x2 , x3 }. For a function F on a
set V ar of variables, we say that an assignment S of V ar satisfies F is F (S) = true.
Now, let S be an assignment of variables labelling the edges of Z. Then S satisfies
F [Z] if and only if there is a root-leaf path P of Z with A(P ) ⊆ S. A dnnf and a
nrobp for the same function are illustrated on Figure 1.
Remark. The above definition of nrobp is equivalent to fbdd with or-nodes in
the sense that each of them can simulate the other with a linear increase of size.
Our main result proved in the next section is the following.
X2 ~X2 X2
X1 X2 X3
X3 X3
~X3
Fig. 1. dnnf and nrobp for function (x1 ∧ x2 ∧ ¬x3 ) ∨ (x1 ∧ ¬x2 ∧ x3 ) ∨ (¬x1 ∧ x2 ∧ x3 )
2 Proof of Theorem 1
– (u, le, in) for all u ∈ V (Z ∗ ) (recall that if G is a graph, V (G) denotes the
set of nodes of G) and le ∈ LE(u). The ‘in’ in the third coordinate stands
for ‘internal’ to distinguish from the ‘leaf’ nodes defined in the next item.
– For each input node u of Z ∗ and for each le ∈ LE(u), Z has a node (u, le, lf )
where ‘lf’ stands for ‘leaf’. We say that (u, le, lf ) is the leaf corresponding to
(u, le, in).
When we refer to a node of Z with a single letter, we use bold letters like u, v
to distinguish from nodes u, v of Z ∗ . We denote by mnode(u), coord(u), type(u),
the respective components of u, that is u = (mnode(u), coord(u), type(u)). We
also call the components the main node of u, the coordinate of u and the type of
u. The nodes of Z whose type is in are internal nodes and the nodes whose type
is lf are leaf nodes. The leaf nodes are not necessarily leaves of Z but rather
leaves of special subgraphs of Z that are important for the proof.
370 I. Razgon
Lemma 1. Let u ∈ V (Z) with type(u) = in and let u = mnode(u). Then the
following statements hold.
1. Graph(u) is a dag.
2. u is the (only) root of Graph(u) and Leaves(u) is the set of leaves of
Graph(u).
3. If u is an or-node and v1 , . . . , vq are as in the description of processing of
u then each root-leaf path P of Graph(u) is of the form (u, vi ) + P where
P is a root-leaf path of Graph(vi ).
Quasipolynomial Simulation of DNNF by a NROBP 371
It follows from the first, second, and the last statements of Lemma 1 that
Graph(u) is a nrobp. Therefore, we can consider the function F [Graph(u)]
computed by Graph(u).
Lemma 2. For each u ∈ V (Z) with type(u) = in, F [Graph(u)] = F [Zu∗ ] where
u = mnode(u) and Zu∗ is as defined in the first paragraph of formal statement
part of the introduction.
Proof of Theorem 1. Let out be the output node of Z ∗ and out = (out, ∅, in)
be a node of Z. Graph(out) is a nrobp by Lemma 1 and, by Lemma 2, it
∗ ∗
computes function F (Zout ). By definition, Zout = Z ∗ and hence Graph(out)
∗
computes the same function as Z .
To upper-bound the size of Z ∗ , observe that for each u ∈ V (Z), |coord(u)| ≤
log n. Indeed, let us represent coord(u) as (u1 , u1 ), . . . , (uq , uq ), a sequence of
edges occurring in this order on a path of Z ∗ . Then each (ui , ui ) is the light
edge of an and-node ui . By the decomposability property of dnnf, |V ar(ui )| ≤
|V ar(ui )|/2. Also, since Z ∗ has a path from ui to ui+1 , |V ar(ui )| ≤ |V ar(ui+1 )|.
Applying this reasoning inductively, we conclude that |V ar(u1 )| ≤ |V ar(uq )|/2q .
Since |V ar(u1 )| ≥ 1 and |V ar(uq )| ≤ n, it follows that |coord(u)| = q ≤ log n.
Thus coord(u) is a set of light edges of Z ∗ of size at most log n. Since there
is at most one light edge per element of Z ∗ , there are at most m light edges
in total. Thus the number of possible second coordinates for a node of Z is
log n m
i ≤ m
log n+1
i=1 . As the number of distinct first and third coordinates is
at most m and 2, respectively, the result follows.
Lemma 3. Let u ∈ V (Z) with type(u) = in and let u = mnode(u). Then for
each v ∈ V (Graph(u)), coord(u) ⊆ coord(v). Moreover, if type(v) = lf then
coord(u) = coord(v) if and only if v ∈ Leaves(u).
V (Graph(u)) consists of u itself and the union of all V (Graph(v)), where, fol-
lowing the description of processing of u, v is one of v1 , . . . , vq if u is an or-node
and v is either u1 or u2 if u is an and-node. For each such v it holds by defini-
tion that coord(u) ⊆ coord(v). That is, each node w = u of Graph(u) is in fact
a node of such a Graph(v). By the induction assumption, coord(v) ⊆ coord(w)
and hence coord(u) ⊆ coord(w) as required.
Using the same inductive reasoning, we show that for each w ∈ Leaves(u),
coord(w) = coord(u). This is true by construction if u is an input node.
Otherwise, Leaves(u) is defined as the union of one or more Leaves(v) such
that coord(v) = coord(u) by construction. Then, letting v be such that
w ∈ Leaves(v) we deduce, by the induction assumption that coord(w) =
coord(v) = coord(u).
It remains to prove that for each w ∈ V (Graph(u)) \ Leaves(u) such that
type(w) = lf , coord(u) ⊂ coord(w). This is vacuously true if u is an input node.
Otherwise, the induction assumption can be straightforwardly applied as above
if w ∈ Graph(v) for some v as above and w ∈ / Leaves(v). The only situation
where it is not the case is when u is an and node and v = u1 where u1 is as in
the description of processing of an and node. In this case coord(u) ⊂ coord(u1 )
by construction and, since coord(u1 ) ⊆ coord(w), by the first statement of this
lemma, coord(u) ⊂ coord(w).
Proof. The first statement follows by a direct inspection of the processing algo-
rithm. Indeed, the only case where an edge (u, v) might be introduced during
processing of a node u = u is where mnode(u ) is an and node. However, in
this case type(u) must be lf in contradiction to our assumption.
Consider the second statement. Consider an edge (v, w) such that type(v) =
lf . Suppose this edge has been created during processing of a node u. Then
u = mnode(u) is an and-node. Further, let u1 , u2 be as in the description of
processing of u. Then v ∈ Leaves(u1 ) and w = u2 . By construction, coord(w) =
coord(u) and by Lemma 3, coord(v) = coord(u1 ). Hence, by definition of u1 ,
coord(w) ⊂ coord(v). Suppose that v ∈ Leaves(u ) for some internal u ∈ V (Z).
Then, by Lemma 3, coord(v) = coord(u ) and hence coord(w) ⊂ coord(u ). It
follows from Lemma 3 that w is not a node of Graph(u ) and hence (v, w) is
not an edge of Graph(u ). Thus the out-degree of v in Graph(u ) is 0.
Continuing the reasoning about edge (v, w), we observe that coord(w) =
coord(v) \ {(u1 , u)} where u1 = mnode(u1 ). Notice that all the edges of
coord(v) = coord(u1 ) lie on a path from u1 to the output node of Z ∗ and
(u1 , u) occurs first of them. Due to the acyclicity of Z ∗ , (u1 , u) is uniquely
Quasipolynomial Simulation of DNNF by a NROBP 373
In the rest of the proof, we assume that the set of variables of all the con-
sidered functions is V ar, the set of variables of Z ∗ . Introduction of redundant
variables will simplify the reasoning because we can now make the induction
step without modifying the considered set of variables.
Assume that u is an or node. If S satisfies F [Zu∗ ] then there is an in-neighbour
v of u such that S satisfies F [Zv∗ ]. By construction there is an out-neighbour
v of u such that v = mnode(v). By the induction assumption, S satisfies
F [Graph(v)]. Let P be a v − Leaves(v) path such that A(P ) ⊆ S. Then,
by construction (u, v) + P is a u − Leaves(u) path with the edge (u, v) unla-
belled. Hence A(P ) = A(P ) ⊆ S and hence S satisfies F [Graph(u)]. Conversely,
if S satisfies F [Graph(u)] then there is a u − Leaves(u) path P with A(P ) ⊆ S.
By statement 3 of Lemma 1, P = (u, vi ) + P , the notation as in the state-
ment. A(P ) ⊆ A(P ) and hence S satisfies F [Graph(vi )] and, by the induction
assumption, S satisfies F [Zv∗i ] where vi = mnode(vi ). By definition of vi , vi is
an in-neighbour of u, hence S satisfies F [Zu∗ ].
Assume that u is an and node. Let u1 , u2 be as in the description of process-
ing of u with u1 = mnode(u1 ) and u2 = mnode(u2 ). Suppose that S satisfies
F [Zu∗ ]. Then S satisfies both F [Zu∗1 ] and F [Zu∗2 ]. Hence, by the induction assump-
tion S satisfies F [Graph(u1 )] and F [Graph(u2 )]. For each i ∈ {1, 2}, let Pi be
a ui − Leaves(ui ) path of Graph(ui ) with A(Pi ) ⊆ S. Let w be the last node
of P1 . Then P = (u, u1 ) + P1 + (w, u2 ) + P2 is a u = Leaves(u) path with the
edges (u, u1 ) and (w, u2 ) unlabelled. Hence A(P ) = A(P1 ) ∪ A(P2 ) ⊆ S and
thus S satisfies F [Graph(u)]. Conversely, suppose that S satisfies F [Graph(u)]
and let P be a u − Leaves(u) path with A(P ) ⊆ S. Then by statement 4 of
Lemma 1, P = (u, u1 ) + P1 + (w, u2 ) + P2 , the notation as in the statement.
Clearly, A(P1 ) ⊆ S and A(P2 ) ⊆ S, hence S satisfies both F [Zu∗1 ] and F [Zu∗2 ]
by the induction assumption and thus S satisfies F [Zu∗ ].
References
1. Beame, P., Li, J., Roy, S., Suciu, D.: Lower bounds for exact model counting and
applications in probabilistic databases. In: Proceedings of the Twenty-Ninth Con-
ference on Uncertainty in Artificial Intelligence, Bellevue, WA, USA, August 11–15,
2013 (2013)
2. Bova, S., Capelli, F., Mengel, S., Slivovsky, F.: Expander cnfs have exponential
DNNF size. CoRR, abs/1411.1995 (2014)
3. Darwiche, A.: Decomposable negation normal form. J. ACM 48(4), 608–647 (2001)
4. Darwiche, A., Marquis, P.: A knowledge compilation map. J. Artif. Intell. Res.
(JAIR) 17, 229–264 (2002)
5. Jukna, S.: Boolean Function Complexity: Advances and Frontiers. Springer-Verlag
(2012)
6. Krieger, M.P.: On the incompressibility of monotone DNFs. Theory Comput. Syst.
41(2), 211–231 (2007)
7. Oztok, U., Darwiche, A.: On compiling CNF into decision-DNNF. In: O’Sullivan,
B. (ed.) CP 2014. LNCS, vol. 8656, pp. 42–57. Springer, Heidelberg (2014)
8. Wegener, I.: Branching Programs and Binary Decision Diagrams. SIAM (2000)
MiniSearch: A Solver-Independent Meta-Search
Language for MiniZinc
1 Introduction
When using constraint programming (CP) technology, one often needs to exert
some control over the meta-search mechanism. Meta-search, such as Branch-
and-Bound search (BaB) or Large Neighbourhood Search (LNS), happens on
top of CP tree search, and aids finding good solutions, often by encoding meta-
information a modeller has about the problem.
Unfortunately, there is no widely accepted standard for controlling search or
meta-search. A wide range of high-level languages have been proposed that are
quite similar in how constraints are specified. However, they differ significantly
in the way search can be specified. This ranges from built-in minimisation and
maximisation only to fully programmable search. The main trade-off in devel-
oping search specification languages is the expressivity of the language versus
the required integration with the underlying solver. Fully programmable search,
including meta-search, is most expressive but requires deep knowledge of and
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 376–392, 2015.
DOI: 10.1007/978-3-319-23219-5 27
MiniSearch: A Solver-Independent Meta-Search Language for MiniZinc 377
tight integration with a specific solver. Languages like OPL [24] and COMET [13]
provide convenient abstractions for programmable search for the solvers bundled
with these languages. On the other hand, some solver-independent languages
such as Esra [3], Essence [5] and Essence [6] do not support search specifica-
tions. Zinc [12] and MiniZinc [16] have support for specifying variable and value
ordering heuristics to CP solvers, but also no real control over the search.
Search combinators [19] was recently proposed as a generic meta-search lan-
guage for CP solvers. It interacts with the solver at every node in the search tree.
While very expressive, it requires significant engineering effort to implement for
existing solvers, since typically the solvers’ search engines are highly optimised
and tightly integrated with other components, such as the propagation engine
and state space maintenance.
In this paper, we introduce MiniSearch, a new combinator-like meta-search
language that has three design objectives: a minimal solver interface to facilitate
solver support, expressiveness, and, most importantly, solver-independence.
The objective to obtain a minimal solver interface stems from lessons learnt
in the design of search combinators that interact with the solver at every node.
In contrast, MiniSearch interacts with the underlying solving system only at
every solution, which is a minimal interface. At every solution, constraints can
be added or constraints in a well-defined scope can be removed, before asking
for the next solution. If the underlying solver does not support dynamic adding
and removing of constraints, MiniSearch can emulate this behaviour, for little
overhead.
Despite the lightweight solver interface, MiniSearch is surprisingly expres-
sive and supports many meta-search strategies such as BaB search, lexicographic
BaB, Large Neighbourhood Search variants, AND/OR search, diverse solution
search, and more. MiniSearch can also be used to create interactive optimi-
sation applications. Moreover, since MiniSearch builds upon MiniZinc, all
MiniZinc language features and built-ins can be used, for instance to formulate
custom neighbourhoods.
Solver-independence is the most important contribution of MiniSearch. All
solvers that can read and solve FlatZinc, which the majority of CP solvers
do [15,22], can be used with MiniSearch. Moreover, solvers that provide native
meta-search variants, such as branch-and-bound, can declare so and avoid exe-
cuting the MiniSearch decomposition instead. At the language level, this is
similar to the handling of global constraints in MiniZinc. Thus, solvers can
apply their strengths during meta-search, despite the minimal interface.
With the built-in language extensions summarised in Tab. 1, users can define
functions such as the following branch-and-bound (BaB) minimisation:
The include item on line 1 includes the built-in MiniSearch function dec-
larations. This is necessary for any MiniZinc model that uses MiniSearch.
Line 3 contains the MiniZinc solve item followed by the new search keyword
and a user-defined MiniSearch function that takes a variable representing the
objective as argument. Line 4 is the MiniZinc output item, specifying how solu-
tions should be printed. Lines 7–8 contain the actual MiniSearch specification.
We will explain the different built-ins in more detail below, but the specification
can be read as follows: repeatedly try to find the next solution; and if that is suc-
cessful, commit to the solution, print it and add the constraint that the objective
must have a lower value than the current solution. If unsuccessful, break out of
the repeat.
All MiniSearch built-ins are typed as functions returning annotations.
Semantically, however, every MiniSearch built-in returns a value that repre-
sents either ‘success’ or ‘failure’, with respect to finding a solution. The handling
of these implicit return values is done by the MiniSearch interpreter (Sec. 4.1).
MiniSearch: A Solver-Independent Meta-Search Language for MiniZinc 379
time limit is reached, returning its current status. Time-limits are handled trans-
parently by the MiniSearch kernel as an exception.
Assigning values to constants. In standard MiniZinc constant parameters such
as int: N=10; cannot change their value. However, in MiniSearch we often
want to change constants across different iterations. For this purpose, we added
the assignment operator := which may only be used inside a MiniSearch spec-
ification. It overwrites that constant’s current value by the value supplied.
These meta-search approaches can be used within any MiniZinc model that
includes the library. In the next section we present some of these meta-searches
in detail.
3 MiniSearch Examples
Despite MiniSearch’s limited communication with the solver, it provides
enough power to implement many useful complex searches that we illustrate
here.
In line 2 we search for an initial solution and, if successful, repeatedly open a new
scope (line 3). Then, we post the lexicographic (lex) constraint (line 4) and search
for another solution in line 5. This way, in each iteration of repeat, we add one
lex constraint, and all previously added lex constraints are removed due to the
scope. This is not required but beneficial, since posting several lex-constraints
can cause overhead if many intermediate solutions are found.
of iterations, the destruction rate (the size of the neighbourhood) and a time limit
for exploring each neighbourhood. We have two scopes: in the global scope, we
post BaB style constraints (line 10); in the sub-scope (line 5), we search the
neighbourhoods. The predicate uniformNeighbourhood defines the neighbour-
hood: for each search variable we decide randomly whether to set it to its solution
value of the previous solution (line 15).
1 function ann : lns ( var int : obj , array [ int ] of var int : vars ,
2 int : iterations , float : destrRate , int : exploreTime ) =
3 repeat ( i in 1.. iterations ) (
4 print ( " Iteration " ++ show ( i ) ++ " \ n " ) /\
5 scope (
6 post ( u n i f o r m N e i g h b o u r h o o d ( vars , destrRate ) ) /\
7 time_limit ( exploreTime , minimize_bab ( obj ) ) /\
8 commit () /\ print ()
9 ) /\
10 post ( obj < sol ( obj ) )
11 );
12 predicate u n i f o r m N e i g h b o u r h o o d ( array [ int ] of var int : x , float : destrRate ) =
13 if hasSol () then
14 forall ( i in index_set ( x ) ) (
15 if uniform (0.0 ,1.0) > destrRate then x [ i ] = sol ( x [ i ]) else true endif )
16 else true endif ;
Adaptive LNS modifies the neighbourhood size over the course of the itera-
tions, depending on the success of previous iterations. Below is a simple variant,
where the neighbourhood size parameter nSize (line 3) is step-wise enlarged
each time no solution is found (line 9). The fail command fails the current
conjunction and will hence avoid that the post command on line 10 is executed.
1 function ann : adaptive_lns ( var int : obj , array [ int ] of var int : vars ,
2 int : iterations , int : initRate , int : exploreTime ) =
3 let { int : nSize = initRate , int : step = 1; } in
4 repeat ( i in 1.. iterations ) (
5 print ( " Iteration " ++ show ( i ) ++ " , rate = " ++ show ( nSize ) ++ " \ n " ) /\
6 scope ( ( post ( u n i f o r m N e i g h b o u r h o o d ( vars , nSize /100.0) ) /\
7 time_limit ( exploreTime , minimize_bab ( obj ) ) /\
8 commit () /\ print ()
9 ) \/ ( nSize := nSize + step /\ fail ) )
10 /\ post ( obj < sol ( obj ) ) );
15 secondStageCts (s , recourse ) ) /\ % s u b p r o b l e m
constraints
16 if minimize_bab ( scenarioCosts ) then
17 sc_obj [ s ] := sol ( scenarioCosts )
18 else print ( " No solution for scenario " ++ show ( s ) ++ " \ n " ) /\
19 break endif
20 ) )
21 ) /\ % end repeat
22 if expectedCosts > expectedValue ( sc_obj ) then
23 expectedCosts := expectedValue ( sc_obj ) /\
24 commit () % we found a better AND / OR s o l u t i o n
25 else skip () endif
26 else break endif % no master solution
27 ) );
384 A. Rendl et al.
Lines 3-4 initialise parameters that represent the costs for each scenario/sub-
problem and the combined, expected cost of the master and subproblems. Line 7
searches for a solution to the master problem (OR tree), and if this succeeds, we
continue with the AND search by finding the optimal solution for each subprob-
lem, based on the master solution (line 9): we create each subproblem in a local
scope, and add the respective variables (line 11- 12) and constraints (line 15).
Furthermore, we set the master variables to the values in the master solution
(line 14). Then we search for the minimal solution for the scenario (line 16), and,
if successful, store it in sc_obj (line 17). If we find a solution for each scenario,
then we compute the combined objective (expectedValue) and compare it to the
incumbent solution (line 22). If we found a better solution, we store its value
(line 23) and commit to it (line 24) and continue in the master scope (line 7).
Otherwise, if we find no solution for one of the scenarios (line 18), the mas-
ter solution is invalid. We therefore break (line 19) and continue in the master
problem scope, searching for the next master solution (line 7).
The first few lines initialise the Store, which will contain the K diverse solutions,
as well as the current length of the store up to which it already contains solutions.
On line 8 the length is increased and the previously found solution is saved. If the
length does not exceed K, we construct a new objective on line 12. This objective
expresses how different a solution is from the previously found solutions using
the Hamming distance. This objective is then maximised, resulting in the next
most diverse solution, and the process repeats.
MiniSearch: A Solver-Independent Meta-Search Language for MiniZinc 385
– next() invokes the solver for a new solution; if successful, it replaces the
top-most solution on solution stack. If a time-out has been set, the call to
the solver is only allowed to run up to the time-out. Returns true iff a new
solution was found.
– commit() replaces the parent solution (2nd on the stack) with the current
solution. This commits the current solution into the parent function scope.
Returns true. Aborts if not in a function call.
– function calls duplicate the top of the solution stack before executing the
function body. Return true if the function committed a new solution.
– time_limit(l,s) adds a new time-out now+l to the stack, executes s, and
then pops the time-out. During the execution of s, calls to next and repeat
check whether any time-outs t have expired (t > now), and if so they imme-
diately break. Returns whatever s returned.
– repeat(s) pushes a break scope with a Boolean flag on the stack, then
repeats the execution of s as long as the break flag is false and pops the
break scope when s is finished. The break construct sets the break flag in
the current break scope (similar to a time limit).
– post(c) compiles the MiniZinc expression c into FlatZinc. The compi-
lation is incremental, i.e., the result of compiling c is added to the existing
FlatZinc. The interpreter then adds the newly generated variables and
constraints to the current solver instance.
– scope(s) creates a new local scope. The current implementation copies the
flat model and creates a new solver instance based on this flat model.
– Other operations (/\,\/,print) are interpreted with respect to their seman-
tics.
A key goal of this work is to make MiniSearch available for any solver that sup-
ports FlatZinc. Current FlatZinc solvers, however, neither support incremen-
tally adding constraints and variables, nor do they implement the libminizinc
C++ API. We therefore need to emulate the incremental API.
In order to emulate incrementality, we can implement the dynamic addition
of variables and constraints using a restart-based approach, re-running the solver
on the entire updated FlatZinc. To avoid re-visiting solutions, after each call to
next the emulation layer adds a no-good to the model that excludes the solution
that was just found. This emulation reduces the requirements on the solver to
simply being able to solve a given FlatZinc model.
In order to emulate the C++ API, we generate a textual representation of
the FlatZinc and call an external solver process. The emulator then converts
MiniSearch: A Solver-Independent Meta-Search Language for MiniZinc 387
the textual output of the process back into libminizinc data structures. Using
this emulation of the incremental C++ solver API, any current FlatZinc solver
can be used with the MiniSearch kernel.
Solvers can declare native support for a MiniSearch search specification. For
every MiniSearch call such as f(x,y,z), the kernel will check whether the dec-
laration of f has a function body. If it does not have a function body, the function
is considered to be a solver built-in, and it is executed by passing the call to a
generic solve function in the C++ solver API. This is similar to the handling of
global constraints in MiniZinc, where solvers can either use their own primitives
for a given global constraint, or use the respective MiniZinc decomposition of
the global constraint. This way solvers can easily apply their own primitives, but
can use alternatives if they do not support a certain feature.
5 Experiments
The problems and instances are taken from the MiniZinc benchmarks reposi-
tory2 . The source code of MiniSearch and the respective solver interfaces will
be released in September 2015 [14].
Experiments are run on Ubuntu 14.04 machines with eight i7 cores and 16GB
of RAM. The MiniSearch kernel is based on the MiniZinc 2.0.1 toolchain. The
native Gecode interface and incremental C++ interface were implemented using
the latest Gecode source code (version 4.3.3+, 20 April 2015). The FZN solvers
used are: Gecode (20 April 2015), Choco 3.3.0, Or-tools source (17 February
2015), and Opturion CPX 1.0.2. All solvers use the same variable/value ordering
heuristic that is part of the MiniZinc model.
Table 2. Rectangle Packing. Times (sec) averaged over 10 runs. Comparing FlatZinc-
solvers with MiniSearch BaB through FlatZinc (MS-F), MiniSearch BaB through
incremental API (MS-Inc), and native BaB with FlatZinc (Nat-F).
MiniSearch strategies are not restricted to complete search. For example, dif-
ferent variants of Large Neighbourhood Search can be tried. To demonstrate the
benefits of having heuristic search at hand, we compare the Randomised LNS
approach from Section 3.2 with the standard out-of-the-box branch-and-bound
approach for a selection of FlatZinc solvers on the Capacitated Vehicle Routing
problem (CVRP).
We run each solver on (1) the standard MiniZinc model that uses branch-
and-bound, and (2) the MiniZinc model with the MiniSearch specification of
Randomised LNS. We use the Augerat et al [1] CVRP instance sets A,B and P,
where the 27 Set-A instances contain random customer locations and demands,
MiniSearch: A Solver-Independent Meta-Search Language for MiniZinc 389
Table 3. Average relative improvement of MiniSearch LNS over standard BaB for
the achieved objective within a time limit for different solvers. The figures are averages
over the Augerat et al [1] CVRP instance sets A,B and P.
the 22 Set-B instances have clustered locations and the 23 Set-P instances are
modified versions of instances from the literature. The LNS approach uses a
destroy rate of 0.3 (the neighbourhood size is 30%) and an exploration timeout
(for each neighbourhood) of 5 seconds. Both the LNS and BaB approach have
an overall 2 minute timeout, and we report the quality of the best solution found
on time-out.
We can see that LNS provides better solutions than BaB, and Table 3 reports
the average improvement of the objective of LNS over BaB on the three instance
sets. We observe an improvement between 8-15%, which is considerable within
the given time limit. Furthermore, we see that the improvements are similar for
all solvers across the instances sets, in particular for the Set-B instances. This
demonstrates the added value of MiniSearch search strategies to the existing
out-of-the-box optimisation approaches of standard modelling languages.
6 Related Work
The starting point for MiniSearch is search combinators [19], and MiniSearch
is indeed a combinator language. The MiniSearch language is more restricted
than search combinators. In particular, search combinators can interact with
the search at every node of the tree, essentially replacing the solver’s built-in
search, while MiniSearch only interacts with the solver’s search at the granu-
larity of solutions. Examples not possible in MiniSearch are the use of average
depth of failure or custom limits based on how many search nodes with a par-
ticular property have been encountered, and heuristics such as limited discrep-
ancy search [8] and iterative deepening. Other search combinator expressions are
however expressible with MiniSearch, as witnessed by the library of strategies
presented in this paper.
Neither search combinators nor MiniSearch support fully programmable
search. Especially not variable and value ordering heuristics, which interact with
the internal data structures of the solver. These kinds of search strategies are
important, but cannot be implemented without deep hooks into the solver.
Objective CP [26] can express complex meta-search at the model level, which
can then be executed by any of the Objective CP solvers. For example a CP-
style search can be implemented using a MIP solver. So it also provides solver-
independent search, but through a much more fine grained interface, supporting
interaction at each search node. The fine grained interface however means that
390 A. Rendl et al.
can process FlatZinc, which is the majority of CP solvers. This allows users to
test different solvers with complex meta-searches without having to commit to
one single solver.
For future work, we plan to extend MiniSearch with parallelism, so that
independent searches can be executed in parallel and advanced parallel meta-
search approaches such as Embarrassingly Parallel Search [17] can be specified.
Furthermore, we plan to integrate portfolio search into MiniSearch, so that
different search functions can be executed by different solvers.
References
1. Augerat, P., Belenguer, J., Benavent, E., Corberan, A., Naddef, D., Rinaldi, G.:
Computational results with a branch and cut code for the capacitated vehicle
routing problem. Technical Report 949-M. Universite Joseph Fourier, Grenoble
(1995)
2. Belin, B., Christie, M., Truchet, C.: Interactive design of sustainable cities with
a distributed local search solver. In: Simonis, H. (ed.) CPAIOR 2014. LNCS,
vol. 8451, pp. 104–119. Springer, Heidelberg (2014)
3. Flener, P., Pearson, J., Ågren, M.: Introducing esra, a relational language for
modelling combinatorial problems (Abstract). In: Rossi, F. (ed.) CP 2003. LNCS,
vol. 2833, pp. 971–971. Springer, Heidelberg (2003)
4. Fourer, R., Gay, D.M., Kernighan, B.W.: AMPL: A Modeling Language for Math-
ematical Programming. Cengage Learning (2002)
5. Frisch, A.M., Harvey, W., Jefferson, C., Hernández, B.M., Miguel, I.: Essence :
A constraint language for specifying combinatorial problems. Constraints 13(3),
268–306 (2008)
6. Gent, I.P., Miguel, I., Rendl, A.: Tailoring solver-independent constraint models:
a case study with Essence and Minion. In: Miguel, I., Ruml, W. (eds.) SARA
2007. LNCS (LNAI), vol. 4612, pp. 184–199. Springer, Heidelberg (2007)
7. Godard, D., Laborie, P., Nuijten, W.: Randomized large neighborhood search for
cumulative scheduling. In: Proceedings of the Fifteenth International Conference
on Automated Planning and Scheduling (ICAPS 2005), Monterey, California, USA,
June 5–10 2005, pp. 81–89 (2005)
8. Harvey, W.D., Ginsberg, M.L.: Limited discrepancy search. In: Proceedings of the
14th IJCAI, pp. 607–613 (1995)
9. Hebrard, E., Hnich, B., O’Sullivan, B., Walsh, T.: Finding diverse and similar
solutions in constraint programming. In: Veloso, M.M., Kambhampati, S. (eds.)
AAAI, pp. 372–377. AAAI Press / The MIT Press (2005)
10. Hebrard, E., O’Mahony, E., O’Sullivan, B.: Constraint programming and com-
binatorial optimisation in numberjack. In: Lodi, A., Milano, M., Toth, P. (eds.)
CPAIOR 2010. LNCS, vol. 6140, pp. 181–185. Springer, Heidelberg (2010)
11. Marinescu, R., Dechter, R.: AND/OR branch-and-bound search for combinatorial
optimization in graphical models. Artif. Intell. 173(16–17), 1457–1491 (2009)
392 A. Rendl et al.
12. Marriott, K., Nethercote, N., Rafeh, R., Stuckey, P.J., de la Banda, M.G., Wallace,
M.: The design of the Zinc modelling language. Constraints 13(3), 229–267 (2008)
13. Michel, L., Van Hentenryck, P.: The comet programming language and system. In:
van Beek, P. (ed.) CP 2005. LNCS, vol. 3709, p. 881. Springer, Heidelberg (2005)
14. MiniSearch release. http://www.minizinc.org/minisearch
15. MiniZinc challenge. http://www.minizinc.org/challenge.html
16. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.R.: MiniZ-
inc: towards a standard CP modelling language. In: Bessière, C. (ed.) CP 2007.
LNCS, vol. 4741, pp. 529–543. Springer, Heidelberg (2007)
17. Régin, J.-C., Rezgui, M., Malapert, A.: Embarrassingly parallel search. In: Schulte,
C. (ed.) CP 2013. LNCS, vol. 8124, pp. 596–610. Springer, Heidelberg (2013)
18. Ruszczyński, A., Shapiro, A.: Stochastic Programming. Handbooks in operations
research and management science. Elsevier (2003)
19. Schrijvers, T., Tack, G., Wuille, P., Samulowitz, H., Stuckey, P.J.: Search combi-
nators. Constraints 18(2), 269–305 (2013)
20. Shaw, P.: Using constraint programming and local search methods to solve vehicle
routing problems. In: Maher, M.J., Puget, J.-F. (eds.) CP 1998. LNCS, vol. 1520,
pp. 417–431. Springer, Heidelberg (1998)
21. Simonis, H., O’Sullivan, B.: Search strategies for rectangle packing. In: Stuckey,
P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 52–66. Springer, Heidelberg (2008)
22. Stuckey, P.J., Feydy, T., Schutt, A., Tack, G., Fischer, J.: The MiniZinc challenge
2008–2013. AI Magazine 35(2), 55–60 (2014)
23. Stuckey, P.J., Tack, G.: Minizinc with functions. In: Gomes, C., Sellmann, M. (eds.)
CPAIOR 2013. LNCS, vol. 7874, pp. 268–283. Springer, Heidelberg (2013)
24. Van Hentenryck, P.: The OPL Optimization Programming Language. MIT Press,
Cambridge (1999)
25. Van Hentenryck, P., Michel, L.: OPL script: composing and controlling models.
In: Apt, K.R., Kakas, A.C., Monfroy, E., Rossi, F. (eds.) Compulog Net WS 1999.
LNCS (LNAI), vol. 1865, pp. 75–90. Springer, Heidelberg (2000)
26. Van Hentenryck, P., Michel, L.: The objective-CP optimization system. In: Schulte,
C. (ed.) CP 2013. LNCS, vol. 8124, pp. 8–29. Springer, Heidelberg (2013)
27. Walsh, T.: Stochastic Constraint Programming. In: van Harmelen, F. (ed.) ECAI,
pp. 111–115. IOS Press (2002)
Two Clause Learning Approaches
for Disjunctive Scheduling
1 Introduction
Disjunctive scheduling refers to a large family of scheduling problems having in
common the Unary Resource Constraint. This constraint ensures that a set of
tasks run in sequence, that is, without any time overlap. The traditional con-
straint programming (CP) approaches for this problem rely on tailored propa-
gation algorithms (such as Edge-Finding [6,17,24]) and search strategies (such
as Texture [20]). The technique of Large Neighborhood Search [22] (LNS) was
also extensively used in this context [7,25].
A different type of approaches emerged recently, based on the so-called
Conflict-Driven Clause Learning (CDCL) algorithm for SAT [16]. This proce-
dure uses resolution to learn a new clause for each conflict during search. Recent
constraint programming approaches similarly trade off strong propagation-based
inference for a way to learn during search. For instance, a hybrid CP/SAT
method, Lazy Clause Generation (LCG) [8,9,18] was shown to be extremely effi-
cient on the more general Resource Constrained Project Scheduling Problem [21]
(RCPSP ). Even simple heuristic weight-based learning was shown to be very
efficient on disjunctive scheduling [10–13]. The so called light model combines
minimalist propagation with a slight variant of the weighted degree [5] heuristic.
In this paper, we propose a hybrid CP/SAT method based on this light
model. Similarly to LCG, our approach mimics CDCL. However, it differs from
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 393–402, 2015.
DOI: 10.1007/978-3-319-23219-5 28
394 M. Siala et al.
LCG in two main respects: First, as the time horizon can be large, literals repre-
senting changes in the bounds of the tasks domains should be generated “lazily”
during conflict analysis as it was proposed in [8]. However, handling domain con-
sistency through clauses entails redundancies and hence suboptimal propagation.
We use a dedicated propagation algorithm, running in constant amortized time,
to perform this task. The second contribution is a novel conflict analysis scheme
tailored for disjunctive scheduling. This technique could be applied to any prob-
lem where search can be restricted to a predefined set of Boolean variables. This
is the case of disjunctive scheduling since once every pair of tasks sharing the
same resource is sequenced, we are guaranteed to find a complete solution in
polynomial time. Most methods therefore only branch on the relative order of
tasks sharing a common resource. We propose to use this property to design a
different conflict analysis method where we continue resolution until having a
nogood with only Boolean variables standing for task ordering. As a result, we
do not need to generate domain atoms.
We compare the two methods experimentally and show that the benefit of
not having to generate new atoms during search outweigh in many cases the
more expressive language of literals available in traditional hybrid solvers. The
novel approach is very efficient, especially for proving unfeasibility. We were
able to improve the lower bounds on several well known Job Shop Scheduling
Problem (JSSP ) benchmarks. However, a method implemented within IBM CP-
Optimizer studio recently found, in general, better bounds [25].
The rest of the paper is organized as follows: We give a short background
on hybrid CP/SAT solving in Section 2. Next, we briefly describe the baseline
CP model and strategies that we use in Section 3. We introduce in Section 4
our new lazy generation approach. In Section 5, we present our novel conflict
analysis scheme. Last, we give and discuss the experimental results in Section 6.
In this section, we briefly describe the basic mechanisms and notations of hybrid
CP/SAT used in modern Lazy Clause Generation solvers [8,9,18].
Let X = [x1 , .., xn ] be a sequence of variables. A domain D maps every vari-
able x ∈ X to a finite set D(x)⊂ Z. D(x) is a range if max(D(x)) − min(D(x)) +
1 = |D(x)|. A constraint C is defined by a relation over the domains of a sequence
of variables. In this context, each constraint is associated to a propagator to
reduce the domains with respect to its relation. Propagators are allowed to use
only domain operations of a given type (often x = v, x = v, x ≤ v, and
x ≥ v). Every domain operation is associated to a literal p that can have an
atom (i.e. Boolean variable) generated “eagerly” before starting the search, or
“lazily” when learning a conflict involving this change. Let p be a literal corre-
sponding to a domain operation. level(p) is the number of nodes in the current
branch of the search tree when p becomes true (i.e., when this domain opera-
tion takes place). Moreover, rank(p) is the number of such domain operations
that took place at the same node of the search tree before p. Last, a literal p is
Two Clause Learning Approaches for Disjunctive Scheduling 395
Algorithm 1. 1-UIP-with-Propagators
1 Ψ ← explain(⊥) ;
2 while |{q ∈ Ψ | level(q) = current level}| > 1 do
p ← arg maxq ({rank(q) | level(q) = current level ∧ q ∈ Ψ }) ;
3 Ψ ← Ψ ∪ {q | q ∈ explain(p) ∧ level(q) > 0} \ {p} ;
return Ψ ;
Consider now the lazy generation of atoms (i.e. after computing Ψ ). When
x ≤ u has to be generated, the clauses ¬x ≤ a ∨ x ≤ u; ¬x ≤ u ∨ x ≤ b
where a and b are the nearest generated bounds to u with a < u < b must
be added to maintain the consistency of x ≤ u with respect to previously
generated atoms. In this case, the clause ¬x ≤ l ∨ x ≤ u becomes redundant.
A JSSP requires also a total order on the tasks of each job. We enforce this order
with simple precedence constraints. Last, the objective is to minimize the total
scheduling duration, i.e., the makespan. To this purpose, we have an objective
variable Cmax subject to precedence constraints with the last task of each job.
We use the same search strategy as that proposed in [10,13]. First, we com-
pute a greedy upper bound on the makespan. Then we use a dichotomic search to
reduce the gap between lower and upper bounds. Each step of this dichotomic
phase corresponds to the decision problem with the makespan variable Cmax
fixed to the mid-point value. Each step is given a fixed time cutoff, and exceed-
ing it is interpreted as the instance being unsatisfiable. Therefore, the gap might
not be closed at the end of this phase, so a classic branch and bound procedure
is used until either closing the gap or reaching a global cutoff.
We branch on the Boolean variables of the Disjunctive constraints follow-
ing [13] using the solution guided approach [3] for value ordering. We use the
weighed degree heuristic taskDom/tw in a similar way to [10,13] in addition to
VSIDS [16]. The former branches first on variables occurring most in constraints
triggering failures. The latter favors variables involved in conflict analysis.
(a) Changing the upper bound of x w.r.t. newly assigned atoms: When an
atom bi ↔ x ≤ vi becomes assigned to 1, we check if vi can be the new
upper bound of x. Note that a failure can be triggered if vi < min(x).
(b) In the case of an upper bound propagation event, one has to assign
some atoms to be consistent with the new upper bound u of x.
Every atom bi such that vi ≥ u has to be assigned to 1. Let iub =
arg maxk (vk | D(bk ) = {1}). Observe first that the part simulating UP
(1) guarantees that all atoms bi where i > iub are already assigned
to 1. Consider now the set ϕ ={biub , biub −1 , biub −2 . . . , blastub } where
lastub = arg mink (vk | vk ≥ u)). It is now sufficient to assign every atom
in ϕ to 1 in order to complete the filtering.
Finally, since down a branch of the search tree the upper bound can only decrease,
we can compute the current value of iub , that is, arg maxk (vk | D(bk ) = {1}) by
exploring the sequence of successive upper bounds from where we previously
stopped. Therefore, each atom is visited at most once down a branch. This filter-
ing can thus be performed in constant amortized time, that is, in O(n) time down a
branch, however, we must store iub and ilb as “reversible” integers.
Algorithm 2. Substitute(
, Ψ )
visited ← ∅ ;
while |
| > 0 do
1 p ← choose p ∈
;
visited ← visited ∪ {p} ;
2 Ψ ← Ψ ∪ {q | q ∈ explain(p) ∧ level(q) > 0} \ visited ;
3
← {q | q ∈ Ψ ∧ q is a bound litteral};
return Ψ ;
since the language of literal is not as rich in this method, shorter proofs may be
possible with the standard approach.
6 Experimental Results
We first compare the two approaches described in this paper, that is, the imple-
mentation of lazy generation using DomainFaithfulness (lazy) as well as the
new learning scheme (disj) against the the CP model described in [11] on two
well known benchmarks for the JSSP: Lawrence [14] and Taillard [23]. Then, we
compare the lower bounds found by our approaches with the best known lower
bounds. All models are implemented within Mistral-2.0 and are tested on Intel
Xeon E5-2640 processors. The source code, the detailed results, and the experi-
mental protocol are available at http://siala.github.io/jssp/details.pdf .
We denote CP(task) the CP model using the taskDom/tw heuristic. For
the hybrid models, we use the notation H(θ, σ) where θ ∈ {vsids, task} is the
variable ordering and σ ∈ {lazy, disj} indicates the type of learning used.
We ran every method 10 times using randomized geometric restarts [26]. Each
dichotomy step is limited to 300s and 4×106 propagation calls. The total runtime
for each configuration is limited to 3600s. The results are summarized in Table 1.
Table 1 is divided in two parts. The first part concerns instances that are
mostly proven optimal by our experiments. We report for these instances the
average percentage of calls where optimality was proven %O, the average CPU
time T , and the number of nodes explored by second (nds/s). The second part
concerns the rest of the instances (i.e. hard instances). We report for each data
set the speed of exploration (nds/s) along with the average percentage relative
deviation (PRD) of each model. The PRD of a model m for an instance C is
computed with the formula: 100∗ CmC−C best
best
, where Cm is the minimum makespan
found by model m for this instance ; and Cbest is the minimum makespan known
in the literature [1,2,25]. The bigger the PRD, the less efficient a model is.
Consider first small and medium sized instances, i.e., la-01-40, tai-01-10, and
tai-11-20. Table 1 shows clearly that the learning scheme that we introduced (i.e.
H(vsids/task, disj)) dominates the other models on these instances. For exam-
ple H(vsids, disj) proves 91.5% of Lawrence instances to optimality whereas
Two Clause Learning Approaches for Disjunctive Scheduling 399
Instances CP(task) H(vsids, disj) H(vsids, lazy) H(task, disj) H(task, lazy)
Mostly proven optimal
%O T nds/s %O T nds/s %O T nds/s %O T nds/s %O T nds/s
la-01-40 87 522 8750 91.5 437 6814 88 632 2332 90.50 434 5218 88.75 509 2694
tai-01-10 89 768 5875 90 517 4975 88 1060 1033 90 634 3572 84 1227 1013
Hard instances
PRD nds/s PRD nds/s PRD nds/s PRD nds/s PRD nds/s
tai-11-20 1.8432 4908 1.1564 3583 1.3725 531 1.2741 2544 1.2824 489
tai-21-30 1.6131 3244 0.9150 2361 1.0841 438 0.9660 1694 0.8745 409
tai-31-40 5.4149 3501 4.0210 2623 3.7350 580 4.0536 1497 3.8844 510
tai-41-50 7.0439 2234 4.8362 1615 4.6800 436 4.9305 1003 5.0136 390
tai-51-60 3.0346 1688 3.2449 2726 3.7809 593 1.1156 1099 1.1675 575
tai-61-70 6.8598 1432 6.5890 2414 5.4264 578 3.9637 866 3.6617 533
CP(task) and H(vsids, lazy) achieve a ratio of 87% and 88%, respectively. More-
over, VSIDS generally performs better than weighted degree on these instances,
although this factor does not seem as important as the type of learning.
Consider now the rest of instances (tai-21-30 to tai-61-70). The impact of
clause learning is more visible on these instances. For example, with tai-31-
40, CP(task) has a PRD of 5.4149 while the worst hybrid model has a PRD
of 4.0536. The choice of the branching strategy seems more important on the
largest instances. For instance, on tai-51-60, the PRD of H(task, disj) is 1.1156
while H(vsids, disj) has a PRD of 3.2449.
Table 1 shows also that the CP model is often faster than any hybrid model
(w.r.t. nds/s). This is expected because of the overhead of propagating the learnt
clauses in the hybrid models. Lazy generation (lazy) slows the search down
considerably compared to the mechanism we introduced (disj).
Regarding the clauses size, we observed that the new method constantly
learns shorter clauses. For example when both methods use the heuristic VSIDS,
the average size on tai-11..20 is 31 for the disjunctive learning whereas the stan-
dard approach has an average size of 43. This may seem surprising, but several
bounds literals may share part of their explanations.
Overall, our hybrid models outperform the CP model in most cases. The
novel conflict analysis shows promising results especially for small and medium
sized instances. It should be noted that we did not find new upper bounds for
hard instances. However, our experiments show that our best model deviates
only of a few percents from the best known bounds in the literature. Note that
the state-of-the-art CP method [25] uses a timeout of 30000s (similarly to [19])
with a maximum of 600s per iteration in the bottom-up phase for improving the
lower bound. Moreover, they use the best known bounds as an extra information
along with a double threading phase. In our experiments, we use a single thread
and a fixed time limit of 3600s per instance.
400 M. Siala et al.
of these bounds were already improved by Vilı́m et al. [25]. The main difference
is that their algorithm uses the best known bounds as an additional information
before starting search. Our models, however, are completely self-contained in the
sense where search is started from scratch (see Section 3).
We computed the average PRD w.r.t. the best known lower bound includ-
ing those reported in [25]. Excluding the set tai40-50, the best combination,
H(vsids, disj) using Luby restarts [15], finds lower bounds that are 2.78% lower,
in average, than the best known bound in the literature.
Finally, in order to find new lower bounds, we launched again the model
H(vsids, disj) with 2500s as a timeout for each dichotomy step and 7200s as a
global cutoff. We found a new lower bound of 1583 for tai-29 (previously 1573)
and one of 1528 for tai-30 (previously 1519).
7 Conclusion
References
1. Best known lower/upper bounds for Taillard Job Shop instances. http://
optimizizer.com/TA.php (accessed April 15, 2015)
2. Taillard, É.: http://mistic.heig-vd.ch/taillard/problemes.dir/ordonnancement.dir/
jobshop.dir/best lb up.txt (accessed April 15, 2015)
3. Christopher, J.: Beck. Solution-guided multi-point constructive search for job shop
scheduling. Journal of Artificial Intelligence Research 29(1), 49–77 (2007)
4. Bessiere, C.: Constraint propagation. In: van Beek, P., Rossi, F., Walsh, T. (eds.)
Handbook of Constraint Programming, volume 2 of Foundations of Artificial Intel-
ligence, pp. 29–83. Elsevier (2006)
5. Boussemart, F., Hemery, F., Lecoutre, C., Sais, L.: Boosting systematic search
by weighting constraints. In: Proceedings of the 16th European Conference on
Artificial Intelligence, ECAI 2004, Valencia, Spain, pp. 146–150 (2004)
6. Carlier, J., Pinson, É.: An algorithm for solving the job-shop problem. Management
Science 35(2), 164–176 (1989)
7. Danna, E.: Structured vs. unstructured large neighborhood search: a case study
on job-shop scheduling problems with earliness and tardiness costs. In: Rossi, F.
(ed.) CP 2003. LNCS, vol. 2833, pp. 817–821. Springer, Heidelberg (2003)
8. Feydy, T., Schutt, A., Stuckey, P.J.: Semantic learning for lazy clause generation.
In: Proceedings of TRICS Workshop: Techniques foR Implementing Constraint
programming Systems, TRICS 2013, Uppsala, Sweden (2013)
9. Feydy, T., Stuckey, P.J.: Lazy clause generation reengineered. In: Gent, I.P. (ed.)
CP 2009. LNCS, vol. 5732, pp. 352–366. Springer, Heidelberg (2009)
10. Grimes, D., Hebrard, E.: Job shop scheduling with setup times and maximal time-
lags: a simple constraint programming approach. In: Lodi, A., Milano, M., Toth, P.
(eds.) CPAIOR 2010. LNCS, vol. 6140, pp. 147–161. Springer, Heidelberg (2010)
11. Grimes, D., Hebrard, E.: Models and strategies for variants of the job shop schedul-
ing problem. In: Lee, J. (ed.) CP 2011. LNCS, vol. 6876, pp. 356–372. Springer,
Heidelberg (2011)
12. Grimes, D., Hebrard, E.: Solving variants of the job shop scheduling prob-
lem through conflict-directed search. INFORMS Journal on Computing 27(2),
268–284 (2015)
13. Grimes, D., Hebrard, E., Malapert, A.: Closing the open shop: contradicting con-
ventional wisdom. In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 400–408.
Springer, Heidelberg (2009)
14. Lawrence, S.R.: Supplement to resource constrained project scheduling: an experi-
mental investigation of heuristic scheduling techniques. Technical report, Graduate
School of Industrial Administration, Carnegie Mellon University, Pittsburgh, PA
(1984)
15. Luby, M., Sinclair, A., Zuckerman, D.: Optimal speedup of Las Vegas algorithms.
Information Processing Letters 47(4), 173–180 (1993)
16. Matthew, W., Moskewicz, C.F., Madigan, Y.Z., Zhang, L., Malik, S.: Chaff: engi-
neering an efficient SAT solver. In: Proceedings of the 38th Annual Design Automa-
tion Conference, DAC 2001, Las Vegas, Nevada, USA, pp. 530–535 (2001)
17. Nuijten, W.: Time and resource constrained scheduling: a constraint satisfaction
approach. Ph.D thesis, Eindhoven University of Technology (1994)
18. Ohrimenko, O., Stuckey, P.J., Codish, M.: Propagation via Lazy Clause Genera-
tion. Constraints 14(3), 357–391 (2009)
402 M. Siala et al.
19. Pardalos, P.M., Shylo, O.V.: An algorithm for the job shop scheduling problem
based on global equilibrium search techniques. Computational Management Sci-
ence 3(4), 331–348 (2006)
20. Sadeh, N.M.: Lookahead techniques for micro-opportunistic job-shop scheduling.
Ph.D thesis, Carnegie Mellon University, Pittsburgh, PA, USA (1991)
21. Schutt, A., Feydy, T., Stuckey, P.J., Wallace, M.G.: Solving rcpsp/max by lazy
clause generation. Journal of Scheduling 16(3), 273–289 (2013)
22. Shaw, P.: Using constraint programming and local search methods to solve vehicle
routing problems. In: Maher, M.J., Puget, J.-F. (eds.) CP 1998. LNCS, vol. 1520,
pp. 417–431. Springer, Heidelberg (1998)
23. Taillard, É.: Benchmarks for basic scheduling problems. European Journal of Oper-
ational Research 64(2), 278–285 (1993). Project Management anf Scheduling
24. Vilı́m, P.: Edge finding filtering algorithm for discrete cumulative resources in
O(kn log (n)). In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 802–816. Springer,
Heidelberg (2009)
25. Vilı́m, P., Laborie, P., Shaw, P.: Failure-directed search for constraint-based
scheduling. In: Michel, L. (ed.) CPAIOR 2015. LNCS, vol. 9075, pp. 437–453.
Springer, Heidelberg (2015)
26. Walsh, T.: Search in a small world. In: Proceedings of the 16th International
Joint Conference on Artificial Intelligence, IJCAI 1999, Stockholm, Sweden,
pp. 1172–1177 (1999)
27. Zhang, L., Madigan, C.F., Moskewicz, M.H., Malik, S.: Efficient conflict driven
learning in a boolean satisfiability solver. In: Proceedings of the 2001 IEEE/ACM
International Conference on Computer-aided Design, ICCAD 2001, San Jose, Cal-
ifornia, pp. 279–285 (2001)
Bounding an Optimal Search Path with a Game
of Cop and Robber on Graphs
Abstract. In search theory, the goal of the Optimal Search Path (OSP)
problem is to find a finite length path maximizing the probability that
a searcher detects a lost wanderer on a graph. We propose to bound
the probability of finding the wanderer in the remaining search time
by relaxing the problem into a stochastic game of cop and robber from
graph theory. We discuss the validity of this bound and demonstrate its
effectiveness on a constraint programming model of the problem. Exper-
imental results show how our novel bound compares favorably to the
DMEAN bound from the literature, a state-of-the-art bound based on a
relaxation of the OSP into a longest path problem.
1 Introduction
The Optimal Search Path (OSP) problem [1,2] is a classical problem from search
theory [3] of which the SAROPS [4] and the SARPlan [5] are two examples of
successful systems. The goal of an OSP is to find the best finite length path
a searcher has to take in order to maximize the probability of finding a lost
wanderer moving randomly on a graph. It is a common assumption, in search
theory, to consider unconstrained searcher’s motion. The assumption holds, for
instance, in contexts where the searcher is fast in comparison to the target of
interest. There are, however, many cases, such as in land search and rescue [3],
where the searcher is as slow as the moving wanderer. Washburn [6] also notes
how bounded speeds (for searcher and wanderer) is used in modeling searches
for hostile submarines or friendly vessels.
Most of the early work on the OSP problem consisted in computing bounds
for a depth-first branch-and-bound algorithm initially developed by Stewart [2].1
At the opposite of stochastic constraint programming, the OSP requires to com-
pute a single scenario given by the decision variables and the probability that
1
A review of the bounds developed prior to 1993 is found in the work of Washburn [6].
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 403–418, 2015.
DOI: 10.1007/978-3-319-23219-5 29
404 F. Simard et al.
2
Following the convention of cop and robber games on graphs, we suppose that the
searcher (or cop) is a woman and that the wanderer (or robber) is a man.
3
poct (v) also stands for the probability of containment [10].
Bounding an Optimal Search Path 405
The next section summarizes the CP model of the OSP used in [10].
The value of the POC1 (r) variables is fixed given the initial distribution on
the wanderer’s location, a value known for all r ∈ V (G). For all subsequent
time steps t ∈ {2, . . . , T } and vertices v ∈ V (G), the evolution of the searcher’s
knowledge on the wanderer’s location is modeled by the following constraint set:
POCt (v) = M (r, r ) (POCt−1 (r) − POSt−1 (r)) . (5)
r∈V (G)
and improving filtering over the usual double sum definition of the objective.
The objective is finally
max Z, (7)
PATH1 ,...,PATHT
RDMEAN (r , k + 1) = RMEAN (r , k + 1) − RMEAN (r, k)M (r, r )pod(r ). (9)
That is, the wanderer has a probability RMEAN (r , k + 1) of reaching vertex
r on time step k + 1 and being detected there, from which we substract his
probability RMEAN (r, k)M (r, r )pod(r ). This last term is the probability the
wanderer had of being on vertex r at the preceding time step k, transiting on r
and being captured there. The RDMEAN (r , k + 1) value thus corresponds to the
probability that the wanderer reaches r, survives an additional search, reaches
r and gets caught. Given the beginning of a path πt , an admissible4 bound for
the OSP is obtained by first solving a longest path problem of which ZDAG is
the optimal value and then by summing ZDAG and cosπt [7].
Remark 1. Given a graph with n vertices and m edges, DMEAN asks for the
construction of a DAG with nT new vertices and mT new edges. Then, if the
current time is k, the longest path can be solved in O ((T − k + 1)(n + m)) steps.
It is convenient, to apply the DMEAN bound in our CP model of the OSP,
to order the path variables in a static order of the searcher’s positions in time.
This is the natural order to solve an OSP since the PATHt variables are the only
decision variables and since the implicit variables representing the probabilities,
including the objective variable Z that represents cos∗π0 , are entirely determined
by the searcher’s path. When opening a node for a searcher’s position at a time
t, we are able to compute, using the chosen bound, a tighter upper bound on the
domain of the objective variable. The DMEAN bound is proved admissible [7],
that is, it never underestimates the real objective value. Whenever the bound
computed on the opened node of the searcher’s position at a time t is lower than
the best known lower bound on the objective value (e.g., the objective value of
the current incumbent solution) that searcher’s move is proven unpromising.
by considering, after t steps, the best possible scenario for the searcher that
corresponds to allowing her the ability of seeing the wanderer for the remainder
of the game.
In this game, a cop and a robber move in turn on a graph G, the cop moving
first. In contrast with the OSP, the cop has probability 1 of catching the robber
when sharing the same vertex, and she sees the robber, who, as does the wan-
derer in the previous game, walks randomly according to a stochastic transition
matrix M . The value M (r, r ) is the probability that the robber moves to r pro-
vided he is in r at the beginning of the turn. It is positive only if (r, r ) ∈ E(G).
The game ends whenever the cop and the robber share the same vertex. The
following definition generalizes Nowakowski and Winkler’s [11] relational charac-
terization for the classic cop and robber game to the stochastic one. We want to
define the relation wnM (r, c) as standing for the probability that the cop catches
the robber within n moves given their positions (r, c) and the robber’s random
movement model M . Its definition is based upon the observation that in order to
maximize her capture probability, the cop only needs to average her probability
of capture at the next turn on the robber’s possible transitions.
Definition 1. Given r, c the respective positions of the robber and the cop in G,
M the robber’s random walk matrix, we define:
w0M (r, c) := 1 if r = c; otherwise, it is 0;
⎧
⎨1 if c ∈ N [r], n ≥ 1;
wnM (r, c) := M (r, r )wn−1
M
(r , c ) if c ∈
/ N [r], n ≥ 1. (10)
⎩ max
c ∈N [c]
r ∈N [r]
Proposition 1. If the cop plays first on G and M governs the robber’s random
walk, then wnM (r, c) is the probability a cop starting on vertex c captures the
drunk robber on his start vertex r in n steps or less.
Proof. By induction. The base case, with n = 0, is clear. Suppose the proposition
holds for n − 1 ≥ 0 with n > 0 and let us now prove it for n. If c ∈ N [r], then
wnM (r, c) = 1 and the result follows because the cop indeed catches the robber. If
c∈/ N [r], then let the cop move to some vertex c . The position of the robber at
the end of the round is r with probability M (r, r ). The probability that the cop
catches the robber
depends on thisMlast one’s next move and on wn−1 following
the expression r ∈N [r] M (r, r )wn−1 (r , c ). Hence, the best possible move for
the cop is argmaxc ∈N [c] r ∈N [r] M (r, r )wn−1
M
(r , c ). The wanted probability is
thus wnM (r, c).
Bounding an Optimal Search Path 409
The set of actions is V (G), the vertices on which the cop moves.
A := V (G).
From a pair of positions of the cop and the robber at a certain time, once the
cop chooses an action another state is chosen randomly with probability P .
P (r , c , t ) | (r, c, t), a := 0 whenever a = c or c ∈ N [c] or t = t + 1
otherwise, P is defined as : ⎧
⎪
⎪ 1 if r = r = jail;
⎪
⎨pod(r) if r = c , r = jail;
P (r , c , t + 1) | (r, c, t), c := (11)
⎪
⎪
(1 − pod(r))M (r, r ) if r = c , r = jail;
⎪
⎩
M (r, r ) if r ∈ {c, c , jail}.
1 if r = jail = r, t ≤ T ;
R((r , c , t ) | (r, c, t), a) := (12)
0 otherwise.
410 F. Simard et al.
The game is initialized as follows: the cop chooses her initial position c on a
subset X of the graph vertices, and then the initial position r of the robber is
picked at random according to the probability distribution pocπ0, which results
in an initial state (r, c, 1) for the MDP. A turn starts with a cop move. If the
cop transits to the robber state (r = c ), then there is probability pod(r) that
she catches the robber, which results in the robber going to jail (r = jail) and
staying there for the rest of the game. The cop then receives a reward of 1.
If the catch fails (r = jail, with probability 1 − pod(r)) or if the cop did not
transit to the robber state (r = c ), the robber is still free to roam, following
M . Note that the state transition probabilities (11) are non-null only when valid
moves are considered (time goes up by one and a = c ∈ N [c]). Note also that,
when the robber is in jail, no more reward is given to the cop. In the MDP M,
the cop’s goal is to find a strategy, also called policy, to maximize her expected
reward, that is, the probability to capture the robber before a total of T steps
is reached. A strategy in M consists in first choosing an initial position (for
the cop) and then in following a function f : S → A that, given the current
state, tells the cop which action to take, that is, which state to transit to. Note
that, since the current position of the robber is included in the current state
of the MDP, the cop therefore has full information on the system when she is
elaborating her strategy.
Because of M’s Markov property, whenever a strategy f is fixed, one can com-
pute the value uf (r, c, t) of each state (r, c, t) of the MDP, that is, the expected
reward the cop can obtain from that state when following the strategy f . The
optimal strategy, noted u∗ , is therefore the one that gives the highest value on all
states (r, c, t). The cop’s optimal strategy consists in moving to the robber’s posi-
tion if possible, and then trying to capture him. If the robber is not positioned
on one of the cop’s neighbours, the cop moves to the position that maximizes her
probability of capture in the remaining time allowed. Similarly to Proposition 1,
the value of this optimal strategy is:
⎧
⎪
⎪
⎪ max M (r, r )u∗ (r , c , t + 1) if r ∈
/ N [c], t < T ;
⎨c ∈N [c] r ∈N [r]
u∗ (r, c, t) = (13)
⎪
⎪ 1 − (1 − pod(r))T +1−t if r ∈ N [c], t ≤ T ;
⎪
⎩0 if r ∈
/ N [c], t = T.
If r ∈ N [c], the cop, who moves first, must choose a next state that will result in
the best probability of eventual capture, given the robber’s present position, and
knowing that the robber’s next move is governed by M . If r ∈ N [c], the cop tries
to catch the robber with probability of success pod(r); if she fails, the robber
will transit to one of his neighbours, and hence the cop can keep on trying to
catch the robber until success or until the maximal time has been reached. It is
important to note here that the robber is completly visible and the game is not
played simultaneously, hence why the cop can follow the robber. Equation (13)
is analogous to (10) with time steps reversed and pod(r) = 1 for all vertices.
The formula follows from the fact that at the beginning of time step t, the cop
has T + 1 − t remaining attempts.
Bounding an Optimal Search Path 411
Since the optimal probability of capture in the OSP problem is always lower
than the optimal probability of capture in the cop and robber game, we have
the following proposition:
Proposition 2. The probability cos∗π0 of finding the wanderer is always at most
that of catching the robber:
cos∗π0 ≤ max pocπ0(r)u∗ (r, c, 1),
c∈X
r∈V (G)
Proof. Clearly, cos∗π0 is bounded by the optimal probability of capture of the cop
and robber game. In the MDP, the optimal probability of capture is obtained
if the cop’s first choice maximizes his probability of capture considering that at
that moment the robber is not yet positioned on the graph but will be according
to the probability distribution pocπ0 .
We note that Pralat and Kehagias [18] also formulated the game of cop and
visible drunk robber as an MDP, but instead of using this framework to compute
the probability of capture of the robber it was formulated to obtain the expected
number of time steps before capture.
Applying the Copwin bound in CP requires filtering the upper bound of the
objective function variable Z. The solver can be configured to branch in a static
order of the PATHt variable, which is, as discussed in Section 2.2, the natural
order of the decision variables to solve an OSP. We proved that our bound is
admissible in that it never underestimates the real objective value. In the next
section, we use the Copwin bound jointly with a CP model of the OSP and
compare its performance to that of the DMEAN bound from literature.
4 Experiments
All experiments were run on the supercomputer Colosse from Université Laval
using the Choco 2.1.5 solver [23] along with the Java Universal Network/Graph
(JUNG) 2.0.1 framework [24]. The total allowed CPU time is 5 minutes (or 5
million backtracks) per run. We used a total of six graphs representing different
search environments. In the grid G+ , the nodes are connected to their North,
South, East, and West neighbour. The grid G∗ has the same connections than
G+ but also adds connectivity to the North-East, North-West, South-East, and
South-West neighbours. The last grid is a typical hexagonal grid we call GH
with the searcher moving on its edges. Grid-like accessibility constraints are
common in search theory problems in that they model aerial or marine search
operations where the searcher has few accessibility constraints but her own phys-
ical constraints. This justifies the presence of grids in our OSP benchmarks. We
also added a fourth grid with supplementary constraints on accessibility. This
last grid GV is a hexagonal grid with a supplementary node in the center of
each hexagon. We then had removed edges randomly to simulate supplementary
accessibility constraints. The last two graphs, GL and GT , are real underground
environments. The GL graph is the graph of the Université Laval’s tunnels. The
GT graph is the graph of the London Underground subway (also known as the
Tube). Both neighbours of an intermediate station, i.e., a node of degree 2, were
connected together while the node was removed. This practice results in a more
interesting graph environment for searches.
For each instance, we selected a p ∈ {0.3, 0.6, 0.9} and put pod(r) = p
for all vertex r. For the wanderer’s Markovian transition matrix, we pick
ρ ∈ {0.3, 0.6, 0.9} and considered that at any position v, the wanderer has prob-
ρ
ability ρ of staying in v and probability 1 − deg(v) to move to one of his deg(v)
neighbours. We uniformly distributed the remaining probability mass 1−ρ on the
neighbouring vertices. Finally, we chose T ∈ {5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25}.
This leads to a total of 594 instances.
We conducted the experiment in three parts. In the first two parts, we com-
pare our novel bound to the DMEAN bound we reviewed in Section 2.2. First,
we implemented the two bounds as separate constraints on the upper bound of
Bounding an Optimal Search Path 413
the objective value. Both bounds are evaluated on the same problem instances.
This enables us to assess the bounds performance with respect to the objective
value of the best incumbent solution found by the solver and to the time required
to attain it.
In the second part, we implemented both bounds as a single constraint on
the upper bound of the objective value. Both bounds were computed simultane-
ously by the constraint. The minimal value of both bounds was used to update
the upper bound of the domain of the Z variable representing the objective if
required. That is, whenever that minimal value is lower than the upper bound
on the domain of the Z variable. If the domain of Z is emptied, then one of the
bounds produced a value that is lower than the best known lower bound on the
objective thus leading to a backtrack. For each bounding technique (DMEAN
and Copwin), we count how many times, during the search, the bounding of
the objective value causes a backtrack. We gave a single point to a bound that
leads to a backtrack that way. We note that on occasions both bounds could
receive a point. In all cases, the solver branches on the PATHt decision variables
in their natural order, i.e., in ascending order of the time steps. We thus were
able to record the exact time step at which each backtrack occurred. Such an
experiment enables one to empirically assess which bound is more efficient at
pruning the search tree no matter without considering any time constraints.
We show, in the third part, how the bounds perform when paired with the
total detection (TD) heuristic used as a value-selection heuristic [10]. The TD
heuristic is on many account similar to the bound derived in this paper which
gives its theoretical justification. However, rather than using the cop and robber
games theory to bound the objective value, TD is a heuristic that assigns values
to the variables PATHt . Even in this context, the Copwin bound performs and
stays competitive.
Fig. 1. Two by two comparison of DMEAN best incumbent COS value against Copwin
best incumbent COS value for all 594 OSP instances; the incumbent solution of each
instance is represented by a dot on the graph.
Fig. 2. Total number of cuts in the solver’s search tree for both bounds against
searcher’s path length with T = 17; results for each instance are aggregated on motion
models ρ and on detection models pod(r). refers to the use of Copwin whereas
refers to DMEAN.
Bounding an Optimal Search Path 415
Copwin empties the objective value variable’s domain more often than DMEAN
independently of the graph, even though on some instances such as GL both lead
to a great number of prunings. This is a strong indication that Copwin performs
well on all accounts on most instances: for a fixed resolution time, it leads to
better objective values while pruning more branches than the DMEAN bound.
We present on Figure 3, the objective value of the best so far solution against
computational time for both bounding strategies. We present these comparisons
on three representative instances: one in which Copwin is better than DMEAN,
0.100 0.5
0.6
0.4
0.075
COS value
COS value
COS value
0.3
0.4
0.050
0.2
0.2
0.025
0.1
Fig. 3. The COS value achieved and the time it was found for each bound. Red lines
are associated with Copwin and blue ones with DMEAN. Each title refers to the graph
type, the instance pod(r), the instance ρ and maximal time steps of 17.
Fig. 4. Comparison of the best incumbent COS value obtained with the TD heuristic
for the Copwin bound against the best COS value obtained with the TD heuristic for
the DMEAN bound for all OSP problem instances; the incumbent solution of each
instance is represented by a dot on the graph.
416 F. Simard et al.
one in which it is worse and another where both bounds lead to a similar perfor-
mance. These graphs confirm the intuition that, most of the time, Copwin finds
good solutions more quickly than DMEAN.
Bounding an Optimal Search Path 417
5 Conclusion
We tackled the OSP problem from search theory using constraint programming.
As a first contribution, we provided the first implementation of the DMEAN
bound from the search theory literature in CP. As our main contribution, we
developed the Copwin bound, a novel and competitive bound based on MDPs.
This bound is derived from a simple and elegant relaxation of a search problem
into a graph theory pursuit game. Involving a polynomial computational cost,
the Copwin bound leads to an improved solver performance on the vast majority
of OSP problem instances in our benchmark. Altough we used the bound on a
CP model of the OSP, it remains a general technique applicable to other OSP
algorithms.
References
1. Trummel, K., Weisinger, J.: The complexity of the optimal searcher path problem.
Operations Research 34(2), 324–327 (1986)
2. Stewart, T.: Search for a moving target when the searcher motion is restricted.
Computers and Operations Research 6(3), 129–140 (1979)
3. Stone, L.: Theory of Optimal Search. Academic Press, New York (2004)
4. Netsch, R.: The USCG search and rescue optimal planning system (SAROPS)
via the commercial/joint mapping tool kit (c/jmtk). In: Proceedings of the 24th
Annual ESRI User Conference, vol. 9, August 2004
5. Abi-Zeid, I., Frost, J.: A decision support system for canadian search and rescue
operations. European Journal of Operational Research 162(3), 636–653 (2005)
6. Washburn, A.R.: Branch and bound methods for a search problem. Naval Research
Logistics 45(3), 243–257 (1998)
7. Lau, H., Huang, S., Dissanayake, G.: Discounted MEAN bound for the optimal
searcher path problem with non-uniform travel times. European Journal of Oper-
ational Research 190(2), 383–397 (2008)
418 F. Simard et al.
8. Morin, M., Lamontagne, L., Abi-Zeid, I., Lang, P., Maupin, P.: The optimal
searcher path problem with a visibility criterion in discrete time and space.
In: Proceedings of the 12th International Conference on Information Fusion,
pp. 2217–2224 (2009)
9. Sato, H., Royset, J.O.: Path optimization for the resource-constrained searcher.
Naval Research Logistics, 422–440 (2010)
10. Morin, M., Papillon, A.-P., Abi-Zeid, I., Laviolette, F., Quimper, C.-G.: Constraint
programming for path planning with uncertainty. In: Milano, M. (ed.) CP 2012.
LNCS, vol. 7514, pp. 988–1003. Springer, Heidelberg (2012)
11. Nowakowski, R., Winkler, P.: Vertex-to-vertex pursuit in a graph. Discrete Math-
ematics 43(2), 235–239 (1983)
12. Quilliot, A.: Problème de jeux, de point fixe, de connectivité et de représentation
sur des graphes, des ensembles ordonnés et des hypergraphes. Ph.D thesis, Univer-
sité de Paris VI (1983)
13. Bonato, A., Nowakowski, R.: The game of cops and robbers on graphs. American
Mathematical Soc. (2011)
14. Fomin, F.V., Thilikos, D.M.: An annotated bibliography on guaranteed graph
searching. Theoretical Computer Science 399(3), 236–245 (2008)
15. Beldiceanu, N., Demassey, S.: Global constraint catalog (2014). http://sofdem.
github.io/gccat/ (accessed 2015–04)
16. Martins, G.H.: A new branch-and-bound procedure for computing optimal search
paths. Master’s thesis, Naval Postgraduate School (1993)
17. Kehagias, A., Mitsche, D., Pralat, P.: Cops and invisible robbers: The cost of
drunkenness. Theoretical Computer Science 481, 100–120 (2013)
18. Kehagias, A., Pralat, P.: Some remarks on cops and drunk robbers. Theoretical
Computer Science 463, 133–147 (2012)
19. Komarov, N., Winkler, P.: Capturing the Drunk Robber on a Graph. arXiv preprint
arXiv:1305.4559 (2013)
20. Bäuerle, N., Rieder, U.: Markov Decision Processes with Applications to Finance.
Springer (2011)
21. Puterman, M.L.: Markov decision processes: discrete stochastic dynamic program-
ming, vol. 414. John Wiley & Sons (2009)
22. Barto, A.G., Sutton, R.S.: Reinforcement learning: An introduction. MIT press
(1998)
23. Laburthe, F., Jussien, N.: Choco solver documentation. École de Mines de Nantes
(2012)
24. O’Madadhain, J., Fisher, D., Nelson, T., White, S., Boey, Y.B.: The JUNG (Java
universal network/graph) framework (2010)
Restricted Path Consistency Revisited
Kostas Stergiou(B)
1 Introduction
Restricted path consistency (RPC) is a local consistency for binary constraints
that is stronger than arc consistency (AC). RPC was introduced by Berlandier
[4] and was further studied by Debruyne and Bessiere [7,8]. An RPC algorithm
removes all arc inconsistent values from a domain D(x), and in addition, for any
pair of values (a, b), with a ∈ D(x) and b ∈ D(y) s.t. b is the only support for a
in a D(y), it checks if (a, b) is path consistent. If it is not then a is removed from
D(x). In this way some of the benefits of path consistency are retained while
avoiding its high cost.
Although RPC was identified as a promising alternative to AC as far back
as 2001 [8], it has been neglected by the CP community since then. In contrast,
stronger local consistencies such as max restricted path consistency (maxRPC)
[7] and singleton arc consistency (SAC) [8] have received considerable attention
in the past decade or so [1–3,5,9,11,13,14]. However, despite the algorithmic
developments on maxRPC and SAC, none of the two outperforms AC when
maintained during search, except for specific classes of problems. Therefore,
MAC remains the predominant generic algorithm for solving binary CSPs.
In this paper we revisit RPC and make two contributions compared to pre-
vious works that bring the state-of-the-art regarding RPC up to date. The first
is algorithmic and the second experimental.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 419–428, 2015.
DOI: 10.1007/978-3-319-23219-5 30
420 K. Stergiou
The two algorithms that have been proposed for RPC, called RPC1 [4] and
RPC2 [7], are based on the AC algorithms AC4 and AC6 respectively. As a result
they suffer from the same drawbacks as their AC counterparts. Namely, they use
heavy data structures that are too expensive to maintain during search. In recent
years it has been shown that in the case of AC lighter algorithms which sacrifice
optimality display a better performance when used inside MAC compared to
optimal but heavier algorithms such as AC4, AC6, AC7, and AC2001/3.1. Hence,
the development of the residue-based version of AC3 known as AC3r [10,12]. A
similar observation has been made with respect to maxRPC [1]. Also, it has
been noted that cheap approximations of local consistencies such as maxRPC
and SAC are more cost-effective than the full versions. In the case of maxRPC,
the residue-based algorithm lmaxRPC3r , which achieves an approximation of
maxRPC, is the best choice when applying maxRPC [1].
Following these trends, we propose RPC3, an RPC algorithm that makes use
of residues in the spirit of ACr and lmaxRPCr and is very easy to implement. As
we will explain, for each constraint (x, y) and each value a ∈ D(x), RPC3 stores
two residues that correspond to the two most recently discovered supports for a
in D(y). This enables the algorithm to avoid many redundant constraint checks.
We also consider a restricted version of the algorithm (simply called rRPC3)
that achieves a local consistency property weaker than RPC, but still stronger
than AC, and is considerably faster in practice.
Our second and most important contribution concerns experiments. Given
that the few works on RPC date from the 90s, the experimental evaluations of the
proposed algorithms were carried out on limited sets of, mainly random, prob-
lems. Equally importantly, there was no evaluation of the algorithms when used
during search to maintain RPC. We carry out a wide evaluation on benchmark
problems from numerous classes that have been used in CSP solver competi-
tions. Surprisingly, results demonstrate that an algorithm that applies rRPC3
throughout search is not only competitive with MAC, but it clearly outperforms
it on the overwhelming majority of tested instances, especially on structured
problems. Also, it clearly outperforms lmaxRPC3r . This is because RPC, and
especially its restricted version, achieves a very good balance between the prun-
ing power of maxRPC and the low cost of AC.
Our experimental results provide strong evidence of a local consistency that
is clearly preferable to AC when maintained during search. Hence, perhaps it is
time to reconsider the common perception that MAC is the best general purpose
solver for binary problems.
2 Background
A Constraint Satisfaction Problem (CSP) is defined as a triplet (X , D, C) where:
X = {x1 , . . . , xn } is a set of n variables, D = {D(x1 ), . . . , D(xn )} is a set of
domains, one for each variable, with maximum cardinality d, and C = {c1 , . . . , ce }
is a set of e constraints. In this paper we are concerned with binary CSPs. A
binary constraint cij involves variables xi and xj .
Restricted Path Consistency Revisited 421
At any time during the solving process if a value ai has not been removed
from the domain D(xi ), we say that the value is valid. A value ai ∈ D(xi ) is arc
consistent (AC) iff for every constraint cij there exists a value aj ∈ D(xj ) s.t.
the pair of values (ai , aj ) satisfies cij . In this case aj is called an support of ai .
A variable is AC iff all its values are AC. A problem is AC iff there is no empty
domain in D and all the variables in X are AC.
A pair of values (ai , aj ), with ai ∈ D(xi ) and aj ∈ D(xj ), is path consistent
PC iff for any third variable xk constrained with xi and xj there exists a value
ak ∈ D(xk ) s.t. ak is a support of both ai and aj . In this case aj is a PC-support
of ai in D(xj ) and ak is a PC-witness for the pair (ai , aj ) in D(xk ).
A value ai ∈ D(xi ) is restricted path consistent (RPC) iff it is AC and for each
constraint cij s.t. ai has a single support aj ∈ D(xj ), the pair of values (ai , aj )
is path consistent (PC) [4]. A value ai ∈ D(xi ) is max restricted path consistent
(maxRPC) iff it is AC and for each constraint cij there exists a support aj for
ai in D(xj ) s.t. the pair of values (ai , aj ) is path consistent (PC) [7]. A variable
is RPC (resp. maxRPC) iff all its values are RPC (resp. maxRPC). A problem
is RPC (resp. maxRPC) iff there is no empty domain and all variables are RPC
(resp. maxRPC).
The RPC3 algorithm is based on the idea of seeking two supports for a value,
which was first introduced in RPC2 [7]. But in contrast to RPC2 which is based
on AC6, it follows an AC3-like structure, resulting in lighter use of data struc-
tures, albeit with a loss of optimality. As explained below, we can easily obtain
a restricted but more efficient version of the algorithm that only approximates
the RPC property. Crucially, the lack of heavy data structures allows for the
use of the new algorithms during search without having to perform expensive
restorations of data structures after failures.
In the spirit of ACr , RPC3 utilizes two data structures, R1 and R2 , which
hold residual data used to avoid redundant operations. Specifically, for each
constraint cij and each value ai ∈ D(xi ), R1xi ,ai ,xj and R2xi ,ai ,xj hold the two
most recently discovered supports of ai in D(xj ). Initially, all residues are set to
a special value NIL, considered to precede all values in any domain.
The pseudocode of RPC3 is given in Algorithm 1 and Function 2. Being
coarse-grained like AC3, Algorithm 1 uses a propagation list Q, typically imple-
mented as a fifo queue. We use a constraint-oriented description, meaning that Q
handles pairs of variables involved in constraints. A variable-based one requires
minor modifications.
Once a pair of variables (xi , xj ) is removed from Q, the algorithm iterates
over D(xi ) and for each value ai first checks the residues R1xi ,ai ,xj and R2xi ,ai ,xj
(line 5). If both are valid then ai has at least two supports in D(xj ). Hence,
the algorithm moves to process the next value in D(xi ). Otherwise, function
findTwoSupports is called. This function will try to find two supports for ai in
D(xj ). In case it finds none then ai is not AC and will thus be deleted (line 13).
422 K. Stergiou
Algorithm 1. RPC3:boolean
1: while Q = ∅ do
2: Q ← Q−{(xi , xj )};
3: Deletion ← FALSE;
4: for each ai ∈ D(xi ) do
5: if both R1xi ,ai ,xj and R2xi ,ai ,xj are valid then
6: continue;
7: else
8: if only one of R1xi ,ai ,xj and R2xi ,ai ,xj is valid then
9: R ← the valid residue;
10: else
11: R ← NIL;
12: if findTwoSupports(xi , ai , xj , R) = FALSE then
13: remove ai from D(xi );
14: Deletion ← TRUE;
15: if D(xi ) = ∅ then
16: return FALSE;
17: if Deletion = TRUE then
18: for each (xk , xi ) ∈ C s.t. (xk , xi ) ∈ / Q do
19: Q ← Q ∪ {(xk , xi )};
20: for each (xl , xk ) ∈ C s.t. xl = xi and (xl , xi ) ∈ C and (xl , xk ) ∈
/ Q do
21: Q ← Q ∪ {(xl , xk )};
22: return TRUE;
In case it finds only one then it will check if ai is RPC. If it is not then it will
be deleted. Function findTwoSupports takes as arguments the variables xi and
xj , the value ai , and a parameter R, which is set to the single valid residue of
ai in D(xj ) (line 9) or to NIL if none of the two residues is valid.
Function findTwoSupports iterates over the values in D(xj ) (line 3). For each
value aj ∈ D(xj ) it checks if the pair (ai , aj ) satisfies constraint cij (this is what
function isConsistent does). If both residues of ai in D(xj ) are not valid then
after a support is found, the algorithm continues to search for another one.
Otherwise, as soon as a support is found that is different than R, the function
returns having located two supports (lines 9-11).
If only one support aj is located for ai then the algorithm checks if the
pair (ai , aj ) is path consistent. During this process it exploits the residues to
save redundant work, if possible. Specifically, for any third variable xk that is
constrained with both xi and xj , we first check if one of the two residues of ai is
valid and if aj is consistent with that residue (line 16). If this is the case then we
know that there is a PC-witness for the pair (ai , aj ) in D(xk ) without having to
iterate over D(xk ). If it is not the case then the check is repeated for the residues
of aj in D(xk ). If we fail to verify the existense of a PC-witness in this way then
we iterate over D(xk ) checking if any value ak is consistent with both ai and aj .
If a PC-witness is found, we proceed with the next variable that is constrained
with both xi and xj . Otherwise, the function returns false, signaling that ai is
not RPC.
Restricted Path Consistency Revisited 423
The worst-case time complexity of RPC3, and rRPC3, is O(ned3 )1 . The space
complexity is determined by the space required to store the residues, which is
O(ed). The time complexities of algorithms RPC1 and RPC2 are O(ned3 ) and
O(ned2 ) respectively, while their space complexities, for stand-alone use, are
O(ed2 ) and O(end). RPC3 has a higher time complexity than RPC2, and a lower
space complexity than both RPC1 and RPC2. But most importantly, RPC3
does not require the typically quite expensive restoration of data structures
after failures when used inside search. In addition, this means that its space
complexity remains O(ed) when used inside search, while the space complexities
of RPC1 and RPC2 will be even higher than O(ed2 ) and O(end).
4 Experiments
– The mean node visits and run times from non-trivial instances that were
solved by all algorithms within the time limit. We consider as trivial any
instance that was solved by all algorithms in less than a second.
– Node visits and run time from the single instance where AC displayed its
best performance compared to rRPC.
1
The proof is quite simple but it is omitted for space reasons.
Restricted Path Consistency Revisited 425
– Node visits and run time from the single instance where maxRPC displayed
its best performance compared to rRPC.
– Node visits and run time from a representative instance where rRPC dis-
played good performance compared to AC, excluding instances where AC
timed out.
– The number of instances where AC, RPC, maxRPC timed out while rRPC
did not. This information is given only for classes where at least one such
instance occured.
– The number of instances where AC, rRPC, RPC, or maxRPC was the win-
ning algorithm, excluding trivial instances.
Table 1. Node visits (n), run times in secs (t), number of timeouts (#TO) (if appli-
cable), and number of wins (winner) in summary. The number in brackets after the
name of each class gives the number of instances tested.
requires further investigation is that in some cases the node visits of rPRC are
fewer than RPC and and/or maxRPC despite the weaker pruning. This usually
occurs on soluble instances and suggests that the interaction with the dom/wdeg
heuristic can guide search to solutions faster.
Finally, the classes not shown in Table 1 mostly include instances that are
either very easy or very hard (i.e. all algorithms time out). Specifically, instances
in composed and hanoi are all trivial, and the ones in black hole and job shop are
either trivial or very hard. Instances in ehi typically take a few seconds for AC
and under a second for the other three algorithms. Instances in haystacks are
very hard except for a few where AC is clearly outperformed by the other three
algorithms. For example, in haystacks-04 AC takes 8 seconds and the other three
take 0.2 seconds. Instances in pigeons are either trivial or very hard except for
a few instances where rRPC is the best algorithm followed by AC. For example
on pigeons-12 AC and rRPC take 709 and 550 seconds respectively, while RPC
and maxRPC time out. Finally, driver includes only 7 instances. Among them,
3 are trivial, rRPC is the best algorithm on 3, and AC on 1.
5 Conclusion
RPC was recognized as a promising alternative to AC but has been neglected for
the past 15 years or so. In this paper we have revisited RPC by proposing RPC3,
a new algorithm that utilizes ideas, such as residues, that have become standard
in recent years when implementing AC or maxRPC algorithms. Using RPC3 and
a restricted variant we performed the first wide experimental study of RPC when
used inside search. Perhaps surprisingly, results clearly demostrate that rRPC3
is by far more efficient than state-of-the-art AC and maxRPC algorithms when
applied during search. This challenges the common perception that MAC is the
best general purpose solver for binary CSPs.
References
1. Balafoutis, T., Paparrizou, A., Stergiou, K., Walsh, T.: New algorithms for max
restricted path consistency. Constraints 16(4), 372–406 (2011)
2. Balafrej, A., Bessiere, C., Bouyakh, E., Trombettoni, G.: Adaptive singleton-based
consistencies. In: Proceedings of the Twenty-Eighth AAAI Conference on Artificial
Intelligence, pp. 2601–2607 (2014)
3. Barták, R., Erben, R.: A new algorithm for singleton arc consistency. In:
Proceedings of the Seventeenth International Florida Artificial Intelligence,
pp. 257–262 (2004)
4. Berlandier, P.: Improving domain filtering using restricted path consistency. In:
Proceedings of IEEE CAIA 1995, pp. 32–37 (1995)
5. Bessiere, C., Cardon, S., Debruyne, R., Lecoutre, C.: Efficient Algorithms for Sin-
gleton Arc Consistency. Constraints 16, 25–53 (2011)
6. Boussemart, F., Hemery, F., Lecoutre, C., Sais, L.: Boosting systematic search by
weighting constraints. In: Proceedings of ECAI 2004, Valencia, Spain (2004)
428 K. Stergiou
1 Introduction
Bayesian networks are a popular probabilistic graphical model with diverse appli-
cations including knowledge discovery, classification, prediction, and control (see,
e.g., [1]). A Bayesian network (BN) can either be constructed by a domain expert
or learned automatically from data. Our interest here is in the learning of a BN
from discrete data, a major challenge in machine learning. Learning a BN from
discrete data can be cast as a combinatorial optimization problem—the well-
known score-and-search approach—where a scoring function is used to evaluate
the quality of a proposed BN and the space of feasible solutions is systemati-
cally searched for a best-scoring BN. Unfortunately, learning a BN from data is
NP-hard, even if the number of parents per vertex in the DAG is limited to two
[2]. As well, the problem is unlikely to be efficiently approximatable with a good
quality guarantee, thus motivating the use of global (exact) search algorithms
over local (heuristic) search algorithms [3].
Global search algorithms for learning a BN from data have been studied
extensively over the past several decades and there have been proposals based on
dynamic programming [4–6], integer linear programming (ILP) [7,8], A* search
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 429–445, 2015.
DOI: 10.1007/978-3-319-23219-5 31
430 P. van Beek and H.-F. Hoffmann
2 Background
1
An alternative method, called constraint-based structure learning in the literature, is
based on statistical hypothesis tests for conditional independence. We do not discuss
it further here except to note that the method is known to scale to large instances
but to have the drawback that it is sensitive to a single failure in a hypothesis test
(see [17, p. 785]).
Machine Learning of Bayesian Networks Using Constraint Programming 431
(a) (b)
Fig. 1. (a) Random variables and possible parent sets for Example 1; (b) minimum
cost DAG structure with cost 38.9.
score of the entire network σ(G | I) can be rewritten as the sum of local scores
n
i=1 σ(vi , parents(vi ) | I) that only depend on vi and the parent set of vi in
G. Henceforth, we assume that the scoring function is decomposable and that,
following previous work, the local score σ(vi , p | I) for each possible parent set
p ⊆ 2V −{vi } and each random variable vi has been computed in a preprocessing
step prior to the search for the best network structure. Pruning techniques can
be used to reduce the number of possible parent sets that need to be considered,
but in the worst-case the number of possible parent sets for each variable vi is
2n−1 , where n is the number of vertices in the DAG.
acyclic(v1 , . . . , vn ), (1)
where the constraint is satisfied if and only if the graph designated by the parent
sets is acyclic. The DAG is not necessarily connected. A satisfiability checker for
the acyclic constraint is given in Section 3.7, which in turn can be used to
propagate the constraint.
Ordering (permutation) variables. There is an ordering variable oi for each
random variable and dom(oi ) = V , the set of random variables. The assignment
oi = j denotes that vertex vj is in position i in the total ordering of the variables.
The ordering variables represent a permutation of the random variables. A global
constraint is introduced to enforce that the order variables form a permutation
of the vertex variables,
alldifferent(o1 , . . . , on ). (2)
The alldifferent constraint is propagated by, whenever a variable becomes instan-
tiated, simply removing that value from the domains of the other variables.
Depth variables. There is a depth variable di for each random variable and
dom(di ) = {0, ..., n − 1}. The depth variables and the ordering variables are in
one-to-one correspondence. The assignment di = k denotes that the depth of the
vertex variable vj that occurs at position i in the ordering is k, where the depth
is the length of the longest path from a source vertex to vertex vj in the DAG.
where the indices i and j range over 1 ≤ i, j ≤ n and the value p ranges over
dom(vj ). The constraints are propagated as follows. A value p ∈ dom(vj ) can
be pruned iff ∀i • j ∈ dom(oi ) ⇒ depth(p | o1 , . . . , oi−1 ) ∈ dom(di ). A value
j ∈ dom(oi ) can be pruned iff ∀p ∈ dom(vj ) • depth(p | o1 , . . . , oi−1 ) ∈ dom(di ).
Only bounds are maintained on the depth variables. Hence, the notation
depth(p | o1 , . . . , oi−1 ) ∈ dom(di ) is to be interpreted as depth(p | o1 , . . . , oi−1 ) <
min(dom(di )) ∨ depth(p | o1 , . . . , oi−1 ) > max(dom(di )). When propagating
Constraints 3 & 4, we must determine depth(p | o1 , . . . , oi−1 ). In general, this
is a difficult problem. We restrict ourselves to two easy special cases: (i) all of
o1 , . . . , oi−1 have been instantiated, or (ii) some of o1 , . . . , oi−1 have been instan-
tiated and all of the p ∈ dom(vj ) are subsets of these ordering variables. We leave
to future work further ways of safely approximating the depth to allow further
propagation.
One can see that the vertex variables together with the acyclic constraint
are sufficient alone to model the Bayesian network structure learning problem.
Such a search space over DAGs forms the basis of Barlett and Cussens’ integer
programming approach [8]. One can also see that the ordering (permutation)
variables together with the alldifferent constraint are sufficient alone, as the min-
imum cost DAG for a given ordering is easily determinable. Larranaga et al. [22]
were the first to propose the search space of all permutations and Teyssier and
Koller [23] successfully applied it within a local search algorithm. The permu-
tation search space also forms the basis of the approaches based on dynamic
programming [4–6] and on the approaches based on searching for the shortest
path in an ordering graph using A* search [9–11], depth-first branch-and-bound
DFBnB search [13], and BFBnB search [10,11,15].
434 P. van Beek and H.-F. Hoffmann
The unique aspects of our model lie in combining the DAG and permutation
search spaces and introducing the depth variables. As is shown in the next sec-
tions, the combination of variables allows us to identify and post many additional
constraints that lead to a considerable reduction in the search space.
d1 = 0 (5)
di = k ⇐⇒ (di+1 = k ∨ di+1 = k + 1), i = 1, . . . , n − 1 (6)
di = di+1 =⇒ oi < oi+1 , i = 1, . . . , n − 1 (7)
variables. Let [x/y]dom(v) be the domain that results from replacing all occur-
rences of y in the parent sets by x. Two vertex variables v1 and v2 are symmetric
if [v1 /v2 ]dom(v1 ) = dom(v2 ); i.e., the domains are equal once the given substi-
tution is applied. The symmetry is broken by enforcing that v1 must precede v2
in the ordering,
∀i • ∀j • oi = 1 ∧ oj = 2 =⇒ i < j. (8)
Example 8. In Figure 1(b) the edge A → E is a covered edge and the Bayesian
network with the edge reversed to be E → A is an I-equivalent Bayesian network.
Example 12. Continuing with Example 11, consider vE with p = {D} and p =
{A}. The induced parent set ip(p ) is given by {A, D} and cost(p) ≤ cost(p ).
Thus, p can be pruned. Similarly, p = {C} can be pruned.
use memoization for ordering prefixes and only continue with a prefix if it has a
better cost than one already explored (see, e.g., [26,27]). Our implementation of
memoization uses hashing with quadratic probing and the replacement policy is
to keep the most recent if the table becomes too full. It is well known that there
is a strong relationship between backtracking search with memoization/caching
and dynamic programming using a bottom-up approach, but memoization allows
trading space for time and top-down backtracking search allows pruning the
search space.
In this section we describe a propagator for the acyclicity constraint that achieves
generalized arc consistency in polynomial time. We first present and analyze an
algorithm that checks satisfiability for given possible parent sets. We then explain
how this algorithm can be used to achieve generalized arc consistency.
Algorithm 1 can check whether a collection of possible parent sets allows a
feasible parent set assignment, i.e. an assignment that represents a DAG. Its
correctness is based on the following well-known property of directed acyclic
graphs that is also used in the ILP approaches [7,8].
Theorem 7. Let G be a directed graph over vertices V and let parents(v) be the
parents of vertex v in the graph. G is acyclic if and only if for every non-empty
subset S ⊂ V there is at least one vertex v ∈ S with parents(v) ∩ S = {}.
The algorithm works as follows. First, it searches possible sources for the
DAG, i.e. vertices for which {} is a possible parent set. These vertices are stored
in W 0 . Note that if a directed graph does not have a source, it must contain a
cycle by Theorem 7. Thus, if W 0 remains empty, there is no parent set assignment
satisfying the acyclicity constraint. In the next iteration, the algorithm searches
for vertices that have a possible parent set consisting of possible sources only.
These vertices form set W 1 . Again, if there are no such vertices, then no vertex
in V \ W 0 has a possible parent set completely outside V \ W 0 , which violates
the acyclicity characterization of Theorem 7. Thus, there is no consistent parent
set assignment. We continue this process until all vertices
k are included in one of
the W k sets or until we find a contradicting set V \ ( i=0 W i ) for some k.
Theorem 8. We can test satisfiability of the acyclic constraint in time O(n2 d),
where n is the number of vertices and d is an upper bound on the number of
possible parent sets per vertex.
Example 14. Let vA , vB , vC , and vD be vertex variables with the possible parent
sets,
dom(vA ) = {{B}, {D}}, dom(vC ) = {{B}, {D}},
dom(vB ) = {{A}, {C}}, dom(vD ) = {{A}, {C}}.
Algorithm 1 returns false as W 0 is found to be empty.
Machine Learning of Bayesian Networks Using Constraint Programming 439
be introduced. Thus, any parent set that contains vj can be removed from the
domain of vi . Removing domain elements may introduce additional necessary
edges and pruning can be based on chaining necessary edges.
Example 15. Let vA , vB , vC , and vD be vertex variables with the possible parent
sets,
dom(vA ) = {{}, {B}, {C}} dom(vC ) = {{B}}
dom(vB ) = {{A}, {A, C}} dom(vD ) = {{A}, {A, C}}
Since the edge B → C is necessary, the value {A, C} can be pruned from the
domain of vB . This causes the edge A → B to become necessary, and the values
{B} and {C} can be pruned from the domain of vA .
We conclude with the following observation. Let iv be the index of the set W i
in which we include vertex v in the satisfiability algorithm. Then, iv is a lower
bound on the number that vertex v can have in any topological numbering. This
lower bound can be used in propagating Constraint 4.
or if cost(p) + j=i lj ≥ ub. Note that the expression cost(p) + j=i lj can
be replaced with any lower bound on the cost of a solution that includes p and
respects the current domains and instantiations, as long as the lower bound never
over estimates. Fortunately, we have a fast and effective method of querying such
lower bounds and we use it when performing this pruning.
4 Experimental Evaluation
Table 2. For each benchmark, time (seconds) to determine minimal cost BN using
various systems (see text), where n is the number of random variables in the data set,
N is the number of instances in the data set, and d is the total number of possible
parents sets for the random variables. Resource limits of 24 hours of CPU time and 16
GB of memory were imposed: OM = out of memory; OT = out of time. A blank entry
indicates that the preprocessing step of obtaining the local scores for each random
variable could not be completed within the resource limits.
BDeu BIC
GOBN. A* CPBayes GOBN. A* CPBayes
Benchmark n N d v1.4.1 v2015 v1.0 d v1.4.1 v2015 v1.0
shuttle 10 58,000 812 58.5 0.0 0.0 264 2.8 0.1 0.0
adult 15 32,561 768 1.4 0.1 0.0 547 0.7 0.1 0.0
letter 17 20,000 18,841 5,060.8 1.3 1.4 4,443 72.5 0.6 0.2
voting 17 435 1,940 16.8 0.3 0.1 1,848 11.6 0.4 0.1
zoo 17 101 2,855 177.7 0.5 0.2 554 0.9 0.4 0.1
tumour 18 339 274 1.5 0.9 0.2 219 0.4 0.9 0.2
lympho 19 148 345 1.7 2.1 0.5 143 0.5 1.0 0.2
vehicle 19 846 3,121 90.4 2.4 0.7 763 4.4 2.1 0.5
hepatitis 20 155 501 2.1 4.9 1.1 266 1.7 4.8 1.0
segment 20 2,310 6,491 2,486.5 3.3 1.3 1,053 13.2 2.4 0.5
mushroom 23 8,124 438,185 OT 255.5 561.8 13,025 82,736.2 34.4 7.7
autos 26 159 25,238 OT 918.3 464.2 2,391 108.0 316.3 50.8
insurance 27 1,000 792 2.8 583.9 107.0 506 2.1 824.3 103.7
horse colic 28 300 490 2.7 15.0 3.4 490 3.2 6.8 1.2
steel 28 1,941 113,118 OT 902.9 21,547.0 93,026 OT 550.8 4,447.6
flag 29 194 1,324 28.0 49.4 39.9 741 7.7 12.1 2.6
wdbc 31 569 13,473 2,055.6 OM 11,031.6 14,613 1,773.7 1,330.8 1,460.5
water 32 1,000 159 0.3 1.6 0.6
mildew 35 1,000 166 0.3 7.6 1.5 126 0.2 3.6 0.6
soybean 36 266 5,926 789.5 1,114.1 147.8
alarm 37 1,000 672 1.8 43.2 8.4
bands 39 277 892 15.2 4.5 2.0
spectf 45 267 610 8.4 401.7 11.2
sponge 45 76 618 4.1 793.5 13.2
barley 48 1,000 244 0.4 1.5 3.4
hailfinder 56 100 167 0.1 9.9 1.5
hailfinder 56 500 418 0.5 OM 9.3
lung cancer 57 32 292 2.0 OM 10.5
carpo 60 100 423 1.6 OM 253.6
carpo 60 500 847 6.9 OM OT
but they are solving a different problem, severely restricting the cardinality of
the parent sets to ≤ 2).
Benchmarks from the small class are easy for the CPBayes and A* methods,
but can be somewhat challenging for GOBNILP depending on the value of the
parameter d, the total number of parent sets for the random variables. Along
with the integer linear programming (ILP) solver GOBNILP, CPBayes scales
fairly robustly to medium instances using a reasonable restriction on memory
usage (both use only a few GB of memory, far under the 16 GB limit used
in the experiments; in fairness, the scalability of the A* approach on a very
large memory machine is still somewhat of an open question). CPBayes also has
several other advantages, which it shares with the ILP approach, over A*, DP,
and BFBnB approaches. Firstly, the constraint model is a purely declarative
representation and the same model can be given to an exact solver or a solver
based on local search, such as large neighborhood search. Secondly, the constraint
model can be augmented with side structural constraints that can be important
in real-world modeling (see [28]). Finally, the solver is an anytime algorithm
since, as time progresses, the solver progressively finds better solutions.
Let us now turn to a comparison between GOBNILP and CPBayes. CPBayes
scales better than GOBNILP along the dimension d which measures the size of
the possible parent sets. A partial reason is that GOBNILP uses a constraint
model that includes a (0,1)-variable for each possible parent set. GOBNILP
scales better than CPBayes along the dimension n which measures the number
of random variables. CPBayes has difficulty at the topmost range of n proving
optimality. There is some evidence that n = 60 is near the top of the range for
GOBNILP as well. Results reported by Barlett and Cussens [8] for the carpo
benchmark using larger values of N and the BDeu scoring method—the scoring
method which usually leads to harder optimization instances than BIC/MDL—
showed that instances could only be solved by severely restricting the cardinality
of the parent sets. A clear difficulty in scaling up all of these score-and-search
methods is in obtaining the local scores within reasonable resource limits.
In future work on Bayesian network structure learning, we intend to focus on
improving the robustness and scalability of our CPBayes approach. A direction
that appears especially promising is to improve the branch-and-bound search by
exploiting decomposition and lower bound caching during the search [29,30]. As
well, our approach, as with all current exact approaches, assumes complete data.
An important next step is to extend our approach to handle missing values and
latent variables (cf. [31]).
References
1. Witten, I.H., Frank, E., Hall, M.A.: Data Mining, 3rd edn. Morgan Kaufmann
(2011)
2. Chickering, D., Meek, C., Heckerman, D.: Large-sample learning of Bayesian net-
works is NP-hard. In: Proc. of UAI, pp. 124–133 (2003)
3. Koivisto, M.: Parent assignment is hard for the MDL, AIC, and NML costs. In:
Lugosi, G., Simon, H.U. (eds.) COLT 2006. LNCS (LNAI), vol. 4005, pp. 289–303.
Springer, Heidelberg (2006)
4. Koivisto, M., Sood, K.: Exact Bayesian structure discovery in Bayesian networks.
J. Mach. Learn. Res. 5, 549–573 (2004)
5. Silander, T., Myllymäki, P.: A simple approach for finding the globally optimal
Bayesian network structure. In: Proc. of UAI, pp. 445–452 (2006)
6. Malone, B., Yuan, C., Hansen, E.A.: Memory-efficient dynamic programming for
learning optimal Bayesian networks. In: Proc. of AAAI, pp. 1057–1062 (2011)
7. Jaakkola, T., Sontag, D., Globerson, A., Meila, M.: Learning Bayesian network
structure using LP relaxations. In: Proc. of AISTATS, pp. 358–365 (2010)
8. Barlett, M., Cussens, J.: Advances in Bayesian network learning using integer pro-
gramming. In: Proc. of UAI, pp. 182–191 (2013)
9. Yuan, C., Malone, B.: Learning optimal Bayesian networks: A shortest path per-
spective. J. of Artificial Intelligence Research 48, 23–65 (2013)
10. Fan, X., Malone, B., Yuan, C.: Finding optimal Bayesian network structures with
constraints learned from data. In: Proc. of UAI, pp. 200–209 (2014)
11. Fan, X., Yuan, C.: An improved lower bound for Bayesian network structure learn-
ing. In: Proc. of AAAI (2015)
12. Tian, J.: A branch-and-bound algorithm for MDL learning Bayesian networks. In:
Proc. of UAI, pp. 580–588 (2000)
13. Malone, B., Yuan, C.: A depth-first branch and bound algorithm for learning opti-
mal bayesian networks. In: Croitoru, M., Rudolph, S., Woltran, S., Gonzales, C.
(eds.) GKR 2013. LNCS, vol. 8323, pp. 111–122. Springer, Heidelberg (2014)
14. de Campos, C.P., Ji, Q.: Efficient structure learning of Bayesian networks using
constraints. Journal of Machine Learning Research 12, 663–689 (2011)
15. Fan, X., Yuan, C., Malone, B.: Tightening bounds for Bayesian network structure
learning. In: Proc. of AAAI, pp. 2439–2445 (2014)
16. Darwiche, A.: Modeling and Reasoning with Bayesian Networks. Cambridge Uni-
versity Press (2009)
17. Koller, D., Friedman, N.: Probabilistic Graphical Models: Principles and Tech-
niques. The MIT Press (2009)
18. Schwarz, G.: Estimating the dimension of a model. Ann. Stat. 6, 461–464 (1978)
19. Lam, W., Bacchus, F.: Using new data to refine a Bayesian network. In: Proc. of
UAI, pp. 383–390 (1994)
20. Buntine, W.L.: Theory refinement of Bayesian networks. In: Proc. of UAI,
pp. 52–60 (1991)
21. Heckerman, D., Geiger, D., Chickering, D.M.: Learning Bayesian networks: The
combination of knowledge and statistical data. Machine Learning 20, 197–243
(1995)
22. Larranaga, P., Kuijpers, C., Murga, R., Yurramendi, Y.: Learning Bayesian net-
work structures by searching for the best ordering with genetic algorithms. IEEE
Trans. Syst., Man, Cybern. 26, 487–493 (1996)
Machine Learning of Bayesian Networks Using Constraint Programming 445
23. Teyssier, M., Koller, D.: Ordering-based search: a simple and effective algorithm
for learning Bayesian networks. In: Proc. of UAI, pp. 548–549 (2005)
24. Chickering, D.M.: A transformational characterization of equivalent Bayesian net-
work structures. In: Proc. of UAI, pp. 87–98 (1995)
25. Chickering, D.M.: Learning equivalence classes of Bayesian network structures.
Journal of Machine Learning Research 2, 445–498 (2002)
26. Michie, D.: “memo” functions and machine learning. Nature 218, 19–22 (1968)
27. Smith, B.M.: Caching search states in permutation problems. In: van Beek, P. (ed.)
CP 2005. LNCS, vol. 3709, pp. 637–651. Springer, Heidelberg (2005)
28. Cussens, J.: Integer programming for Bayesian network structure learning. Quality
Technology & Quantitative Management 1, 99–110 (2014)
29. Kitching, M., Bacchus, F.: Symmetric component caching. In: Proc. of IJCAI,
pp. 118–124 (2007)
30. Kitching, M., Bacchus, F.: Exploiting decomposition in constraint optimization
problems. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 478–492. Springer,
Heidelberg (2008)
31. Friedman, N.: Learning belief networks in the presence of missing values and hidden
variables. In: Proc. of ICML, pp. 125–133 (1997)
Hybridization of Interval CP and Evolutionary
Algorithms for Optimizing Difficult Problems
1 Motivation
We consider n-dimensional continuous constrained optimization problems over
a hyperrectangular domain D = D1 × . . . × Dn :
When f , gi and hj are non-convex, the problem may have multiple local
minima. Such difficult problems are generally solved using generic exhaustive
branch and bound (BB) methods. The objective function and the constraints are
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 446–462, 2015.
DOI: 10.1007/978-3-319-23219-5 32
Hybridization of Interval CP and Evolutionary Algorithms 447
2 Differential Evolution
Differential evolution (DE) [29] is among the simplest and most efficient meta-
heuristics for continuous problems. It combines the coordinates of existing
individuals (candidate solutions) with a given probability to generate new
individuals. Initially devised for continuous unconstrained problems, DE was
extended to mixed problems and constrained problems [23].
Let NP denote the size of the population, W > 0 the amplitude factor and
CR ∈ [0, 1] the crossover rate. At each generation (iteration), NP new individ-
uals are generated: for each individual x = (x1 , . . . , xn ), three other individuals
448 C. Vanaret et al.
3 Reliable Computations
Reliable (or rigorous) methods provide bounds on the global minimum, even
in the presence of roundoff errors. The only reliable approaches for achieving a
numerical proof of optimality in global optimization are interval-based methods
that interleave branching of the search-space and pruning of the subdomains
that cannot contain an optimal solution.
Section 3.1 introduces interval arithmetic, an extension of real arithmetic.
Reliable global optimization is detailed in Section 3.2, and interval contractors
are mentioned in Section 3.3.
Hybridization of Interval CP and Evolutionary Algorithms 449
– FN (X) = X 2 − X = [−2, 0.5]2 − [−2, 0.5] = [0, 4] − [−2, 0.5] = [−0.5, 6];
– FT (X, c) = 2 + (2X − 1)(X + 1) = 2 + [−5, 0][−1, 1.5] = [−5.5, 7].
1. whenever the DE improves its best evaluation, the best individual and its
evaluation are sent to the IBC to update the best known upper bound f˜;
2. whenever the IBC finds a better punctual solution (e.g. the center of a box),
it is injected into DE’s population;
3. the exploration strategy MaxDist periodically reduces the search-space of
DE, then regenerates the population in the new search-space.
Sections 4.2 and 4.3 detail the particular implementations of the DE (Algo-
rithm 1) and the IBC (Algorithm 2) within Charibde.
452 C. Vanaret et al.
Base Individual. In the standard DE strategy, all the current individuals have
the same probability to be selected as the base individual u. We opted for an
alternative strategy [23] that guarantees that all individuals of the population
play this role once and only once at each generation: the index of the base
individual is obtained by summing the index of the individual x and an offset
in {1, . . . , NP − 1}, drawn with uniform probability.
– x and y are feasible and y has a lower or equal objective value than x;
– y is feasible and x is not;
– x and y are infeasible, and y does not violate any constraint more than x.
– explore the neighborhood of the global minimizer (a tedious task when the
objective function is flat in this neighborhood) only when the best possible
upper bound is available;
– explore regions of the search-space that are hardly accessible by the DE
algorithm.
The distance between a point x and a box X is the sum of the distances between
each coordinate xi and the closest bound of Xi . Note that MaxDist is an adap-
tive heuristic: whenever the best known solution x̃ is updated, Q is reordered
according to the new priorities of the boxes.
Preliminary results (not presented here) suggest that MaxDist is competi-
tive with standard strategies. However, the most interesting observation lies in
the behavior of Q: when using MaxDist, the maximum size of Q (the maxi-
mum number of boxes simultaneously stored in Q) remains remarkably low (a
few dozens compared to several thousands for standard strategies). This offers
promising perspectives for the cooperation between DE and IBC: the remaining
456 C. Vanaret et al.
boxes of the IBC may be exploited in the DE to avoid exploring regions of the
search-space that have already been proven infeasible or suboptimal.
The following numerical example illustrates how the remaining boxes are
exploited to reduce DE’s domain through the generations. Let
(x + y − 10)2 (x − y + 10)2
min − −
(x,y)∈(X,Y ) 30 120
20 (7)
s.t. −y ≤0
x2
x2 + 8y − 75 ≤ 0
5 Experimental Results
Currently, GlobSol [15], IBBA [22] and Ibex [8] are among the most efficient
solvers in rigorous constrained optimization. They share a common skeleton of
interval branch and bound algorithm, but differ in the acceleration techniques.
GlobSol uses the reformulation-linearization technique (RLT), that introduces
new auxiliary variables for each intermediary operation. IBBA calls a contractor
similar to HC4Revise, and computes a relaxation of the system of constraints
Hybridization of Interval CP and Evolutionary Algorithms 457
10.0
7.5
5.0
y
2.5
0.0
using affine arithmetic. Ibex is dedicated to both numerical CSPs and con-
strained optimization; it embeds most of the aforementioned contractors (HC4,
3B, Mohc, CID, X-Newton). Couenne [5] and BARON [25] are state-of-the-art
NLP solvers. They are based on a non-rigorous spatial branch and bound algo-
rithm, in which the objective function and the constraints are over- and underes-
timated by convex relaxations. Although they perform an exhaustive exploration
of the search-space, they cannot guarantee a given precision on the value of the
optimum.
All five solvers and Charibde are compared on a subset of 11 COCONUT con-
strained problems (Table 1), extracted by Araya [3] for their difficulty: ex2 1 7,
ex2 1 9, ex6 2 6, ex6 2 8, ex6 2 9, ex6 2 11, ex6 2 12, ex7 2 3, ex7 3 5, ex14 1 7
and ex14 2 7. Because of numerical instabilities of the ocaml-glpk LP library
458 C. Vanaret et al.
(“assert failure”), the results of the problems ex6 1 1, ex6 1 3 and ex 6 2 10 are
not presented. The second and third columns give respectively the number of
variables n and the number of constraints m. The fourth (resp. fifth) column
specifies the type of the objective function (resp. the constraints): L is linear, Q
n and NL is nonlinear. The logsize of the domain D (sixth column)
is quadratic
is log( i=1 (Di − Di )).
The comparison of CPU times (in seconds) for solvers GlobSol, IBBA, Ibex,
Couenne, BARON and Charibde on the benchmark of 11 problems is detailed in
Table 2. Mean times and standard deviations (in brackets) are given for Charibde
over 100 runs. The numerical precision on the objective function ε = 10−8 and
the tolerance for equality constaints ε= = 10−8 were identical for all solvers.
TO (timeout) indicates that a solver could not solve a problem within one hour.
The results of GlobSol (proprietary piece of software) were not available for
all problems; only those mentioned in [22] are presented. The results of IBBA
were also taken from [22]. The results of Ibex were taken from [3]: only the
best strategy (simplex, X-NewIter or X-Newton) for each benchmark problem
is presented. Couenne and BARON (only the commercial version of the code is
available) were run on the NEOS server [13].
Table 2. Comparison of convergence times (in seconds) between GlobSol, IBBA, Ibex,
Charibde (mean and standard deviation over 100 runs), Couenne and BARON on
difficult constrained problems
Rigorous Non rigorous
Problem GlobSol IBBA Ibex Charibde Couenne BARON
ex2 1 7 16.7 7.74 34.9 (13.3) 476 16.23
ex2 1 9 154 9.07 35.9 (0.29) 3.01 3.58
ex6 2 6 306 1575 136 3.3 (0.41) TO 5.7
ex6 2 8 204 458 59.3 2.9 (0.37) TO TO
ex6 2 9 463 523 25.2 2.7 (0.03) TO TO
ex6 2 11 273 140 7.51 1.96 (0.06) TO TO
ex6 2 12 196 112 22.2 8.8 (0.17) TO TO
ex7 2 3 TO 544 1.9 (0.30) TO TO
ex7 3 5 TO 28.91 4.5 (0.09) TO 4.95
ex14 1 7 TO 406 4.2 (0.13) 13.86 0.56
ex14 2 7 TO 66.39 0.2 (0.04) 0.01 0.02
Sum > 1442 TO 1312.32 101.26 TO TO
the crossover rate CR is related to the separability of the problem, and the
techniques based on linear relaxation have little influence for problems with few
constraints, but are cheap when the constraints are linear.
6 Conclusion
References
1. Alliot, J.M., Durand, N., Gianazza, D., Gotteland, J.B.: Finding and proving
the optimum: cooperative stochastic and deterministic search. In: 20th European
Conference on Artificial Intelligence (ECAI 2012), Montpellier, France, August
27–31, 2012 (2012)
2. Araya, I., Trombettoni, G., Neveu, B.: Exploiting monotonicity in interval con-
straint propagation. In: Proc. AAAI, pp. 9–14 (2010)
3. Araya, I., Trombettoni, G., Neveu, B.: A contractor based on convex interval taylor.
In: Beldiceanu, N., Jussien, N., Pinson, É. (eds.) CPAIOR 2012. LNCS, vol. 7298,
pp. 1–16. Springer, Heidelberg (2012)
4. Araya, I., Trombettoni, G., Neveu, B., Chabert, G.: Upper bounding in inner
regions for global optimization under inequality constraints. Journal of Global
Optimization 60(2), 145–164 (2014)
5. Belotti, P., Lee, J., Liberti, L., Margot, F., Wächter, A.: Branching and bounds
tighteningtechniques for non-convex minlp. Optimization Methods & Software
24(4–5), 597–634 (2009)
6. Benhamou, F., Goualard, F., Granvilliers, L., Puget, J.F.: Revising hull and box
consistency. In: International Conference on Logic Programming, pp. 230–244. MIT
press (1999)
7. Blum, C., Puchinger, J., Raidl, G.R., Roli, A.: Hybrid metaheuristics in combina-
torial optimization: A survey. Applied Soft Computing 11(6), 4135–4151 (2011)
8. Chabert, G., Jaulin, L.: Contractor programming. Artificial Intelligence 173,
1079–1100 (2009)
9. Cotta, C., Troya, J.M.: Embedding branch and bound within evolutionary algo-
rithms. Applied Intelligence 18(2), 137–153 (2003)
10. Csendes, T., Ratz, D.: Subdivision direction selection in interval methods for global
optimization. SIAM Journal on Numerical Analysis 34(3), 922–938 (1997)
11. Focacci, F., Laburthe, F., Lodi, A.: Local search and constraint programming. In:
Handbook of metaheuristics, pp. 369–403. Springer (2003)
12. Gallardo, J.E., Cotta, C., Fernández, A.J.: On the hybridization of memetic algo-
rithms with branch-and-bound techniques. IEEE Transactions on Systems, Man,
and Cybernetics, Part B: Cybernetics 37(1), 77–83 (2007)
13. Gropp, W., Moré, J.: Optimization environments and the NEOS server. Approxi-
mation theory and optimization, 167–182 (1997)
14. Hansen, E.: Global optimization using interval analysis. Dekker (1992)
15. Kearfott, R.B.: Rigorous global search: continuous problems. Springer (1996)
16. Leroy, X., Doligez, D., Frisch, A., Garrigue, J., Rémy, D., Vouillon, J.: The objective
caml system release 3.12. Documentation and userâĂŹs manual. INRIA (2010)
17. Lhomme, O.: Consistency techniques for numeric csps. In: IJCAI, vol. 93,
pp. 232–238. Citeseer (1993)
18. Mimram, S.: ocaml-glpk (2004). http://ocaml-glpk.sourceforge.net/
19. Moore, R.E.: Interval Analysis. Prentice-Hall (1966)
462 C. Vanaret et al.
20. Moore, R.E.: On computing the range of a rational function of n variables over a
bounded region. Computing 16(1), 1–15 (1976)
21. Neumaier, A., Shcherbina, O.: Safe bounds in linear and mixed-integer linear pro-
gramming. Mathematical Programming 99(2), 283–296 (2004)
22. Ninin, J., Hansen, P., Messine, F.: A reliable affine relaxation method for global
optimization. Groupe d’études et de recherche en analyse des décisions (2010)
23. Price, K., Storn, R., Lampinen, J.: Differential Evolution - A Practical Approach
to Global Optimization. Natural Computing, Springer-Verlag (2006)
24. Puchinger, J., Raidl, G.R.: Combining metaheuristics and exact algorithms in com-
binatorial optimization: a survey and classification. In: Mira, J., Álvarez, J.R. (eds.)
IWINAC 2005. LNCS, vol. 3562, pp. 41–53. Springer, Heidelberg (2005)
25. Sahinidis, N.V.: Baron: A general purpose global optimization software package.
Journal of Global Optimization 8(2), 201–205 (1996)
26. Schichl, H., Neumaier, A.: Interval analysis on directed acyclic graphs for global
optimization. Journal of Global Optimization 33(4), 541–562 (2005)
27. Skelboe, S.: Computation of rational interval functions. BIT Numerical Mathemat-
ics 14(1), 87–95 (1974)
28. Sotiropoulos, D., Stavropoulos, E., Vrahatis, M.: A new hybrid genetic algo-
rithm for global optimization. Nonlinear Analysis: Theory, Methods & Applications
30(7), 4529–4538 (1997)
29. Storn, R., Price, K.: Differential evolution - a simple and efficient heuristic
for global optimization over continuous spaces. Journal of Global Optimization,
341–359 (1997)
30. Trombettoni, G., Araya, I., Neveu, B., Chabert, G.: Inner regions and interval
linearizations for global optimization. In: AAAI (2011)
31. Trombettoni, G., Chabert, G.: Constructive interval disjunction. In: Bessière, C.
(ed.) CP 2007. LNCS, vol. 4741, pp. 635–650. Springer, Heidelberg (2007)
32. Van Hentenryck, P.: Numerica: a modeling language for global optimization. MIT
press (1997)
33. Vanaret, C., Gotteland, J.-B., Durand, N., Alliot, J.-M.: Preventing premature con-
vergence and proving the optimality in evolutionary algorithms. In: Legrand, P.,
Corsini, M.-M., Hao, J.-K., Monmarché, N., Lutton, E., Schoenauer, M. (eds.) EA
2013. LNCS, vol. 8752, pp. 29–40. Springer, Heidelberg (2014)
34. Zhang, X., Liu, S.: A new interval-genetic algorithm. In: Third International
Conference on Natural Computation, ICNC 2007, vol. 4, pp. 193–197. IEEE (2007)
A General Framework for Reordering Agents
Asynchronously in Distributed CSP
1 Introduction
2 Background
2.1 Distributed Constraint Satisfaction Problem
The Distributed Constraint Satisfaction Problem (DisCSP) is a 5-tuple
(A, X , D, C, ϕ), where A is a set of agents {A1 , . . . , Ap }, X is a set of variables
{x1 , . . . , xn }, D = {D1 , . . . , Dn } is a set of domains, where Di is the initial set
of possible values which may be assigned to variable xi , C is a set of constraints,
and ϕ : X → A is a function specifying an agent to control each variable. During
a solution process, only the agent which controls a variable can assign it a value.
A constraint C(X) ∈ C, on the ordered subset of variables X = (xj1 , . . . , xjk ),
is C(X) ⊆ Dj1 × · · · × Djk , and specifies the tuples of values which may be
assigned simultaneously to the variables in X. For this paper, we restrict atten-
tion to binary constraints. We denote by Ci ⊆ C all constraints that involve xi . A
A General Framework for Reordering Agents 465
is denoted by d0i while its current domain size is denoted by di . Let Σi be the
conjunction of the left hand sides of all no-goods ruling out values from Di . We
explain the current domain size of Di by the following expression ei : Σi → di ,
called explanation of xi (ei ). Every explanation ei induces safety conditions:
{∀xm ∈ Σi , xm ≺ xi }. When all values of a variable xi are ruled out by some no-
goods (Σi → 0), these no-goods are resolved, producing a new no-good from Σi .
There are clearly many different ways of representing Σi as a directed no-good
(an implication). In standard backtracking search algorithms (like ABT), the
variable, say xt , that has the lowest priority in the current order (among variables
in Σi ) must change its value. xt is called the backtracking target and the directed
no-good is ngt : Σi \ xt → xt = vt . In AgileABT the backtracking target is not
necessarily the variable with the lowest priority within the conflicting variables
in the current order.
Each agent needs to compute the size of the domain of other variables to
build its termination value. Hence, each agent Ai stores a set Ei of explanations
sent by other agents. During search, Ai updates Ei to store new received expla-
nations and to remove those that are no more relevant to the search state or
not compatible with its current order λi . If ek ∈ Ei , Ai uses this explanation
A General Framework for Reordering Agents 467
∀i ∈ 1..4
A2 x2 Di = {1, 2, 3, 4}
.=
.=
.≥
A3 x3 .< x4 A4
x1 = x3 , c15 : x1 = |x5 −2|, c25 : x2 = x5 , c34 : x3 < x4 , and c45 : x4 ≥ x5 . All agents
start with the same initial ordering λi = [1, 2, 3, 4, 5] associated with the termi-
nation value τi = [4, 4, 4, 4, 4] and values are chosen lexicographically. Consider
the situation in A5 after receiving ok? messages from other agents (fig. 1b).
On receipt, explanations e1 , e2 , e3 , and e4 are stored in E5 , and assignments
x1 = 1, x2 = 2, x3 = 2, and x4 = 3 are stored in A5 agent-view. After checking
its constraints (c15 , c25 , and c45 ), A5 detects a dead-end (D5 = ∅) where Σ5 :
{x1 = 1 ∧ x2 = 2 ∧ x4 = 3}. A5 iterates through all variables xt ∈ Σ5 , considering
xt as the target of the backtracking. Figure 1c shows the updates on the expla-
nations stored in A5 (E5 ) when it considers x1 as the target of the backtracking
(i.e., xt = x1 ). A5 updates E5 to remove all explanations containing x1 (i.e., e2
and e3 ) and considering the new generated no-good ng1 in the explanation of
x1 , i.e., e1 (fig. 1c, left). Finally, A5 computes a new order (λ5 ) and its associ-
ated termination value (τ5 ) from the updated explanations E5 . λ5 is obtained
by performing a topological sort on the directed acyclic graph formed by safety
conditions induced by the updated explanations E5 (fig. 1c, right). Figure 1d
presents the computed orderings and their associated termination values (by
topological sort) when considering each xt ∈ Σ5 as backtracking target. The
strongest computed order (e.g, λ5 = [3, 4, 2, 5, 1], τ5 = [4, 2, 4, 2, 3]) is that com-
puted when considering x1 as backtracking target. Since λ5 is stronger than λ5 ,
A5 changes its current order to λ5 and proposes this ordering to all other agents
A General Framework for Reordering Agents 469
through order messages (i.e., order :
λ5 , τ5 ). Then, A5 sends the no-good ng1
to agent x1 .
It has been proved that AgileABT is sound, complete and terminates [1,25].
The termination proofs of AgileABT are based on the fact that the termina-
tion value is a tuple of positive integers (representing the expected sizes of the
domains of other agents) and, as search progresses, these tuples can only decrease
lexicographically. Thus, any change to the form of the termination values (i.e.
implemented heuristic) may directly affect the termination of AgileABT.
3 Generalized AgileABT
In AgileABT, the termination value can be seen as an implementation of the dom
dynamic variable ordering heuristic. In this section, we generalize AgileABT
to get a new framework AgileABT(α), in which α represents any measure
used to implement a DVO. The original AgileABT [1] is then equivalent to
AgileABT(dom).
Due to space constraints, we only present in Algorithm 2 the pseudo-code of
AgileABT(α) related to the cases where an agent (Ai ) may change its current
order λi (i.e., calling procedure changeOrder) where ≺tv is an ordering on the
tv
termination values and = represents the equality. Ai can change its current
order λi and its associated termination value τi (procedure changeOrder, line 6)
in two cases. The first case is when Ai receives a stronger order λj associated
with the termination value τj from another agent Aj (processOrder, line 1 The
second case occurs when Ai itself proposes a new order (λi ) associated with a
termination value τi that is preferred (w.r.t. ≺tv ) to the termination value τi
associated to its current order λi (procedure proposeOrder, line 3 and 4).
The soundness, completeness and polynomial space complexity2
of AgileABT(α) are directly inherited from original AgileABT, i.e.,
2
If the computation of the measure α also has polynomial space complexity.
470 M. Wahbi et al.
procedure computeWeight()
5. wdeg ← 1;
6. foreach ( C(X) ∈ Ci | nbU nassigned(X) > 1 ) do wdeg ← wdeg + weight[C];
7. wdeg(i) ← min(wdeg, W ) ;
is the number of neighbors of Ak that appear before k in λi and the outgoing
degree f deg(k) in λi is the number of neighbors of Ak that appear after k in λi .
and the weighted degrees received from other agents, wdeg(k). In order to
compute the weighted degree, wdeg, (Algorithm 3) each agent Ai maintains a
counter weight[C] for each constraint C(X) in Ci . Whenever a domain (Dj where
xj ∈ X) is wiped-out while propagating C(X) (line 3, Algorithm 3), weight[C] is
incremented. Before assigning its variable and sending an ok? message to lower
priority agents, Ai computes its weighted degree, wdeg(i), by summing up (line
6, Algorithm 3) the weights of all constraints in Ci having at least two unassigned
variables ([14]). However, to guarantee that AgileABT(dom/wdeg) terminates
we only update wdeg(i) if the new computed weighted degree (wdeg) does not
exceed a limit W on which all agents agree beforehand (line 7, Algorithm 3). In
AgileABT(dom/wdeg), whenever Ai sends an ok? message it attaches to this
message the largest weighted degree computed so far wdeg(i).
4 Empirical Analysis
In this section we experimentally compare AgileABT(α)3 using different DVO
heuristics to three other algorithms: ABT, ABT DO with nogood-triggered
heuristic (ABT DO-ng) [29] and ABT DO with min-domain retroactive heuris-
tic (ABT DO Retro(mindom)) [31]. All experiments were performed on the
DisChoco 2.0 platform [26],4 in which agents are simulated by Java threads
that communicate only through message passing.
3
For AgileABT(dom/wdeg), we fixed W = 1, 000. But, varying W made negligible
difference to the results.
4
http://dischoco.sourceforge.net/
A General Framework for Reordering Agents 473
AgileABT(dom)
1e+4
2.0 ⋅10
5 AgileABT(dom/deg)
AgileABT(dom/pdeg) 0.65
AgileABT(dom/fdeg)
1.0 ⋅10 5
AgileABT(dom/wdeg)
ratio of forbidden value pairs to all possible pairs. We solved instances of two
classes of random DisCSPs: sparse problems
20, 10, 0.2, p2 and dense problems
20, 10, 0.7, p2 . We varied the tightness from 0.1 to 0.9 by steps of 0.05. For each
pair of fixed density and tightness (p1 , p2 ), we generated 20 instances, solved 5
times each. We report average over the 100 execution.
Figures 2 and 3 show the results on sparse respectively dense uniform binary
random DisCSPs. In sparse problems (Figure 2), AgileABT(α) outperforms all
other algorithms on both #msg and #ncccs. ABT with AC-2001 is signifi-
cantly the slowest algorithm but it requires fewer messages than ABT DO-
ng. Regarding the speedup, AgileABT(α) shows almost an order of magni-
tude improvement compared to ABT and they all improve on ABT DO-ng and
ABT DO Retro(mindom). Comparing AgileABT(α) algorithms, neighborhood
based heuristics (i.e., deg, pdeg and f deg) show an almost two-fold improvement
over dom and wdeg on #ncccs. This improvement is even more significant on
#msg. wdeg requires fewer messages than dom. In dense problems (Figure 3),
neighborhood based heuristics outperform all other algorithms both on #msg
and #ncccs. ABT requires almost half the #msg of ABT DO Retro(mindom),
A General Framework for Reordering Agents 475
4.4 Discussion
5 Related Work
Bliek ([5]) proposed Generalized Partial Order Dynamic Backtracking
(GPODB), an algorithm that generalizes both Partial Order Dynamic Back-
tracking (PODB) [9] and Dynamic Backtracking (DBT) [8]. This generaliza-
tion was obtained by relaxing the safety conditions of PODB which results in
additional flexibility. AgileABT has some similarities with PODB and GPODB
because AgileABT also maintains a set of safety conditions. However, both
PODB and GPODB are subject to the same restriction: when a dead end occurs,
the backtracking target of the generated no-good must be selected such that the
safety conditions induced by the new no-good satisfy all existing safety condi-
tions. By contrast, AgileABT overcomes this restriction by allowing the violation
of existing safety conditions by relaxing some explanations.
Silaghi et al. proposed Asynchronous Backtracking with Reordering (ABTR)
[21–23]. In ABTR, a reordering heuristic identical to the centralized dynamic
backtracking [8] was applied to ABT. The authors in [29] proposed Dynamic
Ordering for Asynchronous Backtracking (ABT DO) [29]. When an ABT DO
agent assigns a value to its variable, it can reorder lower priority agents. In
other words, an agent on a position j can change order of the agents on posi-
tions j + 1 through n. The authors in [29] proposed three different ordering
heuristics to reorder lower priority agents: random, min-domain and nogood-
triggered inspired by dynamic backtracking [8]. Their experimental results show
that nogood-triggered (ABT DO-ng), where the generator of the no-good is
placed just after the target of the backtrack, is best.
A new kind of ordering heuristics for ABT DO is presented in [31] for reorder-
ing higher agents. These retroactive heuristics enable the generator of a no-good
(backtrack) to be moved to a higher position than that of the target of the back-
track. The resulting algorithm is called ABT DO Retro. The degree of flexibility
of these heuristics depends on the size of the no-good storage capacity K, which
is predefined. Agents are limited to store no-goods with a size equal to or smaller
than K. The space complexity of the agents is thus exponential in K. However,
the best of those heuristics, ABT DO Retro(mindom) [17,31], does not need
any no-good storage. In ABT DO Retro(mindom), the agent that generates a
no-good is placed between the last and the second last agents in the no-good if
its domain size is smaller than that of the agents it passes on the way up.
6 Conclusion
We proposed a general framework for reordering agents asynchronously in DisC-
SPs which can implement many different dynamic variable ordering heuristics.
Our general framework is sound, complete, and has a polynomial space complex-
ity. We proved that a simple condition on the measure used in the heuristics is
478 M. Wahbi et al.
References
1. Bessiere, C., Bouyakhf, E.H., Mechqrane, Y., Wahbi, M.: Agile asynchronous back-
tracking for distributed constraint satisfaction problems. In: Proceedings of ICTAI
2011, Boca Raton, Florida, USA, pp. 777–784, November 2011
2. Bessiere, C., Maestre, A., Brito, I., Meseguer, P.: Asynchronous backtracking with-
out adding links: a new member in the ABT family. Artif. Intel. 161, 7–24 (2005)
3. Bessiere, C., Régin, J.C.: MAC and combined heuristics: two reasons toforsake FC
(and CBJ?) on hard problems. In: Freuder, E.C. (ed.) CP 1996. LNCS, vol. 1118,
pp. 61–75. Springer, Heidelberg (1996)
4. Bessiere, C., Régin, J.C.: Refining the basic constraint propagation algorithm. In:
Proceedings of IJCAI 2001, San Francisco, CA, USA, pp. 309–315 (2001)
5. Bliek, C.: Generalizing partial order and dynamic backtracking. In: Proceedings of
AAAI 1998/IAAI 1998, Menlo Park, CA, USA, pp. 319–325 (1998)
6. Bonnet-Torrés, O., Tessier, C.: Multiply-constrained dcop for distributed plan-
ning and scheduling. In: AAAI SSS: Distributed Plan and Schedule Management,
pp. 17–24 (2006)
7. Boussemart, F., Hemery, F., Lecoutre, C., Sais, L.: Boosting systematic search by
weighting constraints. In: Proceedings of ECAI 2004, pp. 146–150 (2004)
8. Ginsberg, M.L.: Dynamic Backtracking. JAIR 1, 25–46 (1993)
9. Ginsberg, M.L., McAllester, D.A.: GSAT and dynamic backtracking. In: KR,
pp. 226–237 (1994)
10. Haralick, R.M., Elliott, G.L.: Increasing tree search efficiency for constraint satis-
faction problems. Artif. Intel. 14(3), 263–313 (1980)
11. Jung, H., Tambe, M., Kulkarni, S.: Argumentation as distributed constraint sat-
isfaction: applications and results. In: Proceedings of AGENTS 2001, pp. 324–331
(2001)
12. Junges, R., Bazzan, A.L.C.: Evaluating the performance of dcop algorithms in
a real world, dynamic problem. In: Proceedings of AAMAS 2008, Richland, SC,
pp. 599–606 (2008)
13. Léauté, T., Faltings, B.: Coordinating logistics operations with privacy guarantees.
In: Proceedings of the IJCAI 2011, pp. 2482–2487 (2011)
14. Lecoutre, C., Boussemart, F., Hemery, F.: Backjump-based techniques versus
conflict-directed heuristics. In: Proceedings of IEEE ICTAI 2004, pp. 549–557
(2004)
15. Lynch, N.A.: Distributed Algorithms. Morgan Kaufmann Series (1997)
16. Maheswaran, R.T., Tambe, M., Bowring, E., Pearce, J.P., Varakantham, P.: Taking
DCOP to the real world: efficient complete solutions for distributed multi-event
scheduling. In: Proceedings of AAMAS 2004 (2004)
A General Framework for Reordering Agents 479
17. Mechqrane, Y., Wahbi, M., Bessiere, C., Bouyakhf, E.H., Meisels, A., Zivan, R.:
Corrigendum to “Min-Domain Retroactive Ordering for Asynchronous Backtrack-
ing”. Constraints 17, 348–355 (2012)
18. Ottens, B., Faltings, B.: Coordination agent plans trough distributed constraint
optimization. In: Proceedings of MASPLAN 2008, Sydney, Australia (2008)
19. Petcu, A., Faltings, B.V.: A value ordering heuristic for local search in distributed
resource allocation. In: Faltings, B.V., Petcu, A., Fages, F., Rossi, F. (eds.) CSCLP
2004. LNCS (LNAI), vol. 3419, pp. 86–97. Springer, Heidelberg (2005)
20. Roussel, O., Lecoutre, C.: Xml representation of constraint networks: Format
XCSP 2.1. CoRR (2009)
21. Silaghi, M.C.: Framework for modeling reordering heuristics for asynchronous back-
tracking. In: IEEE/WIC/ACM International Conference on Intelligent Agent Tech-
nology, IAT 2006, pp. 529–536, December 2006
22. Silaghi, M.C.: Generalized dynamic ordering for asynchronous backtracking on
DisCSPs. In: Proceedings of DCR 2006 (2006)
23. Silaghi, M.C., Sam-Haroud, D., Faltings, B.: ABT with Asynchronous Reordering.
In: 2nd Asia-Pacific IAT (2001)
24. Silaghi, M.C., Sam-Haroud, D., Calisti, M., Faltings, B.: Generalized english auc-
tions by relaxation in dynamic distributed CSPs with private constraints. In:
Proceedings of DCR 2001, pp. 45–54 (2001)
25. Wahbi, M.: Algorithms and Ordering Heuristics for Distributed Constraint Satis-
faction Problems. John Wiley & Sons, Inc. (2013)
26. Wahbi, M., Ezzahir, R., Bessiere, C., Bouyakhf, E.H.: DisChoco 2: a platform
for distributed constraint reasoning. In: Proceedings of workshop on DCR 2011,
pp. 112–121 (2011). http://dischoco.sourceforge.net/
27. Yokoo, M., Durfee, E.H., Ishida, T., Kuwabara, K.: Distributed constraint sat-
isfaction for formalizing distributed problem solving. In: Proceedings of ICDCS,
pp. 614–621 (1992)
28. Zivan, R., Meisels, A.: Parallel Backtrack search on DisCSPs. In: Proceedings of
DCR 2002 (2002)
29. Zivan, R., Meisels, A.: Dynamic Ordering for Asynchronous Backtracking on DisC-
SPs. Constraints 11(2–3), 179–197 (2006)
30. Zivan, R., Meisels, A.: Message delay and DisCSP search algorithms. AMAI 46(4),
415–439 (2006)
31. Zivan, R., Zazone, M., Meisels, A.: Min-Domain Retroactive Ordering for Asyn-
chronous Backtracking. Constraints 14(2), 177–198 (2009)
Automatically Generating Streamlined
Constraint Models with Essence and Conjure
1 Introduction
The search space defined by a constraint satisfaction problem can be vast, which
can lead to impractically long search times as the size of the problem instance
considered grows. An approach to mitigating this problem is to narrow the focus
of the search onto promising areas of the search space using streamliners [11].
Streamliners take the form of uninferred additional constraints (i.e. constraints
not proven to follow from the original problem statement) that rule out a sub-
stantial portion of the search space. If a solution lies in the remainder then it can
typically be found more easily than when searching the full space. Previously,
streamlined models have been produced by hand [11,13,15,16], which is both
difficult and time-consuming. The principal contribution of this paper is to show
how a powerful range of streamliners can be generated automatically.
Our approach is situated in the automated constraint modelling system Con-
jure [2]. This system takes as input a specification in the abstract constraint
specification language Essence [7,8]. Figure 1 presents an example specifica-
tion, which asks us to partition the integers 1 . . . n into k parts subject to a set
of constraints. Essence supports a powerful set of type constructors, such as set,
multi set, function and relation, hence Essence specifications are concise and
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 480–496, 2015.
DOI: 10.1007/978-3-319-23219-5 34
Automatically Generating Streamlined Constraint Models 481
Fig. 1. Essence specification of the Van Der Waerden Number Problem [24] (see
Appendix A). The specification describes a certificate for the lower bound on W (k, l),
and will be unsatisfiable if n is equal to W (k, l).
highly structured. Existing constraint solvers do not support these abstract deci-
sion variables directly. Therefore we use Conjure to refine abstract constraint
specifications into concrete constraint models, using constrained collections of
primitive variables (e.g. integer, Boolean) to represent the abstract structure.
Our method exploits the structure in an Essence specification to produce
streamlined models automatically, for example by imposing streamlining con-
straints on or between the parts of the partition in the specification in Figure 1.
The modified specification is refined automatically into a streamlined constraint
model by Conjure. Identifying and adding the streamlining constraints at this
level of abstraction is considerably easier than working directly with the con-
straint model, which would involve first recognising (for example) that a certain
collection of primitive variables and constraints together represent a partition
— a potentially very costly step.
Our system contains a set of rules that fire when their preconditions match a
given Essence specification to produce candidate streamliners. Using Conjure
to refine the streamlined specifications into constraint models, solved with Sav-
ile Row1 [19] and Minion2 [10], candidates are evaluated against instances of
the specified class. Effective streamliners are combined to produce more powerful
candidates. As we will show, high quality streamlined models can be produced
in this way, in some cases resulting in a substantial reduction in search effort.
Herein we focus on satisfaction problems. Optimisation is an important future
consideration but requires different treatment: streamliners may allow us to find
good solutions quickly but exclude the optimal solution to the original model.
The rest of this paper is structured as follows. Following a summary of related
work, we give some background on the Essence language. Section 4 describes
in detail our approach to generating streamliners automatically, then Section 5
discusses combining streamliners to produce yet more effective models. We con-
clude following a discussion of discovering streamliners in practice.
1
http://savilerow.cs.st-andrews.ac.uk
2
http://constraintmodelling.org/minion/
482 J. Wetter et al.
2 Related Work
Colton and Miguel [5] and Charnley et al [4] used Colton’s HR system [6] to con-
jecture the presence of implied constraints from the solutions to small instances
of several problem classes, including quasigroups and moufang loops. The Otter
theorem prover3 was used to prove the soundness of these conjectures. If proven
sound, the implied constraints were added to the model to aid in the solution of
larger instances of the same problem class.
Streamlined constraint reasoning differs from the approach of Charnley et
al in that the conjectured constraints are not typically proven to follow from a
given constraint model. Rather, they are added in the hope that they narrow
the focus of the search onto an area containing solutions. When first introduced
by Gomes and Sellmann [11] streamlined constraint reasoning was used to help
construct diagonally ordered magic squares and spatially balanced experiment
designs. For the magic squares the additional structure enforced was regularity
in the distribution of numbers in the square. That is, the small numbers are
not all similarly located, and likewise for large numbers. The spatially balanced
experiment designs were forced to be self-symmetric: the permutations repre-
sented by the rows of the square must commute with each other. For both of
these problems streamlining led to huge improvements in solve time, allowing
much larger instances to be solved.
Kouril et al. refer to streamlining as “tunneling” [13]. They describe the addi-
tional constraints as tunnels that allow a SAT solver to tunnel under the great
width seen early in the search tree when computing bounds on Van de Waerden
numbers. They used simple constraints that force or disallow certain sequences
of values to occur in the solutions. Again this led to a dramatic improvement in
run time of the solver, allowing much tighter bounds to be computed.
Le Bras et al. used streamlining to help construct graceful double wheel
graphs [15]. Constraints forcing certain parts of the colouring to form arithmetic
sequences allowed for the construction of colourings for much larger graphs.
These constraints led to the discovery of a polynomial time construction for
such colourings, proving that all double wheel graphs are graceful.
Finally Le Bras et. al. made use of streamlining constraints to compute new
bounds on the Erdős discrepancy problem [16]. Here constraints enforcing peri-
odicity in the solution, the occurrence of the improved Walters sequence, and
a partially multiplicative property improved solver performance, allowing the
discovery of new bounds.
In all of these examples streamliners proved very valuable, but were generated
by hand following significant effort by human experts. In what follows, we will
show that the structure recognised and exploited by these experts is often present
in abstract constraint specifications.
3
http://www.cs.unm.edu/∼mccune/otter/
Automatically Generating Streamlined Constraint Models 483
such that
forAll o : Obj . | bibd (o , _ )| = r ,
forAll bl : Block . | bibd (_ , bl )| = k ,
forAll o1 , o2 : Obj .
o1 != o2 -> | bibd ( o1 , _ ) intersect bibd ( o2 , _ )| = lambda
Fig. 2. Essence specification of the square (ensured by the where statement) Balanced
Incomplete Block Design Problem [20]. Streamliner added as an Essence annotation
shown underlined.
3 Background: Essence
The motivation for abstract constraint specification languages, such as Zinc [18]
and Essence is to address the modelling bottleneck: the difficulty of formulating
a problem of interest as a constraint model suitable for input to a constraint
solver. An abstract constraint specification describes a problem above the level
at which constraint modelling decisions are made. An automated refinement
system, such as Conjure, can then be used to produce a constraint model from
the specification automatically.
An Essence specification, such as those given in Figures 1 and 2, identifies:
the input parameters of the problem class (given), whose values define a prob-
lem instance; the combinatorial objects to be found (find); and the constraints
the objects must satisfy (such that). In addition, an objective function may
be specified (min/maximising — not shown in these examples) and identifiers
declared (letting). Abstract constraint specifications must be refined into con-
crete constraint models for existing constraint solvers. Our Conjure system
employs refinement rules to convert an Essence specification into the solver-
independent constraint modelling language Essence . From Essence we use
Savile Row to translate the model into input for a particular solver while
performing solver-specific model optimisations.
A key feature of abstract constraint specification languages is the support for
abstract decision variables with types such as set, multiset, relation and function,
as well as nested types, such as set of sets and multiset of relations. This allows
the problem structure to be captured very concisely. As explained below, this
clarity of structure is a good basis for the conjecture of streamlining constraints.
such as the partition in Figure 1. For each variable, the system forms conjec-
tures of possible regularities that impose additional restrictions on the values of
that variable’s domain. Since the domains of Essence decision variables have
complex, nested types, these restrictions can have far-reaching consequences for
constraint models refined from the modified specification. The intention is that
the search space is reduced considerably, while retaining at least one solution.
Multiple conjectures found to produce successful streamlined specifications indi-
vidually can be combined in an attempt to produce a single more sophisticated
streamliner. Currently conjectures are formed about each variable independently;
an important future direction is to make conjectures across multiple variables.
1e+08 1000
1e+07
100
Symmetric Relation Search Nodes
1e+06
10
100000
10000 1
1000
0.1
100
0.01
10
1 0.001
1 10 100 1000 10000 100000 1e+06 1e+07 1e+08 0.001 0.01 0.1 1 10 100 1000
Original Specification Search Nodes Original Specification Search Time
Fig. 3. Search effort to find the first solution to satisfiable square BIBD instances
where v = b ≤ 40: original vs streamlined specification.
Automatically Generating Streamlined Constraint Models 485
The existing Essence domain annotations are, however, of limited value. They
are very strong restrictions and so often remove all solutions to the original
problem when added to a specification. In order to generate a larger variety of
useful conjectures we employ a small set of rules, categorised into two classes:
1. First-order rules add constraints to reduce the domain of a decision variable
directly.
2. Higher-order rules take other rules as arguments and use them to reduce the
domain of a decision variable.
The full list of rules is shown in Table 1. A selection of the first-order rules is
given in Figure 4, and a selection of the higher-order rules are given in Figure 5.
We define four first-order rules that operate on integer domains directly:
‘odd’, ‘even’, ‘lowerHalf’ and ‘upperHalf’. Each restricts an integer domain to
an appropriate subset of its values. We define six first-order rules for function
domains. Two of these constrain the function to be monotonically increasing (or
decreasing). The other four place the largest (or smallest) element first (or last).
Functions mapping a pair of objects to a third object of the same type can be
viewed as binary operators on these objects. We define three first-order rules
to enforce such functions to be commutative, non-commutative, and associa-
tive respectively. Finally, we define a first-order rule for partitions called ‘quasi-
regular’. Partition domains in Essence can have a regular annotation, however
this can be too strong. The ‘quasi-regular’ streamlining rule posts a soft version
Table 1. The rules used to generate conjectures. Rows with a softness parameter
specify a family of rules each member of which is defined by an integer parameter.
Class Trigger Domain Name Softness
odd{even} no
int
lower{upper}Half no
monotonicIncreasing{Decreasing} no
function int --> int
largest{smallest}First{Last} no
First-order
commutative no
function (X,X) --> X associative no
non-commutative no
partition from X quasi-regular yes
all no
most yes
set of X
half no
approxHalf yes
range no
Higher-order
defined no
function X --> Y
pre{post}fix yes
allBut yes
function (X,X) --> Y diagonal no
partition from X parts no
486 J. Wetter et al.
forAll s in parts(p) .
|s|/2 + i >= sum x in s . toInt(x <= n/2) /\
|s|/2 - i <= sum x in s . toInt(x <= n/2)
Table 2. Number of conjectures generated for a set of problem classes. The Total
column lists all conjectures generated for each class, the Retain column lists the number
of conjectures that retain at least one solution and the Improve column lists the number
of conjectures that improve solver performance.
100000 100
10 0.01
1 0.001
1 10 100 1000 10000 100000 0.001 0.01 0.1 1 10 100
Original Specification Search Nodes Original Specification Solve Time
Fig. 6. The size and execution time of search required to find the first solution for
a collection of problem classes for both the original specification and the streamlined
specification that resulted in the smallest cumulative search size across instances. The
generated conjectures often result in order of magnitude reduction in search size for
harder problem instances.
ABCD
AB AC AD BC BD CD
A B C D
Fig. 7. The power set of singleton conjectures can be explored to identify combinations
that result in powerful streamlined specifications. If small sets of conjectures that fail
to retain solutions are identified all super sets can be pruned from the search vastly
reducing the number of vertices to be explored.
experimented with depth first search (DFS) and breadth first search (BFS) of the
lattice. In order to guide both the searches the singleton conjectures were ordered
from best to worst, where the quality metric compared the number of instances
solved in under 100,000 search nodes and ties were broken by comparing the
total search nodes across all instances.
In order to compare the two approaches they were each allowed to evaluate
500 combinations of conjectures in addition to the singleton conjectures already
evaluated for three problem classes (Van der Waerden numbers, graceful helms
graphs and graceful double wheel graphs). The set of instances used for evalua-
tion was augmented by increasing the integer parameters until the best singleton
streamliner was unable to solve the instance in under 100,000 search nodes. Each
combination of conjectures was evaluated by refining, tailoring and solving for
the first solution using Conjure’s compact heuristic and default settings for
Savile Row and Minion. The experiments were performed on 32-core AMD
Opteron 6272 at 2.1 GHz taking approximately 6 hours for each problem class.
Figures 8 to 10 show the best set of conjectures found by this process, where
the quality metric compares the number of instances solved and ties were broken
by comparing the total number of search nodes.
Figure 8 shows three singleton conjectures that were found to produce an effec-
tive streamlined specification of the Van Der Waerden numbers problem, one of
which results from the chained application of four rules, whereas another results
directly from a single rule. Figure 9 shows two conjectures being combined for the
graceful helm graph problem, one of which results from the chained application
of three rules. Figure 10 shows the combination of two conjectures for the grace-
ful colouring of double wheel graphs. In all cases the combination of streamliners
results in better performance than any of the streamliners in isolation.
492 J. Wetter et al.
100000 10
10000 1
Time (s)
Nodes
1000 0.1
basic basic
100 parts(all(half(odd))) p 0.01 parts(all(half(odd))) p
parts(all(approxHalf(lowerHalf,2) p parts(all(approxHalf(lowerHalf,2) p
quasiRegular(3) p quasiRegular(3) p
combined combined
10 0.001
35 40 45 50 55 60 35 40 45 50 55 60
n n
On one problem, Van Der Waerden numbers, DFS performed very well, reach-
ing a powerful set of three conjectures within the first three models evaluated.
On the other problems DFS performed poorly, unable to beat the best pair found
by BFS within the allotted resource budget. In all three cases DFS failed to find
an improved model after the first five models it considered.
The poor performance of DFS can be attributed to two factors. First, the two
best singleton conjectures do not always produce the best pair of conjectures,
even when they retain solutions in combination. A better heuristic would need
some notion of complementary conjectures. Second, far more combinations are
pruned from the search space if failing sets are detected early. Consider the
lattice of conjecture sets shown in Figure 7. If conjecture C and D fail to retain
solutions when used in combination so will {A,C,D}, {B,C,D} and {A,B,C,D}.
A breadth first traversal would be guaranteed to detected this failure early and
would consequently never evaluate these three models. Alternatively a depth
first traversal would detect this failure late, and would therefore waste time
evaluating the supersets of {C,D}, all of which fail to retain solutions.
100000 10
10000 1
Time (s)
Nodes
1000 0.1
100000 10
1
10000
Time (s)
Nodes
0.1
1000
Streamliners are then generated, combined and evaluated against the set of
test instances, as described in Sections 4 and 5. This is a costly process, in the
same way that a considerable effort is expended by human experts in manual
streamliner generation. However, streamliners are generated for use over the
entire problem class. Under the assumption that our problem class has infinitely
many elements, the cost of streamliner discovery is amortised over all instances
not used in the streamliner evaluation process and becomes negligible.
7 Conclusion
Streamliner generation has been the exclusive province of human experts, requir-
ing substantial effort in examining the solutions to instances of a problem class,
manually forming conjectures as to good streamliners, and then testing their
efficacy in practice. In this paper we have demonstrated for the first time the
494 J. Wetter et al.
A Problem Descriptions
Van Der Waerden Numbers. Van Der Waerden’s theorem states that given
any positive integers k and l, there exists a positive integer n such that for any
partition of the integers 1 to n into k parts at least one of the parts contains an
arithmetic sequence of length l. The Van Der Waerden number, W (k, l), is the
lowest such n [24]. The Essence specification studied here describes a certificate
that the given n = W (k, l).
Schur Numbers. Given a positive integer r, there exists a positive integer s
such that for any partition of the integers 1 to s at least one part is not sum free.
Alternatively at least one part is a super set of {x, y, z} such that x + y = z.
Schur’s number, S(r), is the smallest such s [22]. The Essence specification
studied here describes a certificate that the given s = S(r)
Graceful Graphs. Given a graph with n edges a graceful labelling assigns
each node in the graph a label between 0 and n such that no label is used more
than once and that every pair of adjacent nodes can be uniquely identified by
the absolute difference of their labels. A graceful graph is a graph that permits
a graceful labelling [21]. Several classes of graph have been investigate in this
context including wheels [9], double wheels [15], helms [3] and gears [17].
Quasigroup Existsence. Given a positive integer n, does there exist a quasi-
group (latin square) of size n such that an additional side constraint is met.
These side constraints are: QGE3 - ∀a, b ∈ g (a · b) · (b · a) = a, QGE4 -
∀a, b ∈ g (b · a) · (a · b) = a, QGE5 - ∀a, b ∈ g ((b · a) · b) · b = a, QGE6 -
∀a, b ∈ g (a · b) · b = a · (a · b), QGE7 - ∀a, b ∈ g (b · a) · b = a · (b · a) [23].
Equidistant Frequency Permutation Arrays. Given v, q, λ and d, con-
struct a set of v codewords such that each code word is of length q · λ and
contains λ occurrence of each symbol in the set {1, 2, . . . , q}. Each pair of code
words must be of hamming distance d [12].
Langford’s Problem. Given any positive integer n, arrange copies of the
numbers between 1 and n such that for all k in {1 . . . n} there are k digits
between occurrences of k [14].
Automatically Generating Streamlined Constraint Models 495
References
1. Akgun, O., Frisch, A.M., Gent, I.P., Hussain, B.S., Jefferson, C., Kotthoff, L.,
Miguel, I., Nightingale, P.: Automated symmetry breaking and model selection in
Conjure. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 107–116. Springer,
Heidelberg (2013)
2. Akgün, O., Miguel, I., Jefferson, C., Frisch, A.M., Hnich, B.: Extensible automated
constraint modelling. In: AAAI 2011: Twenty-Fifth Conference on Artificial Intel-
ligence (2011)
3. Ayel, J., Favaron, O.: Helms are graceful. Progress in Graph Theory (Waterloo,
Ont., 1982), pp. 89–92. Academic Press, Toronto (1984)
4. Charnley, J., Colton, S., Miguel, I.: Automatic generation of implied constraints.
In: ECAI, vol. 141, pp. 73–77 (2006)
5. Colton, S., Miguel, I.: Constraint generation via automated theory formation. In:
Walsh, T. (ed.) Proceedings of the Seventh International Conference on Principles
and Practice of Constraint Programming, pp. 575–579 (2001)
6. Colton, S.: Automated Theory Formation in Pure Mathematics. Ph.D. thesis, Uni-
versity of Edinburgh (2001)
7. Frisch, A.M., Jefferson, C., Hernandez, B.M., Miguel, I.: The rules of constraint
modelling. In: Proc. of the IJCAI 2005, pp. 109–116 (2005)
8. Frisch, A.M., Harvey, W., Jefferson, C., Martı́nez-Hernández, B., Miguel, I.:
Essence: A constraint language for specifying combinatorial problems. Constraints
13(3), 268–306 (2008). doi:10.1007/s10601-008-9047-y
9. Frucht, R.: Graceful numbering of wheels and related graphs. Annals of the New
York Academy of Sciences 319(1), 219–229 (1979)
10. Gent, I.P., Jefferson, C., Miguel, I.: Minion: A fast scalable constraint solver.
In: ECAI, vol. 141, pp. 98–102 (2006)
11. Gomes, C., Sellmann, M.: Streamlined constraint reasoning. In: Wallace, M. (ed.)
CP 2004. LNCS, vol. 3258, pp. 274–289. Springer, Heidelberg (2004)
12. Huczynska, S., McKay, P., Miguel, I., Nightingale, P.: Modelling equidistant fre-
quency permutation arrays: an application of constraints to mathematics. In:
Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 50–64. Springer, Heidelberg (2009)
13. Kouril, M., Franco, J.: Resolution tunnels for improved SAT solver performance. In:
Bacchus, F., Walsh, T. (eds.) SAT 2005. LNCS, vol. 3569, pp. 143–157. Springer,
Heidelberg (2005)
14. Langford, C.D.: Problem. The Mathematical Gazette, 287–287 (1958)
15. Le Bras, R., Gomes, C.P., Selman, B.: Double-wheel graphs are graceful.
In: Proceedings of the Twenty-Third international Joint Conference on Artificial
Intelligence, pp. 587–593. AAAI Press (2013)
16. Le Bras, R., Gomes, C.P., Selman, B.: On the erdős discrepancy problem. In:
O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 440–448. Springer, Heidelberg
(2014)
17. Ma, K., Feng, C.: On the gracefulness of gear graphs. Math. Practice Theory 4,
72–73 (1984)
18. Marriott, K., Nethercote, N., Rafeh, R., Stuckey, P.J., de la Banda, M.G., Wallace, M.:
The design of the zinc modelling language. Constraints 13(3) (2008). doi:10.1007/
s10601-008-9041-4
19. Nightingale, P., Akgün, Ö., Gent, I.P., Jefferson, C., Miguel, I.: Automatically
improving constraint models in Savile Row through associative-commutative com-
mon subexpression elimination. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656,
pp. 590–605. Springer, Heidelberg (2014)
496 J. Wetter et al.
20. Prestwich, S.: CSPLib problem 028: Balanced incomplete block designs. http://
www.csplib.org/Problems/prob028
21. Rosa, A.: On certain valuations of the vertices of a graph. In: Theory of Graphs
Internat. Symposium, Rome, pp. 349–355 (1966)
22. Schur, I.: Über die kongruenz xm + y m ≡ z m (mod p). Jahresber. Deutsch. Math.
Verein 25, 114–117 (1916)
23. Slaney, J., Fujita, M., Stickel, M.: Automated reasoning and exhaustive search:
Quasigroup existence problems. Computers & Mathematics with Applications
29(2), 115–132 (1995)
24. Van der Waerden, B.L.: Beweis einer baudetschen vermutung. Nieuw Arch. Wisk
15(2), 212–216 (1927)
Application Track
Constraint-Based Local Search
for Finding Node-Disjoint Bounded-Paths
in Optical Access Networks
Insight Centre for Data Analytics, University College Cork, Cork, Ireland
{alejandro.arbelaez,deepak.mehta,barry.osullivan}@insight-centre.org
1 Introduction
Continuous growth in the amount of data transferred within national and global
networks in the last decade necessitates new infrastructures and data transfer
technologies [1]. In line with this, the goal of the DISCUS project [2] is to develop
an end-to-end network design that can provide high-speed broadband capability
of at least three orders-of-magnitude greater than today’s networks to all users,
reduce energy consumption by 95%, and remain economically viable.1 The archi-
tecture is based on maximising the sharing of network infrastructure between
customers by deploying a Long-Reach Passive Optical Network (LR-PON) [3] in
the access part. All network points have equal bandwidth and service capability
including core bandwidth (10Gbs to 100Gbs) delivered to the access network.
LR-PONs provide an economically viable solution for fibre-to-the-home net-
work architectures [4]. In a LR-PON fibres are distributed from metro nodes
(MNs) to exchange sites (ESs) through cables that form a tree distribution net-
work. Typically due to signal loss the maximum distance from a MN to an ES is
up to 90 km, and the maximum distance from an ES to the customers is up to
10 km. A major fault occurrence in a LR-PON would be a complete failure of a
1
http://www.discus-fp7.eu
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 499–507, 2015.
DOI: 10.1007/978-3-319-23219-5 35
500 A. Arbelaez et al.
MN, which could affect tens of thousands of customers. A dual homing protec-
tion mechanism is recommended for LR-PONs whereby customers are connected
to two MNs, so that whenever a single MN fails all customers are still connected
to a back-up. Simply connecting two MNs to an ES is not sufficient to guarantee
the connectivity because if a link or a node is used is common in the routes of
fibre going from ES to its 2 MNs then both MNs would be disconnected.
Broadly speaking, there are two protection strategies for dual homing. One
approach is protecting links in the tree distribution network, e.g., a fibre cut,
amplifier failure, or other equipment that can fail. This strategy, known as the
edge-disjoint solution, allows switching to an alternative path whenever a link in
the distribution network fails. Alternatively, protection can be provided at the
node level with node-disjoint paths between MNs and ESs, when an entire ES
fails and all adjacent links to the node will be affected. This strategy, known
as node-disjoint solution, provides a stronger protection mechanism and allows
switching to an alternative path whenever a node fails. The selection of one
protection mechanism over another is a matter of choice for the broadband
provider, generally higher protection means higher deployment cost.
Figure 1 shows an example with two MNs F1 and F2 and the set of ESs
{a, b, c, d, e, f }. Black and gray coloured edges are used to show the trees corre-
sponding to the facilities F1 and F2 respectively, and maximum allowed distance
λ=12. This example shows three scenarios satisfying the length constraint, how-
ever, each scenario shows a different level of resiliency. Dashed lines indicate
edges leading to a conflict, i.e., violating node or edge disjointness, and gray
nodes indicate the conflicting node when violating node-disjointness. The total
solution cost for Figure 1(a) is 46. The indicated solution satisfies the length con-
straint (i.e., the distance from the MNs to any ES is at most λ=12) and it also sat-
isfies node-disjoint constraints and consequently edge-disjoint constraints. Here
we observe that failure of any single link or node would not affect the remain-
ing ESs. Figure 1(b) does not satisfy node-disjoint constraints but edge-disjoint
constraints. Here we observe that a single node failure could disconnect one or
more ESs from the MNs F1 and F2 , e.g., f would be disconnected from F1 and
F2 whenever a fails. Nevertheless, the solution is resilient to any single facility
or single link failure. Figure 1(c) shows a solution that violates both node and
edge disjoint constraints. In this example the link e, f appears in both trees
and the path from f is neither edge-disjoint nor node-disjoint but it is resilient
to a failure of a single MN.
Network operators tend to evaluate multiple options. Their choices of pro-
viding resiliency depends on many factors, e.g., captial and operational costs,
rural or sparse regions, business or residential customers etc. Ideally they would
prefer a tool where one can try to impose different configurations and get feed-
back quickly. In particular we focus on node-disjointness as the other options
can be seen as relaxation of the node-disjoint constraints. The problem is to
determine the routes of cable fibres such that there are two node-disjoint paths
from each ES to its two MNs, the length of each path must be below a given
threshold and the total cable length required for connecting each ES to two MNs
Constraint-Based Local Search for Finding Node-Disjoint Bounded-Paths 501
F1 F2 F1 F2 F1 F2
5 7 5 7 5 7
4 8 4 8 4 8
a 3 a 3 a 3
b 2 b 2 b 2
4 2 6 4 2 6 4 2 6
3 c 3 c 3 c
d e d e d e
1 1 2 1 1
1
f f f
(a) Node and (b) Not Node but (c) Neither Node
Edge disjoint Edge Disjoint nor Edge Disjoint
Fig. 1. Passive Optical Networks with and without node and edge disjoint protection.
should be minimised. The bottleneck is that the instances of the network sizes
can be very huge e.g., UK has approximately 5000 ESs while Italy has more
than 10,000. Solving very large instances of this problem in limited time is very
challenging. We therefore apply a constraint-based local search and develop an
efficient algorithm to handle node-disjoint constraints for selecting best move
during LS.
The authors studied two move-operators to tackle the distance constraint, infor-
mally speaking nodes are sequentially added in the tree using Prim’s algorithm,
and a backup route is used whenever the move cannot satisfy the length con-
straint. This framework is difficult to extend with side constraints, and therefore
the algorithms cannot be extended to solve our problem with node and edge
disjointed paths. For instance, the operators rely on a pre-computed alternative
route from the root to any node. However that route might violate disjointedness.
2.1 Node-Disjointness
The LS algorithm uses the move-operators in two different phases. In the inten-
sification phase a subtree is selected and it is moved to another location that
provides the maximal improvement in the objective function. In the perturba-
tion phase both a subtree and its new location are selected randomly in order
diversify the search by adding noise to the current incumbent solution. In order
to complete the intensification and diversification phases, the sub-tree opera-
tor requires four main functions: removing a subtree from the current solution;
checking whether a given solution is feasible or not; inserting a subtree in the
solution; finding the best location of a subtree in the current solution.
Additionally, the LS algorithm is equipped with an incremental way of main-
taining information related to checking constraints and computing the cost of
the assignment. For the length constraint it is necessary to maintain for each
node ej the length of the path from MN i to ES (or node in the tree) j, and
the length of the path emanating from ej down to the farthest leaf from ej .
These two lengths are updated after removing and inserting a subtree in the
tree. For enforcing the edge-disjoint constraint in the two paths of a client, we
must maintain the predecessors of each client in the two paths associated to the
MNs, and require that the two predecessors must be different [5]. For enforcing
the node-disjoint constraint between the paths of two clients it is necessary to
maintain all the nodes occurring in each path except the source and target. This
is done by maintaining the transitive graph.
Let M be the set of facilities or MCs. Let E be the set of clients or ESs.
Let Ei ⊆ E be the set of clients associated with MN mi ∈ M . We use N to
denote the set of nodes, which is equal to M ∪ E. We use Ti to denote the tree
network associated with MN i. We also use Ni ⊆ N = Ei ∪ {mi } to denote the
set of nodes in Ti . Let λ be the maximum path-length from a facility to any of
its clients.
Let ej be a node in the tree Ti associated with facility mi . Let epj be the
predecessor of ej , and let Lej be a list of all nodes in the subtree starting at ej of
tree Ti . We now describe the complexities of remove, insert, feasibility check and
best location operations performed during search with respect to node-disjoint
constraint:
Remove. To remove a subtree it is necessary to update the transitive graph.
This is done by removing all the transitive links between any node in the path
from the MN mi down to ej and all the elements in Lej . In Figure 2(a) gray lines
show the links that must be removed from the transitivity graph, i.e., links that
Constraint-Based Local Search for Finding Node-Disjoint Bounded-Paths 503
1 1
5
2 2
3 3
4 5 10 11
4
8 9 10 11 6 7 8 9 6 7
reach any node in the subtree emanating from node 5. Thus, the time-complexity
of removing a subtree rooted at ej from the tree Ti is quadratic with respect to
the number of clients of facility mi .
Insert. The insertion involves adding the transitive links between each node in
the path from the MN down to ej and each element of Lej . Figure 2(b) shows the
links that must be added in the transitivity graph; black links denote existing
links in the tree and gray links denote the new links added by transitivity in the
graph. Therefore, a subtree rooted at ej can be inserted in Ti in quadratic time
complexity with respect to the number of clients of facility mi .
Feasibility. To verify the consistency of the node-disjoint constraint we need
to check that any node occurring in the subtree starting from the node ej is
not transitively connected to any node in the path from the MN down to the
potential predecessor of ej in any other tree corresponding to other MNs. This is
done by checking the occurrence of the links corresponding to the pairs of nodes
occurring in the transitive graph. As the number of links can be quadratic, the
time complexity is quadratic. Additionally, if the node ej is breaking an existing
arc ep , eq , it is necessary to check that ej is not transitively connected to any
node in the subtree emanating from eq .
Best Location. Selecting the best location for a given subtree involves travers-
ing all the nodes of the tree associated with the MN and selecting the one that
maximises the reduction in the cost. As the complexity of feasibility is quadratic,
the time complexity of finding the best location is cubic in the number of nodes
of a given tree.
The complexities for feasibility checking and best location described above do
not make any assumption on the order in which different locations are explored.
In the following we will show that the amortized complexities can be reduced if
the locations in the tree are traversed in a particular order.
For a given subtree rooted at ej there are two types of feasible locations. The
first is a node-type location, say ek , of the tree and the feasibility check is whether
the parent of ej can be ek or not. This type of location is denoted by (ek , ∅). The
second is a link-type location, say epl , el , of the tree and the feasibility check
is whether we can break the link epl , el by making epl and ej the parents of ej
and el respectively. This type of location is denoted by (epl , {el }). For node-type
504 A. Arbelaez et al.
Algorithm 1. BestLocation(ej , Ti , G)
1: Remove subtree rooted at ej from Ti , update Ti and G
2: Nlocations ← ∅, Llocations ← ∅
3: Let s be a stack, let q be a queue
4: s.push(root(Ti ))
5: while s = ∅ do
6: ek ← s.pop()
7: trans ← {ek , el ) | el ∈ Lej ∧ ek , el ∈ G}
8: if trans = ∅ then
9: Nlocations ← Nlocations ∪ {(ek , ∅)}
10: for all ek , el ∈ Ti do
11: Llocations ← Llocations ∪ (ek , {el })
12: s.push(el )
13: end for
14: if out(ek , Ti ) = 0 then
15: q.append((ek , check))
16: while q = ∅ do
17: (el , status) ← q.remove()
18: if epl , el ∈ Llocations then
19: if ej , el ∈ G||status =rem then
20: Llocations ← Llocations \{epl , el }
21: q.append((epl , rem))
22: else
23: q.append((epl , check))
24: Best ← SelectBest(ej , NLocations ∪ Llocations)
25: return Best
locations we explore the tree in a depth-first manner, whereas for link-type loca-
tions we explore the tree in a bottom-up manner.
Algorithm 1 shows the pseudo-code to compute the feasible set of locations
for a given subtree rooted at ej and then select the best location in a tree Ti with
respect to a transitive graph G. The algorithm maintains the set of feasible node-
type locations with respect to the node disjoint constraint in the set Nlocations,
and employs a depth-first search algorithm with a stack s (Lines 5-18). It explores
the successors of a node ek only when there is no existing link in the transitive
graph between the node ek and any node in Lej . Notice that the time complexity
of the first while loop is quadratic in the number of the nodes of the tree. Also
notice that in the first while loop, the algorithm updates the set Llocations by
adding all the candidate links starting from the node ek which will be filtered in
the next while loop. Moreover, for each leaf node, when the outgoing degree of
node ek is 0 (i.e. out(ek , Ti ) = 0), the node is appended to the queue with the
status check as the feasible set of link locations follows a bottom-up approach.
In the second while loop, the algorithm filters the set of candidate links to
determine the feasible set by employing a bottom-up approach with a queue
q. It explores a node el only if its predecessor is a valid parent candidate for
the node ej of a given subtree. If there is a link from ej to el in the transitive
Constraint-Based Local Search for Finding Node-Disjoint Bounded-Paths 505
graph or its status is marked as rem then (epl , el ) is not a feasible link-location
and subsequently all the links involved in the path from the facility to el would
not be feasible link-locations. Therefore, the queue is appended with (epl , rem)
and the set Llocations is filtered. Otherwise, the status of the predecessor of
el is set to check and appended to the q. Notice that the time complexity of
second while loop is linear in the number of links of the tree. Thus, the amortized
time complexity of feasibility checking is linear and, consequently, the amortized
complexity of BestLocation is quadratic.
We remark that computing fji for checking the length constraint can be
merged with the verification of the transitive graph with the same worst-case
time complexity i.e., linear. However we still incrementally maintain fji and bij
for each node in the graph in order to amortize the complexity of the operation
to depend only in the number of nodes in the subtree enumerating from ej .
3 Empirical Evaluation
All experiments were performed on a 4-node cluster, each node features 2 Intel
Xeon E5430 processors at 2.66Ghz and 12 GB of RAM memory. We report the
median cost solution of 11 independent executions of the LS algorithm with a
1-hour time limit for each experiment. We would like to point out that CPLEX
ran out of memory when we tried to create and solve the MIP model for nearly
all instances. Hence, we limit our attention to the CBLS algorithm.
To evaluate the performance of the proposed LS we use 3 real networks from
three EU countries: Ireland with 1121 ESs, the UK with 5393 ESs, and Italy
with 10708 ESs. For each dataset we use [10] to identify the position of the
MNs and computed four instances for each country. Ireland with 18, 20, 22, and
24 MNs; the UK with 75, 80, 85, and 90 MNs; and Italy with 140, 150, 160,
and 170 MNs. We set λ=90 km. Cable fibre cost is a dominant factor in the
deployment of LR-PONs, therefore we report the estimated total cost in euro
to deploy edge and node disjoint distribution networks. To this end, we use the
subtree operator to optimise the total cable link distance and then we extract
the actual fibre cost of the solutions. [11] suggests that on average four fibres will
be needed to provide broadband services to all customers for each ES, and the
cost of the fibres are defined as follows: {12, e2430}, {24, e2430}, {48, e3145},
{96, e4145}, {144, e5145}, {192, e6145}, {240, e7145}, {276, e7859}, the left
part indicates the number of fibres per cable and the respective cost per km.
In Table 1 we report results. As expected the cost of node-disjointness is
higher than that of edge-disjointness as the former provides stronger protection.
However, it is worth pointing out that the total cable link distance of deployment
of a fully node disjoint solution is only up to 13.7% more expensive for Ireland,
16.3% for the UK, and 19.7% for Italy, with respect the best known edge-disjoint
solutions. And with a gap between 22% and 31% with respect to the LBs,2
2
We recall that the lower bounds are valid for both edge and node disjoint paths.
Therefore we expect the node disjoint solution to be much closer to the actual
optimal solution.
506 A. Arbelaez et al.
Table 1. Results for Ireland, UK and Italy to provide Node and Edge disjoint paths.
which is used as the reference baseline for comparison. Finally, we would like
to highlight the cost in euro of deployment both the edge and node disjoint
alternatives. We foresee that the cost of deployment node disjoint protection in
LR-PON in Ireland, the UK, and Italy is respectively 9.9%, 11%, and 12% more
expensive (on average) than the corresponding edge disjoint alternative.
Acknowledgments. We would like to thank both eircom and Telecom Italia for pro-
viding their optical network data. We would also like to thank atesio for providing the
Italian reference network on which the Italian experiments have been carried out. This
work is supported by the EU Seventh Framework Programme (FP7/ 2007-2013) under
grant agreement no. 318137 (DISCUS) and by Science Foundation Ireland (SFI) under
grant 08/CE/I1423. The Insight Centre for Data Analytics is also supported by SFI
under Grant Number SFI/12/RC/2289.
Constraint-Based Local Search for Finding Node-Disjoint Bounded-Paths 507
References
1. Benhamiche, A., Mahjoub, R., Perrot, N.: On the design of optical OFDM-based
networks. In: Pahl, J., Reiners, T., Voß, S. (eds.) INOC 2011. LNCS, vol. 6701,
pp. 1–6. Springer, Heidelberg (2011)
2. Ruffini, M., Wosinska, L., Achouche, M., Chen, J., Doran, N., Farjady, F., Mon-talvo,
J., Ossieur, P., O’Sullivan, B., Parsons, N., Pfeiffer, T., Qiu, X.Z., Raack, C., Rohde,
H., Schiano, M., Townsend, P., Wessaly, R., Yin, X., Payne, D.B.: Discus: An end-to-
end solution for ubiquitous broadband optical access. IEEE Communications Maga-
zine 52(2), 24–32 (2014)
3. Davey, R., Grossman, D., Rasztovits-Wiech, M., Payne, D., Nesset, D., Kelly, A.,
Rafel, A., Appathurai, S., Yang, S.H.: Long-reach passive optical networks. Journal
of Lightwave Technology 27(3), 273–291 (2009)
4. Payne, D.B.: FTTP deployment options and economic challenges. In: Proceedings of
the 36th European Conference and Exhibition on Optical Communication (ECOC
2009) (2009)
5. Arbelaez, A., Mehta, D., O’Sullivan, B., Quesada, L.: Constraint-based local search
for edge disjoint rooted distance-constrainted minimum spanning tree problem.
In: CPAIOR 2015, pp. 31–46 (2015)
6. Pham, Q.D., Deville, Y., Van Hentenryck, P.: LS(Graph): a constraint-based local
search for constraint optimization on trees and paths. Constraints 17(4), 357–408
(2012)
7. Mukherjee, B.: Optical WDM Networks (Optical Networks). Springer-Verlag New
York Inc., Secaucus (2006)
8. Blesa, M., Blum, C.: Finding edge-disjoint paths in networks: An ant colony
optimization algorithm. Journal of Mathematical Modelling and Algorithms 6(3),
361–391 (2007)
9. Ruthmair, M., Raidl, G.R.: Variable neighborhood search and ant colony opti-
mization for the rooted delay-constrained minimum spanning tree problem.
In: Schaefer, R., Cotta, C., Kolodziej, J., Rudolph, G. (eds.) PPSN XI. LNCS,
vol. 6239, pp. 391–400. Springer, Heidelberg (2010)
10. Ruffini, M., Mehta, D., O’Sullivan, B., Quesada, L., Doyle, L., Payne, D.B.:
Deployment strategies for protected Long-Reach PON. Journal of Optical Com-
munications and Networking 4, 118–129 (2012)
11. DISCUS: Project Deliverable 2.6, Architectural optimization for different geotypes
Open Packing for Facade-Layout Synthesis
Under a General Purpose Solver
1 Introduction
The authors wish to acknowledge the TBC Générateur d’Innovation company, the
Millet and SyBois companies and all partners in the CRIBA project, for their involve-
ment in the construction of the CSP model.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 508–523, 2015.
DOI: 10.1007/978-3-319-23219-5 36
Open Packing for Facade-Layout Synthesis Under a General Purpose Solver 509
Due to the rectangular geometry of panels and facades, this problem may be
treated as a constrained two-dimensional packing problem [8]. By doing this, we
may take advantage of the great body of literature on two-dimensional packing
while exploiting technological tools, such as general purpose constraint solvers,
to tackle the problem. Indeed, Constraint Programming (CP) is, arguably, the
most used technology at the crossroads of Artificial Intelligence and Operations
Research to address combinatorial problems. CP provides a declarative language
and efficient solvers to model and solve complex decision problems where vari-
ables are subject to various constraints. It is known to solve efficiently packing
problems [3] having, among other abstractions, the geometrical constraint GEOST
[2]. However, as we only deal with rectangular shapes, the constraint GEOST [2]
seems too complex for our need and would bring an unnecessary risk from a
software maintenance point of view. Instead, we use the simpler and well known
non overlapping DiffN global constraint [3]. Moreover, we exploit the possibil-
ities, provided by general purpose CP solvers, to implement ad hoc constraints
and search procedures that fit the problem structure. Thus, we consider a CP
solver as an algorithm integration framework for the development of a decision
support application.
Nevertheless, not having a predefined number of rectangles becomes a draw-
back given that the great majority of constraint programming environments
implement global constraints and search engines with a fixed set of variables. In
fact, performing filtering and searching using an unfixed number of variables, i.e.,
a dynamically changing problem, is an active research topic in the constraint pro-
gramming community. In [1], the author solves the problem of unknown variables
by dynamically adding variables while exploring the search tree. In essence, it
introduces a setup in which constraints may be deactivated to be replaced with
new activated constraints involving more or less variables. Nonetheless, even
though the idea seems simple, a good implementation is intricate. Instead, our
work is inspired from [22], where the authors introduce open global constraints.
An open global constraint is an extension of an existing global constraint that
includes a set variable (or an array of binary variables) to indicate the subset of
decision variables the former constraint holds on. In other words, some decision
510 A.F. Barco et al.
variables of the problem become optional (see [11,19] and Section 4.4.16 in [18]
for further information).
The aim of this paper is to propose a solution to the facade-layout synthe-
sis problem as a two-dimensional packing problem with optional rectangles. We
do so by using an open variant of the DiffN constraint [3] to handle rectan-
gles that are potentially in the solution. Also, we present a simple yet efficient
search heuristic which captures the problem structure. The proposed solutions
are implemented using the open-source constraint environment Choco [17]. An
empirical evaluation shows the practical impact of every contribution and pro-
vides a better understanding of the solving process. The paper is divided as
follows. In Section 2 the facade-layout elements are introduced. In Section 3, the
constraint-based definition of the problem is presented. In Section 4 we provide
technical details of our implementation. In Section 5, a search heuristic that cap-
tures the problem structure is presented. Afterwards, in Section 6, we show some
performance evaluation of our methods. Finally, some conclusions are discussed
in Section 7.
2 Retrofit Industrialization
This work is part of project called CRIBA (for its acronym in French of Con-
struction and Renovation in Industrialized Wood Steel) [7]. This project focuses
on the industrialization of energetic renovation for residential buildings. The
challenge, very ambitious, is to have a building energetic performance under
25kW h/m2 /year after the renovation. The complete renovation (internal and
external retrofit) started at the beginning of 2015 with the internal part only.
The industrialization is based on an external new thermal envelope which
wraps the whole buildings. The envelope is composed of prefabricated rectan-
gular panels comprising insulation and cladding, and sometimes including in
addition, doors, windows and solar modules. As a requirement for the reno-
vation, facades have to be strong enough to support the weight added by the
envelope.
Within CRIBA several tools, needed to industrialize the renovation process,
will be developed:
a. a new method for three-dimensional building survey and modeling (building
information model),
b. a configuration system for the design of the new thermal envelope (topic of
this paper), and
c. a working site planning model with resource constraints.
This section introduces the problem of facade layout-synthesis from the
industrial point of view.
2.1 Elements
Facades. A facade is represented by a two-dimensional coordinate plane (see
Figure 1), with origin of coordinates (0,0) at the bottom-left corner of the facade,
and contains rectangular zones defining:
Open Packing for Facade-Layout Synthesis Under a General Purpose Solver 511
Rectangular panels. Panels are rectangular (see Figure 2), of varying sizes and
may include different equipment (solar modules, window-holes, shutters, etc.).
These panels are designed one at a time in the process of layout synthesis and
manufactured in the factory prior to shipment and installation on the building
site. These panels have a well-defined:
– Size (height and width in meters). Height and width are constrained by a
given lower and upper bound provided that is consequence of environmental
or manufacturing limitations.
– Thickness and insulation. Thermal performance of a given panel depends
on several properties: Size, thickness and insulation type. Consider that the
smaller the thickness of the panel the better quality should be the insulation
in order to reach performance objectives.
– New frames (such as new doors and new windows). Given internal structure
of rectangular panels, new frames must respect a parameterizable minimum
distance (Δ) with respect to panel’s borders.
– Cost depending mainly on size and attached equipment (in Euros).
– Thermal performance (in watts per meter square-kelvins, w.m−2 .k −1 )
depending on size, chosen thickness and insulation type.
512 A.F. Barco et al.
2.3 Assumptions
The following assumptions have been taken into account for the present work.
First, all supporting areas are strong enough in such a way that the problem
only deals with the placement of panel’s corners over supporting areas. In other
words, there is unlimited load-bearing capabilities in supporting areas and no
capabilities in the remaining of the facade area. Second, in order to compute
costs and thermal performance, we assume panel’s thickness to be a constant
and we consider only one insulation type. And third, we assume that costs and
thermal performance depends only and are in proportion with panel’s size.
N
cf ac = (wi × hi ) + (α − wi − hi ) (1)
i=1
the junctions for a given envelope is straightforward, formula (2) expresses this
knowledge:
N
ttcf ac = wf ac + hf ac + (wi + hi ) (2)
i=1
where ttcf ac stands for thermal transfer coefficient for facade f ac, wf ac and
hf ac are the facade width and height, respectively, wi and hi represent the width
and height of panel i, respectively, and N is the number of panels composing
the envelope. According to formulas 1 and 2, using large panels is appropriated
to reduce costs and improve thermal insulation. As the larger the panels the
smaller the number of used panels, our optimization function lies on minimizing
the number of used panels.
3.1 Variables
It is worth noticing that this constraint will lead to a very weak filtering,
because the domain of the l variables may be large and the constraint allows
panel overlaps. Therefore, it will be strengthened by the search heuristic.
(C3) Any two distinct panels that both belong to the solution do not overlap:
OpenDiffN(b, o, l)
This corresponds to the Open [22] variant of the DiffN [3] constraint, i.e.
a generalization of DiffN to handle optional rectangles.
(C4) Each frame over the facade must be completely overlapped by one and only
one panel. Additionally, frame borders and panel borders must be separated
by a minimum distance denoted by Δ:
4 Implementation
This section provides details on the model implementation. Basically, our solu-
tion follows the approach in [22] where a set variable is used to handle decision
variables that are potentially in the solution. In this work however, as rectan-
gle variables are already composed of several integer attributes, we found more
natural to use an extra binary variable per rectangle instead of a set variable.
Intuitively, an open constraint with boolean variables may be implemented fol-
lowing traditional filtering algorithms and may be enhanced by targeting the
structure of the problem.
6 if r == −1 then
7 return null; // all rectangles are fixed (a solution has been found)
8 // Find the next variable-value assignment to perform
9 IntegerVariable var, int val;
10 if |dom(bi )| > 1 then
11 var ← bi ;
12 val ← 1;
13 else if |dom(oi1 )| > 1 then
14 var← oi1 ;
15 val ← dom(oi1 ).lb;
16 else if |dom(oi2 )| > 1 then
17 var← oi2 ;
18 val ← dom(oi2 ).lb;
19 else if |dom(li1 )| > 1 then
20 var← li1 ;
21 val ← dom(li1 ).ub;
22 else
23 var← li2 ;
24 val ← dom(li2 ).ub;
25 Branch d = new Branch(var, val);
26 if var == oi1 ∨ var == oi2 then
27 d.once(); // prevents the solver from trying different values upon
backtracking
28 return d;
is strong enough: The lower bound is indeed a valid support from the packing
point of view.
3. The size variables l1 and l2 are set to their upper bounds in order to try
rectangles as large as possible and thus cover the largest possible area. This
enables to get a first solution that is very close to the optimal value.
6 Evaluation
In this section we empirically evaluate our model, which has been implemented in
Java, with the Choco solver [17]. We consider a dataset of 20 instances, generated
from realistic specifications. The total area of the facade ranges from 104 to 106
to test the scalability of the approach. Panels are generated using a lower bound
of 20 (pixels) and an upper bound of 150 (pixels), for both width and height.
2500
Number of panels
2000
1500
1000
500
0
0⋅100 2⋅105 4⋅105 6⋅105 8⋅105 1⋅106 1⋅106 1⋅106
Facade surface
Fig. 5. Maximum number of optional panels and number of used panels in the first
solution, for every instance.
520 A.F. Barco et al.
Time of first solution versus facade surface Number of solutions versus facade surface
20 2500
Without symmetry breaking Without symmetry breaking
18 With symmetry breaking With symmetry breaking
16 2000
Number of Solutions
14
Times in seconds
12 1500
10
8 1000
6
4 500
2
0 0
0⋅100 2⋅105 4⋅105 6⋅105 8⋅105 1⋅106 1⋅106 1⋅106 0⋅100 2⋅105 4⋅105 6⋅105 8⋅105 1⋅106 1⋅106 1⋅106
Facade surface Facade surface
(a) (b)
Fig. 6. Time to reach a first solution and number of computed solutions, with a 60
seconds time limit.
In regard to different search heuristics, we have not found any well-suited for
addressing the problem. Actually, well-known black-box search strategies such
as domOverWDeg, impact-based search or activity-based search, do not per-
form well given the problem particularities. These heuristics are designed to
solve problems in a blind way, when we have no expert knowledge of the prob-
lem. In our case, we mix very different kind of variables (booleans, positions,
sizes) that we are able to group by rectangles and order. Introducing random-
ness on either the variable selection or the value selection may be disastrous. In
particular, using arbitrary values for o1 and o2 makes a huge amount of possi-
bilities for uncovered places. Nonetheless, in order to validate the relevance of
our dedicated heuristic, we have tested 16 predefined heuristics from Choco on
a small facade (400 × 100). We present the results for those ones that threw
at least one solution. These strategies are: domOverWDeg which selects the vari-
able with the smallest ratio |d(x)|
w(x) , where |d(x)| denotes the domain size of a
variable x and w(x) its weighted degree; lexico_LB which chooses the first non-
instantiated variable, and assigns it to its lower bound; lexico_Split which
chooses the first non-instantiated variable, and removes the second half of its
domain; maxReg_LB which chooses the non-instantiated variable with the largest
difference between the two smallest values in its domain, and assigns it to its
lower bound; minDom_LB which chooses the first non-instantiated variable with
the smallest domain size, and assigns it to its lower bound and; minDom_MidValue
which chooses the first non-instantiated variable with the smallest domain size,
Open Packing for Facade-Layout Synthesis Under a General Purpose Solver 521
and assigns it to the value closest to the middle of its domain. The last entry is
our own search heuristic. Recall that variables are ordered as b, o1 , o2 , l1 and l2 .
Strategy First solution time (s) Total time (s) #nodes #solutions
domOverWDeg 18.77 19.94 1412897 66
lexico LB 0.03 0.22 2380 66
lexico Split 0.03 0.16 441 66
maxReg LB 0.03 0.22 2380 66
minDom LB 0.74 19.96 1411183 66
minDom MidValue 43.43 47.32 4755206 66
dedicated 0.03 0.85 10978 66
Table 2. Heuristic comparison on a 400 × 200 (pixels) facade with a 3−minute time
limit
Strategy First solution time (s) #nodes #solutions
domOverWDeg - 7286594 0
lexico LB - 5772501 0
lexico Split - 4966920 0
maxReg LB - 5490088 0
minDom LB - 11961712 0
minDom MidValue - 11157755 0
dedicated 0.039 3499527 726
Tables 1 and 2 respectively provide the results for a 400 × 100 and 400 × 200
instance. Although some predefined heuristics have a good performance on the
first (small) instance, none of them scales. In fact, no predefined search heuristic
finds a solution for a facade with size 400 × 200 in reasonable computational
time whereas our dedicated heuristic already finds 726 different solutions in
180 seconds. Our heuristic clearly outperforms the others. More importantly, it
enables to always output a solution fast, which is critical for the user.
7 Conclusions
This paper presents a solution to the facade-layout synthesis problem treated as
a two-dimensional packing problem. Although there exists a great body of lit-
erature on two-dimensional packing, our industrial scenario includes three char-
acteristics never considered simultaneously: Its deals with the allocation of an
unfixed number of rectangular panels that must not overlap, frames over the
facade must be overlapped by one and only one panel, and facades have specific
areas to attach panels. Thus, as far as we know, no support system nor design
system is well-suited for addressing such particularities.
We have used constraint satisfaction and constraint programming as under-
lying model and solving technique. Constraint programming technology is well-
suited for addressing this industrial problem because on the one hand, an objec-
tive function is identified, namely minimize number of panels, and on the other
522 A.F. Barco et al.
References
1. Barták, R.: Dynamic global constraints in backtracking based environments.
Annals of Operations Research 118(1–4), 101–119 (2003)
2. Beldiceanu, N., Carlsson, M., Poder, E., Sadek, R., Truchet, C.: A generic geomet-
rical constraint kernel in space and time for handling polymorphic k -dimensional
objects. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 180–194. Springer,
Heidelberg (2007)
3. Beldiceanu, N., Carlsson, M., Demassey, S., Poder, E.: New filtering for the cumu-
lative constraint in the context of non-overlapping rectangles. Annals of Operations
Research 184(1), 27–50 (2011)
4. The Energy Conservation Center: Energy Conservation Handbook. The Energy
Conservation Center, Japan (2011)
5. Charman, P.: Solving space planning problems using constraint technology (1993)
6. U.S. Green Building Council: New Construction Reference Guide (2013)
7. Falcon, M., Fontanili, F.: Process modelling of industrialized thermal renovation
of apartment buildings. In: eWork and eBusiness in Architecture, Engineering and
Construction, pp. 363–368 (2010)
8. Imahori, S., Yagiura, M., Nagamochi, H.: Practical algorithms for two-dimensional
packing. Chapter 36 of Handbook of Approximation Algorithms and Metaheuris-
tics (Chapman & Hall/Crc Computer & Information Science Series) (2007)
9. Jelle, B.P.: Traditional, state-of-the-art and future thermal building insulation
materials and solutions - properties, requirements and possibilities. Energy and
Buildings 43(10), 2549–2563 (2011)
Open Packing for Facade-Layout Synthesis Under a General Purpose Solver 523
10. Juan, Y.-K., Gao, P., Wang, J.: A hybrid decision support system for sustain-
able office building renovation and energy performance improvement. Energy and
Buildings 42(3), 290–297 (2010)
11. Laborie, P.: IBM ILOG CP optimizer for detailed scheduling illustrated on three
problems. In: van Hoeve, W.-J., Hooker, J.N. (eds.) CPAIOR 2009. LNCS, vol.
5547, pp. 148–162. Springer, Heidelberg (2009)
12. Lee, K.J., Hyun, W.K., Lee, J.K., Kim, T.H.: Case- and constraint-based project
planning for apartment construction. AI Magazine 19(1), 13–24 (1998)
13. Robin, S.: Liggett. Automated facilities layout: past, present and future. Automa-
tion in Construction 9(2), 197–215 (2000)
14. Montanari, U.: Networks of constraints: Fundamental properties and applications
to picture processing. Information Sciences 7, 95–132 (1974)
15. Olarte, C., Rueda, C., Valencia, F.D.: Models and emerging trends of concurrent
constraint programming. Constraints 18(4), 535–578 (2013)
16. Pérez-Lombard, L., Ortiz, J., Pout, C.: A review on buildings energy consumption
information. Energy and Buildings 40(3), 394–398 (2008)
17. Prud’homme, C., Fages, J.G.: An introduction to Choco 3.0, an open source java
constraint programming library. In: International workshop on CP Solvers: Mod-
eling, Applications, Integration, and Standardization, Uppsala, Sweden (2013)
18. Schulte, C., Tack, G., Lagerkvist, M.Z.: Modeling and programming with Gecode
(2010)
19. Schutt, A., Feydy, T., Stuckey, P.J.: Scheduling optional tasks with explanation.
In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 628–644. Springer, Heidelberg
(2013)
20. Smith, B.M.: Modelling for constraint programming (2005)
21. van Hoeve, W.-J., Hooker, J.N. (eds.): CPAIOR 2009. LNCS, vol. 5547. Springer,
Heidelberg (2009)
22. van Hoeve, W.-J., Régin, J.-C.: Open constraints in a closed world. In: Beck, J.C.,
Smith, B.M. (eds.) CPAIOR 2006. LNCS, vol. 3990, pp. 244–257. Springer, Heidel-
berg (2006)
23. Vareilles, E., Barco Santa, A.F., Falcon, M., Aldanondo, M., Gaborit, P.: Config-
uration of high performance apartment buildings renovation: a constraint based
approach. In: 2013 IEEE International Conference on Industrial Engineering and
Engineering Management (IEEM), pp. 684–688, December 2013
24. Zawidzki, M., Tateyama, K., Nishikawa, I.: The constraints satisfaction prob-
lem approach in the design of an architectural functional layout. Engineering
Optimization 43(9), 943–966 (2011)
Power Capping in High Performance
Computing Systems
1 Introduction
account, with its additional power consumption. The extra infrastructure needed
for cooling down the HPC systems has been proved to be a decisively limiting
factor for the energy performance [3]; a common approach taken to address this
problem is the shift from air cooling to the more efficient liquid cooling [10].
Hardware heterogeneity as well as dynamic power management have started
to be investigated to reduce the energy consumption [16][2]. These low-power
techniques have been derived from the embedded system domain where they
have proven their effectiveness [1]. However, a supercomputer is different from
a mobile handset or a desktop machine. It has a different scale, it cannot be
decoupled by the cooling infrastructures and its usage mode is peculiar: it is
composed by a set of scientific computing applications which run on different
datasets with a predicted end time [7]. Finally supercomputers are expensive (6
orders of magnitude more than an embedded device [19]) making it impossible
for researchers to have them on their desk. These features have limited the
development of ad-hoc power management solutions.
Current supercomputers cooling infrastructures are designed to withstand
power consumption at the peak performance point. However, the typical
supercomputer workload is far below the 100% resource utilization and also
the jobs submitted by different users are subject to different computational
requirements[29]. Hence, cooling infrastructures are often over-designed. To
reduce overheads induced by cooling over-provisioning several works suggest to
optimize job dispatching (resource allocation plus scheduling) exploiting non-
uniformity in thermal and power evolutions [8][20][21][23]. Currently most of
these works are based on simulations and model assumptions which unfortu-
nately are not mature enough to be implemented on HPC systems in production,
yet.
With the goal of increasing the energy efficiency, modern supercomputers
adopt complex and hybrid cooling solutions which try to limit the active cool-
ing (chiller, air conditioner) by allowing direct heat exchange with the ambient
(Free-cooling). Authors in [12] show for the 2013’s top GEEN500 supercom-
puter that the cooling costs increase four times when the ambient temperature
moves from 10 C to 40 C. Moreover the authors show that for a given ambient
temperature there is a well-defined maximum power budget which guarantees
efficient cooling. With an ambient temperature of 10 C the power budget which
maximizes the efficiency is 45KWatt while at 40 C is 15KWatt. Unfortunately,
today’s ITs infrastructure can control its power consumption only reducing the
power and performance of each computing node. This approach is not suitable
for HPC system where users require to execute their application in a portion
of the machine with guaranteed performance. A solution commonly adopted in
HPC systems is power capping[25][17][15][27][22], which means forcing a super-
computer not to consume more than a certain amount of power at any given
time. In this paper we study a technique to achieve a power capping by acting
on the number of job entering the system.
526 A. Borghesi et al.
The PBS Dispatcher: The tool currently used to manage the workload on Eurora
system is PBS [28] (Portable Batch System), a proprietary job scheduler by
Altair PBS Works which has the task of allocating computational activities,
i.e. batch jobs, among available computing resources. The main components of
PBS are a server (which manages the jobs) and several daemons running on the
execution hosts (i.e. the 64 nodes of Eurora), which track the resource usage and
answer to polling requests about the host state issued by the server component.
Jobs are submitted by the users into one of multiple queues, each one char-
acterized by different access requirements and by a different estimated waiting
time. Users submit their jobs by specifying 1) the number of required nodes;
2) the number of required cores per node; 3) the number of required GPUs and
MICs per node (never both of them at the same time); 4) the amount of required
memory per node; 5) the maximum execution time. All processes that exceed
their maximum execution time are killed. The main available queues on the
Eurora system are called debug, parallel, and longpar. PBS periodically selects
a job to be executed considering the current state of the nodes - trying to find
enough available resources to start the job. If there are not enough available
resources the job is returned to its queue and PBS considers the following can-
didate. The choices are guided by priority values and hard-coded constraints
defined by the Eurora administrators with the aim to have a good machine uti-
lization and small waiting times. For more detailed information regarding the
system see [7].
Why CP? In its current state, the PBS system works mostly as an on-line
heuristic, incurring the risk to make poor resource assignments due to the lack
of an overall plan; furthermore, it does not include a power capping feature yet.
Power Capping in High Performance Computing Systems 527
Other than that, as we shown in our previous work the lack of an overall plan may
lead to poor resource assignments. The task of obtaining a dispatching plan on
Eurora can be naturally framed as a resource allocation and scheduling problem,
for which CP has a long track of success stories. Nevertheless since the problem
is very complex and we are constrained by very strict time limits (due to the
real-time requirements of a supercomputer dispatcher) it is simply not possible
to always find a optimal solutions. Therefore, we used CP in combination with
multiple heuristic approaches in order to quickly find the resource allocation and
schedule needed.
3 Problem Definition
We give now a more detailed definition of the problem. Each job i enters the sys-
tem at a certain arrival time qi , by being submitted to a specific queue (depend-
ing on the user choices and on the job characteristics). By analyzing existing
execution traces coming from PBS, we have determined an estimated waiting
time for each queue, which applies to each job it contains: we refer to this value
as ewti .
When submitting the job, the user has to specify several pieces of information,
including the maximum allowed execution time Di , the maximum number of
nodes to be used rni , and the required resources (cores, memory, GPUs, MICs).
By convention, the PBS system considers each job as if it was divided into a
set of exactly rni identical “job units”, to be mapped each on a single node.
Formally, let R be a set of indexes corresponding to the resource types (cores,
memory, GPUs, MICs), and let the capacity of a node k ∈ K for resource r ∈ R
be denoted as capk,r . Let rqi,r be the requirement of a unit of job i for resource r.
The dispatching problem at time τ requires to assign a start time si ≥ τ to each
waiting job i and a node to each of its units. All the resource and power capacity
limits should be respected, taking into account the presence of jobs already in
execution. Once the problem is solved, only the jobs having si = τ are actually
dispatched. The single activities have no deadline or release time (i.e. they do
not have to end within or start after a certain date), nor the global makespan is
constrained by any upper bound.
Along with the aforementioned resources in this problem we introduce an
additional finite resource, the power. This will allow us to model and enforce the
power capping constraint. The power capping level, i.e. the maximal amount of
power consumed by the system at any given time, is specified by the user and
represents the capacity of the fake power resource; the sum of all the power con-
sumed by the running job plus the sum of power values related to idle resources
must never exceed the given limit throughout the execution of the whole sched-
ule. Another important thing to notice is that the power “resource” has not a
linear behaviour in terms of the computational workload: the first activation of
a core in a node causes greater power consumptions for the remaining cores in
that node.
The goal is to reduce the waiting times, as a measure of the Quality of Service
guaranteed to the supercomputer users.
528 A. Borghesi et al.
1
This criterion should decrease the fragmentation of the system, trying to fit as many
job as possible on the same node.
Power Capping in High Performance Computing Systems 529
24 orderByRules(R);
25 orderByRules(J);
26 time ← min(endT imes);
if the job cannot start we must undo the possible changes made to the system
usage we made in advance (updateU sages(rni , R), line 23). Finally, after having
dealt with all schedulable jobs we reorder the activities and nodes (the activity
pool is changed and the nodes order depends on the usages), lines 24-25, and
compute the closest time point where some used resource becomes free, following
time-event, i.e. the minimal end time of the running activities (line 26).
It is important to note that since in this problem we have no deadline on the
single activities nor a constraint on the global makespan, the PRB algorithm will
always find a feasible solution, for example delaying the least important jobs until
enough resources become available due to the completion of previously started
tasks.
5 Hybrid Approach
As previously discussed in [7] the task of obtaining a proactive dispatching plan
on Eurora can be naturally framed as a resource allocation and scheduling
530 A. Borghesi et al.
power consumed in the system, 2) we assume that the jobs always run on the
nodes which require less power and 3) we overlook the non-linear behaviour
of the power consumption. These relaxations may produce infeasible solutions,
since a feasible schedule must take into account that the resource are actually
split among heterogeneous nodes and consider also the idle nodes for the power
capping. The following stage of our method will naturally fix these possible
infeasibilities during the allocation phase.
We define the scheduling model using Conditional Intervals Variables
(CVI)[24]. A CVI τ represents an interval of time: the start of the interval is
referred to as s(τ ) and its end as e(τ ); the duration is d(τ ). The interval may or
may not be present, depending on the value of its existence expression x(τ ) (if
not present it does not affect the model). CVIs can be subject to several different
constraints, among them the cumulative constraint[4] to model finite capacity
resources.
∀r ∈ R cumulative(τ, reqr , CapTr ) (1)
where τ is the vector with all the interval vars, where reqr are the job require-
ments for resource r - using past execution traces we learned a simple model to
estimate the power consumed by a job based on its requirements. As mentioned
in section 3 this model is not linear. The cumulative constraints in 1 enforce that
at any given time, the sum of all job requirements will not exceed the available
capacity (for every resource type).
With this model it would be easy to define several different goals, depending
on the metric we optimize. Currently we use as objective function the weighted
queue time, i.e. we want to minimize the sum of the waiting times of all the jobs,
weighted on estimated waiting time for each job (greater weights to job which
should not wait long):
max ewti
min (s(τi ) − qi ) (2)
ewti
i∈I
both mapping and start times, whereas in our hybrid approach we need only to
allocate the jobs.
The behaviour of this algorithm (also referred as mapper ) is very close to
the PRB one described in Section 4 and in particular the rules used to order
jobs and resources are identical. The key difference is that now we already know
the start and end times of the activities (at least the possible ones, they may
change if any infeasibility is detected). This algorithm proceeds by time-step: at
each time event t it considers only the jobs that should start at time t according
to the relaxed CP model described previously, while the simple PRB algorithm
considers at each time-event all the activities that still need to be scheduled.
During this phase the power is also taken into account, again seen as a finite
resource with capacity defined by the power cap; here we consider both active
and idle nodes powers. If the job can be mapped somewhere in the system the
start time t from the previous stage is kept, otherwise - if there are not enough
resources available to satisfy the requirements - the previously computed start
time is discarded and the job will become eligible to be scheduled at the next
time-step t . At the next time event t all the jobs that should start are consid-
ered, plus the jobs that possibly have been postponed due to scarce resources at
the previous time-step. Through this postponing we are fixing the infeasibilities
inherited from the relaxed CP model.
Again, since in this problem we have no constraints on the total duration of
a schedule, it is always possible to delay a job until the system will have enough
available resources to run it, thus this method is guaranteed to find a feasible
solution.
6 Added Value of CP
We decided to make our experiments using two artificial versions of the Eurora
machine: A) a machine composed with 8 nodes and B) a machine with 32 nodes.
In addition to the real traces (set base) we generated two more sets of instances,
one which is composed by especially computationally intensive jobs, in terms
of resource requested (highLoad ), and one which presents jobs composed by
2
https://developers.google.com/optimization/
534 A. Borghesi et al.
Machine with 8 nodes: Figures 1, 2 and 3 show the results of the experiments
with the machine with 8 nodes; each figure corresponds respectively to the base
Power Capping in High Performance Computing Systems 535
workload set of instances (both size 25 and 50 jobs), the highLoad case and
finally the manyUnits case. The solid lines represent the ratios between the
average queue times obtained by PRB and those obtained by DEC feedBack ;
conversely, the dashed line is the ratio between PRB and DEC noFeedBack. As
we can see in Figure 1 with an average workload the hybrid approaches usually
outperform the heuristic algorithm, markedly in the 25 jobs case and especially
at tighter power capping. With less tight power capping levels usually the hybrid
approaches and PRB offer more similar results; this is reasonable since when the
power constraints are more relaxed the allocation and scheduling decisions are
more straightforward and the more advanced reasoning offered by CP is less
necessary.
It is easy also to see that the hybrid method with the feedback mechanism
always outperforms the feedback-less as we expected: the feedback-less solu-
tion has always inferior quality w.r.t. to those generated by the method with
the interaction - the solution produced by DEC feedBack is the same produced
by DEC noFeedBack. Our focus should be on the extent of the improvement
guaranteed by the feedback mechanism in relation to the longer time required
to reach a solution. For example, Fig.1 (corresponding to the original Eurora
workloads) shows that the feedback method offers clear advantages, in particu-
lar with tighter power constraints (around 10%-15% gain over the feedback-less
one), a fact that could justify its use despite the longer times required to reach a
solution. Conversely Figure 2 reveals that the two hybrid approaches offer very
similar performance if the workload is very intensive, leading us to prefer the
faster DEC noFeedBack in these circumstances in case of the implementation of
the real dispatcher.
If we consider the workload characterized by an unusually high amount of
job-units per job we can see slightly different results: as displayed in Figure 3,
DEC feedBack definitely outperforms the other two methods with tight power
capping values, especially in the case of instances of 25 jobs. When the power
constraints get more relaxed the three approaches offers almost the same results.
536 A. Borghesi et al.
Machine with 32 nodes: In Figures 4 and 5 we can see the results of some of the
experiments done on the machine with 32 nodes (in particular we present the
case size 40 and 100); we present only a subset of the experiments made due to
space limitations, but the results not shown comply with those presented here.
Figure 4 shows again the comparison between the two hybrid approaches
and the heuristic technique in the case of average workload. The pattern here is
slightly different from the 8-nodes case: after an initial phase where the hybrid
methods perform better, PRB offers better results for intermediate levels of
power capping (around 3000W); after that we can see a new gain offered by
the hybrid techniques until we reach a power capping level around 6000W (the
power constraint relaxes), where the three approaches provide more or less
the same results. It is evident again that the method with feedback outperforms
the feedback-less one, especially with the larger instances.
In Figure 5 we can see the results obtained with the computationally more
intensive workload. In this case PRB performs generally better at lower power
capping levels until the power constraint become less tight and the three methods
produce similar outcomes again.
7 Conclusions
In this paper we dealt with the allocation and scheduling problem on Eurora
HCP system subject to the power consumption constraint - power capping. We
presented two approaches to solve this problem: 1) a heuristic algorithm and
2) a novel, hybrid approach which combines a CP model for scheduling and a
heuristic component for the allocation. We compared the two approaches using
the average queue times as an evaluation metrics. Short waiting times correspond
to a higher quality of service for the system users.
We tackled a complex problem due to the limited amount of multiple, hetero-
geneous, resources and the additional constraint introduced by the finite power
budget. In addition to the complexity of the problem (scheduling and allocation
are NP-Hard problems) we also had to consider the real-time nature of the appli-
cation we wanted to develop, thus we had to focus on methods able to quickly
produce good solutions. In this preliminary study we shown that the quality of
the solution found by the different approaches varies with the levels of power
capping considered.
As a long-term goal we plan to further develop the preliminary power capping
feature presented here in order to integrate it within the actual dispatcher we
already developed and implemented on Euora. In order to do that we will need
to develop methods to allow our approach to operate quickly enough to match
the frequency of job arrivals; the heuristic would be already fast enough but the
hybrid approach will require us to research new techniques in order to cope with
the real-sized version of Eurora - and possibly even larger systems.
Acknowledgement. This work was partially supported by the FP7 ERC Advance
project MULTITHERMAN (g.a. 291125). We also want to thank CINECA and
Eurotech for granting us the access to their systems.
References
1. Mudge, N.: In: Culler, P., Druschel, D.E. (eds.) OSDI. USENIX Association (2002).
Operating Systems Review 36(Special Issue), Winter 2002
2. Auweter, A., et al.: A case study of energy aware scheduling on supermuc.
In: Kunkel, J.M., Ludwig, T., Meuer, H.W. (eds.) ISC 2014. LNCS, vol. 8488,
pp. 394–409. Springer, Heidelberg (2014)
3. Banerjee, A., Mukherjee, T., Varsamopoulos, G., Gupta, S.K.S.: Cooling-aware and
thermal-aware workload placement for green hpc data centers. In: Green Comput-
ing Conference, pp. 245–256 (2010)
4. Baptiste, P., Laborie, P., Le Pape, C., Nuijten, W.: Constraint-based scheduling
and planning. Foundations of Artificial Intelligence 2, 761–799 (2006)
5. Baptiste, P., Le Pape, C., Nuijten, W.: Constraint-based scheduling. Kluwer Aca-
demic Publishers (2001)
6. Bartolini, A., Cacciari, M., Cavazzoni, C., Tecchiolli, G., Benini, L.: Unveiling
eurora - thermal and power characterization of the most energy-efficient supercom-
puter in the world. In: Design, Automation Test in Europe Conference Exhibition
(DATE), 2014, March 2014
Power Capping in High Performance Computing Systems 539
7. Bartolini, A., Borghesi, A., Bridi, T., Lombardi, M., Milano, M.: Proactive work-
load dispatching on the EURORA supercomputer. In: O’Sullivan, B. (ed.) CP 2014.
LNCS, vol. 8656, pp. 765–780. Springer, Heidelberg (2014)
8. Bartolini, A., Cacciari, M., Tilli, A., Benini, L.: Thermal and energy management
of high-performance multicores: Distributed and self-calibrating model-predictive
controller. IEEE Trans. Parallel Distrib. Syst. 24(1), 170–183 (2013)
9. Bergman, K., Borkar, S., Campbell, D., Carlson, W., Dally, W., Denneau, M.,
Franzon, P., Harrod, W., Hiller, J., Karp, S., Keckler, S., Klein, D., Lucas, R.,
Richards, M., Scarpelli, A., Scott, S., Snavely, A., Sterling, T., Williams, R.S.,
Yelick, K., Bergman, K., Borkar, S., Campbell, D., Carlson, W., Dally, W., Den-
neau, M., Franzon, P., Harrod, W., Hiller, J., Keckler, S., Klein, D., Kogge, P.,
Williams, R.S., Yelick, K.: Exascale computing study: Technology challenges in
achieving exascale systems, September 2008
10. Chu, R.C., Simons, R.E., Ellsworth, M.J., Schmidt, R.R., Cozzolino, V.: Review
of cooling technologies for computer products. IEEE Transactions on Device and
Materials Reliability 4(4), 568–585 (2004)
11. Collina, F.: Tecniche di workload dispatching sotto vincoli di potenza. Master’s
thesis, Alma Mater Studiorum Università di Bologna (2014)
12. Conficoni, C., Bartolini, A., Tilli, A., Tecchiolli, G., Benini, L.: Energy-aware cool-
ing for hot-water cooled supercomputers. Proceedings of the 2015 Design. Automa-
tion & Test in Europe Conference & Exhibition, DATE 2015, pp. 1353–1358. EDA
Consortium, San Jose (2015)
13. Dongarra, J.J.: Visit to the national university for defense technology changsha,
china. Technical report, University of Tennessee, June 2013
14. Dongarra, J.J., Meuer, H.W., Strohmaier, E.: 29th top500 Supercomputer Sites.
Technical report, Top500.org, November 1994
15. Fan, X., Weber, W.-D., Barroso, L.A.: Power provisioning for a warehouse-sized
computer. In: ACM SIGARCH Computer Architecture News, vol. 35, pp. 13–23.
ACM (2007)
16. Feng, W.-C., Cameron, K.: The Green500 List: Encouraging Sustainable Super-
computing. IEEE Computer 40(12) (2007)
17. Gandhi, A., Harchol-Balter, M., Das, R., Kephart, J.O., Lefurgy, C.: Power capping
via forced idleness (2009)
18. Haupt, R.: A survey of priority rule-based scheduling. Operations-Research-
Spektrum 11(1), 3–16 (1989)
19. Kim, J.M., Chung, S.W., Seo, S.K.: Looking into heterogeneity: When simple is
faster
20. Kim, J., Ruggiero, M., Atienza, D.: Free cooling-aware dynamic power manage-
ment for green datacenters. In: 2012 International Conference on High Performance
Computing and Simulation (HPCS), pp. 140–146, July 2012
21. Kim, J., Ruggiero, M., Atienza, D., Lederberger, M.: Correlation-aware virtual
machine allocation for energy-efficient datacenters. In: Proceedings of the Confer-
ence on Design. Automation and Test in Europe, DATE 2013, pp. 1345–1350. EDA
Consortium, San Jose (2013)
22. Kontorinis, V., Zhang, L.E., Aksanli, B., Sampson, J., Homayoun, H., Pettis, E.,
Tullsen, D.M., Rosing, T.S.: Managing distributed ups energy for effective power
capping in data centers. In: 2012 39th Annual International Symposium on Com-
puter Architecture (ISCA), pp. 488–499. IEEE (2012)
540 A. Borghesi et al.
23. Kudithipudi, D., Qu, Q., Coskun, A.K.: Thermal management in many core sys-
tems. In: Khan, S.U., Koodziej, J., Li, J., Zomaya, A.Y. (eds.) Evolutionary Based
Solutions for Green Computing. SCI, vol. 432, pp. 161–185. Springer, Heidelberg
(2013)
24. Laborie, P., Rogerie, J.: Reasoning with conditional time-intervals. In: Proc. of
FLAIRS, pp. 555–560 (2008)
25. Lefurgy, C., Wang, X., Ware, M.: Power capping: a prelude to power shifting.
Cluster Computing 11(2), 183–195 (2008)
26. Pape, C.L., Couronné, P., Vergamini, D., Gosselin, V.: Time-versus-capacity com-
promises in project scheduling. In Proc. of the 13th Workshop of the UK Planning
Special Interest Group, pp. 1–13 (1994)
27. Reda, S., Cochran, R., Coskun, A.K.: Adaptive power capping for servers with
multithreaded workloads. IEEE Micro 32(5), 64–75 (2012)
28. Altair PBS Works: Pbs professional12.2 administrator’s guide (2013). http://
resources.altair.com/pbs/documentation/support/PBSProAdminGuide12.2.pdf
29. You, H., Zhang, H.: Comprehensive workload analysis and modeling of a petascale
supercomputer. In: Cirne, W., Desai, N., Frachtenberg, E., Schwiegelshohn, U.
(eds.) JSSPP 2012. Lecture Notes in Computer Science, vol. 7698, pp. 253–271.
Springer, Heidelberg (2013)
A Constraint-Based Approach to the Differential
Harvest Problem
1 Introduction
In precision viticulture, many studies have proposed to define field quality zones
[14]. They demonstrated the technical and economic value of a differential har-
vesting of these different zones. This interest justifies the recent development
of prototypes of conventional grape harvesting machines able to sort two types
of harvest quality, such as the EnoControlTM system prototype (newHolland
Agriculture, PA, USA). These grape harvesting machines have two tanks, called
hoppers, able to differentiate two types of grape quality, named A and B, accord-
ing to the harvested zone.
Optimizing harvest consists on minimizing the working time of grape har-
vester. This time corresponds to travel time and emptying time of the machine.
Ideally, this goal requires that both hoppers of the machine are full at each
emptying. In the case of selective harvesting, the simultaneous filling of the
two hoppers is combinatorial and complex. Indeed, the hopper that contains A
grapes can fill up at a speed different from the hopper that contains B grapes,
depending on the harvested zone. Other issues have to be considered. Top quality
grapes should not be altered (mixed with lower quality grapes) when the har-
vester moves from one quality zone to another. Turning radius of the machine
must also be taken into account.
This problem, called Differential Harvest Problem, has not been studied in
the literature except in a preliminary study we published in [4]. A comparison
with routing problems can be established. For instance, Bochtis et al. [1,2] show
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 541–556, 2015.
DOI: 10.1007/978-3-319-23219-5 38
542 N. Briot et al.
row, the type of transitions may vary according to the direction that the row is
harvested. Because of latency, the quantity of A grapes (resp. B grapes) that
are collected within a given row can change with the direction. For instance,
consider a row where the sequence of quality areas is A-B-A-B (see Figure 1). If
the machine harvests the row from left to right, there is only one B-A transition.
If the machine harvests the row in the opposite direction, two transitions B-A
appear. Thus, quantities of A grapes and B grapes harvested will necessarily
depend on the direction in which the rows are harvested.
A hopper:
B&A hopper:
Latency
A hopper:
B&A hopper:
Latency Latency
Fig. 2. Three possibilities to fill the hoppers. (a) A grapes and B grapes are separated.
(b) When A hopper is full, A grapes and B grapes are mixed in the B&A hopper. (c)
Once Rmin has been reached, A grapes and B grapes are mixed in the two hoppers.
Another important information is the cost of the path between two extremi-
ties of different rows and between row extremities and the bin place. We denote
d(p, q) = d(q, p) ∀p, q ∈ {0, 1, . . . , 2n − 1} ∪ {2n} the time required to go from
an extremity p to an extremity q (where 2n denotes the bin place). This cost
depends on the distances between extremities and the turning radius of the
harvesting machine.
We are ready to define the problem.
Given a set of variables and a set of possible values for each variable, given a
set of constraints, and given an optimization criterion, constraint optimization
consists in finding an instantiation of variables that satisfies all constraints of
the problem and minimizes the criterion.
0 1 2 3 4 5 6 7
Step 0 1 2 3 4 5 6 7
Row 1 4 5 7 0 2 3 6
Orientation 0 1 0 1 0 1 0 1
Emptying into the bin? 0 1 0 0 0 1 0 1
machine goes to the bin and must have harvested at least a total of Rmin
A grapes. After step k, A grapes and B grapes are mixed in both hoppers.
In the first version of this Step model we included k as a variable but experi-
mental results were very bad. The combinatorial aspect of the problem decreases
if we set k to a fixed value. Hence, each instance of the original problem is
replaced by a set of sub-instances with different values of k. According to the
capacity of the hoppers and the value of Rmin, few values of k must be consid-
ered. Since these instances are independent, they can be executed in parallel.
In section 4, we will see that this model is not effective. The next subsection
gives another model for the DHP, based on models for routing problems.
The Precedence model is based on variables that represent the previous row of a
row. Our model shares similarities with the model presented in [9] for the Vehicle
Routing Problem.
For a given instance of the Differential Harvest Problem, suppose that we
have an upper bound λ on the number of times the hoppers have to be dumped
into the bin. We note γ the number of dumps used in the differential part (begin-
ning) of the harvest (γ ≤ λ ≤ n) where n is the number of rows in the vine field.
We call R = {0, . . . , n−1} the set of rows. S = R∪{n, . . . , n+γ −1, . . . , n+λ−1}
denotes the set of sites (rows and hopper dumps into the bin).
0 1 2 3 4 5 6 7
8 9
10
Site 0 1 2 3 4 5 6 7 8 9 10
Predecessor 7 10 0 8 1 9 3 5 2 4 6
Orientation 0 0 1 0 1 0 1 1
Mix 0 0 0 1 0 0 1 0 0 0 1
– Pi , Si : are integer variables that represent the direct predecessor (Pi ) and
direct successor (Si ) of site i. We have D(Pi ) = D(Si ) = S \ {i};
– Mixi : is a Boolean variable that represents the harvest mode in site i. If
M ixi = 0 the A grapes are separated (differential harvest) otherwise they
are mixed with B grapes. The domain of this variable is: D(M ixi ) = {0, 1};
– Ti : is an integer variable that represents the time to travel from Pi to site
i, including the time to harvest row i. D(Ti ) = N;
– UA B
i , Ui are integer variables that represent the quantity of A grapes and B
grapes harvested up to site i since the last dump into the bin. The domains
are: D(UiA ) = D(UiB ) = {0, . . . , 2 × Cmax}.
P Si = i SPi = i ∀i ∈ S (2)
Constraints (3) and (4) force the harvest mode to be differential or mixed accord-
ing to the index of the corresponding hopper dump. Constraint (5) is an element
constraint that communicates the harvest mode between successors:
The following constraints give the quantities of grapes according to the orienta-
tion of the row. It can be implemented as a table constraint or as an if . . . then
. . . else one. ∀r ∈ R, we have :
uA A A
r = Orir × Q2r→2r+1 + (1 − Orir ) × Q2r+1→2r (6)
uB B B
r = Orir × Q2r→2r+1 + (1 − Orir ) × Q2r+1→2r (7)
Constraint (8) fixes quantities A and B for all sites representing dumps into
the bin. Constraint (9) computes the quantities at the end of row i by adding
548 N. Briot et al.
the accumulated amount from predecessor Pi and the quantity in row i given by
the precedent constraints.
Harvested quantities are limited by the capacity of hoppers. Variable UiA always
have an upper bound of 2Cmax because A grapes can be put in the two hoppers.
When variable M ixi = 0, harvest is not mixed and quantity of B grapes is bound
by Cmax (10). When variable M ixi = 1, A grapes and B grapes are mixed in the
two hoppers. Constraint (11) checks that the total amount of harvested grapes
is smaller than the capacity of the two hoppers:
Constraint (12) requires to harvest at least Rmin A grapes. Only the A grapes
stored in A hopper must be considered. This quantity corresponds to the part of
UiA which is smaller than the capacity of the A hopper. It concerns the differential
harvest mode only, i.e. dumps from n to n + γ − 1.
n+γ−1
min(UpAi , Cmax) ≥ Rmin (12)
i=n
Constraint (13) forces the exit from row Pi to be on the same side of the vine
field as the entrance of row i. Hence, Pi and i have inverse orientations. This is
the case in practice with traditional routing.
Next constraints ((14a) and (14b)) require a unique cycle (subtour elimination)
on predecessor variables and successor variables. Figure 5 is an example of fil-
tering for the circuit constraint described in [5,12].
Constraint (16) is the objective function that minimizes the travel time of
the grape harvester:
n+λ−1
M inimize Ti (16)
i=0
Symmetry Breaking. The main variables of this model are predecessor vari-
ables. They take their values in a set of rows and dumps into the bin. For the
set of dumps in the differential (or mixed) mode, there is a value symmetry
caused by the possibility to dump indexes. To break this symmetry, we add an
550 N. Briot et al.
ordering constraint (17a) (resp. (17b)) on the variables that correspond to the
same harvest mode.
4 Experimental Results
Fig. 6. A vine field with two qualities B grapes in red and A grapes in green.
Table 1 reports results with Step and Precedence models for 10, 12 and 14
rows. Each row in the table reports the average time on 12 instances of the
given size generated from contiguous sequences of rows of the vine field. For
each sequence, we experimented with two capacities of the hoppers (1000 and
2000) and two values for the desired threshold Rmin (50% and 70% of the total
amount of A grapes).
A Constraint-Based Approach to the Differential Harvest Problem 551
For the Step model, each instance of the Differential Harvest Problem is split
into a set of more specific sub-instances of the constraint optimization problem.
Each sub-instance is associated with a fixed value k of number of rows harvested
on differential mode. For 10 (resp. 12) rows we varied k from 4 to 8 (resp. 6 to
10). Each set of sub-instances can be solved in parallel. So, Table 1 shows the
maximum time needed to solve a sub-instance of a given set. The total time (for
all sub-instances) corresponds to a single core architecture. Table 1 also gives
the time for the sub-instance which has the optimal solution. With sequences
of 14 rows, at least one sub-instance of each instance is not solved before the
timeout (7200 sec).
Table 1. Comparison of the Step model and the Precedence model. All CPU times
are averages on 12 instances and are given in seconds. Timeout at 7200 seconds.
These results show that the Step model is clearly outperformed by the Prece-
dence model. One disadvantage of the Step model is that it has to communicate
the harvested quantities between steps. Hence, as long as the route is undefined,
it is impossible to know if the capacity of hoppers is exceeded and if Rmin is
reached. This hinders propagation. There is another drawback of the Step model.
It assumes a fixed value k for the step on which differential harvest stops (A
grapes and B grapes are mixed from step k to step n). Finding an optimal solu-
tion requires to solve several instances of the problem with different values of k.
This can be done in parallel as the problems are independent. But Table 1 shows
that, even with an oracle predicting the value k of the sub-instance containing
the optimal solution of the original instance, the Step model is outperformed by
the Precedence model.
Table 2 shows results for instances of the Precedence model for sequences
of 12, 14 and 16 rows. The first column shows the number of rows in the vine
field. The second column gives the capacity of the hoppers (Cmax) and the third
column gives the desired threshold Rmin. For each size of problem, we give the
average time to solve it and the average number of nodes. Timeout is 7200 sec.
For 16 rows with a Cmax value of 1000 and for any greater number of rows, all
instances exeeded the timeout.
552 N. Briot et al.
These results indicate fairly high variability in CPU times. Instances with
a small value of Cmax seem to be more difficult to solve. When the threshold
Rmin is equal to 50% of A grapes, CPU time generally increases.
Table 3 shows results for different configurations of the Precedence model.
All CPU times and node numbers are average on all instances of the same
number of rows. The first two columns correspond to the complete Precedence
model. The next columns give the results for variants of this model: without
symmetry breaking (constraints (17a) and (17b)); with constraint (12) instead
of constraints (12’a), (12’b) and (12’c); and with the default Choco variable
ordering (minDomain) instead of the DomOverWDeg strategy.
Despite a small number of bins, adding constraints to eliminate symmetric
solutions helps a lot to reduce the search effort. It is also the case when con-
straint (12) with the minimum function is replaced by constraints (12’a), (12’b)
and (12’c), or when the default Choco variable ordering is replaced by DomOver-
WDeg.
5 Discussion
Our experimental results show that the Precedence model is orders of magnitude
faster than the Step model. For small instances (up to 16 rows), the Precedence
model solves the Differential Havest Problem in a reasonable amount of time.
For larger instances, the timeout of 2 hours is generally reached. This amount
of time has to be compared to the time needed to collect data and to build the
A Constraint-Based Approach to the Differential Harvest Problem 553
quality and yield map for the vine field. With additional improvements of the
CP model, we can expect to solve larger real instances.
Our results confirm what other studies have reported on similar problems
like the BBSS problem presented in [7]. In that paper, Di Gaspero et al. show
that a Step formulation is outperformed by Routing (similar to Precedence)
formulation for the optimal solution. In a second experiment, they show that
large neighborhood search (LNS) is a good approach to decrease the time to
solve, though the optimal solution can no longer be guaranteed. It could be
interesting to explore that direction.
Contrary to our expectations, it was not difficult to express our model of the
Differential Harvesting Problem as a set of linear constraints on integer variables.
Such a problem can be solved with Integer Linear Programming (ILP).
So we have designed an ILP model using the two-index vehicle flow formula-
tion of the Capacited Vehicle Routing Problem (CVRP) introduced by Laporte,
Nobert, and Desrochers [10]. There is one Boolean variable xt:i→j , for each pair
i, j of rows extremities and bin on tour t. Each tour corresponds to a single mode
of harvest (differential or not). xt:i→j is equal to 1 if the harvesting machine goes
from i to j on tour t and 0 otherwise. Constraints on the xt:i→j variables ensure
that each extremity is visited exactly once on all routes. Quantities of grapes
harvested in each tour are expressed by a summation over the traversed rows and
similarly for travel cost (objective function). As in CVRP formulation, there are
constraints on capacity of hoppers according to the tour t. Variables and linear
constraints (12’a), (12’b), and (12’c) on threshold Rmin can directly be added
to the ILP formulation.
Unfortunately, the cycle constraint cannot be added so easily. The basic ILP
approach to forbid sub-tours(cycles that do not pass through the bin) is to
post constraints of the form i,j∈S xt:i→j < |S| for any subset S of extremities
of rows. The number of such constraints is exponential. Another formulation
introduced by Miller, Tucker, and Zemlin (M T Z − f ormulation [11]) makes the
number of constraints polynomial but its linear relaxation generally produces a
significantly weaker lower bound compared to the basic model [6]. Hence, a typ-
ical approach consists in adding the sub-tour elimination constraints incremen-
tally, as follows: Step 1: find an optimal solution (without sub-tour constraints
at the beginning). Step 2: If the solution does not contain sub-tours, it is an
optimal solution of the problem; Otherwise, new constraints are added to forbid
all the sub-tours in the current solution. Then, proceed to Step 1. In the worst
case, this algorithm has to solve an exponential number of instances with finally
an exponential number of constraints on sub-tours. Thus, each intermediate ILP
loop gives relaxed solutions that contain sub-tours between rows. It is only in
the last ILP step that the reported (optimal) solution does not contain sub-
tours and can be exploited. As a consequence, if we interrupt the ILP solver at
a given timeout limit, it has not yet produced any feasible solution, not even
554 N. Briot et al.
Table 4. Comparison between CP model and ILP model for 12, 14, 16 and 24 rows,
Cmax = 1000, Rmin = 70% and timeout of 7200s. In bold, optimal solutions.
suboptimal ones. This is an advantage of the CP model over the ILP model. Any
of its solutions, at any time in the solving process, can be exploited.
We have implemented the ILP model with the Cplex solver [8]. Table 4 shows
a comparison between the Precedence model and the ILP formulation using a
single core. Tests are performed with and without an initial upper bound. This
bound is an estimation of the harvest time using a manual routing based on
a repetitive pattern. This upper bound does not improve the ILP results so
we give only one value for the ILP model. Preliminary experiments show that
the ILP formulation clearly outperforms the CP model for small instances. But
for hard instances (n ≥ 16 and Cmax = 1000), ILP search fails to obtain a
solution before the timeout of 7200 seconds. On hard instances the CP model can
find suboptimal solutions that significantly improve the manual routing solution
whilst ILP provides no solution at all.
6 Conclusion
In this paper, we have presented the Differential Harvest Problem in precision
viticulture. We have proposed to use constraint programming to solve it. Two
models have been presented, the Step model and the Precedence model. In the
Step model, variables represent the row that is visited at a given time step and in
which direction the row is traversed. In the Precedence model, variables connect
a row to its predecessor and successor. The experiments we have performed to
assess the behavior of these models show that the Precedence model is orders
of magnitude faster than the Step model. We have also experimentally shown
that an ILP formulation of the Differential Harvest Problem outperforms our
CP approach on easy instances. However, such an ILP formulation requires an
exponential space, and more importantly, fails to produce solutions on hard
instances. All in all, our Precedence model seems to be a good approach. It
allows to solve the problem on real data within reasonable time and it inherits
the flexibility of CP models, that allows the addition of extra user-constraints
in a simple way.
References
1. Bochtis, D.D., Sørensen, C.G.: The vehicle routing problem in field logistics: part
i. Biosystems Engineering 104, 447–457 (2009)
2. Bochtis, D.D., Sørensen, C.G.: The vehicle routing problem in field logistics: part
ii. Biosystems Engineering 105, 180–188 (2010)
3. Boussemart, F., Hemery, F., Lecoutre, C., Sais, L.: Boosting systematic search
by weighting constraints. In: Proceedings of the 16th Eureopean Conference on
Artificial Intelligence (ECAI 2004), Valencia, Spain, pp. 146–150 (2004)
4. Briot, N., Bessiere, C., Tisseyre, B., Vismara, P.: Integration of operational con-
straints to optimize differential harvest in viticulture. In: Proc. 10th European
Conference on Precision Agriculture, July 2015 (to appear)
5. Caseau, Y., Laburthe, F.: Solving small TSPs with constraints. In: Naish, L. (ed.)
Logic Programming, Proceedings of the Fourteenth International Conference on
Logic Programming, July 8–11, 1997, pp. 316–330. MIT Press, Leuven, Belgium
(1997)
6. Desrochers, M., Laporte, G.: Improvements and extensions to the miller-tucker-
zemlin subtour elimination constraints. Operations Research Letters 10(1), 27–36
(1991)
7. Di Gaspero, L., Rendl, A., Urli, T.: Constraint-based approaches for balancing
bike sharing systems. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 758–773.
Springer, Heidelberg (2013)
8. IBM ILOG. Cplex. http://www-01.ibm.com/software/integration/optimization/
cplex-optimizer/ (accessed April 2015)
9. Kilby, P., Shaw, P.: Vehicle routing. In: Rossi, F., Beek, P.V., Walsh, T. (eds),
Handbook of Constraint Programming, chapter 23, pp. 799–834. Elsevier (2006)
10. Laporte, G., Nobert, Y., Desrochers, M.: Optimal routing under capacity and dis-
tance restrictions. Operations Research 33(5), 1050–1073 (1985)
11. Miller, C.E., Tucker, A.W., Zemlin, R.A.: Integer programming formulation of
traveling salesman problems. Journal of the ACM (JACM) 7(4), 326–329 (1960)
556 N. Briot et al.
12. Pesant, G., Gendreau, M., Potvin, J.-Y., Rousseau, J.-M.: An exact constraint logic
programming algorithm for the traveling salesman problem with time windows.
Transportation Science 32(1), 12–29 (1998)
13. Prud’homme, C., Fages, J.G., Lorca, X.: Choco3 Documentation. TASC, INRIA
Rennes, LINA CNRS UMR 6241, COSLING S.A.S. (2014)
14. Tisseyre, B., Ojeda, H., Taylor, J.: New technologies and methodologies for site-
specific viticulture. Journal International des Sciences de la Vigne et du Vin 41,
63–76 (2007)
Constrained Minimum Sum of Squares
Clustering by Constraint Programming
1 Introduction
Cluster analysis is a Data Mining task that aims at partitioning a given set of
objects into homogeneous and/or well-separated subsets, called classes or clus-
ters. It is usually formulated as an optimization problem and different optimiza-
tion criteria have been defined [18]. One of the most used criteria is minimizing the
Within-Cluster Sum of Squares (WCSS) Euclidean distances from each object to
the centroid of the cluster to which it belongs. The well-known k-means algorithm
as well as numerous heuristic algorithms optimize it and find a local optimum [27].
Finding a global optimum for this criterion is a NP-Hard problem and even finding
a good lower bound is difficult [1]. The best exact approach for clustering with this
criterion is based on Integer Linear Programming (ILP) and column generation [2].
On the other hand, since this last decade, user-defined constraints have been
integrated to clustering task to make it more accurate, leading to Constrained
Clustering. User constraints usually make the clustering task harder. The exten-
sion to user constraints is done either by adapting classic algorithms to handle
constraints or by modifying distances between objects to take into account con-
straints [4,9,30]. Recently an exact approach has been proposed, which aims
at finding an optimal solution for the WCSS criterion satisfying all the user
constraints [3]. This approach extends the method based on ILP and column
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 557–573, 2015.
DOI: 10.1007/978-3-319-23219-5 39
558 T.-B.-H. Dao et al.
generation [2]. It integrates different kinds of user constraints but only handle
the WCSS criterion.
Recently general and declarative frameworks for Data Mining have attracted
more and more attention from Constraint Programming (CP) and Data Mining
communities [3,11,16,28]. In our previous work [7,8] we have proposed a gen-
eral framework based on CP for Constrained Clustering. Different from classic
algorithms that are designed for one specific criterion or for some kinds of user
constraints, the framework offers in a unified setting a choice among different
optimization criteria and a combination of different kinds of user constraints. It
allows to find a global optimal solution that satisfies all the constraints if one
exists. Classic heuristic algorithms can quickly find a solution and can scale on
very large datasets, however they do not guarantee the satisfaction of all the con-
straints or the quality of the solution. A declarative and exact approach allows
a better understanding of the data, which is essential for small valuable datasets
that may take years to collect. In order to make the CP approach efficient, it is
important to invest in dedicated global constraints for the clustering tasks [8].
In this paper we propose a global optimization constraint wcss to represent
the WCSS criterion. We propose a method based on dynamic programming to
compute a lower bound and develop a filtering algorithm. The filtering algorithm
filters not only the objective variable, but also the decision variables. The con-
straint extends our framework to the WCSS criterion. Experiments on classic
datasets show that our approach based on CP outperforms the state-of-the-art
approach based on ILP and column generation that handles user constraints [3].
2 Preliminaries
– Maximizing the minimal split between clusters, where the minimal split of
a partition Δ is defined by: S(Δ) = minc=c ∈[1,k] mino∈Cc ,o ∈Cc d(o, o ).
– Minimizing the maximal diameter of clusters, which is defined by:
D(Δ) = maxc∈[1,k] maxo,o ∈Cc d(o, o ).
– Minimizing the Within-Cluster Sum of Dissimilarities, which is defined by:
1
W CSD(Δ) = d(o, o )
2
c∈[1,k] o,o ∈Cc
where for each c ∈ [1, k], mc is the mean (centroid) of the cluster Cc and
d(o, mc ) is defined by the squared Euclidean distance ||o − mc ||2 . When the
dissimilarity between objects is defined by the squared Euclidean distance
d(o, o ) = ||o − o ||2 , we have [12,18]:
21 o,o ∈C d(o, o )
c
W CSS(Δ) =
|Cc |
c∈[1,k]
All these criteria except the split criterion are NP-Hard (see e.g. [14] for the
diameter criterion, [1] for WCSS, or concerning WCSD, the weighted max-cut
problem, which is NP-Complete, is an instance with k = 2). Most of classic
algorithms use heuristics and search for a local optimum [17]. For instance the k-
means algorithm finds a local optimum for the WCSS criterion or FPF (Furthest
Point First) [14] for the diameter criterion. Different optima may exist, some may
be closer to the one expected by the user. In order to better model the task, user
knowledge is integrated to clustering task. It is usually expressed by constraints,
leading to Constrained Clustering. User constraints can be cluster-level, giving
requirements on clusters, or instance-level, specifying requirements on pairs of
objects. The last kind, introduced in [29], is the most used. An instance-level
constraint on two objects can be a must-link or a cannot-link constraint, which
states that the objects must be or cannot be in the same cluster, respectively.
Different kinds of cluster-level constraints exist. The minimal (maximal)
capacity constraint requires that each cluster must have at least (at most, resp.)
a given α (β, resp.) objects: ∀c ∈ [1, k], |Cc | ≥ α (resp. ∀c ∈ [1, k], |Cc | ≤ β).
A diameter constraint sets an upper bound γ on the cluster diameter: ∀c ∈
[1, k], ∀o, o ∈ Cc , d(o, o ) ≤ γ. A split constraint, named δ-constraint in [9], sets
a lower bound δ on the split: ∀c = c ∈ [1, k], ∀o ∈ Cc , o ∈ Cc , d(o, o ) ≥ δ. A
density constraint, which extends -constraints in [9], requires that each object
o must have in its neighborhood of radius at least m objects belonging to the
same cluster as itself: ∀c ∈ [1, k], ∀o ∈ Cc , ∃o1 , .., om ∈ Cc , oi = o ∧ d(o, oi ) ≤ .
User-constraints can make the clustering task easier (e.g. must-link con-
straints) but usually they make the task harder, for instance the split criterion
that is polynomial becomes NP-Hard with cannot-link constraints [10].
560 T.-B.-H. Dao et al.
3.1 Constraints
Any complete assignment of the variables in G defines a partition of points
into clusters. In order to break symmetries between the partitions, we put the
constraint precede(G, [1, . . . , kmax ]) [21], which states that G1 = 1 (the first point
is in cluster 1) and ∀c ∈ [2, kmax ], if there exists Gi = c with i ∈ [2, n], then there
must exists j < i such that Gj = c − 1. Since the domain of the variables Gi is
[1, kmax ], there are at most kmax clusters. The fact that there are at least kmin
clusters means that all the values from 1 to kmin must appear in G. We only
need to require that kmin must appear in G, since with the use of the constraint
precede, if kmin is taken, then kmin −1, kmin −2, . . . , 1 are also taken. This means
#{i | Gi = kmin } ≥ 1 and can be expressed by the constraint: atleast(1, G, kmin ).
Instance-level user constraints can be easily integrated within this model. A
must-link constraint on two points i, j is expressed by Gi = Gj and a cannot-link
constraint by Gi = Gj . All popular cluster-level constraints are also integrated.
For instance, a minimal capacity α constraint is expressed by the fact that each
point must be in a cluster with at least α points including itself. Therefore,
for each i ∈ [1, n], the value taken by Gi must appear at least α times in G,
i.e. #{j | Gj = Gi } ≥ α. For each i ∈ [1, n], we put: atleast(α, G, Gi ). This
requirement allows to infer an upper bound on the number of clusters. Indeed,
Gi ≤
n/α, for all i ∈ [1, n]. For other kinds of user constraints, such as maximal
capacity, diameter or density constraints, we refer the reader to [8].
In order to express that V is the within-cluster sum of squares of the partition
formed by the assignment of variables in G, we develop a global optimization
constraint wcss(G, V, d). The filtering algorithm for this constraint is presented
in Section 4. The value of V is to be minimized.
solution gives an upper bound of the domain of V . After finding the first solution,
the search strategy changes. In the new strategy, at each branching, for each
unassigned variable Gi , for each value c ∈ Dom(Gi ) we compute the value aic ,
which is the added amount to V if point i is assigned to cluster c. For each
unassigned variable Gi , let ai = minc∈Dom(Gi ) aic . The value ai thus represents
the minimal added amount to V when point i is assigned to a cluster. Since each
point must be assigned to a cluster, at each branching, the variable Gi with the
greatest value ai is chosen, and for this variable, the value c with the smallest
value aic is chosen. Two branches are then created, corresponding to two cases
where Gi = c and Gi = c. This strategy tends to detect failure more quickly or
in case of success, to find a solution with the value of V as small as possible.
We consider that the objects are in an Euclidean space and the dissimilarity
measure is defined by the squared Euclidean distance. The sum of dissimilarities
of a cluster Cc is defined by W CSD(Cc ) = 12 o,o ∈Cc d(o, o ). The sum of
squares of Cc is defined by W CSS(Cc ) = |C1c | W CSD(Cc ). The WCSS of a
partition Δ = {C1 , . . . , Ck } is W CSS(Δ) = c∈[1,k] W CSS(Cc ).
We introduce a new constraint wcss(G, V, d) and develop a filtering algorithm.
This constraint maintains the relation that the float value variable V is the sum
of squares of the clusters formed by the assignment of the decision variables of
G, given a dissimilarity measure d. Given a partial assignment of some variables
in G, we develop a lower bound computation for V and an algorithm to filter the
domains of the variables. Since the variable V represents the objective function,
this constraint is a global optimization constraint [13,26]. The filtering algorithm
filters not only the domain of the objective variable V , but also the domain of
decision variables in G.
A partial assignment of variables of G represents a case where some points
have been already assigned to a cluster and there are unassigned points. Let
k = max{c | c ∈ i Dom(Gi )}. The value k is the greatest cluster index among
those remaining in all the domains Dom(Gi ) and thus it is the greatest possible
number of clusters in the partition. Let C be the set of clusters C1 , . . . , Ck .
Some of these clusters can be empty, they correspond to indexes that remain
in some non-singleton domains Dom(Gi ) but not in a singleton domain. For
each cluster Cc , let nc be the number of points already assigned to Cc (nc ≥ 0)
and let S1 (Cc ) be the sum of dissimilarities of all the assigned points in Cc :
S1 (Cc ) = 12 i,j∈Cc d(i, j). Let U be the set of unassigned points and let q = |U |.
We compute a lower bound of V considering all the possibilities for assigning all
the points in U into the clusters C1 , . . . , Ck . This is done in two steps:
Constrained Minimum Sum of Squares Clustering 563
1. For each m ∈ [0, q] and c ∈ [1, k], we compute a lower bound V (Cc , m) of
W CSS(Cc ) considering all possible assignments of m points of U into Cc .
2. For each m ∈ [0, q] and c ∈ [2, k], we compute a lower bound V (C1 . . . Cc , m)
of W CSS({C1 , .., Cc }) considering all the possibilities for assigning any m
points of U into the clusters C1 , . . . , Cc .
11 for c ← 1 to k do
12 for m ← 0 to q do
13 foreach x ∈ U do
14 s[x] = s2 (x, c) + s3 (x, m)
15 sort the arrays increasingly
16 S2 (Cc , m) ← m i=1 s[i]
17 if nc + m = 0 then V (Cc , m) ← 0 ;
18 else
19 V (Cc , m) ← (S1 (Cc ) + S2 (Cc , m))/(nc + m)
20 for c ← 2 to k do
21 V (C1 ..Cc , 0) ← V (C1 ..Cc−1 , 0) + V (Cc , 0)
22 for m ← 1 to q do
23 V (C1 ..Cc , m) ← mini∈[0,m] (V (C1 ..Cc−1 , i) + V (Cc , m − i))
S1 (Cc ) + S2 (Cc , U )
V (Cc , U ) =
nc + m
Here S1 (Cc ) is the sum of dissimilarities of the points already assigned in Cc
and S2 (Cc , U ) is the sum of dissimilarities related to points in U . The value of
S1 (Cc ) is known. If the set U is known the value S2 (Cc , U ) can be computed
exactly by:
1
S2 (Cc , U ) = d(u, v) + d(u, v)
2
u∈U ,v∈Cc u,v∈U
But S2 (Cc , U ) remains unknown while U is not defined. However, for any subset
U of size m, we can compute a lower bound S2 (Cc , m) as follows. Each point
x ∈ U , in case of assignment to the cluster Cc together with other m − 1 points
of U , will contribute an amount s(x, c, m) = s2 (x, c) + s3 (x, m), where:
– s2 (x, c) represents the sum of dissimilarities between x and the points already
in the cluster Cc . If c ∈ Dom(Gx ) then s2 (x, c) = +∞, since x cannot be
assigned to Cc . Otherwise s2 (x, c) = v∈Cc d(x, v). This value s2 (x, c) is 0
if the cluster Cc is empty. It is computed by lines 2–6 in Algorithm 1.
– s3 (x, m) represents a half of the sum of dissimilarities d(x, z), for all the
m − 1 other points z. These points z can be any points in U , however, if we
order all the points u ∈ U in an increasing order on d(x, u) and we denote
by ui the i-th point in this order, we have a lower bound for s3 (x, m) (lines
m−1
7–10 in Algorithm 1): s3 (x, m) ≥ 12 i=1 d(x, ui ).
A lower bound S2 (Cc , m) is thus the sum of the m smallest contributions
s(x, c, m) (represented by s[x] in Algorithm 1, for fixed values c and m), for
all points x ∈ U . The lower bound V (Cc , m) is 0 if nc + m = 0 or otherwise is
computed by:
S1 (Cc ) + S2 (Cc , m)
V (Cc , m) = (1)
nc + m
This is computed for all c ∈ [1, k] and m ∈ [0, q] (lines 11–19 in Algorithm 1).
For an example, let us consider the partial assignment given in Figure 1 (A)
where k = 3 and some points have been assigned into 3 clusters C1 (square),
C2 (triangle) and C3 (circle). The set of unassigned points U is {3, 4, 8, 9}. A
lower bound V (C3 , 2) for the sum of squares of C3 in case of assignment of any
2 points of U into C3 is computed by Formula (1), with nc = 3 and m = 2.
In this formula, S1 (C3 ) = d(10, 11) + d(11, 12) + d(10, 12) and S2 (C3 , 2) is the
sum of the 2 smallest contributions to C3 among those of all the unassigned
points. They are the contributions of points 4 and 9. Figure 1 (B) presents
the dissimilarities used in the computation of S2 (C3 , 2). For the contribution of
point 4, we make use of one (= m − 1) smallest dissimilarity from point 4 to the
other unassigned points, which is d(4, 3). Idem for point 9, where d(9, 8) is used.
Constrained Minimum Sum of Squares Clustering 565
5 5
7 7
6 6
1 1
4 4
1/2
3 3
2 2
10 10
8
8 11 11
1/2
(A) 9 12 (B) 9 12
Let us note that the contribution of each point is computed separately, in order
to avoid combinatory cases. Therefore d(4, 9) is not used, even though points 4
and 9 are assumed to be assigned to C3 .
This is computed by a dynamic program for all c ∈ [2, k] and m ∈ [0, q] (lines
20–23 in Algorithm 1). Let us notice that with (2), for all c ∈ [1, k] and m ∈ [0, q]:
Let us reconsider the example given in Figure 1. The value V (C1 ..C3 , 4) com-
puted by (2) corresponds to the case V (C1 ..C2 , 1) + V (C3 , 3), i.e when one point
is assigned to the clusters C1 , C2 and 3 points are assigned to C3 . The value
V (C1 ..C2 , 1) corresponds to the case V (C1 , 0) + V (C2 , 1). The value V (C2 , 1)
corresponds to the case where point 4 is assigned to cluster C2 and V (C3 , 3) to
the case where points 4, 8 and 9 are assigned to cluster C3 . We note that in this
lower bound, point 4 is considered twice and point 3 is not considered.
Concerning the complexity, the complexity of the first loop (lines 1–10) is
O(q(k + n + q log q + q)) = O(q 2 log q + qn). The complexity of the second
loop (lines 11–19) is O(kq(q + q log q)) = O(kq 2 log q) and the complexity of
the last loop (lines 20–23) is O(kq 2 ). The complexity of Algorithm 1 is then
O(kq 2 log q + qn). Let us notice that in clustering tasks, the number of clusters
k is usually constant or much smaller than n.
566 T.-B.-H. Dao et al.
For all m ∈ [0, q −1], we revise the lower bounds V (C \{Cc }, m) and V (Cc , m) by
exploiting informations constructed by Algorithm 1. The revision will be detailed
in the remainder of this subsection. The new lower bound V is computed by
line 8 of Algorithm 2. Therefore, since Dom(V ) = [V.lb, V.ub), if V ≥ V.ub, the
variable Gi cannot take the value c. The value c is then removed from Dom(Gi )
(lines 9–10). The complexity of Algorithm 2 is the complexity of computing
the lower bound O(kq 2 log q + qn) plus the complexity of the loop (lines 2–10)
O(kq 2 ). The overall complexity therefore is O(kq 2 log q + qn).
Computing V (Cc , m). Let us recall that Cc is the cluster Cc augmented by point
i, and V (Cc , m) is the lower bound of the sum of squares of Cc after adding any
m points of U \{i} into Cc . According to (1):
S1 (Cc ) + S2 (Cc , m)
V (Cc , m) =
nc + 1 + m
We have S1 (Cc ) = S1 (Cc ) + s2 (i, c). The value of S2 (Cc , m) can be revised from
S2 (Cc , m) by:
S2 (Cc , m) = S2 (Cc , m) + s3 (i, m)
According to (1), we have (line 7 of Algorithm 2):
Computing V (C \{Cc }, m). This value represents a lower bound of the sum of
squares for any assignment of m points in U \{i} into the clusters different from
Cc . According to (3), for all q ∈ [m, q]:
We also have:
V (C \{Cc }, m) ≥ V (C\{Cc }, m)
since C \{Cc } and C\{Cc } denote the same set of clusters, V (C \{Cc }, m) is
computed for any m points of U \{i}, while V (C\{Cc }, m) is computed for any
m points of U . Therefore we can exploit the columns computed by the dynamic
program in Algorithm 1 to revise a new lower bound (line 4 in Algorithm 2):
5 Experiments
Our model is implemented with Gecode library version 4.2.72 , which supports
float and integer variables. Experiments have been performed on a 3.0 GHz
Core i7 Intel computer with 8 Gb memory under Ubuntu. All our programs are
available at http://cp4clustering.com. We have considered the datasets Iris,
Soybean and Wine from the UCI Machine Learning Repository3 . The number
of objects and the number of classes are respectively 150 and 3 for Iris, 47 and
4 for Soybean and 178 and 3 for Wine dataset. We compare our model with
the approach proposed in [3], based on Integer Linear Programming and column
generation and optimizing WCSS criterion with user constraints. Our approach is
also compared to COP-kmeans [30] that extends k-means algorithm to integrate
user constraints and to Repetitive Branch-and-Bound Algorithm (RBBA) [5],
without user constraints, since this algorithm is not able to handle them.
In MiningZinc, a modeling language for constraint-based mining [15], it is
shown that clustering with the WCSS criterion can be modeled4 . The model can
be translated to different backend solvers including Gecode. However, because of
the intrinsic difficulty of the WCSS criterion, this example model cannot handle
14 points randomly selected from Iris dataset within 30 min, whereas our model
takes 0.01s to solve them.
run-time and RI. A timeout is set to 30 min. A minus sign (-) in the tables
means that the timeout has been reached without completing the search. Since
the ground truth partition is used to generate user constraints, experiments are
done with k equal to the ground truth number of classes for each dataset.
Table 1 gives results for our model (CP) and for the approach based on ILP
and column generation (ILP) [3] for the Iris dataset with different numbers #c
of must-link constraints. For both the execution time and the Rand index, the
mean value of the five tests and the coefficient of variation (σ/μ) are reported.
Since the two approaches are exact, they find partitions having the same WCSS
value. It can be noticed that must-link constraints help to improve quality of the
solution as well as to reduce the execution time for this dataset. Our approach
can find a global optimal without user constraints, whereas ILP approach needs
at least 100 must-link constraints to be able to prove the optimality. With more
than 100 must-link constraints, our approach always takes less time to complete
the search. Our approach is also more efficient to handle must-link and cannot-
link constraints. Table 2 (left) reports mean execution time in seconds for the
five tests and the coefficient of variation σ/μ. In each case, the same number
#c of must-link and cannot-link constraints are added. We can see that when
#c ≤ 75, our approach can complete the search within the timeout and in the
other cases, it performs better than ILP. Concerning the Wine dataset, the two
approaches cannot prove the optimality of the solution in less than 30 min, when
there are less than 150 must-link constraints, as shown in Table 2 (right).
Our CP approach makes better use of cannot-link constraints, as shown in
Table 3. This table reports the mean time in seconds and the percentage of tests
for which each system completes the search within the timeout. The execution
time varies a lot, depending on the constraints. If we consider the Iris database,
Table 3 (left) shows that our model is able to find an optimal solution and to
prove it for roughly 60 % cases, wheres ILP can solve no cases. If we consider the
Wine dataset, Table 3 (right) shows that when 100 must-link and 100 cannot-link
constraints are added, CP can solve all the cases, whereas ILP cannot solve them.
When 125 must-link constraints and 125 cannot-link constraints are added, both
approaches can solve all the cases, but our approach is less time-consuming.
Experiments with the Soybean dataset lead to the same observations. With
a number of must-link constraints varying from 10 to 80, the mean run-times for
Table 1. Time (in seconds) and RI for Iris dataset with #c must-link constraints
#c CP ILP RI
μ σ/μ μ σ/μ μ σ/μ
0 888.99 0.83 % - - 0.879 0%
50 332.06 78.96 % - - 0.940 1.66 %
100 7.09 40.18 % 62 74.24 % 0.978 1.68 %
150 0.31 36.39 % 0.45 44.55 % 0.989 0.66 %
200 0.07 24.83 % 0.11 48.03 % 0.992 0.66 %
250 0.05 10.63 % 0.06 35.56 % 0.996 0.70 %
300 0.04 9.01 % 0.04 19.04 % 0.998 0.35 %
570 T.-B.-H. Dao et al.
Table 2. Time in seconds for Iris dataset with #c must-link and #c cannot-link
constraints (left) and Wine dataset with #c must-link constraints (right)
#c CP ILP
μ σ/μ μ σ/μ
#c CP ILP
25 969.33 51.98 % - -
150 6.84 12.98
50 43.85 46.67 % - -
200 0.11 0.32
75 4.97 150 % - -
250 0.08 0.11
100 0.41 49.8 % 107 72.35 %
300 0.08 0.06
125 0.09 52.07 % 4.4 95.85 %
150 0.06 22.6 % 0.8 50 %
Table 3. Iris dataset with #c cannot-link constraints (left) and Wine dataset with #c
must-link and #c cannot-link constraints (right)
#c CP ILP
μ solved μ solved
#c CP ILP
50 1146.86 20 % - 0%
μ solved μ solved
100 719.53 80 % - 0%
100 10.32 100 % - 0%
150 404.77 60 % - 0%
125 0.35 100 % 497.6 100 %
200 1130.33 40 % - 0%
150 0.12 100 % 13.98 100 %
250 172.81 60 % - 0%
300 743.64 60 % - 0%
both CP and ILP approaches decrease from 0.3 s to 0.01 s. However, with differ-
ent numbers of cannot-link constraints, CP always outperforms ILP approach.
For instance, the mean time is 5.19 s (CP) vs. 278.60 s (ILP) with 20 cannot-link
constraints, or 2.5 s (CP) vs. 126 s (ILP) with 80 cannot-link constraints.
We perform the same tests, but for each set of constraints, COP-kmeans is
run 1000 times and we report the number of times COP-kmeans has been able to
find a partition. Figure 2 (left) shows the percentage of successes when cannot-
link constraints are added. With the two datasets Iris and Wine, COP-kmeans
fails to find a partition when 150 constraints are added. Our CP model always
find a solution satisfying all the constraints. For Iris dataset, our model succeeds
in proving the optimality for roughly 60 % cases (Table 3 left).
Figure 2 (right) gives the results when #c must-link and #c cannot-link
constraints are added. For Wine dataset, COP-kmeans always fail to find a
partition when #c = 75, 125 or 150. Our CP approach finds a solution satisfying
all the constraints in all the cases. It completes the search in all the cases for
Iris dataset, as shown in Table 2 (left), and in all the cases where #c ≥ 100 for
Wine dataset, as shown in Table 3 (right).
6 Conclusion
In this paper we address the well-known WCSS criterion in cluster analysis.
We develop a new global optimization constraint wcss and present a filtering
algorithm, which filters not only the domain of the objective variable but also
those of decision variables. This constraint integrated to our CP framework [7,
8] extends it to model constrained minimum sum of squares clustering tasks.
Experiments on classic datasets show that our framework outperforms the state-
of-the-art best exact approach, which is based on Integer Linear Programming
and column generation [3].
Working on search strategies and on constraint propagation enables to
improve substantially the efficiency of our CP model. We continue studying
these aspects to make the framework able to deal with larger datasets. We are
working on exploiting user constraints inside the filtering algorithm, either by
using connected components or by modifying the dissimilarities according to the
user constraints. We exploit the flexibility of the CP framework to offer a choice
between exact or approximate solutions, by studying the use of approximate
search strategies, such as local search methods.
572 T.-B.-H. Dao et al.
References
1. Aloise, D., Deshpande, A., Hansen, P., Popat, P.: NP-hardness of Euclidean Sum-
of-squares Clustering. Machine Learning 75(2), 245–248 (2009)
2. Aloise, D., Hansen, P., Liberti, L.: An improved column generation algorithm
for minimum sum-of-squares clustering. Mathematical Programming 131(1–2),
195–220 (2012)
3. Babaki, B., Guns, T., Nijssen, S.: Constrained clustering using column generation.
In: Proceedings of the 11th International Conference on Integration of AI and OR
Techniques in Constraint Programming for Combinatorial Optimization Problems,
pp. 438–454 (2014)
4. Bilenko, M., Basu, S., Mooney, R.J.: Integrating constraints and metric learning
in semi-supervised clustering. In: Proceedings of the 21st International Conference
on Machine Learning, pp. 11–18 (2004)
5. Brusco, M., Stahl, S.: Branch-and-Bound Applications in Combinatorial Data
Analysis (Statistics and Computing). Springer, 1 edn. (2005)
6. Brusco, M.J.: An enhanced branch-and-bound algorithm for a partitioning prob-
lem. British Journal of Mathematical and Statistical Psychology 56(1), 83–92
(2003)
7. Dao, T.B.H., Duong, K.C., Vrain, C.: A Declarative Framework for Constrained
Clustering. In: Proceedings of the European Conference on Machine Learning and
Principles and Practice of Knowledge Discovery in Databases, pp. 419–434 (2013)
8. Dao, T.B.H., Duong, K.C., Vrain, C.: Constrained clustering by constraint pro-
gramming. Artificial Intelligence (2015). doi:10.1016/j.artint.2015.05.006
9. Davidson, I., Ravi, S.S.: Clustering with Constraints: Feasibility Issues and the
k-Means Algorithm. In: Proceedings of the 5th SIAM International Conference on
Data Mining, pp. 138–149 (2005)
10. Davidson, I., Ravi, S.S.: The Complexity of Non-hierarchical Clustering with
Instance and Cluster Level Constraints. Data Mining Knowledge Discovery 14(1),
25–61 (2007)
11. De Raedt, L., Guns, T., Nijssen, S.: Constraint Programming for Data Mining and
Machine Learning. In: Proc. of the 24th AAAI Conference on Artificial Intelligence
(2010)
12. Edwards, A.W.F., Cavalli-Sforza, L.L.: A method for cluster analysis. Biometrics
21(2), 362–375 (1965)
13. Focacci, F., Lodi, A., Milano, M.: Cost-based domain filtering. In: Proceedings of
the 5th International Conference on Principles and Practice of Constraint Pro-
gramming, pp. 189–203 (1999)
14. Gonzalez, T.: Clustering to minimize the maximum intercluster distance. Theoret-
ical Computer Science 38, 293–306 (1985)
15. Guns, T., Dries, A., Tack, G., Nijssen, S., De Raedt, L.: Miningzinc: A modeling
language for constraint-based mining. In: IJCAI (2013)
16. Guns, T., Nijssen, S., De Raedt, L.: k-Pattern set mining under constraints. IEEE
Transactions on Knowledge and Data Engineering 25(2), 402–418 (2013)
17. Han, J., Kamber, M., Pei, J.: Data Mining: Concepts and Techniques, 3rd edn.
Morgan Kaufmann Publishers Inc., San Francisco, CA, USA (2011)
18. Hansen, P., Jaumard, B.: Cluster analysis and mathematical programming. Math-
ematical Programming 79(1–3), 191–215 (1997)
19. Jensen, R.E.: A dynamic programming algorithm for cluster analysis. Journal of
the Operations Research Society of America 7, 1034–1057 (1969)
Constrained Minimum Sum of Squares Clustering 573
20. Koontz, W.L.G., Narendra, P.M., Fukunaga, K.: A branch and bound clustering
algorithm. IEEE Trans. Comput. 24(9), 908–915 (1975)
21. Law, Y.C., Lee, J.H.M.: Global constraints for integer and set value precedence. In:
Wallace, M. (ed.) Proceedings of the 10th International Conference on Principles
and Practice of Constraint Programming, pp. 362–376 (2004)
22. du Merle, O., Hansen, P., Jaumard, B., Mladenovic, N.: An interior point algorithm
for minimum sum-of-squares clustering. SIAM Journal on Scientific Computing
21(4), 1485–1505 (1999)
23. B.J. van Os, J.M.: Improving Dynamic Programming Strategies for Partitioning.
Journal of Classification (2004)
24. Pelleg, D., Baras, D.: K -Means with Large and Noisy Constraint Sets. In: Kok,
J.N., Koronacki, J., Lopez de Mantaras, R., Matwin, S., Mladenič, D., Skowron,
A. (eds.) ECML 2007. LNCS (LNAI), vol. 4701, pp. 674–682. Springer, Heidelberg
(2007)
25. Rand, W.M.: Objective Criteria for the Evaluation of Clustering Methods. Journal
of the American Statistical Association 66(336), 846–850 (1971)
26. Régin, J.C.: Arc consistency for global cardinality constraints with costs. In: Pro-
ceedings of the 5th International Conference on Principles and Practice of Con-
straint Programming, pp. 390–404 (1999)
27. Steinley, D.: k-means clustering: A half-century synthesis. British Journal of Math-
ematical and Statistical Psychology 59(1), 1–34 (2006)
28. Ugarte Rojas, W., Boizumault, P., Loudni, S., Crémilleux, B., Lepailleur, A.: Min-
ing (Soft-) Skypatterns Using Dynamic CSP. In: Simonis, H. (ed.) CPAIOR 2014.
LNCS, vol. 8451, pp. 71–87. Springer, Heidelberg (2014)
29. Wagstaff, K., Cardie, C.: Clustering with instance-level constraints. In: Proceedings
of the 17th International Conference on Machine Learning, pp. 1103–1110 (2000)
30. Wagstaff, K., Cardie, C., Rogers, S., Schrödl, S.: Constrained K-means Clustering
with Background Knowledge. In: Proceedings of the 18th International Conference
on Machine Learning, pp. 577–584 (2001)
A Constraint Programming Approach
for Non-preemptive Evacuation Scheduling
1 Introduction
Evacuation planning is a critical part of the preparation and response to nat-
ural and man-made disasters. Evacuation planning assists evacuation agencies
in mitigating the negative effects of a disaster, such as loss or harm to life, by
providing them guidelines and operational evacuation procedures so that they
can make informed decisions about whether, how and when to evacuate resi-
dents. In the case of controlled evacuations, evacuation agencies instruct each
endangered resident to follow a specific evacuation route at a given departure
time. To communicate this information in a timely fashion, evacuation plan-
ners must design plans which take into account operational constraints arising
NICTA is funded by the Australian Government through the Department of Commu-
nications and the Australian Research Council through the ICT Centre of Excellence
Program.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 574–591, 2015.
DOI: 10.1007/978-3-319-23219-5 40
A Constraint Programming Approach 575
Fig. 1. Departure times and flows of 7 residential areas of the HN80 instance with the
preemptive algorithm FSP from [6].
A Constraint Programming Approach 577
evacuation area (instead of a fixed set of values) and avoids discretizing time.
In contrast to [4], the constraint programming model allows for simultaneous
evacuation while satisfying practice-related constraints.
The constraint programming model was applied on a real-life evacuation
case study for the Hawkesbury-Nepean region in New South Wales, Australia.
This region is a massive flood plain protected from a catchment area (the blue
mountains) by the Warragamba dam. A major spill would create damages that
may reach billions of dollars and require the evacuation of about 80,000 peo-
ple. Preliminary experimental results indicate that the constraint programming
model can be used to generate non-preemptive schedules that are almost always
within 5% of the optimal preemptive schedules generated in prior work. These
results hold both for maximizing the number of evacuees for a given time horizon
and for minimizing the clearance time (i.e., the earliest time when everyone is
evacuated). These results are particularly interesting, given that the optimal pre-
emptive solutions produce evacuation plans which are far from practical. Indeed,
Fig. 1 shows the repartition of departure times for seven residential areas in the
original HN80 instance using a preemptive schedule produced by the algorithm
in [6]. Observe how departure times are widely distributed within the scheduling
horizon, indicating that the plan makes heavy use of preemption and is virtually
impossible to implement in practice. Finally, experimental results on the phased
version of the algorithm indicate that phased evacuations are much less time
effective, and should not be the preferred method for short-notice or no-notice
evacuation.
The rest of this paper is organized as follows. Section 2 defines the prob-
lem. Section 3 presents the constraint programming model, including the core
model, the decomposition scheme, the dominance relationships, and the search
procedure. Section 4 presents the experimental results. Section 5 concludes the
paper.
2 Problem Description
The Evacuation Planning Problem (EPP) was introduced by the authors in [11].
It is defined on a directed graph G = (N = E ∪ T ∪ S, A), where E, T , and
S are the set of evacuation, transit, and safe nodes respectively, and A is the
set of edges. The EPP is designed to respond to a disaster scenario, such as a
flood, which may determine a time at which some edges become unavailable.
Each evacuation node k ∈ E is characterized by a number of evacuees dk , while
each arc e is associated with a triple (te , ue , be ), where te is the travel time, ue
is the capacity, and be is the time at which the arc becomes unavailable. We
denote by e.tail (resp. e.head) the tail (resp. head) of an edge e. The problem
is defined over a scheduling horizon H, which depends on the disaster forecast
and the time to mobilize resources. The objective is either (1) to maximize the
total number of evacuees reaching a safe node (for a fixed horizon) or (2) to
minimize the time at which the last evacuee reaches a safe zone (for a variable
horizon). In the following, we assume that the evacuation is carried out using
578 C. Even et al.
private vehicles, but the proposed approach could be adapted to other contexts,
such as building evacuation.
This paper extends the EPP to the non-preemptive (simultaneous) evacua-
tion planning problem (NEPP) and the non-preemptive phased evacuation plan-
ning problem (NPEPP). Both are designed to assist evacuation planners with
the scheduling of fully controlled evacuations. Given a set of evacuation paths,
the NEPP decides the start time, flow, and flow rate at which vehicles are evac-
uating each individual evacuation node, ensuring that the evacuation operates
without interruption. The NEPP allows several evacuation nodes to use the same
road segments at the same time. In contrast, the NPEPP guarantees that no two
evacuation nodes use the same road segment at the same time. The practical
interest of the NPEPP is to evacuate designated priority areas quickly and effi-
ciently, by limiting the risk of any delay caused by slowdown or traffic accidents
which may result from merging traffic.
Formally, an evacuation plan associates with each evacuation area k ∈ E
exactly one evacuation path pk which is used to route all residents in k to a
same safe node. Let Ωpk = k∈E pk the set of evacuation paths for all evacuations
nodes in E. The characteristics of a path pk are as follows. We denote by Apk
(resp. Npk ) the set of edges (resp. nodes) of pk and by E(e) the set of evacuation
areas whose path contains edge e, i.e., e ∈ Apk . The travel time tk,n between
the evacuation area k and a node n ∈ Npk is equal to the sum of the path edges
travel times separating k from n and tpk is the total travel time between the start
and end of pk . The path capacity upk is the minimum edge capacity of pk . The
last possible departure time lastdep(pk ) along path pk , i.e., the latest time at
which a vehicle can depart on pk without being blocked, is easily derived from
all tk,n (n ∈ Npk ) and the time be at which each path edge e ∈ Apk becomes
unavailable. If none of the path edges e ∈ Apk are cut by the disaster then
lastdep(pk ) = ∞; otherwise lastdep(pk ) = mine∈Apk (be − tk,e.head ). Note
that the latest path departure time only depends on the path characteristics
and not on H.
The NEPP and NPEPP are two optimization problems whose objective is either
to maximize the number of evacuees or to minimize the overall evacuation clear-
ance time. The key contribution of this paper is to model them as constraint-
based scheduling problems and to use CP to solve them. This modeling avoids
time dicretization and makes it possible to design non-preemptive plans with
variable flow rates. This section presents the constraint-based scheduling models,
including their decision variables, their domains, and the constraints common
to both problems. This section then presents the constraint-based scheduling
models for NEPP and NPEPP.
A Constraint Programming Approach 579
3.2 Constraints
The NEPP requires to schedule the flow of evacuees coming from each evacuation
area k on their respective path pk such that, at any instant t, the flow sent on all
paths through the network does not exceed the network edges capacities. These
flow constraints can be expressed in terms of cumulative constraints. Consider
an edge e and the set E(e) of evacuation areas whose evacuation paths use e. For
each evacuation area k ∈ E(e), the model introduces a new task taskek which is
a view over task taskk satisfying:
This new task variable accounts for the number of vehicles from evacuation area
k traveling on edge e at any time during the scheduling horizon. Note that tk,e.tail
is computed as the sum of the travel times on each edge, each rounded up to the
next integer for consistency with the domains of the decision variables. While this
approximation may slightly overestimates travel times, it also counterbalances
possible slowdowns in real-life traffic, which are not taken into account in this
model.
580 C. Even et al.
The constraint-based scheduling model for the NEPP introduces the following
cumulative constraint for edge e:
The objective (2) maximizes the number of evacuated vehicles. Constraints (3)
and (4) link the flow, flow rate, and evacuation duration together, by ensuring
that the total flow for each area k is the minimum of the evacuation demand
and the flow rate multiplied by the evacuation duration. They use an auxiliary
variable flowub
k denoting an upper bound on the number of vehicles evacuated
from area k. Constraints (5) impose the capacity constraints.
The model NEPP-SAT is the satisfaction problem version of NEPP-MF
where the objective (2) has been removed and the constraint
flowk = dk ∀k ∈ E (6)
and to relax the start and end time domains to [0, Hub ] where Hub is an upper
bound on the horizon required to evacuate all vehicles to a shelter. The resulting
constraint-based scheduling model is denoted by NEPP-CT.
A constraint programming formulation NPEPP-MF of the non-preemptive
phased evacuation planning problem can be obtained from NEPP-MF by replac-
ing (5) with (1), which prevents the flows from two distinct origins to travel on
the same edge at the same time. NPEPP-SAT, which is the satisfaction problem
A Constraint Programming Approach 581
Proof (Sketch). Using the decomposition method and the dominance criterion,
each subproblem with at least two evacuation paths includes exactly one domi-
nating edge e which is part of every evacuation path. An optimal schedule can
then be obtained in two steps. The first step builds a preemptive schedule by a
sweep over the time starting from the minimal earliest start time of the tasks
on e and ending before the shared completion time. For each point in time,
it schedules one eligible task (if existing) with the largest flow rate (ties are
broken arbitrarily) where a task is eligible if the point in time is not after its
earliest start time on e and it has not been fully scheduled before that time.
Note if a task is almost fully scheduled except the last evacuation batch then
this step considers the actual flow rate of the last batch instead, which may be
smaller than the task flow rate. This preemptive schedule is optimal as for each
point in time, the unscheduled eligible tasks do not have an (actual) greater flow
rate than the scheduled ones. The second step converts this optimal preemptive
schedule to a non-preemptive one by postponing tasks interrupting others until
after the interrupted tasks are completed. This transformation does not change
the flows and hence the non-preemptive schedule has the same objective value
as the preemptive schedule.
The search procedure considers each unassigned task in turn and assigns its
underlying variables. A task taskk is unassigned if the domain of any of its
variables {startk , durk , endk , flowk , λflowk } has more than one value. The
584 C. Even et al.
search procedure selects an unassigned task taskk and then branches on all its
underlying variables until they all are assigned. Depending on the considered
problem, the models use different heuristics to (1) find the next unassigned task
and to (2) select the next task variable to branch on and the value to assign.
For NPEPP, the flow rate is directly set to the maximum value. The search
strategy is determined by the problem objective as follows. If the objective max-
imizes the number of evacuees for a given scheduling horizon H, the search is
divided into two steps. The first step selects a task with an unfixed duration and
the highest remaining actual flow rate. If the lower bound on duration of the
task is at least two time units less than its maximal duration then a minimal
duration of the maximal duration minus 1 is imposed and a maximal duration
of the maximal duration minus 2 on backtracking. Otherwise the search assigns
duration in decreasing order starting with the largest value in its domain. The
second step selects tasks according to their earliest start time and assigns a start
time in increasing order.1 If the objective is to minimize the horizon H such that
all vehicles are evacuated, then the search selects the next unassigned task with
earliest start time by increasing order among all dominating edges, selecting the
one with maximal flow rate to break ties, and to label the start time in increasing
order.
For NEPP, the different search heuristics are as follows. For the choice (1),
the strategy (1A) randomly selects an unassigned task, and performs geometric
restarts when the number of backtracks equals twice the number of variables in
the model, using a growth factor of 1.5. The strategy (1B) consists in selecting
the next unassigned task in decreasing order of evacuation demand for the dom-
inating edge with the greatest number of tasks. For the choice (2), the strategy
(2A) first labels the flow rate in increasing order, then the task start time also
in increasing order and, finally, the flow in decreasing order. The strategy (2B)
first labels the flow rate in decreasing order, then the flow in decreasing order
again and, finally, the start time in increasing order.
4 Experimental Results
This section reports experiments on a set of instances used in [6]. These instances
are derived from a real-world case study: the evacuation of the Hawkesbury-
Nepean (HN) floodplain. The HN evacuation graph contains 80 evacuated
nodes, 5 safe nodes, 184 transit nodes, 580 edges and 38343 vehicles to evac-
uate. The experimental results also consider a class of instances HN80-Ix
using the HN evacuation graph but a number of evacuees scaled by a factor
x ∈ {1.1, 1.2, 1.4, 1.7, 2.0, 2.5, 3.0} to model population growth. For simplicity,
the experiments did not consider a flood scenario and assume that network edges
are always available within the scheduling horizon H. It is easy to generalize the
results to various flood scenarios.
1
Note that the search procedure does not assume convergent paths or restrictions on
the latest arrival times at the safe node.
A Constraint Programming Approach 585
Table 1. The strongly connected components associated with each HN80-Ix instance.
Instance CPU (s) Perc. Evac. CPU (s) Perc. Evac. Search CPU (s) Perc. Evac.
heuristics and each experimental run was given a maximal runtime of 1800 sec-
onds per strongly connected component. The results were obtained on 64-bit
machines with 3.1GHz AMD 6-Core Opteron 4334 and 64Gb of RAM and the
scheduling algorithms were implemented using the programming language JAVA
8 and the constraint solver Choco 3.3.0, except for NPEPP-MF where the search
was implemented in ObjectiveCP.
Maximizing the Flow of Evacuees. Table 2 compares, for each HN80-Ix instance
and a 10-hour scheduling horizon, the percentage of vehicles evacuated (Perc.
Evac.) and the solving time in seconds (CPU (s)) with FSP, NEPP-MF/SAT
and NPEPP-MF/SAT. All solutions found with FSP are optimal and are thus
an upper bound on the number of vehicles that can be evacuated with NEPP
and NPEPP. Prior to solving NEPP-MF (resp. NPEPP-MF), the algorithm
attempts to solve NEPP-SAT (resp. NPEPP-SAT) with a 60s time limit and,
when this is successful, the annotation (SAT) is added next to the percentage
of vehicles evacuated. As we make use of decomposition and parallel computing,
the reported CPU for NEPP/NPEPP is the latest of the time at which the best
solution is found among all strongly connected components. The table reports
the best results across the heuristics, i.e., the run where the most vehicles are
evacuated ; for the random strategy, the best result is reported across 10 runs
(note that the standard deviation for the objective value ranges between 0.4%
and 1.1% only across all instances). The search strategy for the best run is shown
in column (Search) as a combination {TaskVar, VarOrder} where TaskVar is the
heuristic for choosing the next task variable and VarOrder is the heuristic for
labeling the task variables.
The results highlight the fact that the constraint-based simultaneous schedul-
ing model finds very high-quality results. On the first five instances, with popu-
lation growth up to 70%, the solutions of NEPP-MF are within 2.2% of the
A Constraint Programming Approach 587
preemptive bound. This is also the case for the largest instance. In the worst case,
the constraint-based scheduling model is about 4.9% away from the preemptive
bound. It is thus reasonable to conclude that the constraint-based algorithms
may be of significant value to emergency services as they produce realistic plans
for large-scale controlled evacuations. For NPEPP-MF, the solver found optimal
solutions and proved optimality for all instances, except HN80-I1.1 and HN80-
I1.2 for which the best found solution was within 0.1% of the optimal one.2 The
results indicate that a phased evacuation is much less effective in practice and
decreases the number of evacuees reaching safety by up to 40% in many instances.
Unless phased evacuations allow an evacuation of all endangered people, they are
unlikely to be applied in practice, even if they guarantee the absence of traffic
merging.
Figure 3 shows how the quality of solutions improves over time for all HN-
Ix instances which are not completely evacuated, for a particular run. For all
instances, a high-quality solution is found within 10 seconds, which makes the
algorithm applicable to a wide variety of situations. When practical, giving the
algorithm more time may still produce significant benefits: For instance, on HN-
I1.7 the percentage of vehicles increases from 93.0% to 97.6% when the algorithm
is given 1800s. Such improvements are significant in practice since they may be
the difference between life and death.
Fig. 4. Departure times and flows of 7 evacuated nodes for the NEPP solver.
Table 3. Evacuation clearance time (CT) with FSP-CT, NEPP-CT, and NPEPP-CT.
Instance CPU (s) CT (min) CPU (s) CT (min) Search CPU (s) CT (min)
there are also some suprising combinations {evacuated node, time step}, such
as {3, 50}, {3, 84} and {3, 85} where the flow rate is respectively 22, 3, and 12
for evacuation area 3. In summary, the FSP solution is unlikely to be the basis
of a controlled evacuation: It is just too difficult to enforce such a complicated
schedule. Figure 4 shows a repartition of departure times for the same nodes
in the original HN80 instance using the NEPP. The evacuation profile for the
departure times is extremely simple and can easily be the basis of a controlled
evacuation. Its simplicity contrasts with the complexity of the FSP solution and
demonstrates the value of the constraint programming approach promoted in
this paper.
Minimizing the Clearance Time. Table 3 compares, for each HN80-Ix instance,
the minimal clearance time in minutes (CT (min)) found with FSP-CT, NEPP-
CT and NPEPP-CT. All solutions found with FSP-CT and NPEPP-CT are
optimal for the given set of paths. Once again, solutions found by NEPP-CT are
of high-quality and reasonably close to the preemptive lower bound produced
by FSP-CT. In the worst case, the results are within 5.1% of the preemptive
lower bound. The clearance times of the phased evacuations, which are optimal,
are significantly larger than for the NEPP. Note again that paths are differ-
ent between instances and are not necessarily optimal with respect to different
scheduling horizons, which explain inconsistencies such as the horizon found for
HN80-I1.4 being shorter than the horizon found for HN80-I1.2 with NPEPP-CT.
A Constraint Programming Approach 589
Table 4. Vehicles Evacuated with NEPP-MF with Flow Rates in {2, 6, 10, 15, 20}.
The Impact of the Flow Rates. The constraint-based scheduling models have the
flow rates as decision variables, which increases the flexibility of the solutions.
Table 4 studies the benefits of this flexibility and compares the general results
with the case where the flow rates must be selected from a specific set, here
{2, 6, 10, 15, 20}. This is similar to the approach proposed in [12], which uses a
fixed set of response curves and their associated mobilization resources. Note that
the column-generation algorithm in [12] does not produce convergent plans and
discretizes time. The results seem to indicate that flexible flow rates sometimes
bring benefits, especially for the larger instances where the benefits can reach
3.0% ; nonetheless the possible loss when using fixed rates is not substantial and
may capture some practical situations.
5 Conclusion
This paper proposes, for the first time, several constraint-based models for con-
trolled evacuations that produce practical and actionable evacuation schedules.
These models address several limitations of existing methods, by ensuring non-
preemptive scheduling and satisfying operational evacuation constraints over
mobilization resources. The algorithms are scalable, involve no time discretiza-
tion, and are capable of accommodating side constraints for specific disaster sce-
narios or operational evacuation modes. Moreover, the models have no restriction
on the input set of evacuation paths, which can be convergent or not. Preliminary
experiments show that high-quality solutions, with an objective value close to an
optimal value of an optimal preemptive solution, can be obtained within a few
seconds, and improve over time. Future work will focus on improving the prop-
agation strength of the cumulative constraint for variable durations, flows, and
flow rates, and on generalizing the algorithm for the joint evacuation planning
and scheduling.
References
1. Andreas, A.K., Smith, J.C.: Decomposition algorithms for the design of a nonsi-
multaneous capacitated evacuation tree network. Networks 53(2), 91–103 (2009)
2. Bish, D.R., Sherali, H.D.: Aggregate-level demand management in evacuation plan-
ning. European Journal of Operational Research 224(1), 79–92 (2013)
3. Bretschneider, S., Kimms, A.: Pattern-based evacuation planning for urban areas.
European Journal of Operational Research 216(1), 57–69 (2012)
4. Cepolina, E.M.: Phased evacuation: An optimisation model which takes into
account the capacity drop phenomenon in pedestrian flows. Fire Safety Journal
44, 532–544 (2008)
5. Even, C., Pillac, V., Van Hentenryck, P.: Nicta evacuation planner: Actionable
evacuation plans with contraflows. In: Proceedings of the 20th European Confer-
ence on Artificial Intelligence (ECAI 2014). Frontiers in Artificial Intelligence and
Applications, vol. 263, pp. 1143–1148. IOS Press, Amsterdam (2014)
6. Even, C., Pillac, V., Van Hentenryck, P.: Convergent plans for large-scale evac-
uations. In: Proceedings of the 29th AAAI Conference on Artificial Intelligence
(AAAI 2015) (in press 2015)
7. Huibregtse, O.L., Bliemer, M.C., Hoogendoorn, S.P.: Analysis of near-optimal evac-
uation instructions. Procedia Engineering 3, 189–203 (2010), 1st Conference on
Evacuation Modeling and Management
8. Huibregtse, O.L., Hegyi, A., Hoogendoorn, S.: Blocking roads to increase the evac-
uation efficiency. Journal of Advanced Transportation 46(3), 282–289 (2012)
9. Huibregtse, O.L., Hoogendoorn, S.P., Hegyi, A., Bliemer, M.C.J.: A method to
optimize evacuation instructions. OR Spectrum 33(3), 595–627 (2011)
10. Lim, G.J., Zangeneh, S., Baharnemati, M.R., Assavapokee, T.: A capacitated net-
work flow optimization approach for short notice evacuation planning. European
Journal of Operational Research 223(1), 234–245 (2012)
A Constraint Programming Approach 591
11. Pillac, V., Even, C., Van Hentenryck, P.: A conflict-based path-generation heuristic
for evacuation planning. Tech. Rep. VRL-7393, NICTA (2013), arXiv:1309.2693,
submitted for publication
12. Pillac, V., Cebrian, M., Van Hentenryck, P.: A column-generation approach for
joint mobilization and evacuation planning. In: International Conference on Inte-
gration of Artificial Intelligence and Operations Research Techniques in Constraint
Programming for Combinatorial Optimization Problems (CPAIOR), Barcelona
(May 2015)
13. Pillac, V., Van Hentenryck, P., Even, C.: A Path-Generation Matheuristic for Large
Scale Evacuation Planning. In: Blesa, M.J., Blum, C., Voß, S. (eds.) HM 2014.
LNCS, vol. 8457, pp. 71–84. Springer, Heidelberg (2014)
14. Richter, K.F., Shi, M., Gan, H.S., Winter, S.: Decentralized evacuation manage-
ment. Transportation Research Part C: Emerging Technologies 31, 1–17 (2013)
Solving Segment Routing Problems with Hybrid
Constraint Programming Techniques
1 Introduction
During the last decades, the Internet has quickly evolved from a small network
mainly used to exchange emails to a large scale critical infrastructure responsible
of significant services including social networks, video streaming, and cloud com-
puting. Simultaneously, Internet Service Providers have faced increasing require-
ments in terms of quality of service to provide to their end-users, e.g., low delays
and high bandwidth. For this reason, controlling the paths followed by traffic has
become an increasingly critical challenge for network operators [22] – especially
those managing large networks. Traffic Engineering – a field at the intersection
of networking, mathematics, and operational research – aims at optimizing net-
work traffic distribution. Among its main objectives, avoiding link overload is
one of the most important as it leads to drop of network reliability, e.g., loss
of packets and increasing delays [1]. New traffic engineering objectives recently
emerged [29]. For instance, a network operator may want specific demands to
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 592–608, 2015.
DOI: 10.1007/978-3-319-23219-5 41
Solving Segment Routing Problems 593
get through different sequences of network services, e.g., suspect traffic through
a battery of firewalls and high-priority traffic via load-balancer and on low-delay
paths [13].
Segment Routing (SR) [12] has been recently proposed to cope with those
challenges. It is an emerging network architecture that provides enhanced packet
forwarding capabilities while keeping a low configuration impact on networks.
Segment Routing is both an evolution of MPLS (MultiProtocol Label Switch-
ing) [23] and of IPv6 [31]. Many actors of the network industry support segment
routing and several internet service providers will implement segment routing to
manage their networks [12,13,14,28]. All-in-one, segment routing seems to be a
promising technology to solve traffic engineering problems.
The basic idea of Segment Routing is to prepend packets with a stack of
labels, called segments, contained in a segment routing header. A segment rep-
resents an instruction. In this work, we focus on node segments that can be used
to define paths in a weighted graph that represents the network topology. A
node segment contains the unique label of the next router to reach. When such
a router is reached, the current node segment is popped and the packet is sent
to the router referenced by the next segment and so on. Note that segment rout-
ing exploits all the equal cost shortest-paths to reach a given destination. Such
equal cost shortest-paths – called Equal-Cost Multi-Paths (ECMP) paths – are
extremely frequent in network architectures and it is not rare to see as much as
128 different shortest-paths between a source and a destination within a single
network [13]. Fig. 1 illustrates the use of two node segments to define a segment
routing path from router s to router t. Note that the use of segments provides
extreme flexibility in the path selection for different demands.
1) a b 2) a b 3) a b
s c d t s c d t s c d t
SR header SR header
Fig. 1. A segment routing header with two segments prepended to a packet. First, the
packet is sent to router d using the ECMP path from s to d (assuming unary link
costs). Then, the packet is sent to the next label b following the ECMP path from d to
b. Finally, all the segments have been processed and the original packet is sent to its
destination t using the ECMP path from b to t.
also used in commercial traffic engineering tools is a tabu search algorithm [18]
proposed by Fortz and Thorup in [15]. However, this method is based on the
assumption that the network paths are computed as shortest paths in the net-
work topology, hence it simply cannot be used to optimize segment routing
networks. Similar considerations also apply to optimization frameworks used for
more flexible protocols, like RSVP-TE [11,20].
In this work, we focus on the traffic placement problem using segment rout-
ing. Precisely, this problem consists in finding an SR-path for each demand such
that the usage of each link is minimized while respecting a set of side constraints
on the demands and the network (§2). We target large networks, like those of
Internet Service Providers, hence both performance and scalability of the opti-
mization techniques are crucial requirements, in addition to good quality of the
solution. We note that classical constraint programming encoding of the prob-
lems generally lead to expensive memory consumption that cannot be sustained
for large networks (several hundreds of nodes) (§3.1). We thus propose a data
structure to encode the domain of our demands that is dedicated to this problem
(§3.2 and §3.3). This encoding has the advantage of reducing the memory con-
sumption of classical constraint programming from O(n4 ) to O(n3 ). We describe
specific and light propagators for constraints defined on top of this new represen-
tation (§4). Our results are finally evaluated on synthetic and real topologies (§5
and §6). They highlight that constraint programming and large neighborhood
search is a winning combination for segment routing traffic engineering.
s c d t s c d t s c d t
4 4 4 4 6
denoted (s, v1 , . . . , vk , t) and such that the destination of a forwarding graph is the
the source of its successor in the sequence. Also, the source of the first forwarding
graph and the destination of the last forwarding graph respectively correspond to
the source and the destination of the SR-path.
a b a b a b
s c d t s c d t s c d t
Fig. 3. Three different SR-paths based on the forwarding graphs of Fig. 2. An SR-path
is represented by the sequence of nodes (top) corresponding to the extremities of its
forwarding graphs (bottom).
and such that a set of constraints on the SR-paths and the network is respected.
596 R. Hartert et al.
where A is the set of elements not contained in A. This problem can easily be
reduced to the instance of the GSRP depicted in Fig. 4 with all edge capacities
n
fixed to i=1 ci /2. First, consider n demands d1 , . . . , dn from node s to node t
such that bw(di ) = ci . Then, consider that forwarding graphs are defined such
that there are only two possible SR-paths from node s to node t (see Fig. 4).
Finding a valid SR-path for each demand amounts to find a solution to the
Partition problem, i.e., demands having (s, A, t) as SR-path are part of the set
A while the remaining demands are part of the set A.
A A
s t s t
forwarding graph F G(u, v). With this consideration in mind, let us motivate the
need of an alternative representation by reviewing classical ways to model path
variables, i.e., path-based, link-based, and node-based representations [39].
In path-based representations, a single variable is associated to each path. The
domain of this variable thus contains all the possible paths to be assigned
to the variable. This representation is usual in column generation frame-
works [2]. In the context of the GSRP, complete path-based representations
have an impracticable memory cost of Θ(|D||N|k ) where k is the maximal
length of the SR-paths.
Link-based representations are surely the most common way to model path
variables [25,42]. The idea is to associate a boolean variable x(d, e) to each
demand d ∈ D and edge e ∈ E. The boolean variable is set to true if edge e is
part of the path, false otherwise. Hence, modeling SR-paths with link-based
representations requires Θ(|D||N|2 ) boolean variables.
Basically, a node-based representation models a path as a sequence of visited
nodes [33]. This could be easily modeled using a discrete variable for each
node that represents the successor of this node. The memory impact of such
representation is Θ(|D||N|2 ).
As mentioned above, memory and computational costs are of practical impor-
tance as we want to solve the GSRP on networks containing several hundreds of
nodes with tens of thousands of demands. In this context, even link-based and
node-based representations suffer from important shortcomings in both aspects.
(see Fig. 5). Hence, no assumption can be made on the part of the sequence
that follows the prefix of already visited nodes and the set of candidates. As a
side effect, visiting a new node c automatically generates a new set of candidates
as assumptions on the successor of c were impossible until now. It is then the
responsibility of constraints to reduce this new set of candidates.
visited a FG (d, a)
a b
b FG (d, b)
s d candidates
c FG (d, c)
s c d t
t FG (d, t)
FG (s, d), . . . FG (s, d), . . .
Fig. 5. A partial SR-path (left) and its corresponding SR-path variable (right). The
SR-path variable maintains the partial sequence of visited nodes from the source s
to the destination t and a set of candidates. Candidates represent the possible direct
successors of the last visited node.
3.3 Implementation
We propose to use array-based sparse-sets [5] to implement the internal struc-
ture of SR-path variables. Our data structure is similar to the one proposed
to implement set variables in [8]. The sparse-set-based data structure relies on
two arrays of |N| elements, nodes and map, and two integers V and R. The V
first nodes in nodes correspond to the sequence of visited nodes. The nodes at
positions [V, . . . , R[ in nodes form the set of candidates. The map array maps
each node to its position in nodes. Fig. 6 illustrates this data structure and its
corresponding partial SR-path.
The sparse-set-based implementation of SR-path variables offers several
advantages. First, it is linear in the number of nodes since it only relies on
two arrays and two integers. Also, it implicitly enforces the AllDifferent con-
straint on the sequence of visited nodes. Finally, it allows optimal computational
complexity for all the operations presented in Table 1. Many of these operations
Solving Segment Routing Problems 599
visited candidates
nodes s d c a b t visited a
0 1 2 3 4 5
b candidates
V R s d
c
map 0 3 4 2 1 5 t
s a b c d t
Visit a new node. Each time a node is visited, it swaps its position in nodes
with the node at position V. Then, the value of V is incremented to append
the visited node to the sequence of visited nodes. Finally, the value of R is set
to |N| to restore the set of candidates to all the non-visited nodes. The visit
operation is illustrated in Fig. 7. Observe that the sequence of visited nodes
keeps its chronological order.
nodes s d c a b t nodes s d b a c t
0 1 2 3 4 5 0 1 2 3 4 5
V R V R
map 0 3 4 2 1 5 map 0 3 2 4 1 5
s a b c d t s a b c d t
Fig. 7. State of the internal structure before (left) and after (right) visiting node b.
First, node b exchanges its position with the node at position V in nodes, i.e., c. Then,
V is incremented and R is set to |N|.
nodes s d c a b t nodes s d b a c t
0 1 2 3 4 5 0 1 2 3 4 5
V R V R
map 0 3 4 2 1 5 map 0 3 2 4 1 5
s a b c d t s a b c d t
Fig. 8. State of the internal structure before (left) and after (right) removing node c.
First, node c exchanges its position with the node at position R in nodes, i.e., b. Then,
R is decremented.
We chose to apply the third solution as visiting a new node automatically restores
the set of candidates to all the non-visited nodes (by updating the value of R
to |N|). This search mechanism thus allows us to keep backtracking in constant
time since previous sets of candidates do not need to be recovered.
∀c ∈ candidates(S), ∀e ∈ F G(last(S), c) :
(2)
load(e) + flow(last(S),c) (e, bw(d)) ≤ capa(e)
The filtering of the Channeling constraint is enforced using two filtering pro-
cedures. The first filtering procedure is triggered each time a new candidate is
visited by an SR-path variable to adjust the load variable of all the links tra-
versed by the visited forwarding graph. Then, the second filtering procedure is
called to reduce the set of candidates by removing forwarding graphs which can-
not accommodate demand d due to the insufficient remaining bandwidth of their
links. This second filtering procedure is also called each time the load variable
of a link is updated.
The Channeling constraint relies intensively on forwarding graphs and flow
functions. In our implementation, we chose to precompute these flow functions
for fast propagation of the Channeling constraint. Such data structures may
have an important impact of O(|N|2 |E|) in memory. Fortunately, this cost can
be reduced to O(|N||E|) by exploiting the shortest-paths DAG2 returned by
Dijkstra’s algorithm.3 Indeed, we can test the presence of an edge (u, v) in
a shortest-path from s to t using the transitive property of shortest-paths as
follows:
dist(s, u) + cost(u, v) + dist(v, t) = dist(s, t). (3)
This property allows one to use shortest-paths DAGs to recompute flow functions
and forwarding graphs in O(|E|) when required.
2
Shortest-paths DAGs can be easily computed by maintaining several shortest-paths
to a given node in Dijkstra’s algorithm.
3
Recall that we make the assumption that forwarding graphs correspond to ECMP
paths.
602 R. Hartert et al.
of visited nodes to the bounds of the length variable. Let min(length(S)) and
max(length(S)) respectively be the lower bound and the upper bound of the
length variable of S. Changes on the bounds of this variable trigger both following
filtering procedures :
– If |visited(S)| < min(length(S)) − 1, we know that the destination of the
SR-path is not a valid candidate as visiting it next will result in a path that
is smaller than the lower bound of its length variable ;
– If |visited(S)| = max(length(S)) − 1, the destination of the SR-path must
be visited next to respect the upper bound of its length variable.
The Length constraint is also awakened when a new node is visited. In this
case, the filtering procedure first checks if the visited node is the destination
of the path. If it is the case, the length variable is assigned to |visited(S)|.
Otherwise, the lower bound of the length variable is updated to be strictly greater
than |visited(S)| as the path destination still has to be visited.
visited(S) = . . . , s1 , . . . , s2 , . . . , sk , . . .
(5)
∀i ∈ {1, . . . , k} : si ∈ servicei
5 Hybrid Optimization
Finding a first feasible solution of the GSRP can be a difficult task. In this
context, it is often more efficient to relax the capacity constraint of each link
and to minimize the load of the maximum loaded links until respecting the
original capacity constraints.
Frameworks such as Large Neighborhood Search (LNS) [38] have been
shown to be very efficient to optimize large scale industrial problems in many
domains [4,21,26,27,32,37]. The idea behind LNS is to iteratively improve a best-
so-far solution by relaxing some part of this solution. In the context of GSRP, this
could be easily achieved by removing demands that seem inefficiently placed and
to replace them in the network to improve the objective function. The selected
set of removed demands defines the neighborhood to be explored by a branch-
and-bound constraint programming search.
Instead of dealing with all the load variables with a unique aggregation func-
tion (e.g. the maximum load), we designed a specific hybrid optimization scheme
to make the optimization more aggressive. At each iteration, we force a randomly
chosen most loaded link to strictly decrease its load. The load of the remaining
links are allowed to be degraded under the following conditions:
– The load of the most loaded links cannot increase;
– The load of the remaining links are allowed to increase but must remain under
the maximum load, i.e., the set of the most loaded links cannot increase;
– The load of the non-saturated links must remain under their link capacity
to not increase the number of saturated links.
This optimization framework can be seen as particular instantiation of the
variable-objective large neighborhood search framework [36].
Neighborhoods to be explored by constraint programming are generated
using the following procedure [38]:
1. Let Dmax be the set of demands routed through the most loaded links;
2. While fewer than k demands have been selected:
(a) Let A be the array of the not yet selected demands in Dmax sorted by
non-increasing bandwidth;
(b) Generate a random number r ∈ [0, 1[;
(c) Select the rα |A| demand in array A.
The parameter α ∈ [1, ∞[ is used to control the diversification of the selection
procedure. If α = 1 all demands have the same chance to be selected. If α = ∞
the k demands with the highest bandwidth are always selected. The sub-problem
generated by removing the selected demands is then explored by constraint pro-
gramming with a CSPF-like (Constrained Shortest Path First) heuristic [7]:
1. Select the unassigned demand with the largest bandwidth;
2. Try to extend the SR-path variable of this demand as follows:
(a) If the demand destination is a valid candidate, visit the destination to
assign the SR-path variable;
Solving Segment Routing Problems 605
(b) Otherwise, visit all the candidates sorted by non-decreasing order of their
impact on the load of the most loaded links.
3. If the SR-path variable has no valid candidate, backtrack and reconsider the
previous visit.
4
In a solution with all demands routed through their ECMP path.
606 R. Hartert et al.
90% 90%
86%
76%
90%
75%
20% 22%
34%
15% 1% 0%
SynthB RealC RealH
Fig. 9. Load of the 40 most loaded edges before (left) and after (right) optimization
on a synthetic topology and two real ones. The load of many links have to be reduced
to improve the maximum load on the artificial topologies while only a few have to be
considered on the real ones. Real topologies contain more bottleneck links.
7 Conclusion
References
1. Awduche, D., Chiu, A., Elwalid, A., Widjaja, I., Xiao, X.: Overview and principles
of internet traffic engineering-rfc3272. IETF (2002)
2. Barnhart, C., Hane, C.A., Vance, P.H.: Using branch-and-price-and-cut to solve
origin-destination integer multicommodity flow problems. Operations Research
48(2), 318–326 (2000)
3. Beasley, J.E., Christofides, N.: An algorithm for the resource constrained shortest
path problem. Networks 19(4), 379–394 (1989)
4. Bent, R., Hentenryck, P.V.: A two-stage hybrid algorithm for pickup and delivery
vehicle routing problems with time windows. Computers & Operations Research
33(4), 875–893 (2006)
5. Briggs, P., Torczon, L.: An efficient representation for sparse sets. ACM Letters on
Programming Languages and Systems (LOPLAS) 2(1–4), 59–69 (1993)
6. Uslar, M., Specht, M., Rohjans, S., Trefke, J., Gonzalez, J.M.V.: Introduction. In:
Uslar, M., Specht, M., Rohjans, S., Trefke, J., Vasquez Gonzalez, J.M. (eds.) The
Common Information Model CIM. POWSYS, vol. 2, pp. 3–48. Springer, Heidelberg
(2012)
7. Davie, B., Rekhter, Y.: MPLS: technology and applications. Morgan Kaufmann
Publishers Inc. (2000)
8. le Clément de Saint-Marcq, V., Schaus, P., Solnon, C., Lecoutre, C.: Sparse-sets
for domain implementation. In: CP workshop on Techniques for Implementing
Constraint programming Systems (TRICS), pp. 1–10 (2013)
9. Desrochers, M., Soumis, F.: A generalized permanent labeling algorithm for the
shortest path problem with time windows. INFOR Information Systems and Oper-
ational Research (1988)
10. Dooms, G., Deville, Y., Dupont, P.E.: CP(Graph): Introducing a Graph Computa-
tion Domain in Constraint Programming. In: van Beek, P. (ed.) CP 2005. LNCS,
vol. 3709, pp. 211–225. Springer, Heidelberg (2005)
11. Figueiredo, G.B., da Fonseca, N.L.S., Monteiro, J.A.S.: A minimum interference
routing algorithm. In: ICC, pp. 1942–1947 (2004)
12. Filsfils, C., et al.: Segment Routing Architecture. Internet draft, draft-filsfils-spring-
segment-routing-00, work in progress (2014)
13. Filsfils, C., et al.: Segment Routing Use Cases. Internet draft, draft-filsfils-spring-
segment-routing-use-cases-00, work in progress (2014)
14. Filsfils, C., et al.: Segment Routing with MPLS data plane. Internet draft, draft-
filsfils-spring-segment-routing-mpls-01, work in progress (2014)
15. Fortz, B., Thorup, M.: Internet traffic engineering by optimizing OSPF weights.
In: Proc. INFOCOM (March 2000)
16. Frei, C., Faltings, B.V.: Resource Allocation in Networks Using Abstraction and
Constraint Satisfaction Techniques. In: Jaffar, J. (ed.) CP 1999. LNCS, vol. 1713,
pp. 204–218. Springer, Heidelberg (1999)
17. Gervet, C.: Conjunto: Constraint logic programming with finite set domains. ILPS
94, 339–358 (1994)
18. Glover, F.: Tabu search: A tutorial. Interfaces 20(4), 74–94 (1990)
19. Inc., Gurobi Optimization. Gurobi optimizer reference manual (2015)
20. Kodialam, M., Lakshman, T.V.: Minimum interference routing with applications to
mpls traffic engineering. In: Proceedings of the Nineteenth Annual Joint Conference
of the IEEE Computer and Communications Societies, INFOCOM 2000, vol. 2,
pp. 884–893. IEEE (2000)
608 R. Hartert et al.
21. Mairy, J.B., Deville, Y., Van Hentenryck, P.: Reinforced adaptive large neighbor-
hood search. In: The Seventeenth International Conference on Principles and Prac-
tice of Constraint Programming (CP 2011), p. 55 (2011)
22. Nucci, A., Papagiannaki, K.: Design, Measurement and Management of Large-
Scale IP Networks - Bridging the Gap between Theory and Practice. Cambridge
University Press (2008)
23. RFC3031 ŒTF. Multiprotocol label switching architecture (2001)
24. OscaR Team. OscaR: Scala in OR (2012). https://bitbucket.org/oscarlib/oscar
25. Ouaja, W., Richards, B.: A hybrid multicommodity routing algorithm for traffic
engineering. Networks 43(3), 125–140 (2004)
26. Pacino, D., Van Hentenryck, P.: Large neighborhood search and adaptive ran-
domized decompositions for flexible jobshop scheduling. In: Proceedings of the
Twenty-Second International Joint Conference on Artificial Intelligence, vol. 3,
pp. 1997–2002. AAAI Press (2011)
27. Shaw, P., Furnon, V.: Propagation Guided Large Neighborhood Search. In: Wal-
lace, M. (ed.) CP 2004. LNCS, vol. 3258, pp. 468–481. Springer, Heidelberg (2004)
28. Previdi, S., et al.: IPv6 Segment Routing Header (SRH). Internet draft, draft-
previdi-6man-segment-routing-header-00, work in progress (2014)
29. Quinn, P., Nadeau, T.: Service function chaining problem statement. draft-ietf-sfc-
problem-statement-07 (work in progress) (2014)
30. Quoitin, B., Van den Schrieck, V., Francois, P., Bonaventure, O.: IGen: Generation
of router-level Internet topologies through network design heuristics. In: ITC (2009)
31. Deering, S.: RFC2460 and R Hinden. Internet protocol
32. Ropke, S., Pisinger, D.: An adaptive large neighborhood search heuristic for the
pickup and delivery problem with time windows. Transportation Science 40(4),
455–472 (2006)
33. Giralt, L.R., Creemers, T., Tourouta, E., Colomer, J.R., et al.: A global constraint
model for integrated routeing and scheduling on a transmission network (2001)
34. Rossi, F., Van Beek, P., Walsh, T.: Handbook of constraint programming. Elsevier
Science (2006)
35. Roughan, M.: Simplifying the synthesis of internet traffic matrices. SIGCOMM
Comput. Commun. Rev. 35(5), 93–96 (2005)
36. Schaus, P.: Variable objective large neighborhood search (Submitted to CP13,
2013)
37. Schaus, P., Hartert, R.: Multi-Objective Large Neighborhood Search. In: Schulte,
C. (ed.) CP 2013. LNCS, vol. 8124, pp. 611–627. Springer, Heidelberg (2013)
38. Shaw, P.: Using Constraint Programming and Local Search Methods to Solve
Vehicle Routing Problems. In: Maher, M.J., Puget, J.-F. (eds.) CP 1998. LNCS,
vol. 1520, pp. 417–431. Springer, Heidelberg (1998)
39. Simonis, H.: Constraint applications in networks. Handbook of Constraint
Programming 2, 875–903 (2006)
40. Spring, N., Mahajan, R., Wetherall, D., Anderson, T.: Measuring isp topologies
with rocketfuel. IEEE/ACM Trans. Netw., 12(1) (2004)
41. Van Hentenryck, P., Deville, Y., Teng, C.-M.: A generic arc-consistency algorithm
and its specializations. Artificial Intelligence 57(2), 291–321 (1992)
42. Xia, Q., Simonis, H.: Primary/Secondary Path Generation Problem: Reformula-
tion, Solutions and Comparisons. In: Lorenz, P., Dini, P. (eds.) ICN 2005. LNCS,
vol. 3420, pp. 611–619. Springer, Heidelberg (2005)
Modeling Universal Instruction Selection
1 Introduction
i = 0;
(i < N) {
c = A [ i ] + B [ i ];
( MAX < c )
c = MAX ;
C[i] = c;
i ++;
}
(a) C code
Fig. 1. An example program that computes the saturated sums of two arrays, where
A, B, and C are integer arrays of equal lengths and stored in memory, and N and MAX
are integer constants representing the array length and the upper limit, respectively.
An int value is assumed to be 4 bytes.
612 G. Hjort Blindell et al.
This section introduces representations for both programs and instructions and
how they can be used to express covering and global code motion.
Program Representation. The key idea is to combine both data flow and
control flow in the very same representation. We start by modifying control-flow
graphs such that the nodes representing blocks no longer contain any compu-
tations. We refer to these as block nodes. In addition, the control procedures
previously found within the blocks now appear as separate control nodes, where
each control node has exactly one inbound control-flow edge indicating to which
block the procedure belongs. Consequently, the control-flow edges that previ-
ously originated from the block nodes now originate from the control nodes. An
example will be provided shortly.
To capture the data flow of entire program functions as a data-flow graph
we use the SSA (Static Single Assignment) graph constructed from programs in
SSA form. SSA is a state-of-the-art program representation where each program
variable must be defined only once [14]. When the definition depends on the
control flow, SSA uses so-called ϕ-functions to disambiguate such cases by taking
a value and the block from where it originates as arguments. Fig. 2 shows the
C program from Fig. 1a in SSA form, and the corresponding control-flow and
SSA graphs are shown in Fig. 3a and Fig. 3b, respectively. Originally the SSA
graph only consists of nodes representing computations – called computation
nodes – but we extend it such that each value is represented by a value node.
Also note that copying of values is not represented as separate computation
nodes in the SSA graph. Therefore, in Fig. 3b the program variables i1 and c2
have been replaced by 0 and MAX , respectively.
To unify the control-flow graph and the SSA graph, we first add data-flow
edges from value nodes to the control nodes that make use of the corresponding
values. For the control-flow graph shown in Fig. 3a this entails the c.br nodes,
which represent conditional jumps. Note that the SSA graph does not indicate
in which block a given computation should be performed. Although we want
to keep such pre-placements to a minimum, having no pre-placements permits
moves that violate the program semantics. For example, in Fig. 1b the assignment
c = MAX must be performed in block bb4 as its execution depends on whether
614 G. Hjort Blindell et al.
bb1 0
ϕ
br
N i2 4
bb2 > ∗
A t1 B
c.br end
F + +
T
bb3 t2 t3
ld ld
c.br bb4
T
a b
F
br + MAX
MAX c1 C 1
bb5
< ϕ + +
br c3 t4 i3
st
Fig. 3. The program graph constructed from the program shown in Fig. 2. Thick-lined
diamonds, boxes, and arrows represent control nodes, block nodes, and control-flow
edges, respectively. Thin-lined circles, boxes, and arrows represent computation nodes,
value nodes, and data-flow edges, respectively. Dotted lines represent definition edges.
MAX < c holds. Fortunately, these cases can be detected whenever a ϕ-function
appears in the program. The SSA-based program in Fig. 2, for example, has in
block bb2 a statement i2 = ϕ(i1 :bb1, i3 :bb5). Thus, the program variable i2
is assigned either the value i1 or the value i3 depending on whether the jump
to bb2 was made from block bb1 or block bb5. These conditions can be ensured
to hold in the generated code by requiring that (i) due to the arguments to the
ϕ-function, the values i1 and i3 must be computed in blocks bb1 and bb5,
respectively; and (ii) due to the location of the ϕ-function in the program, the
value i2 must be assigned its value in block bb2. We encode these constraints
into the program graph by introducing definition edges to signify that a certain
value must be produced in a specific block. Hence, in case of the example above
three definition edges are added: one from value node 0 to block node bb1, one
from value node i3 to block node bb5, and another from value node i2 to block
node bb2. Such edges are also added for the statement c3 = ϕ(c1 :bb3, c2 :bb4),
which results in the program graph shown in Fig. 3.
Modeling Universal Instruction Selection 615
This alone, however, may cause no solutions to be found for processors where
there is little overlap between the locations – like in the case of multiple register
banks – that can be used by the instructions. This problem is addressed using
a method called copy extension. Prior to identifying the matches, the program
graph is expanded such that every data usage is preceded by a special operation
called a copy, represented by copy nodes. This expansion is done
by inserting a copy node and value node along each data-flow edge
that represents a use of data, as shown in the figure to the right.
The definition edges are also moved such that they remain on the v
This condition may also be imposed by instructions that span multiple blocks.
Consequently, the order in which the blocks appear in the generated code is
interconnected with the selection of certain matches.
The set of variables succ(b) ∈ B ∪ {bnull } models the successor of block b. A
valid block order then corresponds to a cycle formed by the succ(·) variables.
Using the global circuit constraint [27], this condition can be expressed as:
circuit ∪b∈B∪{bnull } {succ(b)} (9)
For every block b in which a datum is defined, there must exist a selected
match that either is placed in b or spans b:
Branching Strategy. Our branching strategy only concerns those sel(·) vari-
ables of matches not corresponding to copy instructions. Let M denote this
set of matches. We branch on {sel(m) | m ∈ M } ordered by non-increasing
| covers(m)|, trying sel(m) = 1 before sel(m) = 0. The intuition behind this is to
eagerly cover the operations. The branching on the remaining decision variables
is left to the discretion of the solver (see Sect. 5 for details).
Model Limitations. A constant value that has been loaded into a register for
one use cannot be reused for other uses. Consequently, the number of selected
matches may be higher than necessary. This problem is similar to spilling reused
temporaries in [11] and can be addressed by adapting the idea of alternative
temporaries introduced in [10].
For some processors, conditional jumps can be removed by predicating
instructions with a Boolean variable that determines whether the instruction
shall be executed [3]. For example, assume that the statement c = MAX in Fig. 1b
is implemented using a copy instruction. If this instruction can be predicated
with the Boolean value MAX < c, then the conditional jump to block bb4 becomes
superfluous. This is known as if-conversion. Such instructions can be described
using two pattern graphs: one representing the predicated version, and another
representing the non-predicated version. But because every operation must be
covered by exactly one match, the predicated version can only be selected if the
match implements all computations in the conditionally executed block.
5 Experimental Evaluation
The model is implemented in MiniZinc [31] and solved with CPX [1] 1.0.2, which
supports FlatZinc 1.6. The experiments are run on a Linux machine with an Intel
Core i7-2620M 2.70 GHz processor and 4 GB main memory using a single thread.
We use all functions (16 in total) from MediaBench [28] that have more than
5 LLVM IR instructions and do not contain function calls or memory computa-
tions (due to limitations in the toolchain but not in the constraint model). The
size of their corresponding program graphs ranges between 34 and 203 nodes. The
functions are compiled and optimized into LLVM IR files using LLVM 3.4 [26]
with the -O3 flag (optimizes execution time). These files serve as input to our
Modeling Universal Instruction Selection 621
Simple Instructions. For proof of concept, the processor used is MIPS32 [33]
since it is easy to implement and extend with additional instructions. The pat-
tern graphs are manually derived from the LLVM instruction set description (to
enable comparison), however the process could be easily automated as patterns
are already described as trees in LLVM. As greedy heuristics already generate
code of sufficient quality – in many cases even optimal – for MIPS32, we should
not, in general, expect to see any dramatic execution speedup.
The shortest full runtime for the benchmarks is 0.3 seconds, the longest is
83.2 seconds, the average is 27.4 seconds, and the median is 10.5 seconds.
Fig. 6 shows the estimated execution speedup of our approach compared to
LLVM. The geometric mean speedup is 1.4%; in average our approach is slightly
better than LLVM. As the figure reveals, our approach has the potential to gener-
ate better code than the state of the art even for simple and regular architectures
such as MIPS32, mainly due to its ability of moving computations to blocks with
lesser execution frequency. The cases where our approach generates code that is
worse than LLVM are due to the model limitations described in Sect. 4. Some of
these cases are aggravated by the fact that LLVM’s instruction selector is capa-
ble of, where appropriate, combining chains of binary ϕ-functions into a single
ϕ-function in order to reduce the number of branch operations. This feature has
yet to be implemented in our toolchain.
622 G. Hjort Blindell et al.
30%
20%
10%
0%
re
gs
gs
gs
gs
jp
gs
gs
gs
gs
gs
ul
gs
jr
gs
al
co
m_
m_
m_
m_
eg
m_
m_
m_
m_
m_
aw
m_
ou
m_
aw
ns
L_
mu
as
ad
_q
L_
L_
L_
mu
as
2l
ab
nd
su
2l
tr
su
lt
ua
as
ad
as
lt
in
_u
in
uc
_r
li
ea
ea
t
ty
r
_s
c.
Fig. 7. Estimated execution speedup by adding SIMD instructions to MIPS32.
6 Related Work
Several linear time, optimal algorithms exist for local instruction selection on
tree-based program and pattern graphs [2,22,32]. These have subsequently been
extended to DAG-based program graphs [17,18,25], but at the loss of optimal-
ity. Together with instruction scheduling or register allocation, the problem has
also been approached using integer programming (IP) [7,21,36] and constraint
programming (CP) [6,19,30]. Far fewer methods exist for global instruction selec-
tion, which so far only has been approached as a partitioned Boolean quadratic
problem [9,15,16]. Common among these techniques is that they are restricted
to pattern trees or pattern DAGs.
Many methods exist for selecting vector instructions separately from instruc-
tion selection, but attempts have been made at combining these two tasks using
IP [29,34] and CP [4]. Of these, however, only [34] takes the cost of data copying
into account, and none is global.
Global code motion has been solved both in isolation [12] as well as in inte-
gration with register allocation [5,24]. Both [5] and [12] use a program represen-
tation that is similar to ours, but where the data are not explicitly represented
as nodes. To the best of our knowledge, no previous attempt has been made in
combining global code motion with instruction selection.
References
1. Opturion CPX user’s guide: Version 1.0.2. Tech. rep., Opturion Pty Ltd (2013)
2. Aho, A.V., Ganapathi, M., Tjiang, S.W.K.: Code Generation Using Tree Match-
ing and Dynamic Programming. Transactions on Programming Languages and
Systems 11(4), 491–516 (1989)
3. Allen, J.R., Kennedy, K., Porterfield, C., Warren, J.: Conversion of Control Depen-
dence to Data Dependence. In: ACM SIGACT-SIGPLAN Symposium on Principles
of Programming Languages, pp. 177–189 (1983)
4. Arslan, M.A., Kuchcinski, K.: Instruction Selection and Scheduling for DSP Ker-
nels on Custom Architectures. In: EUROMICRO Conference on Digital System
Design (2013)
5. Barany, G., Krall, A.: Optimal and Heuristic Global Code Motion for Minimal
Spilling. In: Jhala, R., De Bosschere, K. (eds.) Compiler Construction. LNCS,
vol. 7791, pp. 21–40. Springer, Heidelberg (2013)
6. Bashford, S., Leupers, R.: Constraint Driven Code Selection for Fixed-Point DSPs.
In: ACM/IEEE Design Automation Conference, pp. 817–822 (1999)
7. Bednarski, A., Kessler, C.W.: Optimal Integrated VLIW Code Generation with
Integer Linear Programming. In: Nagel, W.E., Walter, W.V., Lehner, W. (eds.)
Euro-Par 2006. LNCS, vol. 4128, pp. 461–472. Springer, Heidelberg (2006)
8. Bruno, J., Sethi, R.: Code Generation for a One-Register Machine. Journal of the
ACM 23(3), 502–510 (1976)
9. Buchwald, S., Zwinkau, A.: Instruction Selection by Graph Transformation. In:
International Conference on Compilers, Architectures and Synthesis for Embedded
Systems, pp. 31–40 (2010)
10. Castañeda Lozano, R., Carlsson, M., Blindell, G.H., Schulte, C.: Combinatorial
spill code optimization and ultimate coalescing. In: Kulkarni, P. (ed.) Languages,
Compilers, Tools and Theory for Embedded Systems, pp. 23–32. ACM Press, Edin-
burgh, UK (2014)
11. Lozano, R.C., Carlsson, M., Drejhammar, F., Schulte, C.: Constraint-Based Reg-
ister Allocation and Instruction Scheduling. In: Milano, M. (ed.) CP 2012. LNCS,
vol. 7514, pp. 750–766. Springer, Heidelberg (2012)
12. Click, C.: Global Code Motion/Global Value Numbering. In: ACM SIGPLAN 1995
Conference on Programming Language Design and Implementation, pp. 246–257
(1995)
13. Cordella, L.P., Foggia, P., Sansone, C., Vento, M.: A (Sub)Graph Isomorphism
Algorithm for Matching Large Graphs. IEEE Transactions on Pattern Analysis
and Machine Intelligence 26(10), 1367–1372 (2004)
14. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently
Computing Static Single Assignment Form and the Control Dependence Graph.
ACM TOPLAS 13(4), 451–490 (1991)
15. Ebner, D., Brandner, F., Scholz, B., Krall, A., Wiedermann, P., Kadlec, A.: Gen-
eralized Instruction Selection Using SSA-Graphs. In: ACM SIGPLAN-SIGBED
Conference on Languages, Compilers, and Tools for Embedded Systems, pp. 31–40
(2008)
16. Eckstein, E., König, O., Scholz, B.: Code Instruction Selection Based on SSA-
Graphs. In: Anshelevich, E. (ed.) SCOPES 2003. LNCS, vol. 2826, pp. 49–65.
Springer, Heidelberg (2003)
Modeling Universal Instruction Selection 625
17. Ertl, M.A.: Optimal Code Selection in DAGs. In: ACM SIGPLAN-SIGACT Sym-
posium on Principles of Programming Languages, pp. 242–249 (1999)
18. Ertl, M.A., Casey, K., Gregg, D.: Fast and Flexible Instruction Selection with On-
Demand Tree-Parsing Automata. In: ACM SIGPLAN Conference on Programming
Language Design and Implementation, pp. 52–60 (2006)
19. Floch, A., Wolinski, C., Kuchcinski, K.: Combined Scheduling and Instruction
Selection for Processors with Reconfigurable Cell Fabric. In: International Confer-
ence on Application-Specific Systems, Architectures and Processors, pp. 167–174
(2010)
20. Garey, M., Johnson, D.: Computers and Intractability: A Guide to the Theory of
NP-Completeness. Freeman (1979)
21. Gebotys, C.H.: An Efficient Model for DSP Code Generation: Performance,
Code Size, Estimated Energy. In: International Symposium on System Synthesis,
pp. 41–47 (1997)
22. Glanville, R.S., Graham, S.L.: A New Method for Compiler Code Generation. In:
ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages,
pp. 231–254 (1978)
23. Hjort Blindell, G.: Survey on Instruction Selection: An Extensive and Modern
Literature Study. Tech. Rep. KTH/ICT/ECS/R-13/17-SE, KTH Royal Institute
of Technology, Sweden (October 2013)
24. Johnson, N., Mycroft, A.: Combined Code Motion and Register Allocation Using
the Value State Dependence Graph. In: International Conference of Compiler Con-
struction, pp. 1–16 (2003)
25. Koes, D.R., Goldstein, S.C.: Near-Optimal Instruction Selection on DAGs. In:
IEEE/ACM International Symposium on Code Generation and Optimization,
pp. 45–54 (2008)
26. Lattner, C., Adve, V.: LLVM: A compilation framework for lifelong program anal-
ysis & transformation. In: IEEE/ACM International Symposium on Code Gener-
ation and Optimization (2004)
27. Laurière, J.L.: A Language and a Program for Stating and Solving Combinatorial
Problems. Artificial Intelligence 10(1), 29–127 (1978)
28. Lee, C., Potkonjak, M., Mangione-Smith, W.H.: MediaBench: A tool for evaluating
and synthesizing multimedia and communications systems. In: IEEE MICRO-30,
pp. 330–335 (1997)
29. Leupers, R.: Code Selection for Media Processors with SIMD Instructions. In:
Conference on Design, Automation and Test in Europe, pp. 4–8 (2000)
30. Martin, K., Wolinski, C., Kuchcinski, K., Floch, A., Charot, F.: Constraint-Driven
Instructions Selection and Application Scheduling in the DURASE System. In:
International Conference on Application-Specific Systems, Architectures and Pro-
cessors, pp. 145–152 (2009)
31. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.R.: MiniZ-
inc: Towards a Standard CP Modelling Language. In: Bessière, C. (ed.) CP 2007.
LNCS, vol. 4741, pp. 529–543. Springer, Heidelberg (2007)
32. Pelegrı́-Llopart, E., Graham, S.L.: Optimal Code Generation for Expression Trees:
An Application of BURS Theory. In: ACM SIGPLAN-SIGACT Symposium on
Principles of Programming Languages, pp. 294–308 (1988)
626 G. Hjort Blindell et al.
33. Sweetman, D.: See MIPS Run, Second Edition. Morgan Kaufmann (2006)
34. Tanaka, H., Kobayashi, S., Takeuchi, Y., Sakanushi, K., Imai, M.: A Code Selection
Method for SIMD Processors with PACK Instructions. In: International Workshop
on Software and Compilers for Embedded Systems, pp. 66–80
35. Živojnović, V., Martı́nez Velarde, J., Schläger, C., Meyr, H.: DSPstone: A DSP-
Oriented Benchmarking Methodology. In: Conference on Signal Processing Appli-
cations and Technology, pp. 715–720 (1994)
36. Wilson, T., Grewal, G., Halley, B., Banerji, D.: An Integrated Approach to Retar-
getable Code Generation. In: International Symposium on High-Level Synthesis,
pp. 70–75 (1994)
Optimizing the Cloud Service Experience
Using Constraint Programming
1 Introduction
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 627–637, 2015.
DOI: 10.1007/978-3-319-23219-5 43
628 S. Kadioglu et al.
In terms of solution methods, the assignment problem can be solved with the
simplex algorithm as it is a special case of linear programming. However, there
exist more efficient algorithms for this special structure. The prominent solution
method is the Hungarian algorithm (due to Hungarian mathematicians D. Kőnig
and J. Egerváry [17]). The algorithm runs in cubic time in the number of agents
(tasks) in the worst-case and is strongly polynomial [18], i.e., there exists no algo-
rithm for this structure with better time complexity. Other solutions include the
shortest augmenting path algorithms (see e.g., [13]), or flow-based approaches,
which have similar worst-case complexity.
Moving beyond the assignment problem to a more general setting, the next
section describes a number of important dimensions that extends the classical
definition. While these extensions bring the problem closer to real-life applica-
tions, it also becomes much harder to solve using a specialized approach such as
the Hungarian algorithm. To that end, this paper introduces a better solution
based on Constraint Programming (CP).
It is important to note that not all agents possess the same skill level. Given a
particular skill, there is a natural ordering among agents based on their expertise
and experience. Similarly, not every request is equally important. Depending on
the service level agreement, some requests may have priority over others. In
fact, there might even be multiple priority levels. The ultimate goal is to assign
the most skillful agent to the most important request while increasing agent
utilization and decreasing the wait time. This strategy is referred to as the best
agent matching.
Figure 1 presents an example of the AMP with 5 agents, shown in blue icons,
and 15 requests, shown in either green or yellow triangles depending on whether
they are standard or priority requests respectively. This is the initial state of the
problem before any matching has taken place. Each agent possesses a number of
technical skills and speaks one or more languages (see e.g., Agent 1). Similarly,
each request demands a certain technical skill and a language (see e.g., Request
3). Agents are ordered with respect to their skills based on their experience level
as shown in the Agent Skills list.
3 Why CP?
The AMP is a generalization of the assignment problem and differs from the clas-
sical definition in a number important ways. Unlike the original definition, the
number of tasks and requests might not align, leading to an unbalanced match-
ing problem. Secondly, this is an online problem as opposed to its one-time-only
offline counterpart, meaning that, the complete set of incoming requests cannot
be determined apriori. Consequently, the number of available agents changes
dynamically as the system proceeds and requests become active (or inactive)
through time. The agents are distinguishable in their skill set. Not every agent
can handle every request, i.e., there exists forbidden pairs of assignments. More-
over, agents are not bound to perform a single task as in the classical assignment
problem; they can work on multiple requests simultaneously. In addition, there
is no single objective to optimize; it is often the case that multiple conflicting
objectives are present. For example, while minimizing the number of agents is
important to reduce the operating cost, employing more agents reduces the wait
time, which in turn improves the customer satisfaction.
Such real-life requirements complicate the efficient algorithms that are
designed for the original setting. The Hungarian method, and similarly flow-
based approaches, have to generate a weighted combination of different objec-
tives and cost values for possible assignments. These values are not only hard
to predict but also need to be updated each time a constraint or preferences
change. Both the objective weighting schema and cost values highly influence
the actual solutions found. In practice, even the exact numeric values become
important for the stability and the convergence of the algorithm. Finally, intro-
ducing artificial high cost values to forbid infeasible agent-request assignments
or copies of agents (or tasks) are prohibitive for the scalability of the approach
as they have direct impact on the asymptotic complexity of the algorithm.
630 S. Kadioglu et al.
4 Added Value of CP
5 Solution Approach
Value Selection: Given a request variable, the next step is to find an agent to
assign to it. Agents can be selected as directed by a “best” matching heuristic.
Several interesting alternatives exist; an exemplar value selection procedure is
outlined in Algorithm 1. The algorithm treats priority requests specially; if it
is possible, priority requests are assigned to the most skillful agent for the task
(line 6), otherwise, they are still matched with an agent with the same language
(line 10).
632 S. Kadioglu et al.
Fig. 2. The Solution Quality. Solutions found for the AMP instance in Figure 1 when
the Best Agent Matching heuristic is not active (on the left) and is active (on the
right).
Remark 1. When the maximum cardinality of an agent is less than the number
of requests demanding the same skill, for which, this agent is the most skilled,
the best agent matching heuristic, in combination with a bounds consistent gcc
operator, might lead to thrashing.
6 Related Work
The existing approaches for solving the variants of the assignment problem
broadly fall into two main categories: (i) ad-hoc, heuristic implementations,
and (ii) generic methods. As opposed to the approaches in the first category,
which produce very specific solutions, lack modeling support, and hard to adapt
changes, our approach belongs to the second category, where, traditionally, Oper-
ational Research and Artificial Intelligence methods are employed. In particular,
constraint (logic) programming techniques were successfully used for assignment
problems, such as stand or counter allocation in airports, and berth allocation
to container ships (see e.g., [6,7,10,23]). CP is also applied to the special case
of personnel assignment as it is well-suited for changing work rules and labor
regulations, such as rostering nurses in hospitals, scheduling technicians, and
generating work plans to cover different skills (see e.g., [5,8,11]).
The work presented in [3,19,26] uses CP to assign highly-skilled profession-
als and employs similar decision variables. However, it focuses on one-to-one
matching, whereas, in our context, multiple assignments are allowed. Also, our
solution is geared toward a rapid operational setting whereas other approaches
634 S. Kadioglu et al.
Fig. 3. Scalability Experiments. The effect of increasing the number of agents, A, and
the number of requests, R.
seek long-term strategic or tactical planning. As in the work of [28], our approach
also avoids the costly optimality search and constructs a good solution instead.
Finally, it is possible to take into account not only the preferences of requests
but also the agents as shown in [2].
7 Numerical Results
The constraint model and the search heuristic are implemented using an in-house
constraint programming solver. All experiments were run on a Dell laptop with
Intel Core i5 CPU @2.5 GHz and 8.00 Gb RAM.
Benchmarks: Experiments were run on instances of varying complexity and size
based on the information gathered from our collaboration with other internal
groups. Each data set consists of 50 synthetic instances whereby the largest
instance deals with 250 agents and 500 request. Half of the requests selected
uniformly at random as priority, and are treated specially. Regarding the capacity
constraint, each agent is allowed to handle up to four requests simultaneously.
The goal of the experiments is to analyze the runtime and scalability of the
approach. Notice that, in real applications, there is a dynamic nature of the
problem: ongoing chat sessions remain active in the system for some unknown
period, and as agents become available, the system continues to serve the pre-
viously unmatched requests as well as the new incoming requests that arrived
in the meantime. In that sense, the following experiments stress test the initial
state of the problem.
Impact of Problem Size: In an online setting such as the AMP, the response
time is crucial, therefore, only a restricted runtime is allowed. As shown in
Figure 3, the CP approach spends minimal time, around half of a second on
average for the largest data set, while performing the best agent matching for
50% of the requests. If the proposed solution is deployed in a service center,
this would amount to dealing with more than 2 million requests per hour which
satisfies the business requirements of typical cloud based service centers under
heavy loads.
Optimizing the Cloud Service Experience Using Constraint Programming 635
Next, the impact of increasing the number of agents and the number of
requests in isolation is studied. While the former leads to larger domains, the
latter corresponds to handling more decision variables. The tests revealed that
the complexity of the CP model depends more on the number of requests than
the number of agents.
Comparison with the Hungarian Algorithm: To test the CP approach
with the best-known algorithm, an in-house, specialized implementation of the
Hungarian method is considered. Experiments showed that the CP approach was
more than an order of magnitude faster on average for the same data sets. It
should be noted that the Hungarian algorithm solves an optimization problem,
albeit a fictitious one generated by imaginary agent-request assignment costs,
while the CP approach finds a greedy solution empowered with a constraint
model. The modification of the problem instances to fit into the right format
(such as, creating dummy nodes and copies of agents, generating artificial values
to express preferences and to forbid incompatible pairs) turned out to be pro-
hibitive in practice, especially for an online setting where multiple assignment
problems are solved successively. The same issue applies to flow-based approaches
as well. Moreover, this not only requires pre-processing the instances, but also,
post-processing to map the solution found back, which further complicates the
code and maintenance in the long run.
Impact of Best Agent Matching: Finally, the overhead of the special treat-
ment for priority requests is studied. The percentage of priority requests is
adjusted from none (0%) to all (100%) using increments of size 5. The num-
ber of agents is fixed to 200 and the number of requests is fixed to 400.
The experiments shown in Figure 4 reveals an interesting property of these
generated instances. The AMP problem goes through a transition when the
20(±3)% of requests are marked as priority, which might be attributed to an
easy-hard-less–hard pattern [9,14,16]. The behavior is due to the opposing forces
between the best agent matching heuristic, which favors most skilled agents,
versus the cardinality constraints, which allows only up to four simultaneous
requests. The combination stretches the cardinality constraint for validation.
Across all priority levels, the impact of the heuristic remains marginal. In a
sense, within the CP formalism, preference based search, i.e., the considered
best agent matching heuristic, comes at almost no additional cost, which makes
the approach more attractive.
8 Conclusion
Optimizing a service center involves many decisions one of which deals with
assigning agents in the best possible way. A good long-term hiring policy, skill-
based routing, and the right mix of employee contract types are essential for good
workforce management. This paper focused on runtime efficiency and assign-
ment quality in a real-time environment. The expressive modeling language of
constraint programming enabled a compact and flexible representation of this
combinatorial problem. This model provided an efficient solution that can handle
hundreds of requests per second, and more than 2 million per hour. The flexibility
of variable and value selection allowed customizable search that can account for
multiple objectives. The model and the search remained completely independent
from each other allowing practitioners to develop and modify one without alter-
ing the other. Overall, the proposed constraint programming solution, stands
out as an attractive approach to be considered for industrial applications of the
service center optimization problem.
References
1. Ahuja, R.K., Magnanti, T.L., Orlin, J.B., Reddy M.R.: Applications of Network
Optimization. In: Network Models. Handbooks in Operations Research and Man-
agement Science, vol. 7. North-Holland (1995)
2. Alsheddy, A., Tsang, E.P.K.: Empowerment scheduling for a field workforce.
J. Scheduling 14(6), 639–654 (2011)
3. Boni, O., Fournier, F., Mashkif, N., Naveh, Y., Sela, A., Shani, U., Lando, Z.,
Modai, A.: Applying Constraint Programming to Incorporate Engineering Method-
ologies into the Design Process of Complex Systems. In: Proceedings of the Twenty-
Fourth Conference on Innovative Applications of Artificial Intelligence (2012)
4. Bourdais, S., Galinier, P., Pesant, G.: hibiscus: A Constraint Programming Appli-
cation to Staff Scheduling in Health Care. In: Rossi, F. (ed.) CP 2003. LNCS, vol.
2833, pp. 153–167. Springer, Heidelberg (2003)
5. Chan, P., Heus, K., Veil, G.: Nurse scheduling with global constraints in CHIP:
Gymnaste. In: Proc. PACT 1998 (1998)
6. Chow, K.P., Perrett, M.: Airport counter allocation using constraint logic program-
ming. In: Proc. PACT 1997 (1997)
7. Chun, A.H.W., Chan, S.H.C., Tsang, F.M.F., Yeung, D.W.M.: Stand allocation
with constraint technologies at Chek Lap Kok international airport. In: Proc.
PACLP 1999 (1999)
8. Collignon, C.: Gestion optimisée de ressources humaines pour l’Audiovisuel. In:
Proc. CHIP users club (1996)
9. Crawford, J.M., Auton, L.D.: Experimental Results on the Crossover Point in
Random 3sat. Artificial Intelligence 81, 31–57 (1996)
Optimizing the Cloud Service Experience Using Constraint Programming 637
10. Dincbas, M., Simonis, H.: APACHE - a constraint based, automated stand alloca-
tion system. In: Proc. of Advanced Software technology in Air Transport (ASTAIR
1991) (1991)
11. Dubos, A., Du Jeu, A.: Application EPPER planification des agents roulants. In:
Proc. CHIP users club (1996)
12. Durbin, S.D., Warner, D., Richter, J.N., Gedeon, Z.: RightNow eService Center:
Internet customer service using a self-learning knowledge base. In: Proceedings of
the Thirteenth Annual Conference of Innovative Applications of Artificial Intelli-
gence (IAAI 2002), pp. 815–821 (2002)
13. Fredman, M.L., Tarjan, R.E.: Fibonacci Heaps and Their Uses in Improved Net-
work Optimization Algorithms. J. ACM 34(3), 596–615 (1987)
14. Hogg, T., Huberman, B.A., Williams, C.P.: Phase Transitions and the Search Prob-
lem. Artif. Intell. 81(1–2), 1–15 (1996)
15. Katriel, I., Thiel, S.: Complete Bound Consistency for the Global Cardinality Con-
straint. Constraints 10(3), 191–217 (2005)
16. Kirkpatrick, S., Selman, B.: Critical Behavior in the Satisfiability of Random
Boolean Expressions. Science 264(5163), 1297–1301 (1994)
17. Kuhn, H.W.: The Hungarian method for the assignment problem. Naval Research
Logistics Quarterly 2(1–2), 83–97 (1955)
18. Munkres, J.: Algorithms for the Assignment and Transportation Problems. Journal
of the Society for Industrial and Applied Mathematics 5(1), 32–38 (1957)
19. Naveh, Y., Richter, Y., Altshuler, Y., Gresh, D.L., Connors, D.P.: Workforce opti-
mization: Identification and assignment of professional workers using constraint
programming. IBM Journal of Research and Development 51(3/4), 263–280 (2007)
20. Nightingale, P.: The extended global cardinality constraint: An empirical survey.
Artif. Intell. 175(2), 586–614 (2011)
21. Oplobedu, A., Marcovitch, J., Tourbier, Y.: CHARME: Un langage industriel de
programmation par contraintes, illustré par une application chez Renault. In: Pro-
ceedings of the Ninth International Workshop on Expert Systems and their Appli-
cations: General Conferencehnical, vol. 1, pp. 55–70 (1989)
22. Pentico, D.W.: Assignment problems: A golden anniversary survey. European Jour-
nal of Operational Research 176(2), 774–793 (2007)
23. Perrett, M.: Using constraint logic programming techniques in container port plan-
nings. ICL Technical Journal, 537–545 (1991)
24. Quimper, C.-G., Golynski, A., Lopez-Ortiz, A., van Beek, P.: An Efficient Bounds
Consistency Algorithm for the Global Cardinality Constraint. Constraints 10(2),
115–135 (2005)
25. Régin, J.C., Gomes, C.P.: The Cardinality Matrix Constraint. In: 10th Interna-
tional Conference on Principles and Practice of Constraint Programming, CP 2004,
pp. 572–587 (2004)
26. Richter, Y., Naveh, Y., Gresh, D.L., Connors, D.P.: Optimatch: applying con-
straint programming to workforce management of highly skilled employees. Int. J.
of Services Operations and Informatics 3(3/4), 258–270 (2008)
27. Rossi, F., van Beek, P., Walsh, T.: Handbook of Constraint Programming. Elsevier
(2006)
28. Yang, R.: Solving a Workforce Management Problem with Constraint Program-
ming. Technical Report, University of Bristol, Bristol (1996)
Find Your Way Back: Mobility Profile Mining
with Constraints
Abstract. Mobility profile mining is a data mining task that can be for-
mulated as clustering over movement trajectory data. The main challenge
is to separate the signal from the noise, i.e. one-off trips. We show that
standard data mining approaches suffer the important drawback that
they cannot take the symmetry of non-noise trajectories into account.
That is, if a trajectory has a symmetric equivalent that covers the same
trip in the reverse direction, it should become more likely that neither of
them is labelled as noise. We present a constraint model that takes this
knowledge into account to produce better clusters. We show the efficacy
of our approach on real-world data that was previously processed using
standard data mining techniques.
1 Introduction
Clustering is one of the fundamental tasks in data mining whose general aim
is to discover structure hidden in the data, and whose means consist in iden-
tifying the homogeneous groups of objects (the clusters) that emerge from the
data [7]. Typically, this translates into putting together objects that are similar
to each other, and keep separated as much as possible those that are different.
The applications of this basic task are many and varied, ranging from customer
segmentation for business intelligence to the analysis of images, time series, web
search results and much more.
This paper focuses on the application domain of mobility data mining, which
is concerned with the study of trajectories of moving objects and other kinds of
mobility-related data [6]. Trajectories are sequences of time-stamped locations
(typically longitude-latitude pairs) that describe the movements of an object. A
most relevant example, which will also be the reference context for this work,
is the sequence of GPS traces of cars collected by on-board devices, such as a
satellite navigation system or an anti-theft platform [5].
In this context, clustering can be used to identify popular paths followed by
several moving objects, such as common routes adopted by car drivers in a city.
A different perspective to the problem was proposed in recent years in [8]: the
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 638–653, 2015.
DOI: 10.1007/978-3-319-23219-5 44
Find Your Way Back: Mobility Profile Mining with Constraints 639
Existing data mining approaches to extract mobility profiles are usually cus-
tomised algorithms that have been developed specifically for this purpose. The
approach proposed in [8] (schematically depicted in Figure 1) consists of two
ingredients: a trajectory distance function that encapsulates the context-specific
notion of similar trajectories and a clustering schema that takes care of group-
ing similar trajectories together (center of Figure 1). It also ensures that the
resulting groups have a certain minimum size, e.g. the cluster composed of the
single dashed trajectory is removed (center of Figure 1). Once clusters have
been formed, a representative trajectory for each of them is simply extracted by
selecting the most central element of the cluster, i.e. the one that minimizes the
sum of distances from the others (see the selected trajectories on the right of
Figure 1).
We impose the minimum size constraint because we aim to identify the trips
that are made regularly and are not interested in trips that occur regularly, but
infrequently (such as a trip to a holiday home). The clustering procedure yields
a list of trip groups, each of them essentially representing a mobility routine
followed by the user. The set of routines of a user form the mobility profile of
that user.
A very typical (and expected) result is that an individual’s mobility contains
at least two routines, one for the home-to-work systematic trips and one for
the symmetric work-to-home return journey. Indeed, symmetric routines (the
640 L. Kotthoff et al.
Fig. 1. The three steps of profile extraction: identify the trajectories (single trips)
from the GPS data, discover clusters by grouping trajectories that are close, refine the
clusters to remove the noise and extract representative routines.
home-work-home cycle being the most typical example) appear very naturally
in real life, and they are a very important component of an individual’s mobility.
Therefore, while it is simply important to discover all the routines hidden in an
individual’s mobility data, it is crucial to discover symmetric routines if they
exist.
From the viewpoint of a traffic management application for example, sym-
metric routines represent simple and regular mobility cycles that might neatly
fit a public transportation offer. Asymmetric routines on the other hand are
generally a symptom of a more complex daily mobility, for instance involving
bring-and-get activities interleaved within a home-work-home cycle, which are
much more difficult to serve by a public transportation service.
These observations lead to conclude that it would be advisable to equip
the routine extraction procedure with mechanisms that boost the discovery of
symmetric routines. Unfortunately, the plain clustering-based approach provided
so far in [8] follows a local perspective, focused on guaranteeing properties of
each single cluster – namely, mutual similarities of its members and a certain
minimum size of the cluster – without considering the relation between different
clusters or trajectories in different clusters.
Therefore, symmetric routines, which correspond to separate clusters even
though they are connected by this particular property, are treated in isolation.
What we would need to stimulate the discovery of symmetric routines, is a
way to link such separate clusters, and change the cluster construction criteria
accordingly. The purpose of this paper is to explore this way by exploiting a con-
straint formulation of the clustering problem, which can then be easily enriched
and customized to include the application-specific requirements we mentioned
above.
3 Constraint Model
We present the constraint model that takes all the considerations mentioned
above into account. The constraints encode when two trajectories should be in
the same cluster, when they should be in different clusters, when they are noise
and the conditions that apply when there are symmetric trajectories.
For the sake of simplicity, trajectories are represented by a start and an end
point. For our purposes, the route taken to get from the start to the end point
is secondary, as we are interested in the extraction of mobility profiles that do
not contain this information. For example, the way from home to work could be
different from the way from work to home because of traffic conditions, one-way
streets, or similar, but both are still part of the same routine. If the user stops,
e.g. to do some shopping, the trajectory is split into two parts with two separate
start and end points.
The model itself is general enough to accommodate routes represented by
more than two points as well, but would likely reduce the number of symmetric
trajectories as pairs would look less similar because of additional (irrelevant)
information. Overall, the model would become larger and more complex.
Individual trajectories x ∈ X are modelled as variables whose domains con-
sist of the clusters they can be assigned to. That is, each trajectory can be
assigned a cluster ID, including a special value which denotes that the trajectory
is noise. We use dist(x, y) to denote the distance (both spatial and temporal)
between two trajectories x and y. Note that for the temporal distance, only
the time of day is relevant, not the date. The reason for this is that we want
to cluster trips that occur regularly, e.g. the daily commute to work. The dis-
tance of two trajectories is defined as the spatial and temporal distance between
their start points and their end points, so dist(x, y) < A is short hand for
dist(xstart , ystart ) < A ∧ dist(xend , yend ) < A. T denotes the distance above
which two trajectories are considered to be not close and R the distance above
642 L. Kotthoff et al.
which they are considered far, T < R. If a trajectory is noise and should not be
part of any cluster, it is denoted x = noise.
Our formulation consists of two complementary parts. The first part is a set
of constraints that specify under which conditions two trajectories should belong
to different clusters or be labelled as noise. The second one is a multi-objective
optimization function that requires to cluster as many trajectories as possible
and to fit them into as few clusters as possible. This requires the identified
clusters to be as large as possible.
Our optimization function can be formulated as follows, where we use X
to denote the cardinality of the set X:
We now introduce the symmetry constraints that represent the main advan-
tage of the constraint model over existing data mining algorithms. We denote
the threshold for the minimum number of trajectories in a cluster S. This is
a fixed value specified by the user and potentially prevents identifying clusters
that are small, but supported by a symmetric cluster. We therefore introduce the
threshold size for a pair of symmetric clusters S , where S > S. If a trajectory
x is symmetric to another trajectory y, they should belong to different clusters
if they are not noise and the sum of the sizes of the clusters they belong to must
be greater than S .
drawbacks of having a fixed minimum cluster size. The fixed threshold S is the
only means of separating signal from noise in the data mining application. In the
constraint model, we can relax this requirement in the presence of symmetric
clusters – if a symmetric pattern is identified, we require the sum of the cluster
sizes to be greater than the threshold for a pair of symmetric clusters, which is
greater than the threshold for a single cluster.
If, on the other hand, there is no trajectory that is symmetric to x, then x
is either noise or the size of the cluster that it is assigned to is greater than the
threshold S for the size of a single cluster.
4 Model Implementation
Our Minion model is an almost direct translation of the model presented in the
previous section. For each trajectory, we add one variable whose domain values
represent the clusters the trajectory can be assigned to. We also add the dual
representation where each cluster is represented by an array of Booleans, one
for each trajectory. If a particular trajectory is in a particular cluster, the corre-
sponding Boolean value is set to 1, else 0. We also add the channelling constraints
between the one-variable-per-trajectory and the one-array-per-cluster represen-
tations. We require the dual representation to be able to post constraints on
cluster sizes.
The noise trajectories are assigned to a special cluster that is represented by
the value 0 in the domains of the trajectory variables. Modelling noise this way
allows us to treat it in the same way as other clusters.
The Minion input language is flat and does not support quantifications over
the variables. We therefore instantiate the free variables in Equations 2 to 5
and add constraints for each grounding. Note that the left hand side (before the
644 L. Kotthoff et al.
4.3 Scalability
The main reason why data mining and machine learning applications use spe-
cialised approximate algorithms instead of complete optimisation approaches
such as constraint programming is the scalability of such methods. Approxi-
mate methods are almost always orders of magnitude faster than corresponding
complete methods while delivering solutions of similar quality.
Find Your Way Back: Mobility Profile Mining with Constraints 645
5 Experimental Evaluation
We evaluated the quality of the clusters that the constraint model finds on
real-world trajectories collected in Italy. We will show how our constraint model
improves on the existing solution for extracting mobility profiles, thus evaluating
the impact of taking symmetric clusters into account on the results. We briefly
describe the dataset used in the experiments, then summarize the results, and
finally show an example of profiles found on a single user with the different
approaches.
5.1 Dataset
Our dataset contains the trajectories of the cars of 150 users living around the
city of Pisa, Italy, collected over a period of 5 weeks (Figure 2). We cannot make
the actual data available because of privacy reasons; an anonymized version
is available at http://www.cs.ubc.ca/∼larsko/downloads/cp2015 anonymized
dataset.tar.gz.
The users were selected in such a way to have a good representation of differ-
ent mobility complexities, i.e. different numbers of trajectories. In our stratified
sample, the number of trajectories per user roughly follows a uniform distribu-
tion that ranges from 1 to 100 (see Figure 3).
Experiments were carried out adopting a spatio-temporal distance dist(x, y)
between two points that is computed as the standard Euclidean distance between
646 L. Kotthoff et al.
Fig. 2. Dataset of trajectories used in the experiments, containing 150 users centered
around Pisa, Italy.
Fig. 3. Distribution of number of trajectories per user used in the experiments (blue
bars) vs. distribution of original dataset (green line).
Find Your Way Back: Mobility Profile Mining with Constraints 647
the spatial components of x and y if their temporal gap is less than a threshold
τ = 1hr, and ∞ otherwise. Therefore, we used the following ranges of values
for parameters S (the minimum number of trajectories in a cluster) and T (the
distance threshold between trajectories, expressed in meters): S ∈ {3, 4, 5, 6},
T ∈ {100, 200, 300, 400, 500}. Moreover, the parameters S (the threshold for
the combined size of two symmetric clusters) and R (the maximum distance
between trajectories in a cluster) are set as functions of S and T , respectively:
S = 1.5 · S, R = 3 · T . The coefficients used to compute S and R have been
chosen empirically through a set of preliminary experiments over the dataset.
Different datasets may exhibit different properties and a recalibration of these
values may be required.
Computation over a medium-low-end desktop machine (i3 CPU at 3GHz,
with 4GB RAM, running Ubuntu 12) took an overall time below 15 minutes. In
particular, single users with 20 or less trajectories (which are the most common
in the original dataset) are dealt with in less than one second, while those with
50 to 100 trajectories (less common, yet over-represented in our sample set, to
evaluate their impact) took up to 15 seconds each.
The main advantage of our constraint model over previous approaches is that it
allows to take symmetric clusters into account. Without the constraints that do
this, we should achieve results that are equivalent to the data mining solution
proposed in [8]. However, the constraint model should find an optimal solution
instead of a heuristic one.
In our first set of experiments, we compare both approaches without taking
symmetric clusters into account to get a baseline for the performance of our
new approach. This also allows to evaluate the impact of taking the symmetric
clusters into account later.
Figures 4 and 5 show a comparison of the two approaches for the different
parameter values (S and T ) in terms of the number of non-noise trajectories
(Figure 4) and of number of clusters found (Figure 5).
Both the number of non-noise trajectories and clusters increases as we relax
the constraints, i.e. allow fewer trajectories that are further apart in a cluster.
This is true for both the data mining and the CP approach. In general, both the
number of non-noise trajectories and clusters is larger for the CP approach, in
some cases significantly so. For example, the number of clusters for S = 3 that the
CP approach finds is almost twice the number the data mining approach finds. As
S is increased, the difference becomes smaller. The reason for this phenomenon
is that the data mining approach partitions the set of trajectories into clusters
through a heuristics that considers the distribution of data only locally, and
therefore can create small clusters that are later discarded, as shown in the
example of Figure 1. This kind of situations are avoided by the CP approach,
which instead considers the assignment of trajectories to clusters from a global
viewpoint.
648 L. Kotthoff et al.
Fig. 4. Number of clustered trajectories found by the data mining approach (dm) and
the constraint model without symmetry constraints (CPnosym ) for different distance
threshold and cluster size values T and S.
where U is the set of users and Cu the number of clusters found by A for
user u. Function cl covu (A, B), in turn, is computed over each user u as the
average trajectory coverage of each cluster of u found by A w.r.t. those found
by B. The matching between clusters is performed by taking the best match,
Find Your Way Back: Mobility Profile Mining with Constraints 649
Fig. 5. Number of clusters found by the data mining approach (dm) and the constraint
model without symmetry constraints (CPnosym ) for different distance threshold and
cluster size values T and S.
i.e. maximizing the trajectory coverage limited to the two clusters compared.
Clusters left unpaired are assigned to an empty set. When A completely
covers B, cl cov(A, B) = 1.
While the trajectory coverage compares the overall ability to recognize sys-
tematic trips, the cluster coverage looks at how much each single cluster is dis-
covered by the other method. Figures 6 and 7 report the results obtained on
our dataset. Lines labelled with SCPsym represent the coverages of the model
with symmetry constraint (CPsym ) over that without symmetry (CPnosym ),
and SCPnosym the opposite.
The plots clearly show that the model that takes symmetric trajectories
into account completely covers the other one, both in global terms of trajectory
coverage (Figure 6) and in terms of (the more precise) cluster coverage (Figure 7),
since the corresponding values are always very close to 1. The model that does
not take symmetric trajectories into account on the other hand loses at least 50%
of trajectories and 70% of cluster coverage. These results are consistent across
the range of values for S and T that we consider here, with little variation.
Our results show that considering the symmetry of clusters has a large impact
on results. We are able to cluster a lot more trajectories that were mistakenly
identified as noise before, allowing to recover several backward trips that would
otherwise not be recognized as routines.
650 L. Kotthoff et al.
Fig. 6. Trajectory coverage for constraint models with symmetry constraint (CPsym )
and without (CPsym ) for different distance threshold and cluster size values T and S.
Fig. 7. Cluster coverage for constraint models with symmetry constraint (CPsym ) and
without (CPsym ) for different distance threshold and cluster size values T and S.
Find Your Way Back: Mobility Profile Mining with Constraints 651
The quality of the clustering is more difficult to assess, as there are no auto-
mated means to determine whether a set of clusters “makes sense”. In practice,
clusterings are evaluated through assessment by a human expert. We obviously
cannot do this for all of the users we consider in this paper and consider the
clusters for a single user as an example here.
While not all users have symmetric trajectories, the following example
demonstrates the motivation of our approach and the case that is difficult to
solve for specialised data mining methods. A clustering example that shows the
benefit of the constraint model is presented in Figure 8. The image was obtained
by using T = 100 and S = 6.
The red and the blue trajectories represent symmetric parts of the same
routine. However, there are fewer red than blue trajectories; in particular the
number of red trajectories is smaller than the threshold S. If the symmetry is not
taken into account, only the blue trajectories are clustered, whereas the red ones
are discarded as noise. The CP approach that does consider symmetry identifies
the red trajectories correctly as a non-noise cluster.
For the eastward journey, our user mainly follows the blue routine, but for
the return journey he/she often changes path, either for traffic reasons or for
personal needs, and the red trajectories represent the most frequent choice. The
figure clearly shows the benefit of being able to take symmetric trajectories into
account. Indeed, there are only three trajectories in the red cluster, which has
been discarded as noise by the other method.
652 L. Kotthoff et al.
References
1. Davidson, I., Ravi, S.S., Shamis, L.: A SAT-based Framework for Efficient Con-
strained Clustering. In: SIAM International Conference on Data Mining, pp. 94–105
(2010)
2. De Raedt, L., Guns, T., Nijssen, S.: Constraint programming for data mining and
machine learning. In: AAAI, pp. 1671–1675 (2010)
3. Gent, I.P., Jefferson, C.A., Miguel, I.: MINION: a fast, scalable, constraint solver.
In: ECAI. pp. 98–102. IOS Press (2006)
4. Giannotti, F., Nanni, M., Pedreschi, D., Pinelli, F.: Trajectory pattern analysis for
urban traffic. In: Proceedings of the Second International Workshop on Computa-
tional Transportation Science, IWCTS 2009, pp. 43–47 (2009)
5. Giannotti, F., Nanni, M., Pedreschi, D., Pinelli, F., Renso, C., Rinzivillo, S.,
Trasarti, R.: Unveiling the complexity of human mobility by querying and min-
ing massive trajectory data. The VLDB Journal 20(5), 695–719 (2011). http://dx.
doi.org/10.1007/s00778-011-0244-8
6. Giannotti, F., Pedreschi, D. (eds.): Mobility, Data Mining and Privacy - Geographic
Knowledge Discovery. Springer (2008)
7. Tan, P.N., Steinbach, M., Kumar, V.: Introduction to Data Mining. Addison-Wesley
(2005)
8. Trasarti, R., Pinelli, F., Nanni, M., Giannotti, F.: Mining mobility user profiles for
car pooling. In: KDD, pp. 1190–1198 (2011)
9. Wagstaff, K., Cardie, C.: Clustering with Instance-level Constraints. In: Seventeenth
International Conference on Machine Learning, ICML 2000, pp. 1103–1110. Morgan
Kaufmann Publishers Inc., San Francisco, CA, USA (2000)
Joint Vehicle and Crew Routing and Scheduling
1 Introduction
A vehicle routing problem (VRP) aims to design routes for a fleet of vehicles that
minimize some cost measure, and perhaps, while adhering to side constraints,
such as time windows, or pickup and delivery constraints. In practice, however,
VRPs are not solved in isolation; they typically arise in a sequential optimization
process that first optimizes vehicle routes and then crew schedules given the vehi-
cle routes [33]. This sequential methodology has the advantage of reducing the
computational complexity. However, by assigning vehicle routes first, this app-
roach may lead to suboptimal, or even infeasible, crew schedules since decisions
in the first stage ignore crew constraints and objectives. Hence it is imperative to
simultaneously consider vehicle and crew constraints and objectives, particularly
in industries in which crew costs outstrip vehicle costs.
This paper considers a Joint Vehicle and Crew Routing and Scheduling Prob-
lem (JVCRSP) motivated by applications in humanitarian and military logistics.
In these settings, vehicles (e.g., airplanes) travel long routes, and serve a variety
of pickup and delivery requests under various side constraints. Vehicles must be
operated by crews who have limitations on their operating times. Crews are also
able to interchange vehicles at different locations and to travel as passengers
before and after their operating times. JVCRSPs are extremely challenging com-
putationally since vehicle and crew routes are now interdependent. In addition,
vehicle interchanges add an additional time complexity, since two vehicles must
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 654–670, 2015.
DOI: 10.1007/978-3-319-23219-5 45
Joint Vehicle and Crew Routing and Scheduling 655
2 Problem Description
The traditional vehicle routing problem with pickup and delivery and time win-
dows (VRPPDTW) [30] consists of a fleet of vehicles, stationed at a common
depot, that services pickup and delivery requests before returning to the depot.
Every pickup request has one associated delivery request, with an equal but
negated demand, that must be served after the pickup and by the same vehicle.
In addition, every request has a time window, within which service must begin.
Vehicles can arrive earlier than the time window, but must wait until the time
window opens before starting service. Given a route, fixed travel times dictate
the arrival and departure times of requests along the route.
The JVCRSP considered in this paper overlays, on top of the VRPPDTW,
crew routing constraints that explicitly capture the movements of crews. The
JVCRSP groups requests by location, and defines travel times between loca-
tions, thereby removing the one-to-one mapping between requests and locations
656 E. Lam et al.
1 3 5 7 9
2 4 6 8 10
Fig. 1. A location at which vehicle interchange occurs. Nodes 3 to 8 belong to the same
location. A vehicle (solid line) and a crew (dotted line) travel from node 1 to node 3,
and another vehicle and crew travel from node 2 to node 4. The two vehicles service
nodes 3 to 8, while the crews travel to nodes 7 and 8 to depart on a different vehicle.
The movements into nodes 3 and 4, and out of nodes 7 and 8 must be synchronized
between the vehicles and crews, but movements within the location are independent.
found in many routing problems. Vehicles require a crew when moving between
two locations, but require no crew when servicing requests within a location.
Similarly, crews require a vehicle to move between two locations, but can move
independently of vehicles within a location. Crews are restricted to at most one
driving shift, which has a maximum duration. No distance or time limitations
are placed on crews before and after the driving shift.
The JVCRSP allows crews to switch vehicles at any given location. This
idea is illustrated in Fig. 1. Vehicle interchange occurs when a crew moves from
a node that is serviced by one vehicle to a node that is serviced by another
vehicle, provided that the departure of the second vehicle is after the arrival
of the first. Hence vehicle interchange requires explicit modelling of arrival and
departure times. The JVCRSP retains the time windows on service start times
and permits early arrival, but also allows vehicles to wait after service to depart
at a later time. This functionality is necessary to facilitate vehicle interchange.
The objective function of the JVCRSP minimizes a weighted sum of the num-
ber of vehicles and crews used, and the total vehicle and crew travel distances.
One of the goals of this paper is to assess the benefits of jointly routing and
scheduling vehicles and crews. A baseline to determine the potential of joint
optimization is a two-stage approach that separates these two aspects by first
solving a vehicle routing problem and then a crew pairing problem. The first
stage can be solved with any appropriate technology, and this paper uses a
large neighborhood search over a constraint programming model (e.g., [29,21,1]).
Arrival and departure times are fixed at their earliest possible starting times
to produce vehicle schedules. The crew pairing problem is modeled with a set
covering problem typical in the airline industry [33]. It is solved using column
generation with a resource-constrained shortest path pricing problem, and then
a mixed integer programming solver to find integer solutions once the column
generation process has converged.
Joint Vehicle and Crew Routing and Scheduling 657
Name Description
crewc,i,j ≤ vehv,i,j , ∀c ∈ C, (i, j) ∈ A, li = lj , (1)
v∈V
vehv,i,j = driverc,i,j , ∀(i, j) ∈ A, li = lj , (2)
v∈V c∈C
Name Description
Fig. 5. A partial solution obtained at some stage during search. A crew is known to
traverse the arcs (1, 2) and (3, 4), but it is not yet known whether the start node S
connects (directly or via a path) to node 1 or node 3, and whether node 4 or node 2
connects to the end node. It is also not known whether such a path exists.
and takes the value 0 when the successor is at the same location, indicating that
no driver is necessary (Eq. (28)). Equation (29) requires drivers to move with
their vehicles. Equation (30) determines whether a crew is used. Equation (31)
is a symmetry-breaking constraint. Equation (32) is a space synchronization con-
straint that requires crews to move to a node at their current location, or move
with a vehicle (to a different location). The CrewShortcut global constraint
in Eq. (33) enforces the crew shortcut property, and is detailed in Section 5.2.
Equation (34) synchronizes time between vehicles and crews. The time window
in this constraint allows a crew to switch vehicle by moving to another node
at the same location, provided that this vehicle departs later than this crew.
Equation (35) forces crews to only move forward in time. Equation (36) is an
optimization constraint, described in Section 5.1, that bounds crew distances and
checks whether crews can return to the depot. Equations (37) to (39) determine
the driving time of each crew.
The objective function (Eq. (40)) minimizes a weighted sum of the vehicle
and crew counts, and the total vehicle and crew travel distances.
min w1 vehUsed(v) + w2 crewUsed(c)+
v∈V c∈C
w3 d(i, succ(i)) + w4 crewDist(c). (40)
i∈R∪S c∈C
min d(i, j) · xi,j , (41)
i∈R∪S j∈cSucc(i)
xi,j = 1, (42)
i∈S j:(i,j)∈B
xh,i = 1, (43)
i∈E h:(h,i)∈B
xh,i = xi,j , ∀i ∈ R, (44)
h:(h,i)∈B j:(i,j)∈B
xi,j ≤ 1, ∀i ∈ R ∪ S, (45)
j:(i,j)∈B
where the set cSucc(i) represents the domain of crewSucc(c, i) for every node
i ∈ R ∪ S and the appropriate crew c. The set cTime(i) represents the domain
of crewTime(i) for every node i ∈ N .
The xi,j variables indicate whether the crew traverses the arc (i, j) ∈ B, and
the ti variables represent the arrival time to node i.
The objective function minimizes the total distance (Eq. (41)). (Equa-
tions (42) to (44) are the flow constraints, which ensure the existence of a path
from a start node to an end node. Equation (45) is a redundant constraint that
strengthens the linear program. Equation (46) is the time-based subtour elimi-
nation constraint, where M is a big-M constant. Equations (47) and (48) restrict
the domains of the xi,j and ti variables respectively.
ensures that crews never visit intermediate nodes, but move directly from incom-
ing to outgoing nodes at a location. This pruning eliminates symmetric solutions
in which crews visit various sequences of intermediate nodes within a location.
Let pred(i) ∈ N be the predecessor of a node i ∈ N . The constraint imple-
ments simple propagation rules, such as,
l(pred(i)) = l(i) = l(succ(i)) ↔ crewSucc(c, i) = i, ∀i ∈ R, (49)
c∈C
which ensures that crews never visit a node whose predecessor and successor are
at the same location as the node itself.
This section briefly describes the labeling procedure and the LNS procedure.
The Labeling Procedure. The labeling procedure first assigns vehicle routes, and
then crew routes.
To determine vehicle routes, the search procedure considers each vehicle in
turn and assigns the successor variables from the start node to the end node.
The value selection strategy first chooses nodes at the same location ordered by
earliest service time, and then considers nodes at other locations, also ordered
by earliest service time.
To assign crew routes, the labeling procedure begins by ordering all nodes
i ∈ R ∪ S that have an unlabeled driver(i) variable by earliest departure time.
The first of these nodes is assigned a driver, and then a path from this node to
any end node is constructed for this crew by labeling both the crew successor
and the driver variables. This process is repeated until all driver(·) variables are
labeled. The value selection heuristic for crew successor variables favors the node
that is visited next by the current vehicle of the crew, provided that the crew
can drive from this node; otherwise, the successor is chosen randomly.
The LNS Procedure. The LNS procedure randomly explores two neighborhoods:
6 Experimental Results
This section compares the solution quality and features of the MIP and CP
models, and the two-stage procedure.
664 E. Lam et al.
Table 3. The number of locations and requests in each of the ten JVCRSP instances.
A B C D E F G H I J
|L| 7 7 7 11 11 12 11 11 5 6
|R| 12 16 20 40 46 46 40 80 54 96
The Instances. The instances are generated to capture the essence of applications
in humanitarian and military logistics. These problems typically feature fewer
locations than traditional vehicle routing applications, but comprise multiple
requests at each location. Both the locations and the time windows are generated
randomly. Table 3 describes the size of the instances. The maximum number of
vehicles and crews are not limited in the instances.
Solution Quality. Tables 4 to 6 depict the experimental results for various vehicle
and crew costs. The tables only report the CPU time for the MIP model, since
the two-stage and CP models have been given short execution times, as explained
above. The experimental results highlight a few important findings:
1. Jointly optimizing vehicle and crew routing and scheduling achieves signifi-
cant benefits. On the above instances, the average benefit of the CP model
over the two-stage approach is 12%. When crew costs are higher, the benefits
can exceed 45%.
2. The benefits obviously increase when the crew costs increase. However, even
when vehicle costs are five times as large as crew costs, the benefits are still
substantial and exceed 5% in more than half of the instances.
Joint Vehicle and Crew Routing and Scheduling 665
Table 4. Solutions found by the three models with equal vehicle and crew costs (w1 =
w2 = 1000, w3 = w4 = 1). The objective value columns separate vehicle and crew costs
in parenthesis. Time (in seconds) is provided for the MIP model. The last column lists
the percentage improvement of the CP model compared against the two-stage method.
Two-Stage MIP CP
A 8328 (2086 + 6242) 8318 (2086 + 6232) 5 8318 (2086 + 6232) -0.1%
B 7198 (2065 + 5133) 6154 (2063 + 4091) 27132 6167 (2068 + 4099) -16.7%
C 8216 (2079 + 6137) 6192 (2088 + 4104) 37254 6200 (2079 + 4121) -32.5%
D 14879 (3298 + 11581) - - 13855 (3302 + 10553) -7.4%
E 18105 (2275 + 15830) - - 17181 (2278 + 14903) -5.4%
F 26334 (4406 + 21928) - - 24570 (4412 + 20158) -7.2%
G 14110 (3351 + 10759) - - 13074 (3355 + 9719) -7.9%
H 25617 (6585 + 19032) - - 24975 (6587 + 18388) -2.6%
I 8894 (2316 + 6578) - - 7795 (2309 + 5486) -14.1%
J 16932 (3710 + 13222) - - 13877 (3710 + 10167) -22.0%
Table 5. Best solutions from the three models with higher crew costs (w1 = 1000,
w2 = 5000, w3 = w4 = 1).
Two-Stage MIP CP
A 32328 (2086 + 30242) 32318 (2086 + 30232) 5 32318 (2086 + 30232) 0.0%
B 27198 (2065 + 25133) 22154 (2056 + 20098) 8352 22167 (2068 + 20099) -22.7%
C 32216 (2079 + 30137) 28198 (3086 + 25112) 4869 22200 (2079 + 20121) -45.1%
D 58879 (3298 + 55581) - - 53905 (3317 + 50588) -9.2%
E 78105 (2275 + 75830) - - 73175 (2280 + 70895) -6.7%
F 110334 (4406 + 105928) - - 100502 (4413 + 96089) -9.8%
G 54110 (3351 + 50759) - - 43996 (3353 + 40643) -23.0%
H 97617 (6585 + 91032) - - 92928 (6585 + 86343) -5.0%
I 32894 (2316 + 30578) - - 27817 (2326 + 25491) -18.3%
J 64932 (3710 + 61222) - - 49930 (3710 + 46220) -30.0%
Table 6. Best solutions from the three models with higher vehicle costs (w1 = 5000,
w2 = 1000, w3 = w4 = 1).
Two-Stage MIP CP
Objective Value Objective Value Time Objective Value %
A 16328 (10086 + 6242) 16318 (10086 + 6232) 7 16318 (10086 + 6232) -0.1%
B 15198 (10065 + 5133) 14154 (10056 + 4098) 2327 14167 (10068 + 4099) -7.3%
C 16216 (10079 + 6137) 14200 (10091 + 4109) 32135 14200 (10079 + 4121) -14.2%
D 26879 (15298 + 11581) - - 24946 (15303 + 9643) -7.7%
E 26105 (10275 + 15830) - - 25172 (10278 + 14894) -3.7%
F 42334 (20406 + 21928) - - 40597 (20412 + 20185) -4.3%
G 26110 (15351 + 10759) - - 24008 (15353 + 8655) -8.8%
H 49617 (30585 + 19032) - - 48911 (30585 + 18326) -1.4%
I 16894 (10316 + 6578) - - 15800 (10326 + 5474) -6.9%
J 28932 (15710 + 13222) - - 25930 (15710 + 10220) -11.6%
666 E. Lam et al.
The Impact of Vehicle Interchanges. One of the main advantages of jointly opti-
mizing vehicle and crew routing and scheduling is the additional flexibility for
vehicle interchanges. For example, instance C in Tables 4 to 6 highlight some of
the benefits of this flexibility. The CP model is able to delay vehicles to favor
interchanges, thereby decreasing crew costs significantly.
Table 7 quantifies vehicle interchanges for the instances with equal vehicle
and crew costs. It reports the total number of crews required in the solution, the
number of crews participating in vehicle interchanges, the total number of vehicle
interchanges, and the average number of interchanges per crew that switches
vehicle. These results indicate that the constraint programming model allows
more vehicle interchanges on average. For the larger instances, each crew travels
on almost three vehicles on average. The total number of vehicle interchanges
is roughly the same for the CP model and the two-stage approach, but the CP
model produces solutions with fewer crews.
The Impact of the Joint Vehicle and Crew Routing and Scheduling. It is also
interesting to notice in Tables (4) to (6) that the CP model often prefers vehicle
routes whose costs are higher than those of the two-stage approach. This is the
case despite the fact that the CP search is initialized with the first-stage VRP
solution. This indicates that the CP model trades off crews costs for vehicle
costs. Running a two-stage version of the CP model, in which the vehicle routes
Table 7. Statistics on vehicle interchange in the solutions to the runs with equal vehicle
and crew costs. For both the two-stage and the CP models, this table provides the
number of crews used in the solution, the number of crews that participates in vehicle
interchange, the total number of interchanges, and the average number of interchanges
for each crew that undertakes interchange.
Two-Stage CP
A 6 2 2 1.0 6 3 3 1.0
B 5 2 2 1.0 4 3 3 1.0
C 6 3 3 1.0 4 4 4 1.0
D 11 8 12 1.5 10 7 7 1.0
E 15 9 14 1.6 14 12 21 1.8
F 21 20 35 1.8 19 19 36 1.9
G 10 8 9 1.1 9 8 11 1.4
H 18 17 28 1.6 17 16 29 1.8
I 6 5 5 1.0 5 3 5 1.7
J 12 11 15 1.4 9 8 15 1.9
Joint Vehicle and Crew Routing and Scheduling 667
(but not the vehicle schedules) are fixed, also confirms these benefits. The CP
model significantly outperforms this two-stage CP approach on a number of
instances. These results indicate that both the flexibility in interchanges and the
joint optimization are key benefits of the CP model.
7 Related Work
JVCRSPs have not attracted very much interest in the literature at this point,
probably due to their inherent complexity [5]. This contradicts with the numer-
ous studies of VRPs and related problems (e.g., [30,23,2]). This section reviews
the most relevant work.
A JVCRSP is considered in [22], in which vehicles transport teams to service
customers, and are able to move without any team on board. The problem
features three types of tasks that must be serviced in order, and all customers
have one task of each type. Each team can only service one compatible type
of task. The MIP formulation has variables indexed by five dimensions, and is
intractable. The paper also develops a simple iterative local search algorithm
embedded within a particle swarm metaheuristic. This approach is very specific
and cannot accommodate side constraints easily.
A JVCRSP modeling a mail distribution application is solved using a two-
stage heuristic column generation approach in [19]. This model features multiple
depots at which vehicle routes begin and end. In the first stage, trips that begin
and end at these depots are computed. The second stage takes a scheduling
approach and assigns vehicles and crews to the trips. Vehicle interchange can only
occur at the depots at the start or end of a trip. In addition, the model features
a 24-hour cyclic time period, and variables indexed by discretized time blocks.
Since the solution method is based on two stages, it cannot jointly optimize
vehicles and crews. Observe also that the CP formulation in our paper does not
require time-indexed variables, and allows for vehicle interchange at all locations.
Another JVCRSP considers European legislation and includes relay stations
where drivers are allowed to rest and interchange vehicles [8]. Upon reaching a
relay station, the vehicle must wait a fixed amount of time. Vehicle interchange
can only occur if other drivers arrive at this relay station during this time interval.
The problem also provides a shuttle service, separate to the fleet of vehicles,
that can be used to move drivers between relay stations. The problem is solved
using a two-stage LNS method. In the first stage, a VRP is solved and the
resulting routes form the customers of a VRP in the second stage, in which the
crews perform the role of vehicles. Observe that this approach also cannot jointly
optimize vehicle and crew routing. The model features several fixed parameters,
such as the duration during which a vehicle waits at a relay station, and a
search procedure that only explores a limited number of nearby relay stations.
Both these restrictions reduce the search space, but negatively impact vehicle
interchange, leading the authors to conclude that allowing for vehicle interchange
does not significantly improve the objective value. Our model proves the contrary
since it does not fix the duration that a crew waits, and can explore all locations
for vehicle interchange.
668 E. Lam et al.
JVCRSPs belong in the class of problems known as the VRPs with multiple
synchronization constraints [5]. Synchronization is a feature present in certain
VRPs, in which decisions about one object (e.g., vehicle, route, request) imply
actions that may or must be taken on other objects. A complex VRP with
synchronization is the VRP with Trailers and Transshipments (VRPTT) [7,4]. It
features two vehicle classes: lorries which can move independently, and trailers
which must be towed by an accompanying lorry. All lorries begin at a single
depot with or without a trailer. A lorry can detach its trailer at transshipment
locations in order to visit customers who are unable to accommodate a trailer
(e.g., due to size). Lorries can transfer load into and/or attach with any trailer
at any transshipment location. A lorry that has detached its trailer can also
return to the depot without reattaching a trailer, leaving its trailer behind at a
transshipment location to be collected by another lorry at a future time. Several
sophisticated MIP formulations are presented, which are solved using branch-
and-cut on instances with up to eight customers, eight transshipment locations
and eight vehicles. The VRPTT can be reformulated into a JVCRSP by casting
crews as lorries with zero capacity, and vehicles as trailers [6].
The VRPTT is most closely related to our JVCRSP model, since lorry routes
and trailer routes are jointly computed, and the search space is not artificially
limited. However, one major difference is that the VRPTT incorporates load
synchronization, which the JVCRSP does not consider.
Finally, observe that vehicle and crew scheduling problems (VCSPs) are thor-
oughly studied (e.g., [18,27,17,15,16,3,25,26]). VCSPs aim to assign vehicles and
crews to a predetermined set of trips, with each trip consisting of a fixed route,
and usually fixed arrival and departure times. Trips in VCSPs correspond to
parts of a route in JVCRSPs, which are not available a priori, but instead, must
be computed during search, thereby increasing the computational challenges.
8 Conclusion
References
1. Bent, R., Van Hentenryck, P.: A two-stage hybrid local search for the vehicle rout-
ing problem with time windows. Transportation Science 38(4), 515–530 (2004)
2. Berbeglia, G., Cordeau, J.F., Gribkovskaia, I., Laporte, G.: Static pickup and deliv-
ery problems: a classification scheme and survey. TOP 15(1), 1–31 (2007)
3. Cordeau, J.F., Stojković, G., Soumis, F., Desrosiers, J.: Benders decomposition for
simultaneous aircraft routing and crew scheduling. Transportation Science 35(4),
375–388 (2001)
4. Drexl, M.: On some generalized routing problems. Ph.D. thesis, RWTH Aachen
University, Aachen (2007)
5. Drexl, M.: Synchronization in vehicle routing–a survey of VRPs with multiple
synchronization constraints. Transportation Science 46(3), 297–316 (2012)
6. Drexl, M.: Applications of the vehicle routing problem with trailers and transship-
ments. European Journal of Operational Research 227(2), 275–283 (2013)
7. Drexl, M.: Branch-and-cut algorithms for the vehicle routing problem with trailers
and transshipments. Networks 63(1), 119–133 (2014)
8. Drexl, M., Rieck, J., Sigl, T., Press, B.: Simultaneous vehicle and crew routing and
scheduling for partial- and full-load long-distance road transport. BuR - Business
Research 6(2), 242–264 (2013)
9. Dreyfus, S.E.: An appraisal of some shortest-path algorithms. Operations Research
17(3), 395–412 (1969)
10. Focacci, F., Lodi, A., Milano, M.: Embedding relaxations in global constraints for
solving TSP and TSPTW. Annals of Mathematics and Artificial Intelligence 34(4),
291–311 (2002)
11. Focacci, F., Lodi, A., Milano, M.: Optimization-oriented global constraints. Con-
straints 7(3–4), 351–365 (2002)
12. Focacci, F., Lodi, A., Milano, M.: Exploiting relaxations in CP. In: Milano, M.
(ed.) Constraint and Integer Programming, Operations Research/Computer Sci-
ence Interfaces Series, vol. 27, pp. 137–167. Springer, US (2004)
13. Focacci, F., Lodi, A., Milano, M., Vigo, D.: Solving TSP through the integration of
OR and CP techniques. Electronic Notes in Discrete Mathematics 1, 13–25 (1999)
14. Francis, K.G., Stuckey, P.J.: Explaining circuit propagation. Constraints 19(1),
1–29 (2014)
15. Freling, R., Huisman, D., Wagelmans, A.: Applying an integrated approach to vehi-
cle and crew scheduling in practice. In: Voß, S., Daduna, J. (eds.) Computer-Aided
Scheduling of Public Transport. Lecture Notes in Economics and Mathematical
Systems, vol. 505, pp. 73–90. Springer, Berlin Heidelberg (2001)
16. Freling, R., Huisman, D., Wagelmans, A.: Models and algorithms for integration
of vehicle and crew scheduling. Journal of Scheduling 6(1), 63–85 (2003)
17. Freling, R., Wagelmans, A., Paixão, J.: An overview of models and techniques for
integrating vehicle and crew scheduling. In: Wilson, N. (ed.) Computer-Aided Tran-
sit Scheduling. Lecture Notes in Economics and Mathematical Systems, vol. 471,
pp. 441–460. Springer, Berlin Heidelberg (1999)
18. Haase, K., Desaulniers, G., Desrosiers, J.: Simultaneous vehicle and crew scheduling
in urban mass transit systems. Transportation Science 35(3), 286–303 (2001)
19. Hollis, B., Forbes, M., Douglas, B.: Vehicle routing and crew scheduling for
metropolitan mail distribution at Australia Post. European Journal of Operational
Research 173(1), 133–150 (2006)
670 E. Lam et al.
20. Ibaraki, T.: Algorithms for obtaining shortest paths visiting specified nodes. SIAM
Review 15(2), 309–317 (1973)
21. Kilby, P., Prosser, P., Shaw, P.: A comparison of traditional and constraint-based
heuristic methods on vehicle routing problems with side constraints. Constraints
5(4), 389–414 (2000)
22. Kim, B.I., Koo, J., Park, J.: The combined manpower-vehicle routing problem for
multi-staged services. Expert Systems with Applications 37(12), 8424–8431 (2010)
23. Laporte, G.: What you should know about the vehicle routing problem. Naval
Research Logistics (NRL) 54(8), 811–819 (2007)
24. Laporte, G., Mercure, H., Norbert, Y.: Optimal tour planning with specified nodes.
RAIRO - Operations Research - Recherche Opérationnelle 18(3), 203–210 (1984)
25. Mercier, A., Cordeau, J.F., Soumis, F.: A computational study of benders decompo-
sition for the integrated aircraft routing and crew scheduling problem. Computers
& Operations Research 32(6), 1451–1476 (2005)
26. Mercier, A., Soumis, F.: An integrated aircraft routing, crew scheduling and flight
retiming model. Computers & Operations Research 34(8), 2251–2265 (2007)
27. Mesquita, M., Paias, A.: Set partitioning/covering-based approaches for the inte-
grated vehicle and crew scheduling problem. Computers & Operations Research
35(5), 1562–1575 (2008), part Special Issue: Algorithms and Computational Meth-
ods in Feasibility and Infeasibility
28. Rousseau, L.M., Gendreau, M., Pesant, G.: Using constraint-based operators to
solve the vehicle routing problem with time windows. Journal of Heuristics 8(1),
43–58 (2002)
29. Shaw, P.: Using Constraint Programming and Local Search Methods to Solve
Vehicle Routing Problems. In: Maher, M.J., Puget, J.-F. (eds.) CP 1998. LNCS,
vol. 1520, pp. 417–431. Springer, Heidelberg (1998)
30. Toth, P., Vigo, D.: The Vehicle Routing Problem. Society for Industrial and Applied
Mathematics (2002)
31. Van Hentenryck, P., Michel, L.: The Objective-CP Optimization System. In:
Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 8–29. Springer, Heidelberg (2013)
32. Volgenant, T., Jonker, R.: On some generalizations of the travelling-salesman prob-
lem. The Journal of the Operational Research Society 38(11), 1073–1079 (1987)
33. Yu, G.: Operations Research in the Airline Industry. International Series in Oper-
ations Research & Management Science: 9, Springer, US (1998)
Constructing Sailing Match Race Schedules:
Round-Robin Pairing Lists
1 Introduction
This work describes a round-robin competition format that arises from sailing,
known as match racing. Competitors, i.e. skippers, compete against each other in
a series of matches taking place in rounds, known as flights. A match is composed
of two skippers, with each skipper in a boat on their own. Skippers in a match set
off together, one on the port side, the other starboard, and first home wins that
match. Criteria published by the International Sailing Federation (ISAF) dictate
what makes a legal match race schedule and what should be optimized. This is
a rich set of criteria, 13 in all, and as far as we know, all published schedules
have been produced by hand. This is a daunting task. A close inspection of
these schedules reveals that most are illegal, violating many of the match race
scheduling criteria, many schedules are missing, and some that are legal are far
from the ISAF definition of optimality.
This paper describes the scheduling problem. We present a constraint pro-
gramming solution and document how this model was constructed incrementally.
We believe this illustrates how adaptable constraint programming is: a robust
model can be developed incrementally to address all of the required criteria.
Our schedules are then constructed in a sequence of stages, not dissimilar to the
hybrid and decomposition based approaches by Lombardi and Milano [3]. Some
ISAF published schedules are presented along with some of our own, some of
these being new. These schedules are essentially blank forms, made available to
event organizers, which can be filled in with names of actual competitors, i.e.
these schedules are reusable.
The paper is organized as follows: we introduce the 13 match racing criteria,
then explain the constraint models and four stages of schedule construction, and
then schedules are presented. We finish with discussion and a conclusion.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 671–686, 2015.
DOI: 10.1007/978-3-319-23219-5 46
672 C. Macdonald et al.
Note that criteria 10, 11 and 12 only apply when there are fewer boats than
skippers; 11 and 12 override 6 when changes are required, and 13 applies
when there are more boats than skippers.
Constructing Sailing Match Race Schedules: Round-Robin Pairing Lists 673
Our approach produces schedules in four stages. The first stage produces a
schedule that respects criteria 1, 4, 11 and 12, and minimizes criteria 10 (boat
changes). The second stage constructs a schedule that respects criteria 1, 4, 11,
12 (again), has criterion 10 as a hard constraint generated from first stage, and
minimizes criterion 6 (balance). This results in a multi-objective schedule that
1
http://www.sailing.org/rankings/match/
674 C. Macdonald et al.
Flight Matches
Table 1. A round-robin schedule with 7 skippers,
0 (0,1) (2,3) (4,5) 6 boats and 7 flights. Skippers are numbered 0 to
1 (0,2) (4,6) (1,5) 6. Note that the order of skippers within a flight is
2 (2,6) (0,5) (1,3) significant, as is position within a match (port or
3 (5,6) (0,3) (1,4) starboard). This schedule is the result of stages 1
4 (3,5) (1,6) (2,4) and 2, and has yet to be renumbered and oriented
5 (3,6) (0,4) (2,5) (stages 3 and 4).
6 (3,4) (1,2) (0,6)
attempts to minimize boat changes and balance. The third stage satisfies crite-
rion 9, and is a simple translation of the schedule produced in stage 2. The final
stage orients skippers within matches to address criteria 2, 3, 5 and 8.
We now describe the constraint models and processes used in each stage. In
the text below we assume there are n skippers and b boats, with m = b/2 matches
in a flight. In total there are t = n(n−1)/2 matches and f = n(n−1)/m flights.
We use the schedule in Table 1, for 7 skippers and 6 boats, to help illustrate the
constraint models.
Modeling skippers: The first thing we model, in the first half of Figure 1, is a
skipper. Each skipper σ has both a temporal view of their schedule (“who, if
anyone, am I racing in the match at time t?”), and a state view (“where am I
racing within flight f ?”). The temporal view is via the array timeSlot defined in
(V1). If variable timeSlot[i] = k and k ≥ 0 then this skipper is in a match with
skipper k at time i.
Variable , [i] (V2) gives the state of this skipper in flight i, corresponding to
time slots timeSlot[m · i] to timeSlot[m(i + 1) − 1]. The cases in (C1) state that
a skipper can be in a match in the first time slot in the flight, or in the middle
of the flight2 , or in the last time slot of the flight. Alternatively, if all time slots
in a flight are equal to −1 then the skipper is in a bye (i.e. not in a match in
this flight), and if all time slots in a flight are equal to −2 then the skipper has
finished all matches.
We must then ensure that each skipper σ is in a match with all other skip-
pers {0, ... , n − 1} \ {σ}. This is (C2), which is enforced by imposing a global
cardinality constraint [5] on the array timeSlot.
State transitions: The , variables are then used to impose match race criterion 4
(if last in flight i then not first in flight i + 1), criterion 11 (if last in flight i
then not in a bye in flight i + 1) and criterion 12 (if flight i is a bye then flight
i + 1 is not first). These criteria are imposed in (C3) by the deterministic finite
automaton (DFA) shown in Figure 2 using Pesant’s regular constraint [4]. The
2
i.e. not first and not last.
Constructing Sailing Match Race Schedules: Round-Robin Pairing Lists 675
Fig. 1. Our constraint model, from a skipper perspective (top) and a match and tem-
poral perspective (below). The number of skippers is n, and m is the number of matches
in a flight. The number of flights is f =
n(n − 1)/m, and there are t = n(n − 1)/2
matches (and time slots) in total. We define N to include zero.
676 C. Macdonald et al.
Skipper 5:
4 1 0 6 3 2
0
1
2
3
4
5
6 (3,4) (1,2) (0,6)
arcs in Figure 2 represent possible transitions from one state to another. The
DFA is encoded as a set of transition objects qi , ι, qj , where a transition is
made from state qi to state qj when encountering input ι. In addition we specify
the accepting states, which are all states except the start state (white) and the
bye state (pink). This constraint also ensures that if a skipper has finished all
matches in flight i (i.e. is in state End) then that skipper will also have finished
all matches in flight i + 1 (and so on). Note that when we have as many boats
as skippers, the directed edge (Bye, Last) (marked ) becomes bidirectional.
Figure 2 also shows the skipper-oriented variables and constraints corre-
sponding to skipper 5 in the schedule shown in Table 1. The state array is
presented as coloured boxes, and below that is the timeSlot array. The arrows
represent the channeling constraints (C1). The state array is coloured with green
representing Last, yellow for Mid, blue for First, red for Last and (not shown)
pink for Bye. The schedule of Table 1 is reproduced with the matches for skipper
5 emboldened.
Boat changes: A boat change occurs when a skipper has been in a Bye state in
flight i and then is in a match in the next flight i + 1. This is encoded using the
array of zero/one variables (V3), and the constraint (C4), and accumulated into
totalChanges (V4, C5).
modMatch
0 1 2 3 4 5 6
0 - 0 1 3 5 2 6
1 0 - 6 2 3 1 4
schedule
2 1 6 - 0 4 5 2
3 3 2 0 - 6 4 5 Flight Matches
4 5 3 4 6 - 0 1 0 (0,1) (2,3) (4,5)
5 2 1 5 4 0 - 3 1 (0,2) (4,6) (1,5)
2 (2,6) (0,5) (1,3)
6 6 4 2 5 1 3 -
3 (5,6) (0,3) (1,4)
4 (3,5) (1,6) (2,4)
match 5 (3,6) (0,4) (2,5)
0 1 2 3 4 5 6 6 (3,4) (1,2) (0,6)
0 - 0 3 10 16 7 20
1 - 19 8 11 5 13
2 - 1 14 17 6
3 - 18 12 15
4 - 2 4
5 - 9
6 -
time (0,1) (2,3) (4,5) (0,2) (4,6) (1,5) (2,6) (0,5) (1,3) (5,6) (0,3) (1,4) (3,5) (1,6) (2,4) (3,6) (0,4) (2,5) (3,4) (1,2) (0,6)
Constructing Sailing Match Race Schedules: Round-Robin Pairing Lists
Fig. 3. A pictorial representation of the entire model of the schedule for 7 skippers and 6 boats. The schedule is reproduced on the right.
In the centre we have the 7 skippers, on left the modMatch and match arrays, and along the bottom the time array. The arrows signify
channeling between parts of the model.
677
678 C. Macdonald et al.
Temporal perspective: We now take a temporal view (V7), such that time[τ ] is
a pair (i, j), stating that at time τ skippers σ[i] and σ[j] are in a match. We
channel between the match perspective and the temporal perspective using (C9).
Decision variables: The decision variables are time[0] to time[t − 1], i.e. for each
time slot we decide what match takes place. A symmetry break is made at the
top of search by forcing the first round to contain the matches (0, 1), (2, 3), ... ,
i.e. ∀i ∈ {0 ... m − 1} : match[2i, 2i + 1] = i. (This is independent of criterion 9,
which will be enforced in a subsequent stage by renumbering.)
Figure 3 gives a pictorial view of the entire model, using the 7 skipper and 6
boat problem. On the right we have the 7 skippers with their states and time
slots. Again, on the right we give the schedule actually produced. On the left we
have the modMatch and match arrays, and at the bottom the time array. The
arrows show the channeling between parts of the model.
The schedule presented has 6 boat changes: there are no boat changes in
flight 0 (first flight), in flight 1 skipper 6 has a boat change, in flight 2 skipper 3
has a boat change, in flight 3 skipper 4, in flight 4 skipper 6, in flight 5 skipper
0, and flight 6 skipper 1.
maxImbalance ∈ N (V11)
maxImbalance = maximum(imbalance) (C14)
Fig. 4. Additions to the constraint model in Figure 1 for stage 2. The constant β is
the minimum number of boat changes found in stage 1.
i.e. in the ith match of the j th flight (C12). Imbalance (V10) is then computed
for each position, as the absolute amount over or under the expected presence
in a given position (C13). Finally, we compute the maximum imbalance over all
positions for this skipper (V11, C14).
We then capture the maximum imbalance over all skippers (V12, V13
and C15) and minimize this (C16). As before, the decision variables are time[0]
to time[t − 1] and the same symmetry breaking is imposed at top of search.
Stage 3 then takes as input the schedule produced in stage 2 and renames skip-
pers in the last round of the last flight to be (0, 1), satisfying criterion 9. This
is a simple linear process. The schedule produced for 7 skippers and 6 boats is
shown in Table 2.
680 C. Macdonald et al.
Flight Matches
Table 2. A round-robin schedule with 7 skippers,
0 (0,6) (2,3) (4,5) 6 boats and 7 flights, which is the result of stages
1 (0,2) (4,1) (6,5) 1, 2, and 3. It has 6 boat changes and imbalance
2 (2,1) (0,5) (6,3) 1. An example of imbalance is skipper σ[0] with 2
3 (5,1) (0,3) (6,4) matches in position 0 (first), 3 in position 1 and 1
4 (3,5) (6,1) (2,4) (mid) in position 2 (last). Perfect balance would be
5 (3,1) (0,4) (2,5) 2 matches in each position, only achieved by σ[2].
6 (3,4) (6,2) (0,1)
4 Sample Schedules
We present four pairs of schedules. The first pair is for 8 skippers and 6 boats,
one published by ISAF, the other generated by us. Next, we present two new
schedules, not appearing in the ISAF manual, for 9 skippers and 6 boats and 9
skippers with 8 boats, then 10 skippers and 6 boats, again both published by
ISAF and generated by us. Finally, we show what is a relatively easy problem, 8
skippers and 8 boats. For each of our schedules (with the exception of the latter
“easy-8” problem) we used 1 day CPU time for the first stage (minimizing boat
changes) then a further 2 days to minimize imbalance. We were unable to prove
optimality in this time, therefore some of these schedules might be improved.
The processor used was an Intel (R) Xeon (R) E5-2660 at 2.20GHz. Note, stages
3 and 4 (renaming and orientation) completed in less than a second.
Constructing Sailing Match Race Schedules: Round-Robin Pairing Lists 681
Fig. 5. A pictorial representation of the orientation process, stage 4. Top right is the
actual oriented schedule. Below that is the DFA to satisfy criterion 5. On the left is the
zero/one variables, a row representing a skipper’s sequence of competitors. An edge
between variables corresponds to a matched pair, that must take different values.
Fig. 6. Schedules for 8 skippers and 6 boats. On the left, the published ISAF schedule
(illegal), and on the right is our schedule.
8 skippers and 6 Boats: We first analyze the ISAF schedule, Figure 6 on the
left. Criterion 4 (skippers in last match in a flight cannot be first in next flight)
is violated on 3 occasions (skipper 1 in flight 3, skipper 7 in flight 4, skipper
0 in flight 7). Criterion 5 (no more than two consecutive port or starboard
assignments) is violated for skipper 6 (flights 1 to 3) and skipper 7 (flights 7 to
9). Criterion 6 (imbalance) is violated for skippers 6 and 8. Criterion 12 (new
boats do not sail first) is violated in flight 9 for skipper 5. Finally, the schedule
has 8 boat changes. Our schedule, Figure 6 on the right, respects all criteria and
has 6 boat changes and a maximum imbalance of 1.
682 C. Macdonald et al.
Fig. 7. Two new schedules. On the left, 9 skippers and 6 boats, and on the right 9
skippers and 8 boats.
9 skippers: Two new schedules are presented in Figure 7, on the left for 6 boats
and on the right for 8 boats. Neither of these schedules appear in the ISAF
Umpires’ Manual. Both schedules respect all criteria. For 6 boats there are 8
boat changes (no skipper making more than 1 boat change) and a maximum
imbalance of 2. For 8 boats there are again 8 boat changes, no skipper with
more than 1 boat change, and each skipper 4 times on starboard side and 4 on
port side.
10 skippers and 6 boats: Figure 8 shows the ISAF schedule on the left for 10
skippers and 6 boats and on the right, our schedule. The ISAF schedule violates
criterion 5 (no more than 2 consecutive port or starboard assignments) ten times
(twice for skippers 0, 1 and 6 and once for skippers 3, 7, 8 and 9). Criterion 12
(new boats do not sail first) is violated 7 times (in flight 3 for skippers 6 and
2, flight 5 for skipper 8, flight 6 for skipper 7, flight 8 for skipper 1, flight 9 for
skipper 4 and flight 12 for skipper 4 again). There are 22 boat changes, with the
minimum changes for a skipper being 1 and the maximum 3. Our schedule, right
of Figure 8, satisfies all criteria, has 12 boat changes with the minimum changes
for a skipper being 0 and the maximum 2, and a maximum imbalance of 1.
8 skippers and 8 boats (easy-8): Figure 9 shows the ISAF schedule on the right
for 8 skippers and 8 boats and on the right, our schedule. The ISAF schedule
violates criterion 4 (last match in a flight cannot be first in next flight) for
skipper 5 in flights 1 and 2. Also, criterion 5 (no skipper should have more than
2 consecutive port or starboard assignments) is violated for skippers 0, 1, 3, 4 and
6. Furthermore, skipper 1 appears in the last match of four flights resulting in
significant imbalance. Our schedule, on the right, satisfies all criteria, is optimal
(maximum imbalance of 1) and took less than 10 seconds in total (all stages) to
produce.
Constructing Sailing Match Race Schedules: Round-Robin Pairing Lists 683
Fig. 8. Schedules for 10 skippers and 6 boats. On the left, the ISAF published schedule
(illegal), and on the right, our schedule.
Fig. 9. Schedules for 8 skippers and 8 boats. On the left, the published ISAF schedule
(illegal), and on the right, our schedule.
5 Discussion
It was anticipated that this problem would be easy to model. This naı̈vety was
due to the use of the term “round-robin” for these schedules, leading us to believe
that we could use some of the models already in the literature [1,6,7]. This
naı̈vety slowly dissolved as we addressed more and more of the ISAF criteria. A
number of models we produced were scrapped due to misunderstanding about the
actual problem, i.e. a communication problem between the authors. Eventually
this was resolved by presenting the majority of the criteria as a deterministic
finite automaton. This became our Rosetta Stone, with the surprising benefit
that it not only improved the team’s communications, it was also a constraint
(the regular constraint).
The staged approach was taken cautiously. We expected that isolating the
orientation of schedules as a post-process might leave us with a hard or insoluble
684 C. Macdonald et al.
problem. So far, every schedule we have produced has been oriented with very
little search, typically taking less than a second.
We used the Choco constraint programming toolkit and one of our goals was
to use only toolkit constraints, i.e. we wanted to see how far we could go without
implementing our own specialized constraints. We are pleased to say that we did
not have to do anything out of the box, although we did feel that we had used
just about every constraint there was.
There are many redundant variables in our model. One of our first valid mod-
els was essentially that shown in Figure 2, and did not use modMatch and match
variables. Performance was hopeless, struggling to produce a 7 skipper 6 boat
schedule in days. The modMatch and match variables were added. This improved
domain filtering, and a flattened match array was used as decision variables.
That is, the decisions where “when do we schedule this match?”. At this point
we had not yet produced a 9 skipper 6 boat schedule and we suspected that
the combined criteria might exclude such a schedule. A non-constraint model
was developed, primarily to attempt to prove that there was no schedule for 9
skippers with 6 boats. This program used a backtracking search with decision
variables being positions within flights, i.e. time slots being assigned to matches.
At the top of search, the matches in the first flight were set, and symmetry
breaking was used to reduce the number of legal second flights. A solution was
found in seconds! With this experience we added in the time variables, channeled
these into the existing model and used these as decision variables, i.e. the ques-
tion now was “what match will we do now?”. We also anchored the matches in
the first flight. With these changes we began to produce schedules in acceptable
time. The model was then built upon, incrementally adding criteria. This took a
6 Conclusion
We have produced new and better match race schedules. These schedules can
be used by anyone who competes under the criteria published by ISAF. Our
schedules can be downloaded as blank schedules and then populated with the
names of the actual competing skippers.
So, why did we use constraint programming? The answer is obvious: we are
constraint programmers, or to borrow Mark Twain’s words “To a man with a
hammer, everything looks like a nail”. But actually, constraint programming has
been a good way to go. From an engineering perspective, it has allowed us to
prototype solutions quickly and to build solutions incrementally. There is also an
advantage that we might exploit in the future: we can now investigate the effect
different criteria have on our ability to produce schedules and how relaxation of
those affect optimization criteria. That is, the constraint program might be used
to design the next set of criteria for match race schedules, or allow the event
organizer to decide which criteria to sacrifice to ensure a faster schedule with
fewer boat changes.
References
1. Henz, M., Müller, T., Thiel, S.: Global constraints for round robin tournament
scheduling. European Journal of Operational Research 153(1), 92–101 (2004)
2. International Sailing Federation. ISAF International Umpires’ and Match Racing
Manual (2012)
3. Lombardi, M., Milano, M.: Optimal methods for resource allocation and scheduling:
a cross-disciplinary survey. Constraints 17(1), 51–85 (2012)
4. Pesant, G.: A regular language membership constraint for finite sequences of vari-
ables. In: Proceedings of the 10th International Conference on Principles and
Practice of Constraint Programming, CP 2004, Toronto, Canada, September 27-
October 1, pp. 482–495 (2004)
686 C. Macdonald et al.
5. Quimper, C.-G., van Beek, P., López-Ortiz, A., Golynski, A., Sadjad, S.B.S.: An
Efficient Bounds Consistency Algorithm for the Global Cardinality Constraint. In:
Rossi, F. (ed.) CP 2003. LNCS, vol. 2833, pp. 600–614. Springer, Heidelberg (2003)
6. Rasmussen, R.V., Trick, M.A.: Round robin scheduling - a survey. European Journal
of Operational Research 188(3), 617–636 (2008)
7. Trick, M.A.: Integer and Constraint Programming Approaches for Round-Robin
Tournament Scheduling. In: Burke, E.K., De Causmaecker, P. (eds.) PATAT 2002.
LNCS, vol. 2740, pp. 63–77. Springer, Heidelberg (2003)
Design and Evaluation of a Constraint-Based
Energy Saving and Scheduling Recommender
System
1 Introduction
In-home networked sensing has, in recent years, reached a level of cost, reliability
and protocol maturity that enables consumer-level home sensing to a degree
not possible before. The increasing variety and availability of Zigbee-compatible
wireless sensing allows for rich sensor coverage of homes with minimal impact or
installation, providing rich data streams from around the home, monitoring use
of space, appliance use, temperature and more. Providing these data streams in
an easy to understand format is of substantial benefit to home-owners to help
understand inefficient heating of spaces, electricity efficiency and overall energy
costs [24].
Furthermore, developments in energy infrastructure and generation have lead
to a greater variety of energy production sources and tariff schemes, leading to a
greater incentive (both in terms of cost and in environmental impact) for home-
owners to take pay attention to their energy consumption over different time
periods. Some regions use variable tariffs based on the time of day [25], and
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 687–703, 2015.
DOI: 10.1007/978-3-319-23219-5 47
688 S.Ó. Murphy et al.
Fig. 1. AUTHENTIC sensors (movement, light, humidty, contact and smartplug sen-
sors)
a threshold). Finally, the app provides facilities for guiding the user to change
their behaviour. At a basic level, the app allows the user to set annual energy
goals, and to track progress towards those goals. More sophisticated feedback,
including advice on how to achieve specified reductions, is the main topic of this
paper, and is discussed in the remaining sections.
3 Requirements
Users need guidance to help change their energy consumption patterns in accor-
dance with their own goals and preferences. We consider two high level goals:
reducing cost, and reducing total energy consumption1 . The first steps are under-
standing how much energy is consumed by each activity and what cost is incurred
by those activities at different times. Reducing consumption itself is easy – appli-
ances can simply be switched off – but the difficulty is in balancing the reduction
in consumption with the users’ preferences for safe and comfortable living. Low-
ering a heating thermostat by 2 degrees may be unsafe in winter, while switching
off an entertainment console may be impractical.
The aim is to propose changes to a user’s behaviour which achieve their
energy goals, while still being acceptable for their health, comfort and enjoyment.
Further, those proposed changes should be personal, tailored to the users in
a specific home. Thirdly, the interaction load imposed on the users must be
manageable: systems which require extensive elicitation of preferences and utility
functions under different scenarios before any proposal can be made are simply
impractical in most domestic settings. Finally, the system should respect the
privacy of the users, and should be capable of operating entirely within the home,
on devices with limited computing power, without releasing data or relying on
data obtained from other users outside the home.
Our intention is to guide the users based on the observed behaviour of those
users in their home. The data streams from the sensors and smart plugs provide
a history of appliance use, from which we can extract daily and weekly patterns.
Given a goal (e.g. reduce the energy bill by 10%), we will then search for minimal
changes to those patterns which satisfy the goal. Our proposals will be on two
levels. The first level will recommend the total number (or duration) of activa-
tions for each appliance over a specified period, and if differential tariffs are in
use, the total number of appliance activations in each price band.
The second level will propose a schedule of use for each day, ensuring the
total simultaneous load is within any threshold, again representing a minimal
change to observed behaviour patterns. Thus in each case an initial proposal is
tailored to each home, without requiring any interactive preference elicitation
apart from setting the initial high level goal. In each case, the users should then
be able to interact with the system, imposing new constraints or objectives if
the proposal is not satisfactory, and requesting a new recommendation. Further,
the system will then monitor energy consumption within the home, alerting the
1
Additional goals of reducing carbon footprint and reducing energy consumption from
non-renewable sources are being developed.
Design and Evaluation of a Constraint-Based Energy Saving 691
user when targets are not going to be met, and offering recomputation of the
schedules or activation levels.
Our problem thus involves multiple levels of decision support and optimisa-
tion, over constrained variables. The problems range from relatively simple linear
assignment problems to constrained scheduling, and in each case the problems
may be extended by additional user constraints. Thus we choose to use constraint
programming as the single technology for all problem variants because of the
dedicated support for modelling cumulative scheduling problems and because
of its flexibility in adding what ultimately could be arbitrary side constraints
and preferences. The Authentic system also imposes some technical limitations,
which influence our choice of solver. The Reporting Tool app (Section 2) runs
under Android, and is limited to JDK 1.6 for library compatibility issues. Thus
we model and solve the decision and optimisation problems using the Choco
2.1.5 Java library, as it is also JDK1.6 compatible. This places a restriction on
the variable types and constraints we use.
rate). This allows for the like-for-like comparison of readings between arbitrary
timepoints and aribtrary sensing types (e.g. plotting Occupancy vs Television,
Light vs Lamp, or Humidity vs Dryer).
An additional function provided by this module is the generation of “Acti-
vationTuples”, data objects representing the usage pattern for appliances in
the home which we use as input for the Appliance Use Optimisation Module
(Section 4.3).
ActivationTuples contain the following information:
– Appliance Name
– Average Consumption Per Activation (Watt-Hours)
– Number of Activations per Tariff (in the case of Day/Night or other variable
tariffs)
– Power Draw Profile (time series, Watts)
Activations are considered from the time an appliance sensor reports instan-
taneous demand above a minimum threshold until the instantaneous demand
returns to below that threshold. The average consumption is based on the watt-
hour (WH) consumption per activation period. In the case of appliances with
variable activation profiles (for example, different washing machine settings), we
can subdivide the appliance into seperate sub-appliances, one for each setting
or pattern. The Power Draw Profile represents the instantaneous power demand
in watts over a time series with configurable sampling rate (e.g. 5 minutes).
The Power Draw Profile is used with the Scheduling Module to ensure that the
total concurrent power load in a home or on a circuit at a given time can be
accounted for in the constraint satisfaction problem. As the reporting interval of
the smart-plug sensors is generally 5 minutes, higher resolution sampling rates
are not required.
Variable Description
Name
Constants
InputCost Cost of the historical period
T arget Reduction in cost required (e.g. 0.9 of the previous cost)
H, L, M Price per unit(wH) of electricity at High, Medium and Low tar-
iffs
Ai InputAct Original Number of activations of Appliance i in input
Ai Cons Average Consumption of Appliance i (wH) per activation
Ai InputH Original number of activations at High tariff for Appliance i in
input
Ai InputM Original number of activations at Medium tariff for Appliance i
in input
Ai InputL Original number of activations at Low tariff for Appliance i in
input
Variables
Ai HAct Number of activations of Appliance i at High tariff times
Ai M Act Number of activations of Appliance i at Medium tariff times
Ai LAct Number of activations of Appliance i at Low tariff times
Auxilliary Variables
Ai HDif f The difference between historical High use and the new plan for
Appliance i
Ai M Dif f The difference between historical Medium use and the new plan
for Appliance i
Ai LDif f The difference between historical Low use and the new plan for
Appliance i
Ai HCost Total Cost for Appliance i at High tariff
Ai M Cost Total Cost for Appliance i at Medium tariff
Ai LCost Total Cost for Appliance i at Low tariff
Ai T otalCost Total cost for Appliance i
Ai T otalDif f Sum of the squared differences for Appliance i
T otalCost Total cost of the new plan
TotalDiff Objective variable. Sum of squared differences
Ai Act Total Number of activations of Appliance i
The only input required from the user for the first solution is to specify the
required energy or cost reduction, and thus the interaction load on the user is
minimal. However, it is likely that the proposed changes may not satisfy the
user’s requirements. Thus after the first schedule is proposed, the user is invited
to specify additional constraints. The main type of user constraint is a domain
restriction, specifying for a single appliance the acceptable range of activations in
any price band or in total. Additional constraints, including for example, that the
total number of activations for one appliance must be not less than the number
for another can easily be handled by the solver, but are not yet implemented in
the interface. The intention is to regard these user constraints as critiques of the
694 S.Ó. Murphy et al.
Constraints Description
Ai HCost = Ai HAct ∗ H Set the cost at H for Appliance i
Ai M Cost = Ai HAct ∗ M Set the cost at M for Appliance i
Ai LCost = Ai HAct ∗ L Set the cost at L for Appliance i
Ai HDif f = (Ai HAct − Ai InputH)2 Set the Squared Difference in H.
2
Ai M Dif f = (Ai M Act − Ai InputM ) Set the cost at Squared Difference
in M
Ai LDif f = (Ai LAct − Ai InputL)2 Set the cost at Squared Difference
in L
Ai T otalDif f = Ai HDif f + Ai M Dif f + Ai LDif f Set the sum Difference for Appli-
ance i
Ai T otalCost = Ai HCost + Ai M Cost + Ai LCost Set the total cost for Appliance i
Ai Act = Ai HAct + Ai M Act + Ai LAct Set the total number of activa-
tions for Appliance i
n
T otalDif f = (Ai T otalDif f ) Set the total sum of Differences
i=1
n
T otalCost = (Ai T otalCost) Set the total Cost
i=1
T otalCost ≤ InputCost ∗ T arget Ensure the TotalCost is below the
target price
M inimise(T otalDif f ) Objective is to minimise the sum
of squared differences
proposed solutions, and thus the user is not required to specify any preference
that is already satisfied. However, the added user constraints are stored, and
will be applied to future solving instances (and the user is invited to remove any
constraints that no longer apply).
5 Scheduling Module
The output from the optimisation module is a high level plan specifying the
number of activations of each appliance in each price band over a specified period.
The user is in control, and will choose when to activate an appliance. However,
as discussed above, the system will monitor the activations and alert the user
if the observed activations are not on track to meet the goals at the end of the
period. In cases where there are multiple price bands during a day, or where
there are peak power thresholds which invove a higher price, it may be difficult
for the user to balance their appliance use appropriately. Thus, we also provide a
task scheduler, which recommends start times for appliance use over a number of
days in order to respect the cost constraints. As with the high level plan, there
is an objective to find appliance start times which are as close as possible to
the observed historical patterns for the user. The system allows users to modify
Design and Evaluation of a Constraint-Based Energy Saving 695
aspects of the schedule, by adding or modifying tasks and constraints. The user
is in control, but as before, the system will monitor appliance use compared to
the schedule and alert the user when thresholds are likely to be breached, and
offer the option of rescheduling.
The first aim is to generate a schedule which respects the cost constraints.
The number of activations for each appliance is obtained from the high-level plan,
and the required number of task instances are generated. In order to handle the
time granularity for different constraints, each task instance is then broken up
into multiple sub-tasks each of fixed duration, and sequencing constraints are
applied between the subtasks. Disjunctive constraints[8] are imposed on multi-
ple instance of the same appliance, to ensure that they cannot be scheduled to
operate simultaneously. The high level plan also specifies the number of activa-
tions to take place under each tariff, and so for each task instance, we designate
its highest permissible tariff and impose constraints preventing that task run-
ning in a higher tariff’s time period. Note that this is a permissive approach,
allowing the solver to find schedules with a lower cost than expected.
The next constraint to be considered is the peak power threshold. We handle
this by imposing a cumulative constraint [3] over all tasks. We associate heights
with each appliance task relative to their power demand (and in cases where
the power demand varies over the activation cycle, the heights vary across the
different sub-tasks). The cumulative constraint height parameter is set to to
the maximum power threshold, and in the case of variable maximum demand
schemes we create dummy tasks with appropriate heights to represent temporary
lower thresholds over appropriate time periods.
To ensure each schedule mimics prior behaviour, we analyse historic usage
patterns and infer a time series of the frequency with which an appliance was
active at a given time. The aim is then to minimise the abnormality of appliance
activation times; that is, to avoid recommending appliance use at times with
very low historic use frequency. To achieve this, we divide each day of the week
into timeslots based on the sub-task time granularity (in this work, 5 minutes).
For each appliance activation in the historical data, we increment a count in each
timeslot that matches the day and time (e.g. for a 15-minute activation we might
increment Tuesday 4:00. Tuesday 4:05 and Tuesday 4:10). Having done this for
several weeks worth of historical data, we now have a time series representing the
frequency any appliance was in use at any given time during the 7-day week. We
invert this time series (where F = the highest frequency in the series, all entries E
are changed to F-E, Figure 5) which we use to produce a set of dummy constant
Task Variables (each of height equal to the appropriate inverted frequency) for
use with another cumulative constraint.
The peak value for the cumulative constraint is then a variable, with the aim
being to minimise that peak, subject to the lower bound equal to the maximum
height of the inverse frequencies. For each appliance activation, the height of
all of its sub-tasks are scaled to be the gap between the highest and lowest
frequencies for that appliance, and the sub-tasks are added to the cumulative
constraint (Figure 5). Thus, if we schedule a task so that the full duration of
696 S.Ó. Murphy et al.
The initial solution to the scheduling can now be generated and displayed to
the user. Although it may seem counter-intuitive to schedule uses of appliances
like televisions or games consoles, it is important to account for their expected
use, in order to manage the use of other appliances around that time. Thus we
learn when those devices are most often used, and build that expected usage
into the schedule. This initial solution does not require any interaction with the
user to elicit preferences or objectives. We then allow the user to interact with
the scheduler to improve the schedule, if necessary. The user can add new tasks
or delete existing tasks for a particular day, can extend the duration of a task,
can fix the start time of a task (by sliding the task position on the displayed
schedule), and can add limited temporal constraints between tasks (for example,
a specific dryer task must start within 30 minutes of the completion of specific
washing task, or that the shower and washing machine cannot be active at
the same time), and then can request a rescheduling. For new tasks, the same
historical frequency pattern is applied; for user task time changes, the start time
is fixed, and the frequency mask is adjusted to that no penalty is applied.
6 Performance Evaluation
of the problems. As there is the facility for users to influence the savings prob-
lem through the addition of constraints on the number of appliance activations
at different tariffs (i.e. the user can specify more limited ranges for the number
of activations of appliances during particular tariffs, or to specify limits on the
amount of adjustment made), we investigated the impact of the introduction of
preferences on the running time and solvability of the savings problem. We also
investigate the impact of larger and smaller time-slots on scheduler performance,
with and without some user constraints applied.
7 Related Work
A number of examples of work in optimisation of energy use to balance demand
and reduce costs exist intended to operate at the supply side. These approaches
are typically intended to integrate with “smart” appliances in the home to allow
for load balancing across the so-called “smart grid”. As these approaches typi-
cally operate centrally at the utility, Mixed Integer Linear Programming (MILP)
is commonly used to compute power use schedules based on energy availability
[4,5,13,14,22,23]. MILP approaches take some time to compute (several min-
utes generally), and as they are solving over several homes and with respect to
the utility company’s energy supply requirements, there is limited scope for the
home-owner to understand their personal energy use.
While not applicable to operating on tablets, Lim et al [17] describes a mixed-
integer programming approach to air conditioning scheduling based on scheduled
meetings in buildings, demonstrating the integration of energy-based require-
ments with real-world user requirements in scheduling. Scott et al [21] present
a MILP-based framework featuring the concept of “comfort” in addition to the
consumption and demand considerations that we also consider.
Felfernig & Burke[12] investigated the position of constraint-based models
as the basis of Recommender Systems, noting that limited attention or under-
standing of complex recommender systems on the part of the user is a major
consideration in the design of recommender systems. In our work, we use a
simple-to-understand tablet-based interface to allow users to enter a dialogue
with the system, introducing requirements which are interpreted as constraints,
but without requiring particular expertise on the part of the user. Like our work,
Ha et al [15] proposed a constraint-based approach for demand-side appliance
scheduling, though this work was demonstrated using randomly generate syn-
thetic data and compution time was in the order of minutes.
He et al [16] consider the case where electricity pricing is highly variable
in time and the active use of energy by homes impacts the pricing, a potential
future direction for energy production. They developed a market model combined
with optimisation of community electricity use (using both constraint program-
ming and mixed integer programming) for demand management and cost sav-
ing. Tushar et al [26] described a game-theory-based approach to demand-side
energy management, modeling the interaction between home-owners and utilities
through the trade and consumption of variable energy supplies and costs.
Darby et al [11] and Carroll [9] note that end-user perception has a significant
role to play in motivating changes in energy use behaviours, with greater engage-
ment and savings achieved simply through making more information available to
the homeowner as found in smart-metering, from variable tariff trials in Ireland
[10]. Bu et al [7] presented an MILP-based adaptive home energy scheduling app-
roach with an initial discretisation step similar to the role of data pre-processing
model in our work, though using synthetic test data rather than real-world data
streams, and with relatively high computation time and resources compared to
our approach. De Sá Ferreira et al [20] investigate highly variable tariff design
at the utility level, generating optimised tariff pricing on a day-to-day basis.
Design and Evaluation of a Constraint-Based Energy Saving 701
Highly variable tariffs generated through such a scheme could function well com-
bined with the energy saving and scheduling described in our work, allowing for
dynamic schedule generation on a daily basis while respecting the home-owner’s
typical behaviour patterns.
References
1. Application of delivery prices, orion group energy. http://www.oriongroup.co.nz/
downloads/ApplicationOfDeliveryPrices.pdf (issued February 2, 2015, accessed
April 21, 2015)
702 S.Ó. Murphy et al.
21. Scott, P., Thiébaux, S., van den Briel, M., Van Hentenryck, P.: Residential Demand
Response under Uncertainty. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124,
pp. 645–660. Springer, Heidelberg (2013)
22. Sou, K.C., Kordel, M., Wu, J., Sandberg, H., Johansson, K.H.: Energy and co 2 effi-
cient scheduling of smart home appliances. In: 2013 European Control Conference
(ECC), pp. 4051–4058. IEEE (2013)
23. Sou, K.C., Weimer, J., Sandberg, H., Johansson, K.H.: Scheduling smart home
appliances using mixed integer linear programming. In: 2011 50th IEEE Con-
ference on Decision and Control and European Control Conference (CDC-ECC),
pp. 5144–5149. IEEE (2011)
24. Sweeney, J.C., Kresling, J., Webb, D., Soutar, G.N., Mazzarol, T.: Energy saving
behaviours: Development of a practice-based model. Energy Policy 61, 371–381
(2013)
25. Torriti, J.: Price-based demand side management: Assessing the impacts of time-
of-use tariffs on residential electricity demand and peak shifting in northern italy.
Energy 44(1), 576–583 (2012)
26. Tushar, W., Zhang, J.A., Smith, D.B., Thiebaux, S., Poor, H.V.: Prioritizing con-
sumers in smart grid: Energy management using game theory. In: 2013 IEEE Inter-
national Conference on Communications (ICC), pp. 4239–4243. IEEE (2013)
Scheduling Running Modes of Satellite
Instruments Using Constraint-Based
Local Search
1 Problem Description
The study described in this paper is performed in relation with a future space
program involving an observation satellite orbiting around the Earth at a low-
altitude orbit (several hundreds of kilometers). The task of this satellite is to
realize acquisitions over specific Earth areas using three optical instruments I1,
I2, I3 available on board, and to download collected data towards ground recep-
tion stations. For such a satellite, each orbit takes about one hour and a half, and
different areas are overflied during successive orbits due to the rotation of the
Earth on itself. The set of areas selected for observation is defined by a ground
mission center, which produces so-called acquisition plans for the satellite. Each
acquisition in these plans is defined by its start and end times, by a set of instru-
ments to be used, and by instrument configurations, which correspond to specific
settings regarding instrument signal processing.
In addition to acquisition plans, the ground mission center must also pro-
vide the satellite with low-level plans specifying in more detail the operations
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, pp. 704–719, 2015.
DOI: 10.1007/978-3-319-23219-5 48
Scheduling Running Modes of Satellite Instruments 705
(b) I1 O S S H A H A H A H S H A H S O
I2 O S S H A H S H A H A H S S H A H A H S O
I3 O S S H A H H A H S H A H S O
acqs a1 a2 a3 a4 a5 a6
orbit 1 orbit 2
Fig. 1. (a) Mode automaton associated with each instrument; chgConf stands for a
change of the configuration of the instrument; (b) example of a schedule defining mode
transitions for instruments I1, I2, I3, given an acquisition plan involving 6 acquisitions
a1 to a6 over 2 orbits; transitions correspond to empty rectangles between modes; tran-
sitions between the same two modes correspond to changes in instrument configuration;
an acquisition such as a1 uses all instruments, while a4 uses only I2.
706 C. Pralet et al.
I2, but not two distinct command sequences in parallel; similarly, for instrument
monitoring reasons, it is not possible to perform a transition between off and
standby over I3 in parallel to a transition between off and standby over I1 or I2;
moreover, no transition must be performed during acquisitions to avoid distur-
bances; (3) resource constraints, imposing that the total thermal consumption
induced by the activities performed on each instrument over each orbit cannot
exceed a maximum limit. In terms of optimization criterion, the main objec-
tive is to limit the number of times instruments are switched off, for long-term
reliability issues. For a given number of times instruments are switched off, a
secondary objective is to minimize the total thermal consumption of the instru-
ments (better resource usage). In the end, the goal is to produce schedules such
as the one provided in Fig. 1b.
This mode transition scheduling activity is the last step of the complete mis-
sion programming process which may be done several times a day, depending on
the station opportunities to upload a new plan to the satellite. It is required to
be solved in less than a few seconds. Constraint Programming (CP) comes into
play because the realization of consistent mode transition schedules becomes
more and more challenging for space engineers, due to the increasing complex-
ity of satellites. One expected benefit in using CP is a better exploration of
the search space, at least better than with hard-coded decision rules. Another
advantage is that in first design phases as the one we are in, the declarative
nature of CP is more flexible in case of changes in the satellite specifications,
and it allows to easily assess the impact of new design choices.
The paper is organized as follows. We first give a formal model of the prob-
lem (Sect. 2). We then present a specific constraint-based local search encoding
(Sect. 3) and a dedicated local search procedure (Sect. 4). Finally, we describe
experiments on realistic scenarios involving hundreds of acquisitions (Sect. 5).
2 Problem Modeling
– a set of contiguous orbits O; each orbit o ∈ O has a start time TsOrbo and
an end time TeOrbo ; the planning horizon considered is [Ts, Te] with Ts
the start time of the first orbit and Te the end time of the last orbit;
– a set of instruments I; for each instrument i ∈ I and each mode m ∈ M,
DuMini,m denotes a minimum duration for i in mode m, and for each
transition of type t ∈ T , Dui,t denotes the fixed duration of transition t
for instrument i; a thermal consumption rate ThRatei,s is associated with
Scheduling Running Modes of Satellite Instruments 707
For each instrument i ∈ I, several additional data can be derived, such as the
number of acquisitions Nacqsi for which i is used. For every u ∈ [1..Nacqsi ],
Acqi,u ∈ A denotes the acquisition associated with the uth use of instrument i.
Allowed State Sequences. In order to produce plans such as the one given in
Fig. 1b, it is necessary to determine, for each instrument, the sequence of its con-
tiguous states over planning horizon [Ts, Te], as well as the exact start and end
times associated with these states. As the desired state sequences must contain
the acquisitions, the main question is actually how to handle each instrument
outside these acquisitions, that is (1) from the beginning of the planning horizon,
where instruments are switched off, to the first acquisition, (2) between two suc-
cessive acquisitions which use the same instrument configuration, (3) between
two successive acquisitions which use distinct configurations, and (4) from the
last acquisition to the end of the horizon, where instruments must all be switched
off for safety reasons. These four types of global transitions between successive
uses of instruments must be composed of state sequences that are consistent
with the automaton given in Fig. 1a.
To limit the search space, one key point is to avoid considering state sequences
such as [A,AH,H,HS,S,SH,H,HS,S,SH,H,HA,A], in which the instrument is
warmed up and cooled down (part SH,H,HS) in the middle of two acquisitions.
To do this, we define beforehand a set of allowed state sequences for each global
transition between instrument uses. The decompositions allowed are provided in
Fig. 2. It can be seen that from the beginning of the horizon to the first acqui-
sition, there are only two relevant state sequences, performing the configuration
loading operation in the standby mode and heat mode respectively. For global
transitions between acquisitions which use the same instrument configuration,
there are four relevant decompositions: one which comes back to the heat mode
between the acquisitions, one which comes back to the standby mode, and two
which come back to the off mode and differ in the place where the configuration
is loaded (the loaded configuration is lost when using the off mode). Similarly,
there are six possible decompositions for global transitions between acquisitions
which use distinct configurations. For the last global transition, there is a unique
possible decomposition.
708 C. Pralet et al.
O OS S SS S SH H H H HH H H HS S SO O
O OS S SH H HH H H HS S SH H H HH H HS S SH H
H HS S SO O OS S SS S SH H H HS S SS S SH H
H HS S SO O OS S SH H HH H H HS S SH H HH H
H HS S SO O OS S SS S SH H
H HS S SO O OS S SH H HH H
Fig. 2. Global transitions between instrument uses and their possible decompositions
To describe schedules at a finer level (lower part in Fig. 2), we introduce the
following elements:
– for each instrument i and each use u ∈ [1..Nacqsi + 1] of i, one integer deci-
sion variable decompi,u ∈ [1..Ndeci,u ] is introduced for representing the
index of the decomposition chosen for realizing global transition itvTransi,u ,
among those given in Fig. 2; parameter Ndeci,u stands for the number of
possible decompositions of itvTransi,u ;
– for each instrument i, for each use u ∈ [1..Nacqsi + 1] of i, and for each
decomposition d ∈ [1..Ndeci,u ] of itvTransi,u , one sequence of state inter-
vals Deci,u,d = [itv1 , . . . , itvk ] is introduced; the latter is determined follow-
ing the decomposition schemes provided in Fig. 2; state intervals in sequence
Deci,u,d are optional (they will be present only in case decompi,u = d).
The set of state intervals defined in the model is then Itv = {itvAcqa | a ∈
A} ∪ {itvHAi,u | i ∈ I, u ∈ [1..Nacqsi ]} ∪ {itvAHi,u | i ∈ I, u ∈ [1..Nacqsi ]} ∪
{itv ∈ Deci,u,d | i ∈ I, u ∈ [1..Nacqsi +1], d ∈ [1..Ndeci,u ]}. Each interval itv in
this set has a minimum start time Min(itv) and a maximum end time Max (itv),
both obtained from the known dates of acquisitions and from the minimum
durations of state intervals. The set of intervals in Itv which may overlap orbit
o and which concern instrument i is denoted by ItvOrb i,o .
Constraints. We now express the set of constraints holding over the integer
variables, intervals, and sequences of intervals previously introduced. These con-
straints are given in Eq. 1 to 15. Each constraint introduced is active only when
the intervals over which it holds are present. Constraint 1 expresses that all
intervals involved in sequence Seqi must be present. Constraints 2-3 express
that the start and end times of this sequence must coincide with the start and
end times of the planning horizon. Constraint 4 imposes that successive inter-
vals belonging to sequence Seqi must be contiguous (no period during which
the state of the instrument is undefined). Constraint 5 expresses that for a given
global transition, only state intervals involved in the decomposition chosen for
this transition are present. Constraints 6-7 impose that the start and end times
of the sequence of intervals associated with a decomposition must coincide with
the start and end times of the global transition from which it is derived. Con-
straint 8 specifies that successive intervals belonging to sequence Deci,u,d must
be contiguous (no period during which the state of the instrument is undefined).
Constraints 9-10 define a minimum duration for state intervals labeled by a mode
and a fixed duration for state intervals labeled by a transition. Constraints 11-
12 express that acquisition intervals must start at the required start time and
have the required duration. Constraint 13 imposes that no transition must occur
during acquisitions. Constraint 14 expresses that incompatible transitions must
not overlap. Constraint 15 imposes a maximum thermal consumption over each
orbit of the satellite for each instrument. In this constraint, the left term of the
710 C. Pralet et al.
inequality takes into account only the part of intervals which overlaps the orbit
considered.
∀i ∈ I,
∀itv ∈ Seqi , pres(itv) = 1 (1)
start(f irst(Seqi )) = Ts (2)
end (last(Seqi )) = Te (3)
∀itv ∈ Seqi | itv = last(Seqi ), end (itv) = start(next(itv, Seqi )) (4)
∀i ∈ I, ∀u ∈ [1..Nacqsi + 1], ∀d ∈ [1..Ndeci,u ],
∀itv ∈ Deci,u,d , pres(itv) = (decompi,u = d) (5)
start(f irst(Deci,u,d )) = start(itvTransi,u ) (6)
end (last(Deci,u,d )) = end (itvTransi,u ) (7)
∀itv ∈ Deci,u,d | itv = last(Deci,u,d ), end (itv ) = start(next(itv , Deci,u,d ))(8)
∀itv ∈ Itv s.t. S(itv) ∈ M, duration(itv) ≥ DuMinI(itv),S(itv) (9)
∀itv ∈ Itv s.t. S(itv) ∈ T , duration(itv) = DuI(itv),S(itv) (10)
∀a ∈ A,
start(itvAcqa ) = TsAcqa (11)
duration(itvAcqa ) = DuAcqa (12)
∀itv ∈ Itv | S(itv) ∈ T , noOverlap(itv, itvAcqa ) (13)
∀itv, itv ∈ Itv s.t. (I(itv), I(itv ), S(itv), S(itv )) ∈ Inc, noOverlap(itv, itv ) (14)
∀i ∈ I, ∀o ∈ O, pres(itv) · d(itv) · ThRatei,S(itv) ≤ ThMaxi (15)
itv∈ItvOrb i,o
The second (and less important) criterion is to minimize the total thermal
consumption over all instruments:
minimize pres(itv) · (end (itv) − start(itv)) · ThRateI(itv),S(itv) (17)
itv∈Itv
The two criteria defined are antagonistic because for instance the addition
of off periods into the plan reduces the total thermal consumption. Criteria
imposing a fair sharing between instruments could also be considered, as well as
a minimization of the number of off intervals for a particular instrument.
tasks [1]. It can be related with standard Job Shop Scheduling Problems
(JSSP [2]). In our case, there would be one job per instrument, and the (optional)
operations associated with each job would be the set of state intervals associ-
ated with each instrument. However, there are several differences with JSSP. For
instance, some operations are shared between jobs, namely the acquisition tasks
that require using several instruments simultaneously. Also, successive opera-
tions must be contiguous. Contiguity is important for ensuring that the state of
the instrument is defined at every time and for getting the right thermal con-
sumption. This consumption depends on the duration of state intervals, which
is not fixed for state intervals associated with modes.
Another significant feature of the problem is the presence of global transi-
tion tasks which can be decomposed in several possible ways. Such a hierarchical
aspect is also found in the framework of Hierarchical Task Networks (HTN [3])
developed in the planning community. In this framework, some abstract tasks
are specified and the goal is to decompose these tasks into basic sequences of
actions, through a set of available decomposition methods. In CP, the possible
decompositions of global transitions could be expressed using an alternative con-
straint [4]. In another direction, the set of allowed sequences of state intervals
could be represented using a regular constraint [5].
Last, the criteria considered are not standard criteria such as the makespan
or the tardiness. On this point, it is worth noting that some transitions should
be scheduled as early as possible to reduce the resource consumption, whereas
others should be scheduled as late as possible for the same reason (more details
on these points later in the paper).
The problem obtained could be modeled and solved using CP solvers such as
IBM ILOG CpOptimizer, which contains efficient scheduling techniques. It could
also be represented using Mixed Integer Programming [6], which would be par-
ticularly adapted to deal with linear expressions related to thermal aspects.
However, we must be able to solve in a few seconds large instances, which can
involve several hundreds of acquisitions generating several thousands or tens of
thousands candidate state intervals.
To overcome this difficulty, we use Constraint-Based Local Search (CBLS [7]),
which has the capacity to quickly produce good quality solutions for large-size
problems. As in standard constraint programming, CBLS models are defined
by decision variables, constraints, and criteria. One distinctive feature is that
in CBLS, all decision variables are assigned when searching for a solution, i.e.
the approach manipulates complete variable assignments. The search space is
712 C. Pralet et al.
then explored by performing local moves which reassign some decision variables,
and it is explored more freely than in tree search with backtracking. One speci-
ficity of CBLS models is that they manipulate so-called invariants. The latter
are one-way constraints x ← exp where x is a variable (or a set of variables)
and exp is a functional expression of other variables of the problem, such as
x ← sum(i ∈ [1..N ]) yi . During local moves, these invariants are efficiently main-
tained thanks to specific procedures that incrementally reevaluate the output of
invariants (left part) in case of changes in their inputs (right part).
For tackling the application, we use the InCELL CBLS engine [8]. The lat-
ter offers several generic building blocks, including a large catalog of CBLS
invariants together with incremental reevaluation techniques, and generic ele-
ments for defining specific local search procedures. In InCELL, a temporal
interval itv is represented by a presence variable pres(itv), a start time-point
start(itv), and an end time-point end (itv). For incrementally managing tem-
poral constraints over intervals, InCELL uses the Simple Temporal Network
invariant [9]. The latter takes as input an STN [10], which is a set of simple
temporal constraints over time-points, and it maintains as an output the tem-
poral consistency of this STN as well as, for each time-point t, two variables
earliestTime(t) and latestTime(t) giving its earliest and latest temporal position
in a consistent schedule respectively. In the following, given an interval itv, vari-
ables earliestTime(start(itv)), latestTime(start(itv)), earliestTime(end (itv)),
and latestTime(end (itv)) are denoted more succinctly as est(itv), lst(itv),
eet(itv), and let(itv).
In the local search algorithm defined, some of the local moves are performed
by updating directly the topological ordering of conflicting intervals. To obtain
an efficient approach, it is crucial to avoid considering local moves which cre-
ate precedence cycles between intervals, where for instance an interval itv1 is
Scheduling Running Modes of Satellite Instruments 713
requested to be placed both before and after another interval itv2 . For avoid-
ing this, as in Job Shop Scheduling, we exploit a mandatory precedence graph.
The latter captures all mandatory precedences over transitions and acquisitions,
including: (1) precedences between successive transition intervals involved in
the same sequence Deci,u,d (sequence associated with the dth possible decom-
position of the global transition realized before the uth use of instrument i),
and (2) precedences between the first (resp. last) transition intervals in Deci,u,d
and the acquisition that precedes (resp. follows) Deci,u,d . From this precedence
graph, when a transition interval itv must be moved just after another inter-
val itv in topological order topoOrder, all mandatory successors of itv placed
before itv in the order are also moved just after itv, to avoid the creation of a
precedence cycle.
Also, for each instrument i ∈ I and each use of this instrument u ∈
[1..Nacqsi ], we merge intervals itvHAi,u and itvAcqAcqi,u in the topological
order. Indeed, as transitions and acquisitions cannot overlap, a transition interval
itv which is in conflict with itvHAi,u either ends before itvHAi,u , or starts after
itvAcqAcqi,u , hence there is no need to dissociate itvHAi,u and itvAcqAcqi,u
in the order. For the same reason, intervals itvAHi,u and itvAcqAcqi,u are also
merged.
start(itv) and end (itv) are replaced by lst(itv) and let(itv) respectively (start
and end as late as possible). The schedule obtained with these dates may not be
feasible since it mixes earliest dates and latest dates, but the thermal consump-
tion obtained over each orbit for each instrument can be shown to be a lower
bound on the real consumption.1 The same rewriting is used for building a lower
approximation of the thermal criterion (Eq. 17).
1
Without going into further details, this result holds under the assumption that the
thermal consumption rate of the SS (resp. HH) state is equal to the thermal con-
sumption of the S (resp. H) state, which is true in practice.
Scheduling Running Modes of Satellite Instruments 715
thvi,o ← max(0, pres(itv) · d(itv) · ThRatei,S(itv) − ThMaxi ) (23)
itv∈ItvOrb i,o
Fig. 3 gives a global view of the structure of the resulting CBLS model. The
figure does not represent all individual invariants of the model.
Phase 1: First Heuristic Schedule. In the first phase, we build an initial schedule
from simple decision rules. For decomposing global transitions, we systematically
choose the option whose total minimum duration is the lowest. For choosing a
topological order between intervals, we use a dispatching rule called the best
date heuristic. In this heuristic, we compute, for each global transition and for
each of its possible decompositions dec, the optimal start time of each transition
716 C. Pralet et al.
interval itv involved in dec when non-overlapping constraints are discarded. For
intervals itv placed after the interval to enlarge in dec, this optimal start time
corresponds to the latest start time, denoted by lstAlone(itv), and for the others
it corresponds to the earliest start time, denoted by estAlone(itv). To get a
first schedule, transitions with the smallest best dates are inserted first into the
topological ordering. During this phase, all lock variables are set to 0.
Phase 2: Temporal Repair. The schedule obtained after Phase 1 may violate
temporal constraints on the realization dates of acquisitions. To repair such con-
straint violations, we consider acquisitions chronologically. When considering an
acquisition a, we try to enforce the realization date of a as long as the constraint
violation degree associated with it is not equal to 0 (Eq. 22). To do this, we build
the critical path explaining the late date obtained for a, we randomly select on
this path a critical arc itv → itv relating two intervals associated with distinct
instruments, and we try to place itv just after itv in the topological order. This
local move is accepted iff it strictly reduces the delay of acquisition a. When all
arcs in the critical path have been considered without improving the delay of a,
the algorithm returns an inconsistency, meaning that the acquisition plan is too
tight and should be revised. Otherwise, once the delay of acquisition a is equal to
0, variable locka is set to 1 before considering the next acquisition, meaning that
future moves are not allowed to delay the realization of a. After the traversal of
the acquisition plan, all acquisitions meet their due date. The same principle is
used when the last state interval ends after the end of the planning horizon.
late as possible) are inserted from the first to the last (resp. from the last to the
first); the insertion of an interval itv is made just before the first (resp. after the
last) interval itv in the topological order such that estAlone(itv) < start(itv )
(resp. lstAlone(itv) > start(itv )) and such that the insertion does not lead to
an inconsistency. Possible delays over the realization time of the acquisition con-
sidered are also repaired following the mechanism described in Phase 2. If delays
cannot be repaired, decomposition dec is rejected and we go on with the next
possible decomposition. Otherwise, dec is accepted as the new decomposition.
Phase 4: Resource Repair. After the third phase, the schedule may still be incon-
sistent from a thermal point of view. In this case, it is repaired by testing decom-
positions which add new off intervals during orbits where the thermal resource
constraint is violated. To do this, the plan is traversed chronologically, orbit by
orbit, and we work on an orbit until the thermal constraint of the CBLS model is
satisfied. For introducing off intervals, we consider first global transitions which
have the longest duration, because inserting off intervals during these global
transitions is more likely to better reduce the total thermal consumption. For
testing each decomposition, the same mechanism as in Phase 3 is used.
5 Experiments
Three approaches are compared: (1) the local search algorithm described previ-
ously, built on top of the InCELL CBLS library [8], (2) a MIP approach based on
IBM ILOG CPLEX 12.5; in the MIP model, boolean variables before(itv , itv ) are
introduced for every pair of intervals itv, itv which must not overlap; (3) a CP
approach based on IBM ILOG CpOptimizer 12.5; in the CP model, CpOptimizer
constraints such as the alternative constraint or the noOverlap constraint are
used. From the definition of the formal model (Eq. 1-17) and from the definition
of data structures for representing the instances, obtaining a first implementation
with CpOptimizer took us less than one day, obtaining a first implementation
with CPLEX took us approximately one day, and obtaining the local search
718 C. Pralet et al.
Table 1. Results obtained on an Intel i5-520 1.2GHz, 4GBRAM for 8 realistic instances,
with a max. CPU time set to 2 minutes; #orbits gives the number of orbits which
contain acquisitions; #offs stands for the number of times instruments are switched off
and conso for the total thermal consumption; ’*’ indicates that the solution is optimal
CpOptimizer CPLEX Specific CBLS
#acqs #orbits time (s) #offs conso time (s) #offs conso time (s) #offs conso
sat1 6 1 120 6 1048 0.11 6* 1046.0* 0.43 6 1074
sat2 11 2 - - - 14.01 7* 774.38* 0.61 7 785.87
sat3 37 1 - - - 1.41 8* 2922.30* 0.95 8 2933.80
sat4 42 1 - - - 55.35 13* 3395.49* 0.95 13 3416.27
sat5 47 1 - - - 3.29 8* 2895.54* 1.10 8 2903.03
sat6 82 2 - - - 120 20 6413.07 1.76 19 6569.49
sat7 129 3 - - - - - - 2.25 17 8768.01
sat8 233 10 - - - - - - 3.86 39 17270.62
approach took us approximately one day for implementing the CBLS model and
one week for specifying and testing specific local search procedures.
Experiments were performed over realistic instances provided by the French
space agency, ranging from small instances involving 6 acquisitions to large
instances involving more than 200 acquisitions (see Table 1). To give an idea
of the problem sizes, the largest instance (sat8) leads to 61515 variables and
176842 constraints in the CpOptimizer model, 103428 rows and 62434 columns
in the CPLEX model, and 831074 variables and 258224 invariants in the InCELL
CBLS model. Globally, it can first be observed that the attempt made with
CpOptimizer is not efficient. We believe that the behavior observed is due to the
fact that the sum constraint involved in the computation of the total thermal
consumption does not allow to prune earliest/latest dates of activities that much
because of its duration-dependent nature. Another point is that the domain of
temporal variables may contain millions of values. As for the MIP approach, it
performs very well on small and medium instances, for which it is able to find
optimal solutions.2 However, for the largest instances, the MIP approach does
not find any solution in less than two minutes. Last, the CBLS approach scales
well and delivers good quality solutions in a few seconds, which is compatible
with the application needs. On the largest instance (sat8), the distribution of
computation times among local search phases is as follows: CBLS model cre-
ation: 2.5s, preprocessing step: 0.69s, Phase 1: 0.4s, Phase 2: 0.02s, Phase 3:
0.20s, Phase 4: 0.03s, Phase 5: 0.02s. Moreover, there is no come back to Phase 4
after Phase 5.
6 Conclusion
This paper presents a specific CBLS approach for tackling a scheduling problem
from the space domain. This problem raises several questions for CP. Indeed,
2
Without further details, we relax the requirement of having integer dates, essentially
because an integer solution can almost often be directly extracted from the solution
found by the MIP.
Scheduling Running Modes of Satellite Instruments 719
References
1. Baptiste, P., Pape, C.L., Nuijten, W.: Constraint-based Scheduling: Applying Con-
straint Programming to Scheduling Problems. Kluwer Academic Publishers (2001)
2. Pinedo, M.: Scheduling: Theory, Algorithms, and Systems. Springer (2012)
3. Erol, K., Hendler, J., Nau, D.S.: HTN Planning: Complexity and Expressivity.
In: Proc. of the 12th National Conference on Artificial Intelligence (AAAI 1994),
pp. 1123–1128 (1994)
4. Laborie, P., Rogerie, J.: Reasoning with Conditional Time-Intervals. In: FLAIRS
Conference, pp. 555–560 (2008)
5. Pesant, G.: A Regular Language Membership Constraint for Finite Sequences of
Variables. In: Proc. of the 10th International Conference on Principles and Practice
of Constraint Programming (CP 2004), pp. 482–495 (2004)
6. Nemhauser, G., Wolsey, L.: Integer and Combinatorial Optimization. John Wiley
& Sons (1988)
7. Hentenryck, P.V., Michel, L.: Constraint-Based Local Search. The MIT Press
(2005)
8. Pralet, C., Verfaillie, G.: Dynamic Online Planning and Scheduling Using a Static
Invariant-based Evaluation Model. In: Proc. of the 23th International Conference
on Automated Planning and Scheduling (ICAPS 2013) (2013)
9. Pralet, C., Verfaillie, G.: Time-dependent Simple Temporal Networks: Properties
and Algorithms. RAIRO Operations Research (2013)
10. Dechter, R., Meiri, I., Pearl, J.: Temporal Constraint Networks. Artificial Intelli-
gence 49, 61–95 (1991)
11. Shaw, P.: Using Constraint Programming and Local Search Methods to Solve Vehi-
cle Routing Problems. In: Proc. of the 4th International Conference on Principles
and Practice of Constraint Programming (CP 1998), 417–431 (1998)
Abstracts of Papers Fast Tracked
to Constraints Journal
2
SICSP.O. Box 1263164 29KistaSwedene-mail: Mats.Carlsson@sics.se Mats.
Carlsson@sics.se
3
Insight Centre for Data AnalyticsUniversity College CorkCorkIrelande-mail:
Helmut.Simonis@insight-centre.org Helmut.Simonis@insight-centre.org
Using Finite Transducers for Describing and
Synthesising Structural Time-Series Constraints
1
A full description of this work will appear in Constraints 21(1).
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 723, 2015.
DOI: 10.1007/978-3-319-23219-5
Projection, Consistency, and George Boole
J.N. Hooker
Abstract. Although George Boole is best known for his work in sym-
bolic logic, he made a strikingly original contribution to the logic of
probabilities. He formulated the probabilistic inference problem as an
optimization problem we now call linear programming. He solved the
problem with a projection method we now call Fourier-Motzkin elimina-
tion. In a single stroke, he linked the concepts of projection, optimization,
and logical inference.
References
1. S. Chakraborty, K. S. Meel, and M. Y. Vardi. Balancing scalability and uniformity
in SAT witness generator. In Proc. of DAC, pages 1–6, 2014.
Authors names are ordered alphabetically by last name and does not indicate
contribution.
The full version appears in Constraints 21(1).
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 725, 2015.
DOI: 10.1007/978-3-319-23219-5
General Game Playing with Stochastic CSP
is the state-of-the-art GGP algorithm for stochastic games. MAC-UCB also domi-
nates FC-UCB, a variant where MAC is replaced with the Forward Checking (FC)
algorithm. Such conclusions are drawn from comparing the performance of these
algorithms, using extensive experiments (about 1, 350, 000 face-offs) over a wide
range of GDL games.
Visual Search Tree Profiling
Finding the best combination of model, solver and search strategy for solving a
given combinatorial problem is a challenging, iterative process with three classi-
cal steps: (1) observing the behaviour of the program; (2) developing a hypothesis
about why certain unwanted behaviour occurs; (3) modifying the program to test
the hypothesis by observing a change in behaviour.
Performance profiling tools are designed to support and speed up this process
in a variety of ways. For constraint programs based on tree search, the existing
profiling tools mostly focus on visualising the search tree and related informa-
tion or gathering crude aggregate measures. While these tools can provide very
useful information, they are also limited by requiring close coupling between
the profiling tool and the solver or search strategy. This makes it difficult for
the profiling tool to integrate new solvers and search strategies, or to compare
different solvers. Also, they often leave the user to explore the search tree in a
relatively unguided way, which is particularly problematic for large trees. Finally,
and most importantly, almost none of these tools support the comparison of dif-
ferent executions of the same problem, where one or more aspects of the model,
solver, or search strategy have been modified.
We present an architecture and tool set specifically designed to support pro-
grammers during the performance profiling process. In particular, the profiling
tool enables programmers to extract the information they need to build hypothe-
ses as to why the search is behaving in a particular way. Then it helps to validate
their hypotheses by identifying and visualising the effect of changes in the program
(be they changes in the model, solver, or search strategy). The former is achieved
by providing different views and analyses of the execution as well as efficient nav-
igation tools to help users focus their attention on the parts of the execution that
might be worth modifying. The latter is achieved by providing two tools: one that
can replay searches using a different model or solver, so that the user can isolate
the effect of a change; and a second tool that can visually “merge” the common
parts of two executions and allows users to explore the parts that differ.
The architecture is designed to easily accommodate new solvers and search
strategies, and it allows for solvers to be easily integrated without imposing
an unreasonable overhead on the program’s execution. The modularity of the
design supports the combination of many different visualisation and analysis
components. Our implementation is available at https://github.com/cp-profiler.
1
An extended version of this paper, with the title Fleet Design Optimisation From
Historical Data Using Constraint Programming and Large Neighbourhood Search,
will be published in Constraints 21(1).
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 729, 2015.
DOI: 10.1007/978-3-319-23219-5
Abstracts of Published Journal Track Papers
On the Reification of Global Constraints
(Abstract)
Conventional wisdom has it that many global constraints cannot be easily reified,
i.e., augmented with a 0-1 variable reflecting whether the constraint is satisfied
(value 1) or not (value 0). Reified constraints are useful for expressing proposi-
tional formulas over constraints, and for expressing that a number of constraints
hold (e.g., a cardinality operator). The negation of constraints is important for
inferring constraints from negative examples and for proving the equivalence of
models. Many early CP solvers, such as CHIP, GNU Prolog, Ilog Solver, and
SICStus Prolog, provide reification for arithmetic constraints. However, when
global constraints started to get introduced (e.g., alldifferent and cumu-
lative), reification was not available for them. It was believed that reification
could only be obtained by modifying the filtering algorithms attached to each
constraint. We present a reification method that works in all CP solvers.
A global constraint G(A) can be defined by restrictions R on its arguments A,
say on their bounds, and by a condition C on A, i.e., G(A) ≡ R(A) ∧ C(A).
We define the reified version of G(A) as R(A) ∧ (C(A) ⇔ b), where b is a 0-1
variable reflecting whether G(A) holds or not. We require the negation of G(A)
to satisfy the same restrictions R(A). It turns out that the condition C(A)
can often be reformulated as a conjunction F (A, V) ∧ N (A, V) of constraints,
where A and V are disjoint sets of variables, R(A) implies that F (A, V) is
a total-function constraint uniquely determining V from any A, and N (A, V)
is a Boolean combination of linear arithmetic (in)equalities and 0-1 variables;
we assume such Boolean combinations are already reifiable, as is the case in
all CP solvers we are aware of. The reified version of G(A) is then defined as
R(A) ∧ F (A, V) ∧ (N (A, V) ⇔ b). For example, alldifferent(v1 , . . . , vn ) is
reified by sort(v1 , . . . , vn , w1 , . . . , wn ) ∧ ((w1 < w2 ∧ · · · ∧ wn−1 < wn ) ⇔ b),
where v1 , . . . , vn uniquely determine w1 , . . . , wn in the total-function con-
straint sort(v1 , . . . , vn , w1 , . . . , wn ).
Surprisingly, this insight that many constraints can naturally be defined by
a determine and test scheme, where the determine part is associated to total-
function constraints that determine additional variables, and the test part to
a reifiable constraint on these variables, allows us to reify at least 313 of the
381 (i.e., 82%) constraints of the Global Constraint Catalogue. Most of the
constraints not covered are graph constraints involving set variables.
Beldiceanu, N., Carlsson, M., Flener, P., Pearson, J.: On the reification of global
constraints. Constraints 18(1), 1–6 (January 2013), http://dx.doi.org/10.1007/
s10601-012-9132-0, full details at http://soda.swedish-ict.se/5194
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 733, 2015.
DOI: 10.1007/978-3-319-23219-5
MDD Propagation for Sequence Constraints
This is a summary of the paper “D. Bergman, A. A. Cire, and W.-J. van Hoeve. MDD
Propagation for Sequence Constraints. JAIR, Volume 50, pages 697-722, 2014”.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 734, 2015.
DOI: 10.1007/978-3-319-23219-5
Discrete Optimization with Decision Diagrams
David Bergman1 , Andre A. Cire2 , Willem-Jan van Hoeve3 , and John Hooker3
1
School of Business, University of Connecticut
2
Department of Management, University of Toronto Scarborough
3
Tepper School of Business, Carnegie Mellon University
david.bergman@business.uconn.edu,acire@utsc.utoronto.ca,
vanhoeve@andrew.cmu.edu, jh38@andrew.cmu.edu
This is a summary of the paper “D. Bergman, A. A. Cire, W.-J. van Hoeve, and
J. Hooker. Discrete Optimization with Decision Diagrams. INFORMS Journal on
Computing, forthcoming 2015.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 735, 2015.
DOI: 10.1007/978-3-319-23219-5
A Hybrid Approach Combining Local Search
and Constraint Programming for a Large Scale
Energy Management Problem
In this work we take the perspective of a large utility company, tackling their
problems in modeling and planning production assets, i.e., a multitude of power
plants. The goal is to fulfill the respective demand of energy over a time horizon
of several years, while minimizing a total operation cost.
The proposed problem consists of modeling the production assets and finding
an optimal outage schedule that includes two mutually dependent and related
subproblems:
1. Determining the schedule of plant outages. This schedule must satisfy a cer-
tain number of constraints in order to comply with limitations on resources,
which are necessary to perform refueling and maintenance operations.
2. Determining an optimal production plan to satisfy demand. Production must
also satisfy some technical constraints.
The work presents a heuristic approach combining constraint satisfaction,
local search and a constructive optimization algorithm for a large-scale energy
management and maintenance scheduling problem. The methodology shows how
to successfully combine and orchestrate different types of algorithms and to
produce competitive results. The numerical results obtained on the close-to-
real EDF instances testify about the quality of the approach. In particular, the
method achieves 3 out of 15 possible best results.
It is possible to use different approaches, such as local search, constraint pro-
gramming or constructive procedure, to determine a feasible outage schedule.
Constraint programming with a performant solver emerged to be the most reli-
able, and probably the most elegant approach, with very good numerical results.
The set of additional, artificial, constraints are added to the model to improve
the diversity and the feasibility of the remaining production assignment problem.
Finally, the feasible solution found in this way is then improved using a series of
local improvements.
References
1. H. Gavranović, and M. Buljubaić, A Hybrid Approach Combining Local Search and
Constraint Programming for a Large Scale Energy Management Problem, RAIRO -
Operations Research, Volume 47,Issue 04,2013,pp 481-500,DOI 10.1051/ro/2013053,
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 736, 2015.
DOI: 10.1007/978-3-319-23219-5
Representing and Solving Finite-Domain
Constraint Problems using Systems of
Polynomials (Extended Abstract)
Chris Jefferson1 , Peter Jeavons2 , Martin J. Green3 , and M.R.C. van Dongen4
1
Department of Computer Science, University of St Andrews, UK
2
Department of Computer Science, University of Oxford, UK
3
Department of Computer Science, Royal Holloway, University of London, UK
4
Department of Computer Science, University College Cork, Ireland
In this paper [1] we investigate the use of a system of multivariate polynomials
to represent the restrictions imposed by a collection of constraints. A system
of polynomials is said to allow a particular combination of values for a set of
variables if the simultaneous assignment of those values to the variables makes
all of the polynomials in the system evaluate to zero.
The use of systems of polynomials has been considered a number of times
in the constraints literature, but is typically used to represent constraints on
continuous variables. Here we focus on the use of polynomials to represent finite
domain constraints. One advantage of representing such constraints using poly-
nomials is that they can then be treated in a uniform way along with continuous
constraints, allowing the development of very general constraint-solving tech-
niques. Systems of polynomials can be processed by standard computer algebra
packages such as Mathematica and REDUCE, so our approach helps to unify
constraint programming with other forms of mathematical programming.
Systems of polynomials have been widely studied, and a number of general
techniques have been developed, including algorithms that generate an equiva-
lent system with certain desirable properties, called a Gröbner Basis. Given a
Gröbner Basis, it is possible to obtain the solutions to a system of polynomials
very easily (or determine that it has no solutions). A Gröbner Basis provides
a convenient representation for the whole set of solutions which can be used to
answer a wide range of questions about them, such as the correlations between
individual variables, or the total number of solutions.
In general, the complexity of computing a Gröbner Basis for a system of
polynomials is doubly-exponential in the size of the system. However, we observe
that with the systems we use for constraints over finite domains this complexity
is only singly exponential, and so comparable with other search techniques for
constraints. Our main contributions are a family of polynomial-time algorithms,
related to the construction of Gröbner Bases, which simulate the effect of the
local-consistency algorithms used in constraint programming. Finally, we discuss
the use of adaptive consistency techniques for systems of polynomials.
References
1. C. Jefferson, P. Jeavons, M. J. Green, and M. R. C. van Dongen. Representing and
solving finite-domain constraint problems using systems of polynomials. Annals of
Mathematics and Artificial Intelligence, 67(3-4):359–382, 2013.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 737, 2015.
DOI: 10.1007/978-3-319-23219-5
A Quadratic Extended Edge-Finding Filtering
Algorithm for Cumulative Resource Constraints
Gilles Pesant
Many combinatorial problems require of their solutions that they achieve a cer-
tain balance of given features. For example in assembly line balancing the work-
load of line operators must be balanced. In rostering we usually talk of fairness
instead of balance, because of the human factor — here we want a fair distri-
bution of the workload or of certain features such as weekends off and night
shifts. In the Balanced Academic Curriculum Problem, courses are assigned to
semesters so as to balance the academic load between semesters. Because of
additional constraints (prerequisite courses, minimum and maximum number of
courses per semester) and a varying number of credits per course, reaching per-
fect balance is generally impossible. A common way of encouraging balance at
the modeling level is to set reasonable bounds on each load, tolerating a certain
deviation from the ideal value, but it has the disadvantage of putting on an
equal footing solutions with quite different balance. Another way is to minimize
some combination of the individual deviations from the ideal value, but if other
criteria to optimize are already present one must come up with suitable weights
for the different terms of the objective function. Yet another way is to bound
the sum of individual deviations.
In Constraint Programming the spread and deviation constraints have been
proposed to express balance among a set of variables by constraining their mean
and their overall deviation from the mean. Currently the only practical filtering
algorithms known for these constraints achieve bounds consistency. In [1] we
propose a more general constraint, dispersion, which includes both previous
constraints as special cases and other variants of interest. We improve filtering
by presenting an efficient domain consistency algorithm and also extend it to
count solutions so that it can be used in counting-based search, a generic and
effective family of branching heuristics that free the user from having to write
problem-specific search heuristics.
We provide empirical evidence that these can lead to significant practical
improvements in combinatorial problem solving. In particular we improve the
state of the art on the Nurse to Patient Assignment Problem and on the Balanced
Academic Curriculum Problem.
References
1. Gilles Pesant. Achieving Domain Consistency and Counting Solutions for Dispersion
Constraints. INFORMS Journal on Computing, forthcoming. (Also available as
https://www.cirrelt.ca/DocumentsTravail/CIRRELT-2015-08.pdf)
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 740, 2015.
DOI: 10.1007/978-3-319-23219-5
meSAT: Multiple Encodings of CSP to SAT
This work considers a central operational issue in the liquefied natural gas (LNG)
industry: designing schedules for the ships to deliver LNG from the production
(liquefaction) terminals to the demand (regasification) terminals. Operationally,
a delivery schedule for each customer in the LNG supply chain is negotiated on an
annual basis. The supply and demand requirements of the sellers and purchasers
are accommodated through the development of this annual delivery schedule,
which is a detailed schedule of LNG loadings, deliveries and ship movements for
the planning year. Developing and updating this schedule is a complex problem
because it combines ship routing with inventory management at the terminals.
A specific application of our work is to support supply chain design analysis
for new projects. Typically, new LNG projects require building not only the
natural gas production and treatment facilities, but also constructing the ships
and the production-side terminals, berths and storage tanks. Goel et al. (Journal
of Heuristics, 2012) first introduced an LNG inventory routing problem for this
purpose. They proposed a mixed integer programming (MIP) model as well
as a MIP-based heuristic for finding good solutions to this problem. Yet, both
the MIP model and the MIP heuristic suffered from scalability issues for larger
instances.
We propose two constraint programming (CP) models, both of which are
based on a disjunctive scheduling representation. Visits of ships to facilities
are modeled as optional activities, and distances are represented as sequence-
dependent setup times for the disjunctive resource that represents each ship’s
schedule. In addition, we model the inventory at each location as a cumulative
resource. Even if the number of (optional) activities is proportional to the num-
ber of time points, our CP models are still much smaller than the corresponding
MIP models and much more scalable. We also propose an iterative search heuris-
tic to generate good feasible solutions for these models. Computational results
on a set of large-scale test instances demonstrate that our approach can find
better solutions than existing approaches based on mixed integer programming,
while being 4 to 10 times faster on average.
This is a summary of the paper “V. Goel, M. Slusky, W.-J. van Hoeve, K. C. Fur-
man, and Y. Shao. Constraint Programming for LNG Ship Scheduling and Inventory
Management. European Journal of Operational Research 241(3): 662-673, 2015.”.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 742, 2015.
DOI: 10.1007/978-3-319-23219-5
Revisiting the Limits of MAP Inference
by MWSS on Perfect Graphs
Adrian Weller
University of Cambridge
aw665@cam.ac.uk
This is a summary of the paper “A.Weller. Revisiting the Limits of MAP Inference
by MWSS on Perfect Graphs. JMLR, Volume 38, pages 1061-1069, 2015”.
1
A block is a maximal 2-connected subgraph. A balanced block contains no frustrated
cycle. An almost balanced block may be rendered balanced by removing one node.
c Springer International Publishing Switzerland 2015
G. Pesant (Ed.): CP 2015, LNCS 9255, p. 743, 2015.
DOI: 10.1007/978-3-319-23219-5
Author Index
van Hoeve, Willem-Jan 30, 734, 735, 742 Wahbi, Mohamed 463
Vanaret, Charlie 446 Weller, Adrian 743
Vareilles, E. 508 Wetter, James 480
Vardi, Moshe Y. 725
Vismara, Philippe 541 Yeoh, William 121
Vissicchio, Stefano 592
Vrain, Christel 557 Zytnicki, Matthias 12