Title: Activities of the Combinatorial Problem Solving Group
1Activities of the Combinatorial Problem Solving
Group Nicolas BeldiceanuSICSLägerhyddsvägen
1875237 Uppsalaemail nicolas_at_sics.se
SweConsNet, May 24 2002
2Outline
- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
3- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
4Overview
- Short Term Focus
- Explicit description of constraints
- Efficient and generic filtering algorithms
- Long Term Perspective
- Synthetize filtering algorithms from the
description of constraints - How to Proceed
- Interdisciplinary interactions (Applied Math,
Algorithmic, Constraint) - Implementation (make it available in SICStus
Prolog) - Feedback from applications (configuration,
scheduling, biology,
electronic market)
5Overview
- People
- N.Beldiceanu, M.Carlsson, P.Mildner,
T.Szeredi, M.Ågren - Collaborations
- SICS Kista (M.Aronsson, E.Aurell, P.Kreuger)
- MPII Saarbrücken (S.Thiel)
- Uppsala University (Q.Guo)
6- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
7Motivations for a Classification of Global
Constraints
- Find out the basic constituents of the global
constraint, - Classify the properties of each basic
constituent, - Understand how properties interact.
8Main Idea of the Classification
Global Constraints as Graph Properties
on Structured Network of Elementary
Constraints of the Same Type
9nvalue(NVAL, VARIABLES )
- A R G U M E N T
- R E S T R I C T I O N (S)
- V E R T E X I N P U T
- V E R T E X G E N E R A T O R
- E D G E I N P U T
- E D G E G E N E R A T O R
- E D G E A R I T Y
- E D G E C O N S T R A I N T
- G R A P H P R O P E R T Y
NVAL dvar VARIABLES collection(var-dvar)
NVAL ? 0 NVAL ? VARIABLES required(VARIABLE
S.var) VARIABLES IDENTITY VARIABLES CLIQUE
2 VARIABLES.var1 VARIABLES.var2 NSCC
NVAL
nvalue(4, var-3,var-1,var-7,var-1,var-6 )
10Collections of items
VARIABLES
Vertices generator
IDENTITY
V1
V2
V3
V4
V5
Edge generator
CLIQUE
11nvalue(4, var-3,var-1,var-7,var-1,var-6 )
12A Catalog of Global Constraints
Alldifferent Alldifferent_except_0 Alldifferent_in
terval Alldifferent_modulo Alldifferent_partition
Alldifferent_same_value Among Among_interval Among
_modulo Among_seq Assign_and_count Assign_and_nval
ue Balance Balance_modulo Balance_partition Bin_pa
cking Binary_tree Cardinality_atleast Cardinality_
atmost Change Change_continuity Change_pair
Change_partition Circuit Circuit_cluster Circular_
change Coloured_cumulative Coloured_cumulatives Co
mmon Common_interval Common_modulo Common_partitio
n Connect_points Connected Count Crossing Cumulati
ve Cumulative_2d Cumulative_product Cumulatives Cy
cle Cycle_card_on_path Cycle_cover Cycle_or_access
ibility
Cycle_resource Cyclic_change Cyclic_change_joker C
yclic_cumulative Derangement Diffn Diff_2 Diff_2_c
yclic Diff_2_min_dist Disjoint Disjoint_tasks Dist
ance_change Distance_less Distribute Domain_constr
aint Element Element_greatereq Element_lesseq Elem
ent_sparse Elements Elements_alldifferent Global_c
ardinality
Golomb Graph_crossing Group Group_skip_isolated_it
em Inflexion Interval_and_count Interval_and_sum I
nverse Longest_change Map Max_index Max_n Max_nval
ue Maximum Maximum_modulo Maximum_pair Min_index M
in_n Min_nvalue Minimum Minimum_except_0 Minimum_m
odulo
Minimum_pair Nclass Nequivalence Ninterval Notalle
qual Npair Number_of_rest Nvalue Orchad Place_in_p
yramid Polyomino Relaxed_sliding_sum Same Same_int
erval Same_modulo Same_partition Sliding_card_skip
0 Sliding_sum Sliding_time_window Smooth Soft_alld
ifferent_ctr Soft_alldifferent_var
13A Catalog of Global Constraints
Stretch Stretch_circuit Stretch_path Symmetric_all
diff Temporal_path Tree Tree_resource Used_by Used
_by_interval Used_by_modulo Used_by_partition
- Old constraints which were not inside element,
... - Invented constraints disjoint, ...
- ? Catalog updated as new constraints are
presented - domain_constraint REFALO, CP2000
- stretch PESANT, CP2001
- soft alldifferent PETIT, RÉGIN, CP2001
- ? Modifications in the way of describing
constraints - possibility to have constraint (like global
cardinality, stretch) where - different limits are associated to
different values - avoid properties which cant be evaluated
in polynomial time when all - parameters of the constraint are fixed
(e.g maximum clique)
14- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
15Filtering Algorithms for Families of
Constraints
Alldifferent Alldifferent_except_0 Alldifferent_in
terval Alldifferent_modulo Alldifferent_partition
Alldifferent_same_value Among Among_interval Among
_modulo Among_seq Assign_and_count Assign_and_nval
ue Balance Balance_modulo Balance_partition Bin_pa
cking Binary_tree Cardinality_atleast Cardinality_
atmost Change Change_continuity Change_pair
Change_partition Circuit Circuit_cluster Circular_
change Coloured_cumulative Coloured_cumulatives Co
mmon Common_interval Common_modulo Common_partitio
n Connect_points Connected Count Crossing Cumulati
ve Cumulative_2d Cumulative_product Cumulatives Cy
cle Cycle_card_on_path Cycle_cover Cycle_or_access
ibility
Cycle_resource Cyclic_change Cyclic_change_joker C
yclic_cumulative Derangement Diffn Diff_2 Diff_2_c
yclic Diff_2_min_dist Disjoint Disjoint_tasks Dist
ance_change Distance_less Distribute Domain_constr
aint Element Element_greatereq Element_lesseq Elem
ent_sparse Elements Elements_alldifferent Global_c
ardinality
Golomb Graph_crossing Group Group_skip_isolated_it
em Inflexion Interval_and_count Interval_and_sum I
nverse Longest_change Map Max_index Max_n Max_nval
ue Maximum Maximum_modulo Maximum_pair Min_index M
in_n Min_nvalue Minimum Minimum_except_0 Minimum_m
odulo
Minimum_pair Nclass Nequivalence Ninterval Notalle
qual Npair Number_of_rest Nvalue Orchad Place_in_p
yramid Polyomino Relaxed_sliding_sum Same Same_int
erval Same_modulo Same_partition Sliding_card_skip
0 Sliding_sum Sliding_time_window Smooth Soft_alld
ifferent_ctr Soft_alldifferent_var
16- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
17Applications of Sweep Algorithms
Within the Geometry Literature Database, more
than 100 references
- Voronoi diagram
- Map overlay
- Nearest objects
- Triangulations
- Hidden surface removals
- Rectangles intersection
- Shortest path
sweep line
event point
y
(1)
sweep line status
(2)
(1) Move to next event point (2) Update
sweep line status
x
But not yet used within constraint programming !
18Applications of Sweep Algorithms within
Constraint Programming
Pruning for the following constraint patterns
- A conjunction of constraints with two shared
variables
- Several conjunction of constraints with one
shared variable
- The cardinality operator with two shared variables
- The non-overlapping constraint between polygons
- A multi-resource cumulatives constraint
19Examples of Forbidden and Safe Regions
Y
Y
Y
Y
X
X
X
X
X
0?X?4 0?Y?4 0?R?9
0?X?4 0?Y?4 2?Z?3
0?X?4 0?Y?4 0?T?0 1?U?2
0?X?4 0?Y?4
0?X?4 0?Y?4 1?S?6
X1?T ? T1?X ? Y1?U ? U4?Y
alldifferent(
X-YgtZ
X2Y?S
X,Y,4-Y,R)
XY?0 (mod 2)
20An Example
alldifferent(X,Y,4-Y,R)
X-YgtZ
PROBLEM Adjust minimum of X according to Y and
to the fact that 4 or 5 constraints should hold
X2Y?S
0?X?4 0?Y?4 2?Z?3 1?S?6 0?T?0
1?U?2 alldifferent(X,Y,4-Y, R) X-YgtZ X2Y?S X
1?T ? T1?X ?Y1?U ? U4?Y XY?0 (mod 2)
X1?T ? T1?X ? Y1?U ? U4?Y
XY?0 (mod 2)
Deduction Xgt1
Y
Y
Y
X0
X2
X1
21- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
22The cumulative Constraint
The original cumulative constraint Aggoun
Beldiceanu 92
Restrict the resource consumption at each point
in time.
The generalized cumulatives constraint Beldiceanu
Carlsson 01
A pool of cumulative resources , Height of a task
can be negative , Maximum or minimum resource
consumption , Holds for time-points crossed by at
least one task.
23t
t
i
D E F I N I T I O N
t
m
s
i
m
s
m
resource consumption
7
? 0
6
Machine 2
E X A M P L E
4
5
2
? 0
3
1
Machine 1
time
24- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
25Include Objective Within Constraint
26Algorithms
sum_of...(Variables, Values, Cost)
find BOUNDS for Cost
PROPAGATE from bounds of Cost to Variables
Lower bound LB domination
Remove val from var iff LBlower_regret(var,val)gt
max(Cost)
Upper bound UB matching
Remove val from var iff UB-upper_regret(var,val)lt
min(Cost)
27Algorithms (main results)
Lower bound LB domination
O(n log n m) for a tight bound (when
intervals) nnumber of variables m number of
values
O(n log n m) for computing all the exact lower
regret of all values (when intervals) nnumber of
variables m number of values
Upper bound UB matching
O(m log m c? e) for a tight bound m number of
values ccardinality of max.matching enb.of
edges in bipartite graph
O(e) for computing all the exact upper
regret enumber of edges in bipartite graph
28- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
29Engineering
? Integrate standard constraints from other
systems Global cardinality, sort, ... ? Reuse
algorithms from literature Alldifferent
Mehlhorn, Thiel, Knapsack (dynamic programming
Trick) ? Incremental algorithms Special
cases when go down, optimizations valid for
several global constraints (target, source) ?
Reingenering of the code Revisiting filtering
algorithms for inserting explanations ? Making
the system available on several platforms
30- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
31Different Aspects of Trace
? Control of Execution Posting constraints,
demons, waking constraints, entailment,
failure, choice points ? Locating Information
Situate a piece of information according to the
context it originally came ? Domain
Modification Intended pruning, domain
modification, domain ? Declarative Aspect
Explanation(s) for pruning, failing, adding a
constraint, waking a demon ? Procedural Aspect
Method used or not, nested block structure,
method dependant explanations
32- ? OVERVIEW
- ? CLASSIFICATION OF GLOBAL CONSTRAINTS
- ? GENERIC FILTERING ALGORITHMS
- ? SWEEP BASED FILTERING ALGORITHMS
- ? RESOURCES CONSTRAINT
- ? COST FILTERING ALGORITHMS
- ? ENGINEERING OF FILTERING ALGORITHMS
- ? CONSTRAINT DEBUGGING
- ? IMPLIED CONSTRAINTS
- ? SUMMARY AND CONCLUSION
33Implied Constraints (as relations between graph
properties)
QUESTION
- For a directed graph, relation between
- ? NV number of vertices,
- ? NA number of arcs,
- ? NCC number of connected components.
ANSWER
INTUITION
The maximum number of arcs is achieved by having
a complete clique in each connected components
and the minimum number of connected components.
PROPAGATION RULES
34Implied Constraints (as relations between graph
properties)
QUESTION
- For a directed graph, relation between
- ? NV number of vertices,
- ? NA number of arcs,
- ? NCC number of connected components,
- ? NSCC number of strongly connected components.
GUESS
35Summary and Conclusion
- Provide a Constraint Classification
- Generic Propagation Algorithms for several
Families of Constraints - Use Algorithms from Graph and Geometry
-
- Several Constaints Implemented within SICStus
- and Used within Demonstrators
Collaboration required with applied
mathematics, design of algorithms
36Further Sources of Information
Papers (some at http//www.sics.se/libindex.html
)
- Sweep as a Generic Pruning Technique Applied to
the Non-Overlapping Rectangles Constraint,
Beldiceanu,Carlsson 2001 . - Sweep as a Generic Pruning Technique Applied to
Constraint Relaxation, Beldiceanu,Carlsson 2001
. - Non-overlapping Constraints between Convex
Polytopes, Beldiceanu,Guo,Thiel 2001 . - A New Multi-Resource cumulatives Constraint with
Negative Heights, Beldiceanu,Carlsson 2001 . - Sweep Synchronization as a Global Propagation
Mechanism Beldiceanu,Carlsson, Thiel 2002 .
(submitted) - Cost-Filtering Algorithms for the two Sides of
the Sum of Weights of Distinct Values Constraint,
Beldiceanu,Thiel 2002 . (in preparation)
Implementation (http//www.sics.se/sicstus/)
- Alldifferent, Assignment, Case, Circuit, Count,
Cumulative, Cumulatives, Disjoint1, Disjoint2,
Element, Global_cardinality, Knapsack,
Scalar_product, Serialized, Sort, Sum,
Sum_of_weights_of_distinct_values.