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.