patternMinor
minimizing the summed cardinality of set unions
Viewed 0 times
thecardinalityminimizingsummedunionsset
Problem
this optimization problem, I am working on, is kind of making me crazy. ;)
Given is a list
Every set has a name
These sets are to be combined to unions
The goal is to find the
here is a bad
and the optimum
Until now I only implemented a naive brute force solution (Haskell code): http://lpaste.net/7204008959806537728
I was hoping to find a dynamic programming solution like it exists for the (Z>0) 0-1 knapsack problem, but did not yet succeed.
Is my problem perhaps NP-hard? If so, is it many-one-reducible to SAT or something? Or is there a good approximation?
Of course, if there exists a known efficient optimal algorithm, it would be awesome if you could enlighten me. :)
Given is a list
o of sets (with finite cardinality) of strictly positive integer values (Z>0), e.g.:o_without_sizes =
[ {1, 2, 3, 4}
, {5, 6}
, {2, 3, 4, 5}
, {5, 6, 7}
, {7, 8}
. {9} ]Every set has a name
n (also in Z>0, but only for identification) and a fixed independent size value s (also in Z>0), e.g.:type O = [(Name, Size, Values)]
o =
[ (1, 2, {1, 2, 3, 4})
, (2, 1, {5, 6})
, (3, 2, {2, 3, 4, 5})
, (4, 3, {5, 6, 7})
, (5, 2, {7, 8})
. (6, 1, {9}) ]These sets are to be combined to unions
b of a maximum size value sum h (>= max s, that means that no set has a size making it too big to fit into a single union), e.g. 4.The goal is to find the
b so that the sum of cadinalities of the unions in it is as small as possible.here is a bad
b:size: 3, cardinality: 6, sets: [1,2] , values: [1,2,3,4,5,6]
size: 2, cardinality: 4, sets: [3] , values: [2,3,4,5]
size: 3, cardinality: 3, sets: [4] , values: [5,6,7]
size: 3, cardinality: 3, sets: [5,6] , values: [7,8,9]
cardinality sum: 16and the optimum
b for this example:size: 4, cardinality: 5, sets: [3,1] , values: [1,2,3,4,5]
size: 4, cardinality: 3, sets: [2,4] , values: [5,6,7]
size: 3, cardinality: 3, sets: [5,6] , values: [7,8,9]
cardinality sum: 11Until now I only implemented a naive brute force solution (Haskell code): http://lpaste.net/7204008959806537728
I was hoping to find a dynamic programming solution like it exists for the (Z>0) 0-1 knapsack problem, but did not yet succeed.
Is my problem perhaps NP-hard? If so, is it many-one-reducible to SAT or something? Or is there a good approximation?
Of course, if there exists a known efficient optimal algorithm, it would be awesome if you could enlighten me. :)
Solution
Your problem is NP-complete. We show this by reducing Partition to it.
In Partition you are given a set of numbers $a_1, \ldots, a_k$ and have to decide, if this set can be partitioned into two sets that sum up to the same value.
We map an instance of Partition to your problem by introducing for each $a_i$ the set $(i, a_i, \{1\})$. Set the maximum size to $\frac 12\sum_{i=1}^ka_i$. The original instance can be partitioned if and only if the resulting one can be united to cardinality sum 2.
In Partition you are given a set of numbers $a_1, \ldots, a_k$ and have to decide, if this set can be partitioned into two sets that sum up to the same value.
We map an instance of Partition to your problem by introducing for each $a_i$ the set $(i, a_i, \{1\})$. Set the maximum size to $\frac 12\sum_{i=1}^ka_i$. The original instance can be partitioned if and only if the resulting one can be united to cardinality sum 2.
Context
StackExchange Computer Science Q#21857, answer score: 3
Revisions (0)
No revisions yet.