Number partitioning.

Slides:



Advertisements
Similar presentations
1D Bin Packing (or “CP? Who cares?”)
Advertisements

An empirical study of the stable marriage problem with ties and incomplete lists (SMTI) Ian Gent & Patrick Prosser.
Lecture 6: Job Shop Scheduling Introduction
Coverage by Directional Sensors Jing Ai and Alhussein A. Abouzeid Dept. of Electrical, Computer and Systems Engineering Rensselaer Polytechnic Institute.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
CPM!. Just do it! JChoco We jumped in, and took it for a spin Some counting problems Meeting scheduling problem … you got your hands dirty.
1 Pseudo-polynomial time algorithm (The concept and the terminology are important) Partition Problem: Input: Finite set A=(a 1, a 2, …, a n } and a size.
Constraint Satisfaction Problems
Ch 13 – Backtracking + Branch-and-Bound
© J. Christopher Beck Lecture 11: Constraint Programming 1.
ICS 273A Intro Machine Learning
10/31/02CSE Greedy Algorithms CSE Algorithms Greedy Algorithms.
10/31/02CSE Greedy Algorithms CSE Algorithms Greedy Algorithms.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic Range Allocation.
Daniel Kroening and Ofer Strichman 1 Decision Proceduresfoe Equality Logic 4 Range Allocation.
Introduction to Job Shop Scheduling Problem Qianjun Xu Oct. 30, 2001.
Jobshop scheduling. We have a set of resources a set of jobs a job is a sequence of operations/activities sequence the activities on the resources.
© J. Christopher Beck Lecture 13: Modeling in Constraint Programming.
Magic square An example of how to represent a problem An idea from Chris Beck.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
1 Short Term Scheduling. 2  Planning horizon is short  Multiple unique jobs (tasks) with varying processing times and due dates  Multiple unique jobs.
Solving Problems by searching Well defined problems A probem is well defined if it is easy to automatically asses the validity (utility) of any proposed.
Chapter 5 Constraint Satisfaction Problems
Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers.
Sequences & Series. Sequence: A function whose domain is a set of consecutive integers. The domain gives the relative position of each term of the sequence:
27-Jan-16 Analysis of Algorithms. 2 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based.
5-1 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Integer Programming Chapter 5.
Greedy Algorithms Analysis of Algorithms.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
Car Sequencing Problem Assessed exercise 2 15% 26/11/2010.
Heuristics with Mad queens and example from jssp.
Roman Barták (Charles University in Prague, Czech Republic) ACAT 2010.
An Introduction to Constraint Programming in JChoco.
Discrete Optimization
Jobshop scheduling.
CPS Brief introduction to linear and mixed integer programming
Finite state machine optimization
Finite state machine optimization
Approximation Algorithms
Algorithm Design Methods
Backtracking And Branch And Bound
Lecture 11: Tree Search © J. Christopher Beck 2008.
EMGT 6412/MATH 6665 Mathematical Programming Spring 2016
Design and Analysis of Algorithm
CIS 700 Advanced Machine Learning for NLP Inference Applications
Introduction to Operations Research
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Exam 2 LZW not on syllabus. 73% / 75%.
MURI Kickoff Meeting Randolph L. Moses November, 2008
Richard Anderson Lecture 28 Coping with NP-Completeness
Linear Programming Duality, Reductions, and Bipartite Matching
Planning and Scheduling in Manufacturing and Services
CPS 173 Computational problems, algorithms, runtime, hardness
Analysis of Algorithms
Pruning 24-Feb-19.
Algorithm Design Methods
Topic 15 Job Shop Scheduling.
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
An example of how to represent a problem
Algorithm Design Methods
Analysis of Algorithms
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSIT 301 (Blum)
Flexible Assembly Systems
Our old list of problems
Chapter 1. Formulations.
Heuristic Search Viewed as path Finding in a Graph
Analysis of Algorithms
Algorithm Design Methods
Integer Programming Chapter 5.
Presentation transcript:

number partitioning

Like subset sum

Recently featured in the Crystal Maze! 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?

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

Garey & Johnson “Computers and Intractability” 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)

How complex?

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

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

A number of constraint encodings

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?

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?

Look! No D!

Value ordering … does it matter 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?

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?

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

We want to minimise the difference between the sum 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!?

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

Minimize imbalance

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

Demo of Optimize

Why is Optimize so slow?

When can this propagate?

Can we limit the search effort?

3d stab

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

1st stab variables constraints

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

Demo of OptimizeV2

Why was version 2 faster?

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

So?

Three stabs! A fair bit to consider Has this all been easy? Is there a better way to do numPart?