Global Constraints (continued) Nicolas Beldiceanu SICS Lägerhyddsvägen 5 SE-75237 Uppsala, Sweden (nicolas@sics.se)
Describe other global constraints Except resource scheduling, routing, geometric, regulation and optimisation constraints (see in next courses). But first, go into more detail on how to describe global constraints.
V 2 Principle of description V 1 V 3 Edge constraint: V 5 V 4 = = V 2 = = = V 1 V 3 = = = = = = = = Graph property: = = V 5 V 4 = NSCC= NVAL = 1 = 3 7 = = = = 6 1 nvalue( 4 , { var - 3 , var - 1 , var - 7 , var - 1 , var - 6 })
Arc generators 1 3 1 2 3 4 1 2 3 4 1 2 3 4 2 4 SELF PATH_1 CYCLE PRODUCT 1 3 1 2 1 2 3 1 2 3 4 2 4 3 4 LOOP PATH_N CLIQUE PRODUCT(=) 1 2 1 3 1 2 3 4 1 2 3 4 3 4 2 4 PATH CIRCUIT SYMMETRIC_PRODUCT CLIQUE( ≠ ≠ ) ≠ ≠ 1 3 1 2 1 2 3 4 1 2 3 4 2 4 3 4 PATH CHAIN CLIQUE(<) SYMMETRIC_PRODUCT(=)
V 2 Derived collections More details V 1 V 3 Edge constraint: V 5 V 4 More than one graph = = V 2 = = = Set variables V 1 V 3 = = = = = = = = Graph property: = = V 5 V 4 = NSCC= NVAL = 1 = 3 7 = = = Constraints on = 6 1 subsets of vertices nvalue( 4 , { var - 3 , var - 1 , var - 7 , var - 1 , var - 6 })
Motivations for Set Variables (finite set of integers) 1) Exists since a long time (both in academy and in industrial solvers) 2) Has a discrete nature (as standard domain variables) 3) Expressive (avoid models with artificial variables) 4) Recently some suggestions of global constraints with set variables 5) Within linear programming and constraint programming a typical constraint is: for a given graph selects a subset of arcs so that a given graph property holds
Inserting Set Variables Has to introduce: 1) A new basic data type: finite set of integers 2) Set variables 3) Elementary constraints over set variables
Typical Arc Constraint index 1 : int index 1 : 1 var 1 : svar var 1 : {2,3,5} 2 ∈ var 1 3 ∈ var 1 4 ∈ var 1 index 2 ∈ var 1 index 2 : int index 2 : 2 index 3 : 3 index 4 : 4 var 2 : svar var 2 : {} var 3 : {} var 4 : {}
Typical Arc Constraint index 1 : int index 1 : 1 var 1 : svar var 1 : {2,3,5} 2 ∈ var 1 3 ∈ var 1 4 ∈ var 1 index 2 ∈ var 1 index 2 : int index 2 : 2 index 3 : 3 index 4 : 4 var 2 : svar var 2 : {} var 3 : {} var 4 : {}
Example of Global Constraint with Set Variables Given a directed graph select a subset of vertices so that the corresponding sub-graph does not contain any circuit. (F.Fages)
Example of Global Constraint with Set Variables S ymbolic C onstraints in I ntegeger L inear P rogramming [E.Althaus,A.Bockmayr,M.Elf,M.Jünger,T.Kasper,K.Mehlhorn] http://www.mpi-sb.mpg.de/SCIL/ StronglyConnected ” This symbolic constraints takes as arguments a directed graph G and a var_map<edge> X. X has to map every edge of the graph to a binary variable. The feasible assignments of the symbolic constraint are those where the vector of the variables associated with the edges of the graph is an incidence vector of a strongly connected subgraph of G. ”
Constraints Over Several Final Graphs Want to check graph properties on several final graphs PROBLEM EXAMPLES • global cardinality [ RÉGIN ]: impose restriction on number of occurrences of a value (depend on the value). • stretch [ PESANT ]: impose minimum and maximum time that a value can occur in a consecutive way (depend on the value) SOLUTION Introduce an iterator over the items of a collection for specifying in a generic way a set of: • elementary constraints which are pairwise incompatible (before CTR & ¬ CTR) • graph properties.
Constraints Over Set of Vertices Want to express constraints on set of variables which are CONTEXT not yet defined. EXAMPLES • impose a constraint on all the objects which are assigned to the same bin. • impose a constraint on each set of 3 consecutives locations which are visited by a vehicle. SOLUTION Allows to impose constraints on set of vertices of the final graph: • provide generators for set of vertices, • restrictions: − polynomial number of sets (pred, succ, ...), − computing each set can be done in polynomial time.
Avoid Clique ( MAX ) as a set generator • ARGUMENT : TASKS: collection(origin-dvar,duration-dvar end-dvar, high-dvar) LIMIT: int • RESTRICTION(S) : at least 2 out of [TASKS.origin,TASKS.duration,TASKS.end] required(TASKS.high) TASKS.duration ≥ 0 TASKS.high ≥ 0 LIMIT ≥ 0 • VERTEX INPUT : TASKS Generates all maximum cliques on • VERTEX GENERATOR : IDENTITY the final graph: in general can’t be • EDGE INPUT : TASKS computed in polynomial time !!! • EDGE GENERATOR : CLIQUE • EDGE ARITY : 2 • EDGE CONSTRAINT : TASKS.origin[1]+TASKS.duration[1]=TASKS.end[1] ∧ TASKS.origin[2]+TASKS.duration[2]=TASKS.end[2] ∧ TASKS.origin[1]<TASKS.end[2] ∧ TASKS.origin[2]<TASKS.end[1] • GRAPH PROPERTIE : NVERTEX = |TASKS| • SETS : CLIQUE(MAX) • DYNAMIC CONSTRAINT : Sum(TASKS.high) ≤ LIMIT
Example of Use of Clique ( MAX ) cumulative({ origin-1 duration-3 end-4 high-1, origin-2 duration-9 end-11 high-2, origin-3 duration-10 end-13 high-1, origin-6 duration-6 end-12 high-1, origin-7 duration-2 end-9 high-3 }, 8) ≤ 8 ≤ ≤ ≤ 3 5 1 2 4 1 2 3 4 5 6 7 8 9 101112
Constraints Mentioning Clique ( MAX ) • assign_and_count • assign_and_nvalue • interval_and_sum • interval_and_count • track • bin_packing • cumulative • cumulatives • cumulative_product OBSERVATION : all final graphs • coloured_cumulative associated to these constraints • cyclic_cumulative are interval graphs , so we use one other model which avoids • coloured_cumulatives Clique (MAX). • cumulative_2d
Intuition of the New Model : Time points, Tasks • ARC INPUT : product • ARC GENERATOR : 2 • ARC ARITY : overlap • ARC CONSTRAINT p 1 {t 1 , t 2 } : succ • SETS p 2 t 1 {t 2 , t 3 } p 3 t 2 p 4 t 3 p 5 {t 3 } p 6 Tasks Time points Is overlapped by
Which Time Points ? The task origins and ends: 1 2 3 4 5 6 7 8 9 10 11 12 � � � � � � � � � � But the time points are not explicitly mentioned in the constraint?
Derived Collections An optional extra field for describing a global constraint. Purpose : generates collections from the parameters of the constraint. Motivation: allows to simplify parameters of a constraint. FROM element(INDEX,TABLE,VALUE) INDEX : dvar TABLE: collection(index-dvar,value-dvar) VALUE: dvar TO element(ITEM,TABLE) ITEM : collection(index-dvar,value-dvar) Generates a collection TABLE: collection(index-int ,value-int ) containing one single item FIELD COLLECTION NAME OF GENERATED PARAMETERS FOR THE NAME GENERATOR COLLECTION COLLECTION GENERATOR DERIVED COLLECTION: SIMPLE ITEM: (index-INDEX, value-VALUE)
Derived Collection for cumulatives CONSTRAINT: cumulatives(TASKS,MACHINES,CTR) ARGUMENTS: TASKS : collection(machine-dvar,origin-dvar,duration-dvar,end-dvar,height-dvar) MACHINES: collection(id-int,capacity-int) CTR : atom .......................................................................................... Generates a collection by applying an item generator to each item of the TASKS collection NAME OF FIELD COLLECTION PARAMETERS FOR THE GENERATED NAME GENERATOR COLLECTION GENERATOR COLLECTION DERIVED COLLECTION: EXPAND( TASKS ) TIME_POINTS: (duration-1, origin-origin, end-origin+1) (duration-1, origin-end , end-end+1 )
Categories of Global Constraints • DATA CONSTRAINTS • VALUE CONSTRAINTS (one set of variables) • VALUE CONSTRAINTS (two sets of variables) • ORDERING CONSTRAINTS • CHANNELING CONSTRAINTS • GRAPH CONSTRAINTS • RELAXATION AND PROXIMITY CONSTRAINTS
����������������
Element ORIGIN : [VanHentenryckCarillon88] ARGUMENTS : ctr_arguments(element, [INDEX-dvar, TABLE-collection(value-dvar), VALUE-dvar]). PURPOSE : VALUE is equal to the INDEX-th item of TABLE. EXAMPLE : element(3, [[value-6],[value-9],[value-2],[value-9]], 2)
Element ctr_graph( element , ITEM [ITEM,TABLE], 2, [ PRODUCT >>collection(item,table)], [item.index = table.key, item.value = table.value], [ NARC = 1]). TABLE PRODUCT 1:index 2:key INITIAL GRAPH value value item.index = table.key item.value = table.value ARC CONSTRAINT
Element ITEM TABLE PRODUCT INITIAL GRAPH NARC = 1 FINAL GRAPH element(3, [[value-6],[value-9],[value-2],[value-9]], 2)
����������������� ����������������������
Symmetric_alldifferent ORIGIN : [Régin99] ARGUMENTS : ctr_arguments(symmetric_alldifferent, [NODES-collection(index-int, succ-dvar)]). PURPOSE : All variables associated to the succ attribute of the NODES collection should be pairwise distinct. In addition enforce the following condition: If variable NODES[i].succ takes value j then variable NODES[j].succ takes value i. EXAMPLE : symmetric_alldifferent([[index-1, succ-3], [index-2, succ-4], [index-3, succ-1], [index-4, succ-2]])
Recommend
More recommend