You are on page 1of 38

Partition Problem

&
Hitting Set Problem

Maria Allauddin
(1101)
Outline
• What is Partition Problem?
• What work has been done on this problem?
• Algorithms and their operation
•Applications And Examples

•What is Hitting Set Problem?


• What work has been done on this problem?
• Algorithms and their operation
•Applications And Examples
Partition problem
• What is the problem?
• The problem is to decide whether a given
set of integers can be partitioned into two
"halves" that have the same sum.
• S is a set of integers,
• Partition S into two subsets S1 and S2
• Such that S1+S2 Have equal sum
Example of Problem
• S={2, 10 ,3, 8, 5, 7, 9, 5, 3, 2 }
• S1={2, 5, 3, 10, 7}
• S2={2, 5, 3, 9, 8}
• Both subsets sum to 27.
Partition Problem Variations
• Subset Sum problem is special case of
partition problem
– Given a set S of integers, is there a subset S1
of S that sums to exactly t.
• A variation of the partition problem is the
3-partition problem,
– The set S must be partitioned into |S|/3 triples
each with the same sum.
What work has been done on this
problem?
• Graham’s Greedy Algorithm, "The Easiest Hard Problem", American Scientist,
http://www.americanscientist.org/issues/pub/2002/3/the-easiest-hard-problem 
• Karmarkar, Narenda; Karp, Richard M (1982), "The Differencing Method of Set Partitioning",
Technical Report UCB/CSD 82/113 (University of California at Berkeley: Computer Science
Division (EECS)) 
• Mertens, Stephan (November 1998), "Phase Transition in the Number Partitioning Problem",
Physical Review Letters 81 (20): 4281, doi:10.1103/PhysRevLett.81.4281,
http://link.aps.org/abstract/PRL/v81/p4281, retrieved 2009-10-03 
• Mertens, Stephan (2001), "A physicist's approach to number partitioning", Theoretical Computer
Science 265: 79–108, doi:10.1016/S0304-3975(01)00153-0 
• Mertens, Stephan (2006), "The Easiest Hard Problem: Number Partitioning", in Allon Percus;
Gabriel Istrate; Cristopher Moore, Computational complexity and statistical physics, Oxford
University Press US, p. 125, ISBN 9780195177374,
• Borgs, Christian; Chayes, Jennifer; Pittel, Boris (2001),
"Phase transition and finite-size scaling for the integer partitioning problem", Random Structures
and Algorithms 19 (3-4): 247–288, doi:10.1002/rsa.10004,
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.89.9577, retrieved 2009-10-04 
• Korf, Richard E. (1998), "A complete anytime algorithm for number partitioning", Artificial
Intelligence 106 (2): 181–203, doi:10.1016/S0004-3702(98)00086-1, ISSN 0004-3702,
• Mertens, Stephan (1999), A complete anytime algorithm for balanced number partitioning  arXiv:
cs/9903011
Algorithms and their Operation

• Graham’s Greedy Algorithm

• The differencing Method


Algorithm and their Operation
• Graham’s Greedy Algorithm
•  
• Repeat n times:
• From the current set of numbers, remove the largest number.
• Consider the k numbers removed in an arbitrary order. Place each
of these numbers on the subset with current minimum sum.
• Let
• OPT : The value of the optimal solution to the load balancing
problem.
Algorithm and their Operation
• Graham’s Greedy Algorithm
Algorithm and their Operation
• Graham’s Greedy Algorithm
• The greedy algorithm almost always finds
an approximate partition for a list of a
thousand random numbers. Indeed, the
procedure works equally well on a set of
10,000 or 100,000 or a million numbers.
The explanation of this success is not that
the algorithm is a marvel of ingenuity. Lots
of other methods do as well or better.
The differencing Method
• Karmarkar, Narenda; Karp, Richard M (1982), "The
Differencing Method of Set Partitioning", Technical
Report UCB/CSD 82/113 (University of California at
Berkeley: Computer Science Division (EECS)) 
• Karmarkar-Karp algorithm operates in two phases.
• First, reading down the right hand side, pairs of
numbers are replaced by their difference,
effectively deciding they will go into different
subsets.
• In the second phase, reading up the right
hand side, the partition is constructed from
the sequence of differencing decisions.
• In the case shown the algorithm finds a
close perfect partition, but it is not
guaranteed always to work.
The differencing Method
Example
Let I= {3,6,13,20,30,40,73}

Set a b b-a Partition


{3,6,13,20,30,40,73} 40 73 33 {6,13,73} {3,20,30,40}

{3,6,13,20,30,33 } 30 33 3 {6,13,33} {3,20,30}

{3,3,6,13,20 } 13 20 7 {3,6,13} {3,20}

{3,3,6,7} 6 7 1 {3,6} {3,7}


{1,3,3} 3 3 0 {3} {1,3}
{0,1} 0 1 1 {0} {1}
{1}       ɸ {1}
Example
Let I= {6,9,13,17,19}

Set a b b-a Partition


{6,9,13,17,19} 17 19 2 {6,9,17} {13,19}

{2,6,9,13} 9 13 4 {6,9} {2,13}

{2,4,6} 4 6 2 {6} {2,4}

{2,2} 2 2 0 {2} {2}


{0} 3 3 0 ɸ {0}
Applications
• Applications of such problems
• Any Where if there is need of two equal
partitions e.g. balancing weight of Cargos
for ships.
• Load Balancing in Processors
Example:
n = 8, m= 3, k = 2
J1(10)

J2(30) J6(15)

J7(10)
J4(5)

J8(10)
J3(20) J5(10)

P1(60) P2(15) P3(35)


Example: (Removing 1st job)
n = 8, m= 3, k = 2

J6(15)

J1(10) J7(10)
J4(5)
J3(20) J8(10)
J5(10)
P1(30) P2(15) P3(35)
Removed job: J2(30)
Example: (Removing 2nd job)
n = 8, m= 3, k = 2

J1(10) J7(10)
J4(5)
J8(10)
J3(20)
J5(10)
P1(30) P2(15) P3(20)
Removed job: J2(30), J6(15)
Example: (Assigning 1st removed job)
n = 8, m= 3, k = 2

J2(30)

J1(10) J7(10)
J4(5)
J8(10)
J3(20)
J5(10)
P1(30) P2(45) P3(20)
Removed job: J6(15)
Assigned job: J2(30)
Example: (Assigning 1st removed job)
n = 8, m= 3, k = 2

J6(15)
J2(30)

J1(10) J7(10)
J4(5)
J8(10)
J3(20)
J5(10)
P1(30) P2(45) P3(35)
Removed job: Nil
Assigned job: J6(15)
Hitting Set problem
• Informally, we are given a collection of
subsets S of a universe T and asked to
find a subset H of T that intersects ("hits")
every set in S.
• In other words, every set in S must contain
at least one element of H. We additionally
require that H have at most a given size K.
What is the problem?
• Problem, given a set T of sets s1, s2 … sn,
is there a set H of at most k elements such
that H contains at least one element from
every s1…sn?
• Example: T = {{1,2,3},{a,1},{a,b,c},{}}
– k=2, no valid H!
– k=3, H = {1,a,} (other choices exist)
Vertex Cover and Hitting Set
• Both involve "select some items such that
all items are represented"
• Vertex Cover  Hitting Set
• T={(a,b),(b,c),(c,e),(c,d),(e,f),(d,e),(d,g),(d,f)}
• Vertex Cover
– VC={(b,c),(d,e)}Or {b,c,d,e} => VC=4
• Hitting Set
• T={(a,b),(b,c),(c,e),(c,d),(e,f),(d,e),(d,g),(d,f)}
• H={b,d,e} =>H=3
What work has been done on it?
• An Approximation algorithm for the Hitting Set Problem,
www.ti.inf.ethz.ch/ew/courses/ApproxAlgs0203/hitting.ps
• Frequency heuristic (greedy) algorithm , www.cs.nyu.edu/~cil217/Thesis/algorithm.html
• The Hitting Set Problem and Evolutionary Algorithmic Techniques .,
www.springerlink.com/index/25ga20hq9g8y7r66.pdf
• On the Minimum Hitting Set of Bundles Problem,
www.lamsade.dauphine.fr/~gourves/mhsb.pdf
• An improved algorithm for the red-blue hitting set problem ,
par.cse.nsysu.edu.tw/~algo/paper/paper09/A1-3.pdf
• Implicit Hitting Set Problems, Multi-Genome Alignment,
cs.nyu.edu/parida/CPM2010/MainPage_files/14.pdf
• Periodical genetic algorithms for the probabilistic hitting set ,
140.115.80.28:90/research/2073181.pdf
• [PDF] A Statistics-directed Minimal Hitting Set Algorithm ,
www.isy.liu.se/dx09/papers/dx09_submission_19.pdf
• An improved algorithm for the red-blue hitting set problem , portal.acm.org/citation.cfm?
id=1840164
Algorithm 1
• Approximation algorithm:
• H <-- empty set
• while H not yet hit all set in T do
•     Pick a set not yet hit,
add every element in that set to H
• return H
Algorithm 1
• T={(a,b),(b,c),(c,e),(c,d),(e,f),(d,e),(d,g),(d,f)}
• H= a, b
• H= a, b, c, e
• H= a, b, c, e, d, g
Algorithm 2
• - Frequency heuristic (greedy)
algorithm:
• H <-- empty set
• while H not yet hit all set in T do
•     Choose the element hitting the most un-
hit sets and add it to H
• return H
T={(a,b),(b,c),(c,e),(c,d),(e,f),(d,e),(d,g),(d,f)}
•H= b
•H= b, e
•H= b, e, d
Example
• Genetics-Tree Selecting
– Consensus Method
– Our goal is to select one tree from each gene.
Therefore we would like to select popular
trees since they immediately "cover" may
genes. If there is a single tree suggested by
all genes, then it suffices to select only that
tree.
Example
• gene g1 suggests trees t1, t3, t5
gene g2 suggests trees t1, t2, t4
gene g3 suggests trees t1, t6, t4
gene g4 suggests trees t1, t6, t5
gene g5 suggests trees t2, t4, t7
gene g6 suggests trees t3, t5, t8
• {t1,t2,t3} By approximation
• {t4,t5} By Frequency heuristic
Example
Example
Applications
• Another example of a practical application involving the
hitting set problem arises in efficient dynamic detection of
race conditions.
• In this case, each time global memory is written, the current
thread and set of locks held by that thread are stored.
• Under lockset-based detection, if later another thread writes
to that location and there is not a race, it must be because it
holds at least one lock in common with each of the previous
writes.
• Thus the size of the hitting set represents the minimum lock
set size to be race-free. This is useful in eliminating
redundant write events, since large lock sets are considered
unlikely in practice.
References
• http
://www.americanscientist.org/issues/pub/2002/3/the-easiest-hard-problem/1
• http://www.uespra.org/index.php?option=com_awiki&view=mediawiki&articl
e=Partition_problem%3Fqsrc%3D3044&Itemid=111

• http://archive.numdam.org/ARCHIVE/ITA/ITA_1987__21_1/ITA_1987__21_
1_11_0/ITA_1987__21_1_11_0.pdf
• http://www.worldlingo.com/ma/enwiki/en/Hitting_set
• http://reference.findtarget.com/search/Vertex_cover
%23Vertex_cover_in_hypergraphs/
• http://www.cs.nyu.edu/~cil217/Thesis/algorithm.html
• http://dcgprogram.epfl.ch/webdav/site/dcgprogram/users/184244/public/nabi
l-local-search.pdf
Thank You!

You might also like