sweconsnet, may 24 2002 activities of the combinatorial problem solving group nicolas beldiceanu...
TRANSCRIPT
SweConsNet, May 24 2002
Activities of the Combinatorial Problem Solving Group
Nicolas Beldiceanu
SICSLägerhyddsvägen 18
75237 Uppsala
email: [email protected]
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
Outline
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
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,
Overview
electronic market)
Overview
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)
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
Motivations 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.
Main Idea of the Classification
Global Constraints as:
Graph Properties
on Structured Network
of Elementary Constraints
of the Same Type
nvalue(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
nvalue(4, { var-3,var-1,var-7,var-1,var-6 })
: NVAL : dvar
VARIABLES: collection(var-dvar)
: NVAL 0
NVAL |VARIABLES|
required(VARIABLES.var)
: VARIABLES
: IDENTITY
: VARIABLES
: CLIQUE
: 2
: VARIABLES.var[1] = VARIABLES.var[2]
: NSCC = NVAL
Collections of items:
VARIABLES
Vertices generator:
IDENTITY
Edge generator:
CLIQUE
V1
V2
V3
V4V5
V1 V2 V3 V4 V5
V1
V2
V3
V4V5Edge constraint:
=
V1
V2
V3
V4V5
= =
=
=
=
== =
= =
=
= =
==
3
1
7
16
==
= =
==
Graph property:
NSCC=NVAL
nvalue(4, { var-3,var-1,var-7,var-1,var-6 })
A Catalog of Global Constraints
Alldifferent
Alldifferent_except_0
Alldifferent_interval
Alldifferent_modulo
Alldifferent_partition
Alldifferent_same_value
Among
Among_interval
Among_modulo
Among_seq
Assign_and_count
Assign_and_nvalue
Balance
Balance_modulo
Balance_partition
Bin_packing
Binary_tree
Cardinality_atleast
Cardinality_atmost
Change
Change_continuity
Change_pair
Change_partition
Circuit
Circuit_cluster
Circular_change
Coloured_cumulative
Coloured_cumulatives
Common
Common_interval
Common_modulo
Common_partition
Connect_points
Connected
Count
Crossing
Cumulative
Cumulative_2d
Cumulative_product
Cumulatives
Cycle
Cycle_card_on_path
Cycle_cover
Cycle_or_accessibility
Cycle_resource
Cyclic_change
Cyclic_change_joker
Cyclic_cumulative
Derangement
Diffn
Diff_2
Diff_2_cyclic
Diff_2_min_dist
Disjoint
Disjoint_tasks
Distance_change
Distance_less
Distribute
Domain_constraint
Element
Element_greatereq
Element_lesseq
Element_sparse
Elements
Elements_alldifferent
Global_cardinality
Golomb
Graph_crossing
Group
Group_skip_isolated_item
Inflexion
Interval_and_count
Interval_and_sum
Inverse
Longest_change
Map
Max_index
Max_n
Max_nvalue
Maximum
Maximum_modulo
Maximum_pair
Min_index
Min_n
Min_nvalue
Minimum
Minimum_except_0
Minimum_modulo
Minimum_pair
Nclass
Nequivalence
Ninterval
Notallequal
Npair
Number_of_rest
Nvalue
Orchad
Place_in_pyramid
Polyomino
Relaxed_sliding_sum
Same
Same_interval
Same_modulo
Same_partition
Sliding_card_skip0
Sliding_sum
Sliding_time_window
Smooth
Soft_alldifferent_ctr
Soft_alldifferent_var
A Catalog of Global Constraints
Stretch
Stretch_circuit
Stretch_path
Symmetric_alldiff
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 can’t be evaluated in polynomial time when all
parameters of the constraint are fixed (e.g maximum clique)
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
Filtering Algorithms for Families of Constraints
Alldifferent
Alldifferent_except_0
Alldifferent_interval
Alldifferent_modulo
Alldifferent_partition
Alldifferent_same_value
Among
Among_interval
Among_modulo
Among_seq
Assign_and_count
Assign_and_nvalue
Balance
Balance_modulo
Balance_partition
Bin_packing
Binary_tree
Cardinality_atleast
Cardinality_atmost
Change
Change_continuity
Change_pair
Change_partition
Circuit
Circuit_cluster
Circular_change
Coloured_cumulative
Coloured_cumulatives
Common
Common_interval
Common_modulo
Common_partition
Connect_points
Connected
Count
Crossing
Cumulative
Cumulative_2d
Cumulative_product
Cumulatives
Cycle
Cycle_card_on_path
Cycle_cover
Cycle_or_accessibility
Cycle_resource
Cyclic_change
Cyclic_change_joker
Cyclic_cumulative
Derangement
Diffn
Diff_2
Diff_2_cyclic
Diff_2_min_dist
Disjoint
Disjoint_tasks
Distance_change
Distance_less
Distribute
Domain_constraint
Element
Element_greatereq
Element_lesseq
Element_sparse
Elements
Elements_alldifferent
Global_cardinality
Golomb
Graph_crossing
Group
Group_skip_isolated_item
Inflexion
Interval_and_count
Interval_and_sum
Inverse
Longest_change
Map
Max_index
Max_n
Max_nvalue
Maximum
Maximum_modulo
Maximum_pair
Min_index
Min_n
Min_nvalue
Minimum
Minimum_except_0
Minimum_modulo
Minimum_pair
Nclass
Nequivalence
Ninterval
Notallequal
Npair
Number_of_rest
Nvalue
Orchad
Place_in_pyramid
Polyomino
Relaxed_sliding_sum
Same
Same_interval
Same_modulo
Same_partition
Sliding_card_skip0
Sliding_sum
Sliding_time_window
Smooth
Soft_alldifferent_ctr
Soft_alldifferent_var
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
Applications 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
But not yet used within constraint programming !
y
x
event point
sweep line
sweep line status
(1)
(2)
(1) Move to next event point (2) Update sweep line status
Applications of Sweep Algorithms within Constraint Programming
Pruning for the following constraint patterns:
A conjunction of constraints with two shared variables
The cardinality operator with two shared variables
The non-overlapping constraint between polygons
A multi-resource cumulatives constraint
Several conjunction of constraints with one shared variable
Examples of Forbidden and Safe Regions
0X40Y40R9
X
Y
0 1 2 3 401234
X
Y
0 1 2 3 401234
X
Y
0 1 2 3 401234
0X40Y42Z3
0X4 0Y40T0 1U2
X
Y
0 1 2 3 401234
0X4 0Y4
alldifferent(
|X-Y|>Z
X
Y
0 1 2 3 401234
0X4 0Y41S6
X+2YS
X+1T
T+1X
Y+1U
U+4Y X+Y0 (mod 2){X,Y,4-Y,R})
alldifferent({X,Y,4-Y,R})An Example
0X4 0Y4 2Z3
1S6 0T0
1U2
alldifferent({X,Y,4-Y, R})
|X-Y|>Z
X+2YS
X+1T T+1X
Y+1U U+4Y
X+Y0 (mod 2)
PROBLEM:
Adjust minimum of X
according to Y and to the
fact that 4 or 5 constraints
should hold:
|X-Y|>Z
X+2YS
X+1T T+1X Y+1U U+4Y
X+Y0 (mod 2)
Y
X=001234
Y
01234
X=2
Y
01234
X=1
Deduction:
X>1
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
The cumulative Constraint
The original cumulative constraint[Aggoun & Beldiceanu 92]:
Restrict the resource consumptionat 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.
1 2 3 4 5 6
01
2
34
12
3 4
time
resource consumption 4
time
resource consumption
1 2 3 4 5 6-2
-1
0
1
2
-1
0
1
Cumulatedprofiles
2
13
45
7
6 0
0
time
resource consumption
-2
-1
0
1
2
-1
0
1
3
5
7
6 0
0
Machine 1
Machine 2
1
2
4
For all tasks :
For all time-points crossed by task :
Let be the machine where task is assigned ,
For all tasks which both cross point , and are assigned to
:The sum of the height of tasks is not greater (less)
than the capacity of machine .
DEFINITION
1 2 3 4 5 6
t
t
t
i
m
s i m
m
EXAMPLE
s
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
Include Objective Within Constraint
12,
76
,32
,51
,1,6,1
uesstinct_valghts_of_disum_of_wei
weightval
weightval
weightval
varvarvar
Algorithms
sum_of...(Variables, Values, Cost)
FILTERING ALGORITHMS
find BOUNDSfor Cost
PROPAGATE from boundsof Cost to Variables
Lower bound LB:domination
Upper bound UB:matching
Remove val from var iff:LB+lower_regret(var,val)>max(Cost)
Remove val from var iff:UB-upper_regret(var,val)<min(Cost)
Algorithms (main results)
Lower bound LB:domination
Upper bound UB:matching
O(n log n + m)for a tight bound(when intervals)n:number of variablesm: number of values
O(n log n + m)for computing all the exact lower regret
of all values (when intervals)n:number of variablesm: number of values
O(m log m + c e)for a tight bound
m: number of values c:cardinality of max.matchinge:nb.of edges in bipartite graph
O(e)for computing all the exact upper regret
e:number of edges in bipartite graph
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
Engineering
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
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
Different 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
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
Implied Constraints (as relations between graph properties)
11toofmaxadjust2
NCCNCCNVNA
2
14412toofmaxadjust
NVNANVNCC
11 2 NCCNCCNVNA
For a directed graph, relation between: NV : number of vertices, NA : number of arcs, NCC: number of connected components.
QUESTION
ANSWER
PROPAGATION RULESThe maximum number of arcs is achieved by having a complete clique in each connected components and the minimumnumber of connected components.
INTUITION
Implied Constraints (as relations between graph properties)
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.
QUESTION
2
1111
NCCNSCCNCCNSCCNCCNVNSCCNVNCCNA
GUESS
• 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
Summary and Conclusion
Collaboration required with: applied mathematics, design of algorithms
Further 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.