1 / 65

number partitioning

number partitioning. Like subset sum. Given a bag of numbers, can you partition this into 2 bags such that the sum of the integers in each bag is equal?. Recently featured in the Crystal Maze! (Thanks Zoe!). Try it!. 4 5 3 2 1 8 7 3 5 9. Try that!. Try that?. Try that?.

Download Presentation

number partitioning

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. number partitioning

  2. Like subset sum

  3. Given a bag of numbers, can you partition this into 2 bags such that the sum of the integers in each bag is equal? Recently featured in the Crystal Maze! (Thanks Zoe!)

  4. Try it!

  5. 4 5 3 2 1 8 7 3 5 9 Try that!

  6. Try that?

  7. Try that?

  8. Can you think of a 1st test to carry out to determine if there is no partition?

  9. Given a bag of numbers, can you partition this into 2 bags such that the sum of the integers in each bag is equal? Garey & Johnson “Computers and Intractability” [SP12] PARTITION INSTANCE: Finite set A and a size s(a)  Z+ for each a  A QUESTION: Is there a subset A’  A such that aA’ s(a)  aA-A’ s(a)

  10. How complex?

  11. Who cares? Imagine you have 2 machines on the shop floor You have n activities, of varying durations Place the activities on the machines to minimise makespan

  12. Why just 2-partition? Why not m-way partitioning? Is there an optimisation problem?

  13. A number of constraint encodings

  14. 1st stab variables constraints • Questions: • What are the “decision variables” • Can we be more efficient • generate more propagation • Bound or enumerated variables • Is there a better model? • What if it is insoluble?

  15. How can I make an IntegerVariable with a domain that is a set of values, rather than a range? If I had L[i]  {0,w[i]} and R[i]  {0,w[i]} could I throw away D[i] and have R[i] ≠ L[i]? Laura?

  16. Look! No D!

  17. Questions, questions, questions Decision variables … does it matter? Heuristics? Value ordering … does it matter Bound versus enumerated variables … anyone? Symmetries Propagation: what will it do? Will it have an effect? Size of state space? How big is the model? How will search progress?

  18. Symmetry If we are using a static variable ordering heuristic and If we are using the 0/1 decision variables D[i] Does it make any difference if we have D[0] = 0 or D[0] = 1 That is, can we half the search space?

  19. 1st stab Why use CP for numPart? Can we think of any “side constraints”? Actually, an important question: justify use of CP

  20. A 2nd stab We want to minimise the difference between the sum of the numbers on the left and the sum of the numbers on the right Right!?

  21. A 2nd stab An optimisation problem Minimise the difference between left and right

  22. Minimize imbalance

  23. How do we optimise in CP? A sequence of decision problems Branch and bound

  24. Demo of Optimize

  25. Why is Optimize so slow?

  26. When can this propagate?

  27. Can we limit the search effort?

  28. 3d stab

  29. 3d stab Optimize is a wee bit “clunky” Can we do better? Put ½ the numbers on one side

  30. 1st stab variables constraints

  31. Maximize the sum of Weights on the right As close to tot/2

  32. Demo of OptimizeV2

  33. Why was version 2 faster?

  34. Could we Optimize without the decision variable D? I suppose so … could explore this Replace scalar with sum

More Related