500 likes | 661 Views
The Sum of Weights of Distinct Values Constraint Nicolas Beldiceanu S I C S Lägerhyddsvägen 18 75237 Uppsala nicolas@sics.se. Work done in collaboration with:. Sven Thiel ( MPI für Informatik, Saarbrücken, Germany ) Mats Carlsson ( SICS , Uppsala, Sweden ).
E N D
The Sum of Weights of Distinct Values ConstraintNicolas BeldiceanuSICSLägerhyddsvägen 1875237 Uppsalanicolas@sics.se
Work done in collaboration with: • Sven Thiel (MPI für Informatik, Saarbrücken, Germany) • Mats Carlsson (SICS, Uppsala, Sweden) You can get the corresponding report T2002-14 at: http://www.sics.se/libindex.html
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION Outline of the Presentation
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
Parameters Decision variables Weights of values Cost variable
Origin of the Constraint A Hungarian puzzle inspirates this constraint PROBLEM 1 Given the number of distinct types of ships in each line and each column find their emplacements. 1 1 2 1 3 1 2 0 1 1 2
1 1 1 2 1 3 1 2 0 1 1 2 Origin of the Constraint A SOLUTION
Origin of the Constraint A (PARTIAL) MODEL 1 0 0 0 0 1 1 1 0 3 0 0 0 0 swdv(Vars_of_a_row, [0-0, 1-1, 2-1, 3-1], Nber_dist_val_in_row) 1 0 3 0 0 0 0 2 0 3 0 2 0 3 1 0 0 0 0 0 3 3 1 1 0 2 0 3 1 2 0 1 1 2
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
Relaxation of alldifferent ?- alldifferent([1..2, 0..5, 1..3, 2..3, 1..6, 1..3]) no
Relaxation of alldifferent ?- alldifferent([1..2, 0..5, 1..3, 2..3, 1..6, 1..3]) no 4variables with only3values !
Relaxation of alldifferent ?- alldifferent([1..2, 0..5, 1..3, 2..3, 1..6, 1..3]) no Want to control the number of used distinct values!
Relaxation of alldifferent ?- alldifferent([1..2, 0..5, 1..3, 2..3, 1..6, 1..3]) no ?-swdv([1..2, 0..5, 1..3, 2..3, 1..6, 1..3], [0-1, 1-1, 2-1, 3-1, 4-1, 5-1, 6-1], 5..6) maybe weight of values number of distinct values used
Relaxation of alldifferent ?-swdv([1..2, 0..5, 1..3, 2..3, 1..6, 1..3], [0-1, 1-1, 2-1, 3-1, 4-1, 5-1, 6-1], 5..6) PROPAGATEso that use at least5 distinct values swdv([1..2, 4..5, 1..3, 2..3, 4..6, 1..3], [0-1, 1-1, 2-1, 3-1, 4-1, 5-1, 6-1], 5..5) maybe
Domination Problems QUESTION Find minimum number of queens such that each cell is attacked by at least one queen.
Domination Problems QUESTION Find minimum number of queens such that each cell is attacked by at least one queen. SOLUTION CERTIFICATE
Domination Problems QUESTION How to model the problem with one single swdv constraint ?
9 10 11 12 13 14 15 16 17 25 41 33 57 49 50 42 18 58 26 34 59 27 43 35 19 51 44 20 52 28 60 36 53 37 21 29 45 61 46 54 30 62 38 22 39 63 31 23 47 55 40 64 24 56 32 48 1 2 3 4 5 6 7 8 Domination Problems QUESTION How to model the problem with one single swdv constraint ? ANSWER: Label the cells from 1 to 64
9 10 11 12 13 14 15 16 49 57 25 41 33 17 58 50 18 34 42 26 19 59 35 51 43 27 44 60 28 20 52 36 45 37 61 29 53 21 46 54 30 22 62 38 39 55 31 23 47 63 24 32 64 40 48 56 Domination Problems QUESTION How to model the problem with one single swdv constraint ? ANSWER: Label the cells from 1 to 64 Create a variable for each cell C (its domain are those numbers of the cells which can be attacked from C) V29 :: [2,5,8,11,13,15,20..22,25..32, 36..38,43,45,47,50,53,56,57,61] 1 2 3 4 5 6 7 8
ANSWER: Label the cells from 1 to 64 Create a variable for each cell C (its domain are those numbers of the cells which can be attacked from C) Set one swdv constraint 9 10 11 12 13 14 15 16 57 33 41 49 17 25 58 18 34 50 42 26 59 51 19 27 35 43 36 44 52 20 60 28 21 37 29 61 45 53 38 54 62 30 22 46 39 31 47 55 23 63 32 48 40 24 64 56 1 2 3 4 5 6 7 8 swdv([V1,...,V64], [1-1,...,64-1], NDV) Domination Problems QUESTION How to model the problem with one single swdv constraint ?
Domination Problems QUESTION How to model the problem with one single swdv constraint ? ANSWER: Label the cells from 1 to 64 Create a variable for each cell C (its domain are those numbers of the cells which can be attacked from C) Set one swdv constraint 29 23 35 46 29 35 23 46 35 29 35 12 29 46 46 29 46 46 35 29 35 29 29 46 35 35 35 29 29 29 35 35 29 29 29 29 29 29 29 29 23 35 23 35 29 29 29 23 12 12 46 29 29 35 29 23 46 29 35 12 29 46 35 29 swdv([46,29,35,12,29,46,35,29,...,46], [1-1,...,64-1], 5)
C1 1 C2 closed facility C3 2 C4 3 C5 customers warehouses Cost Modelling Modeling the cost for problems where: using a resourceonce or several times costs the same (for instance cost for opening facilities in the warehouse location problem) CostW=CostW1+CostW3
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
The Three Sides of the swdv Constraint min(Cost) swdv(Vars, Vals, Cost) min(Cost)..max(Cost) max(Cost)
FILTERING ALGORITHMS The Different Algorithms swdv(Variables, Values, Cost) find BOUNDS for Cost PROPAGATE from bounds of Costto Variables Lower bound LB: domination Remove val from var iff: LB+lower_regret(var,val)>max(Cost) Upper bound UB: matching Remove val from var iff: UB-upper_regret(var,val)<min(Cost) Propagate from min(Cost) and max(Cost)
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
FILTERING ALGORITHMS Focus on Lower Bound swdv(Variables, Values, Cost) find BOUNDS for Cost PROPAGATE from bounds of Costto Variables Lower bound LB: domination Remove val from var iff: LB+lower_regret(var,val)>max(Cost) Upper bound UB: matching Remove val from var iff: UB-upper_regret(var,val)<min(Cost) Propagate from min(Cost) and max(Cost)
Evaluating a Lower Bound of Cost MAIN RESULT An O(n·logn+m) algorithm which gives a tight bound when all domain consists of only one interval of consecutive values, where: n m is the number of variables, is the number of values.
Evaluating a Lower Bound of Cost IDEA 1: select a subset of variables Var of V1,V2,…,Vnsuch that If the domain of every variable is an interval, then any set of values covering all variables of Var allows also to cover all variables of V1,V2,…,Vn.
IDEA 2: If dom(Vi) is included in or equal to dom(Vj) then the sum of the weights of the distinct values does not change if Vj is not considered Evaluating a Lower Bound of Cost
Evaluating a Lower Bound of Cost IDEA 3: Assume that, for each possible value of , we know a tight lower bound for covering all variables according to the hypothesis that we use value . Let be a variable such that : If then , If then .
Evaluating a Lower Bound of Cost STEP 1: compute a relevant subset of variables such that can use IDEA3: STEP 2: compute a lower bound for that subset
Computing a Relevant Subset of Variables (1) sorting the variables on their minimum (2) making a first selection of variables (3) restricting the previous selection
4 10 9 8 5 1 7 1 10 5 9 6 6 10 3 12 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 V1V2V3V4V5V6V7V8V9VaVbVcVdVe (1) Sorting the Variables on their Minimum
4 10 9 8 5 1 7 1 10 5 9 6 6 10 3 12 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 V1V2V3V4V5V6V7V8V9VaVbVcVdVe V1V2V3V4V5V6V7V8V9VaVbVcVdVe (2) Making a First Selection of Variables IDEA 2
(3) Restricting the Previous Selection 4 10 9 8 5 1 7 1 10 5 9 6 6 10 3 12 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 V1V2V3V4V5V6V7V8V9VaVbVcVdVe IDEA 2 V1V2V3V4V5V6V7V8V9VaVbVcVdVe V1V2V3V4V5V6V7V8V9VaVbVcVdVe
(3) Restricting the Previous Selection 4 10 9 8 5 1 7 1 10 5 9 6 6 10 3 12 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 V1V2V3V4V5V6V7V8V9VaVbVcVdVe IDEA 2 V1V2V3V4V5V6V7V8V9VaVbVcVdVe V1V2V3V4V5V6V7V8V9VaVbVcVdVe
(3) Restricting the Previous Selection 4 10 9 8 5 1 7 1 10 5 9 6 6 10 3 12 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 V1V2V3V4V5V6V7V8V9VaVbVcVdVe IDEA 2 V1V2V3V4V5V6V7V8V9VaVbVcVdVe V1V2V3V4V5V6V7V8V9VaVbVcVdVe
(3) Restricting the Previous Selection 4 10 9 8 5 1 7 1 10 5 9 6 6 10 3 12 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 By construction the minimum values, maximum values, of the selected variables are sorted in increasing order. So that the following holds: V1V2V3V4V5V6V7V8V9VaVbVcVdVe V1V2V3V4V5V6V7V8V9VaVbVcVdVe V1V2V3V4V5V6V7V8V9VaVbVcVdVe
Evaluating a Lower Bound of Cost (milestone) STEP 1: compute a relevant subset of variables STEP 2: compute a lower bound for that subset (done) (to do next)
If then , If then . Computing a Lower Bound for the Selected Variables Use formula of idea 3: DIFFICULTY: efficient evaluation of Relaxed to:
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
Computing an Tight Upper Bound Based on bipartite matching in the variable-value graph.
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
val1 val2 ... valm A1 A2 ... An regreti j Incremental Algorithms for Cost Filtering: Context Lower bound for Cost: lb Regret matrix: Ai= valjCost lb+regretij CTR1({A1,A2,...,An }, Cost ) Polynomial algorithm for checking a neccessary condition: check_CTR2({A1,A2,...,An }): (maybe,no) CTR2({A1,A2,...,An }) (graph property) How to get a better evaluation of min(Cost) according to CTR2 ?
val1 val2 ... valm A1 A2 ... An Incremental Algorithms for Cost Filtering: Method Search smallest regret such that check_CTR2({A1,A2,...,An }) returns maybe. regretij treshold Ai valj when lb+regretij max(Cost) Bisection search of the smallest regret using check_CTR2({A1,A2,...,An }) Avoid shaving!
1 2 3 4 A1 A2 A3 A4 A1 :: 2 A2 :: 1,3 A3 :: 1,4 A4 :: 3 0 9 0 9 9 2 9 9 3 1 9 9 4 9 9 0 9 1 2 2 1 3 4 3 4 0 Assignment variables Regret matrix Initial graph 0 Incremental Algorithms for Cost Filtering 1 2 2 1 3 4 3 4 0 Assume check_CTR2({A1,A2,...,An }) checks if no more than one strongly connected component in the following graph: 0 1 2 2 1 3 4 3 4 0 0 1 2 2 1 3 4 3 4 0 0 1 2 2 1 3 4 3 4 0 Efficient algorithm ?
DEFINITIONOFTHEsum_of_weights_of_distinct_values CONSTRAINT WHAT CANIT MODELIN PRACTICE? THE DIFFERENT SIDESOFTHE CONSTRAINT FILTERING ALGORITHMOFTHE DOMINATION SIDE FILTERING ALGORITHMOFTHE BIPARTITE MATHCHING SIDE FILTERING ALGORITHM ASSOCIATEDTO BOTH SIDES OTHER AREASOF APPLICATION THE PREVIOUS ALGORITHMS CONCLUSION
Conclusion MAIN RESULTS (1) Model important problems with one constraint. (2) New filtering algorithms with good complexity. Enhance algorithms for the domination side Colored scheduling PERSPECTIVES (1) (2)