Partitioning Graphs of Supply and Demand Generalization of Knapsack Problem Takao Nishizeki Tohoku University
Graph Supply Vertices Demand Vertices Supply Vertices and Demand Vertices
Graph Each Supply Vertex has a number, called Supply. Each Demand Vertex has a number, called Demand Supply Demand Supply Vertices Demand Vertices
Desired Partition partition G into connected components so that
Desired Partition partition G into connected components so that
Desired Partition partition G into connected components so that (a) each component has exactly one supply vertex, (b) supply is no less than the sum of demands in the component. (a) each component has exactly one supply vertex, (b) supply is no less than the sum of demands in the component Desired partition Sum : 23 Sum : 13 Sum : 12
Maximum Partition Problem (Max PP) No desired partition
(a) each component has exactly one supply vertex, (b) supply is no less than the sum of demands in the component. (a) each component has exactly one supply vertex, (b) supply is no less than the sum of demands in the component. A partition of a graph must satisfy no supply vertex Maximum Partition Problem (Max PP) (a) each component has at most one supply vertex, (b) supply is no less than the sum of demands in the component. (a) each component has at most one supply vertex, (b) supply is no less than the sum of demands in the component.
(a) each component has at most one supply vertex, (b) supply is no less than the sum of demands in the component. (a) each component has at most one supply vertex, (b) supply is no less than the sum of demands in the component finds a partition that maximizes the “fulfillment.” Sum : 17 Sum : 7 Sum : 5 Sum : 12 Maximum Partition Problem (Max PP) (a) each component has at most one supply vertex, (b) supply is no less than the sum of demands in the component if there is a supply vertex. (a) each component has at most one supply vertex, (b) supply is no less than the sum of demands in the component if there is a supply vertex. A partition of a graph must satisfy sum of demands in all components with supply vertices
finds a partition that maximizes the “fulfillment.” The fulfillment of this partition = 41 The fulfillment of this partition = Maximum Partition Problem (Max PP) Sum : 17 Sum : 7 Sum : 5 Sum : 12
Sum : 19 Sum : 15 Sum : 8 Sum : finds a partition that maximizes the “fulfillment.” The fulfillment of this partition = 54 The fulfillment of this partition = 54 Maximum fulfillment Maximum Partition Problem (Max PP)
Complexity Status Trees NP-hard Maximum Subset Sum Problem (NP-hard) instance: a set A of integers and an integer b find: a subset C ⊆ A which maximizes the sum of integers in C s.t. the sum does not exceed b. Maximum Subset Sum Problem (NP-hard) instance: a set A of integers and an integer b find: a subset C ⊆ A which maximizes the sum of integers in C s.t. the sum does not exceed b b = 13 max subset sum problem (simple ver. of Knapsack) given set A
C Complexity Status Trees NP-hard Maximum Subset Sum Problem (NP-hard) instance: a set A of integers and an integer b find: a subset C ⊆ A which maximizes the sum of integers in C s.t. the sum does not exceed b. Maximum Subset Sum Problem (NP-hard) instance: a set A of integers and an integer b find: a subset C ⊆ A which maximizes the sum of integers in C s.t. the sum does not exceed b b = 13 max subset sum problem (simple ver. of Knapsack) given set A
Related Result Max PP for Stars with one supply at center Fully Polynomial-Time Approximation Scheme (FPTAS) [Ibarra and Kim ’75] FPTAS: for any , 0 < < 1, the algorithm finds an approximation solution such that APPRO > (1– ) OPT in time polynomial in both n and 1/ . FPTAS: for any , 0 < < 1, the algorithm finds an approximation solution such that APPRO > (1– ) OPT in time polynomial in both n and 1/ . max subset sum problem (NP-hard)
Related Result Max PP for Stars with one supply at center Fully Polynomial-Time Approximation Scheme (FPTAS) [Ibarra and Kim ’75] max subset sum problem (NP-hard) good approximation for larger classes good approximation for larger classes ? ?
Our Results (approximabiliy) General graphs (1) MAXSNP-hard (APX-hard) No PTAS unless P=NP PTAS: for any , 0 < < 1, the algorithm finds an approximation solution such that APPRO > (1– ) OPT in time polynomial in n. (1/ :regarded as a constant.) PTAS: for any , 0 < < 1, the algorithm finds an approximation solution such that APPRO > (1– ) OPT in time polynomial in n. (1/ :regarded as a constant.) No FPTAS unless P=NP
Our Results (approximabiliy) General graphs Trees (2) FPTAS (1) MAXSNP-hard (APX-hard) No PTAS unless P=NP NP-hard
Our Results (approximabiliy) General graphs (2) FPTAS (1) MAXSNP-hard (APX-hard) No PTAS unless P=NP Trees NP-hard
(1) MAXSNP-hardness Max PP is MAXSNP-hard for bipartite graphs. L-reduction: preserves approximability L-reduction Max PP for bipartite graphs occurrence MAX3SAT each variable appears at most 3 times error ratio: error ratio: ’
(1) MAXSNP-hardness 3-occurrence MAX3SAT (MAXSNP-hard) instance: variables and clauses s.t. each clause has exactly 3 literals; and each variable appears at most 3 times in the clauses find: a truth assignment which maximizes # of satisfied clauses variables: v w x y z at most 3 times
(1) MAXSNP-hardness instance: variables and clauses s.t. each clause has exactly 3 literals; and each variable appears at most 3 times in the clauses find: a truth assignment which maximizes # of satisfied clauses variables: v w x y z at most 3 times 3-occurrence MAX3SAT (MAXSNP-hard)
(1) MAXSNP-hardness instance: variables and clauses s.t. each clause has exactly 3 literals; and each variable appears at most 3 times in the clauses find: a truth assignment which maximizes # of satisfied clauses variables: v w x y z 3-occurrence MAX3SAT (MAXSNP-hard)
(1) MAXSNP-hardness variable gadget xx variable x xx x = false xx x = true 4+4 = 8 > 7
(1) MAXSNP-hardness x x y y z z variable xvariable yvariable z
(1) MAXSNP-hardness x x y y z z variable xvariable yvariable z
(1) MAXSNP-hardness x x y y z z variable xvariable yvariable z
(1) MAXSNP-hardness x x y y z z variable xvariable yvariable z at most 3 7 – 4 = 3 enough power
(1) MAXSNP-hardness x x y y z z variable xvariable yvariable z
(1) MAXSNP-hardness x x y y z z x = truey = falsez = false
(1) MAXSNP-hardness x x y y z z variable xvariable yvariable z
(1) MAXSNP-hardness x x y y z z x = falsey = falsez = false not satisfied
(1) MAXSNP-hardness Max PP is MAXSNP-hard for bipartite graphs. L-reduction: preserves approximability 3-occurrence MAX3SAT Max PP for bipartite graphs L-reduction each variable appears at most 3 times
Our Results (approximabiliy) General graphs (2) FPTAS (1) MAXSNP-hard (APX-hard) No PTAS unless P=NP Trees NP-hard Pseudo-poly.-time algorithm
Max PP is NP-hard even for trees. Max PP can be solved for a tree T in time O(F 2 n) if the supplies and demands are integers. Max PP can be solved for a tree T in time O(F 2 n) if the supplies and demands are integers ・・・ +4+5= = 40 F= min{43,40}=40 max fulfillment ≦ F sum of all demands sum of all supplies F = min Pseudo-Polynomial-Time Algorithm
root Dynamic Programming Pseudo-Polynomial-Time Algorithm
5 9 TvTv TvTv 3 9 v v optimal partition of T v optimal partition of T T fulfillment = 18fulfillment = 20 Pseudo-Polynomial-Time Algorithm
TvTv v fulfillment: TvTv v fulfillment: 18 Dynamic Programming 20 - (10+5+3) = 2 marginal power = Pseudo-Polynomial-Time Algorithm
5 9 TvTv v fulfillment: 15 TvTv v (10+3)= 7 fulfillment: (10+5)=5 Dynamic Programming Pseudo-Polynomial-Time Algorithm
TvTv 3 9 v optimal partition of T Pseudo-Polynomial-Time Algorithm
1 2 3 marginal power 0 F fulfillment staircase,non-increasing Pseudo-Polynomial-Time Algorithm F points
TvTv 15 v optimal partition of T TvTv 15 v TvTv v fulfillment: = 9 deficient power Pseudo-Polynomial-Time Algorithm
TvTv 15 v fulfillment: 8 8 TvTv 15 v 5 5 fulfillment: TvTv 15 v fulfillment: 9 9 TvTv 15 v 5 53 fulfillment: TvTv 15 v optimal partition of T TvTv 15 v Pseudo-Polynomial-Time Algorithm
TvTv 15 v fulfillment: 8 8 TvTv 15 v 5 5 fulfillment: TvTv 15 v fulfillment: 9 9 TvTv 15 v 5 53 fulfillment: deficient power 0 F fulfillment staircase, non-decreasing Pseudo-Polynomial-Time Algorithm F points
leaves Pseudo-Polynomial-Time Algorithm
marginal power 0 F fulfillment deficient power 0 F fulfillment deficient power 0 F fulfillment marginal power 0 F 12 3 fulfillment O(F 2 ) time marginal power 0 F fulfillment deficient power 0 F fulfillment
root Dynamic Programming marginal power 0 F fulfillment deficient power 0 F fulfillment max fulfillment Pseudo-Polynomial-Time Algorithm
root Computation time for each vertex ・・・・・・・・・・・・・・ O(F 2 ) Dynamic Programming There are n vertices. Pseudo-Polynomial-Time Algorithm
Computation time O(F 2 n) Computation time O(F 2 n) The algorithm takes polynomial time if F is bounded by a polynomial in n. There are n vertices. Computation time for each vertex ・・・・・・・・・・・・・・ O(F 2 ) Pseudo-Polynomial-Time Algorithm
(2) FPTAS For any , 0< <1, the algorithm finds a partition of a tree T such that OPT – APPRO < OPT in time polynomial in both n and 1/ . For any , 0< <1, the algorithm finds a partition of a tree T such that OPT – APPRO < OPT in time polynomial in both n and 1/ . Let all demands and supply be positive real numbers. n : # of vertices
The algorithm is similar to the previous algorithm. 0 fulfillment marginal power t sampled fulfillment (2) FPTAS
0 fulfillment marginal power t The algorithm is similar to the previous algorithm. (2) FPTAS OPT – APPRO < 2nt total error < error/merge × # of merge < 2t × n sampled fulfillment OPT APPRO
Error m d : max demand m d = 9 (2) FPTAS OPT – APPRO < 2nt
Error m d : max demand (2) FPTAS OPT – APPRO < 2nt m d ≦ OPT ≦ OPT OPT – APPRO < OPT error ratio
m d : max demand Computation time marginal power 0 t Sampled fulfillment (2) FPTAS Error OPT – APPRO < OPT
Conclusions General graphs (1) MAXSNP-hard (APX-hard) No PTAS unless P=NP Trees (2) FPTAS NP-hard
Variant (Generalization of Knapsack Problem) find a partition which maximizes sum of profits of all demand vertices that are supplied power. 10 3, 507, 308, 200 demandprofit
Variant (Generalization of Knapsack Problem) 10 3, 507, 308, 200 demands = 3+7 = 10 profits = = 80 Sum 10 3, 507, 308, 200 demands = 8 profits = 200 Sum max find a partition which maximizes sum of profits of all demand vertices that are supplied power.
Variant (Generalization of Knapsack Problem) find a partition which maximizes sum of profits of all demand vertices that are supplied power. FPTAS for KP [Ibarra and Kim ’75] FPTAS for trees 7, 305, , 20 6, 12 2, , 507, 308, 200
Variant (Generalization of Knapsack Problem) find a partition which maximizes sum of profits of all demand vertices that are supplied power. FPTAS for KP [Ibarra and Kim ’75] FPTAS for trees 7, 305, , 20 6, 12 2, extendable to partial k-trees (graphs with bounded treewidth) if there is exactly one supply 20 7, 85, 25 8, 3 6, 12 2, 10 3, 5 8, , 507, 308, 200
Variant (Generalization of Knapsack Problem) find a partition which maximizes sum of profits of all demand vertices that are supplied power. FPTAS for KP [Ibarra and Kim ’75] FPTAS for trees 7, 305, , 20 6, 12 2, extendable to partial k-trees (graphs with bounded treewidth) if there is exactly one supply 10 3, 507, 308, , 85, 25 8, 3 6, 12 2, 10 3, 5 8, 13
Thank You! Thank You!
(2b) Parallel connection G1G1 :terminal Series-Parallel Graphs (recursively) (1) A single edge is a SP graph. (2a) Series connection G2G2 G1G1 G2G2 G1G1 G2G2 G1G1 G2G2
e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 :terminal SP Graph & Decomposition Tree P S S P SS e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree
e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 SP Graph & Decomposition Tree :terminal
e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 SP Graph & Decomposition Tree :terminal Series connection S
e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 SS :terminal Series connection e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree SP Graph & Decomposition Tree
e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 P SS :terminal Parallel connection SP Graph & Decomposition Tree e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree
e1e1 e2e2 e3e3 e7e7 e6e6 e4e4 e5e5 S P SS :terminal Series connection SP Graph & Decomposition Tree e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree
e1e1 e2e2 e3e3 e7e7 e6e6 e4e4 e5e5 S S P SS :terminal Series connection SP Graph & Decomposition Tree e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree
e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 P S S P SS :terminal Parallel connection SP Graph & Decomposition Tree e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree
e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 P S S P SS :terminal SP Graph & Decomposition Tree e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 e6e6 e4e4 e5e5 e7e7 e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7
e1e1 e2e2 e3e3 e6e6 e4e4 e5e5 e7e7 P S S P SS DP algorithm :terminal SP Graph & Decomposition Tree e 1 e 2 e 3 e 4 e 5 e 6 e 7 leaves Decomposition tree
Pseudo-Polynomial-Time Algorithm Suppose that a SP graph has exactly one supply. Max PP for such a SP graph can be solved in time O(F 2 n) if the demands and the supply are integers F : sum of all demands F = = 29 pseudo-polynomial- time algorithm (2) FPTAS max fulfillment ≦ F n: # of vertices
Decomposition treeCorresponding SP subgraphs G 12 G1G1 G2G2 S P S DP table What should we store in the table for Max PP ? Pseudo-Polynomial-Time Algorithm
G If G had more than one supply, Max PP would find a partition.
Pseudo-Polynomial-Time Algorithm G Max PP finds only one component with the supply
Pseudo-Polynomial-Time Algorithm G two terminals are supplied power and contained in same component
Pseudo-Polynomial-Time Algorithm G Max PP finds only one component with the supply
Pseudo-Polynomial-Time Algorithm G two terminals will be supplied power, but are contained in different components
Pseudo-Polynomial-Time Algorithm G Max PP finds only one component with the supply
Pseudo-Polynomial-Time Algorithm G this terminal will be supplied power this terminal is never supplied power
Pseudo-Polynomial-Time Algorithm G Max PP finds only one component with the supply
Pseudo-Polynomial-Time Algorithm G two terminals are never supplied power
Pseudo-Polynomial-Time Algorithm both are/will be supplied power both are/will be supplied power one is/will be supplied, but the other is never supplied one is/will be supplied, but the other is never supplied both are never supplied same component different components
If the component has the supply vertex, then the component may have the “marginal” power Pseudo-Polynomial-Time Algorithm
If the component has the supply vertex, then the component may have the “marginal” power. marginal power 10 – (3+2) = 5 Pseudo-Polynomial-Time Algorithm 10 32
If the component has no supply vertex, the component may have the “deficient” power Pseudo-Polynomial-Time Algorithm
If the component has no supply vertex, the component may have the “deficient” power. deficient power = 12 Pseudo-Polynomial-Time Algorithm 32 7
both are/will be supplied power both are/will be supplied power same component one is/will be supplied, but the other is never supplied one is/will be supplied, but the other is never supplied both are never supplied different components
Pseudo-Polynomial-Time Algorithm both are/will be supplied power both are/will be supplied power 0 F fulfillment marginal power fulfillment marginal power 5 staircase,non-increasing
Pseudo-Polynomial-Time Algorithm both are/will be supplied power both are/will be supplied power deficient power fulfillment deficient power 0 F fulfillment staircase, non-decreasing
Pseudo-Polynomial-Time Algorithm both are/will be supplied power both are/will be supplied power same component one is/will be supplied, but the other is never supplied one is/will be supplied, but the other is never supplied both are never supplied different components marginal power 0 F fulfillment deficient power 0 F fulfillment deficient power 0 F fulfillment marginal power 0 F 12 3 fulfillment marginal power 0 F fulfillment deficient power 0 F fulfillment marginal power 0 F fulfillment deficient power 0 F fulfillment
Decomposition treeCorresponding SP subgraphs G 12 G1G1 G2G2 S P S DP table Pseudo-Polynomial-Time Algorithm size O(F ) size O(F ) time O(F 2 ) time O(F 2 )
Pseudo-Polynomial-Time Algorithm P S S P SS e 1 e 2 e 3 e 4 e 5 e 6 e 7 Decomposition tree O(F 2)O(F 2) O(F 2)O(F 2) # of nodes = O(n) O( F 2 n )O( F 2 n ) O( F 2 n )O( F 2 n ) n : # of vertices in a given SP graph
Pseudo-Polynomial-Time Algorithm Suppose that a SP graph has exactly one supply. Max PP for such a SP graph can be solved in time O(F 2 n) if the demands and the supply are integers F : sum of all demands F = = 29 pseudo-polynomial- time algorithm (2) FPTAS max fulfillment ≦ F n: # of vertices
(2) FPTAS For any , 0< <1, the algorithm finds a component with the supply vertex such that APPRO > (1– ) OPT in time polynomial in both n and 1/ . For any , 0< <1, the algorithm finds a component with the supply vertex such that APPRO > (1– ) OPT in time polynomial in both n and 1/ . Let all demands and supply be positive real numbers. n : # of vertices
(2) FPTAS The algorithm is similar to the previous algorithm. 0 fulfillment marginal power t sampled fulfillment
0 fulfillment marginal power t (2) FPTAS The algorithm is similar to the previous algorithm. APPRO > (1– ) OPT m d : max demand
Open Problem Is there an approximation algorithm for SP graphs having more than one supply? FPTAS or PTAS ? constant-factor ?
Open Problem both are/will be supplied power both are/will be supplied power one is/will be supplied, but the other is never supplied one is/will be supplied, but the other is never supplied both are never supplied same component different components
Open Problem both are/will be supplied power different components The two components must become ONE component. j k deficient power = j + k deficient power 0 F fulfillment j + k (1D)
Open Problem j k deficient power = j + k If a given graph has more than one supply
Our Results Max subset sum problem FPTAS [Ibarra and Kim, 1975] Max PP our FPTAS straightforward ?
Our Results Max subset sum problem FPTAS [Ibarra and Kim, 1975] Max PP our FPTAS straightforward ? Sum: 10 margin: 2 Sum: 8 The graph structure plays crucial role. 2 2
Every demand vertex must be supplied from exactly one supply vertex. Assumption of the Problem Max PP is applied to Power delivery networks. It is difficult to synchronize two or more sources.
Power delivery network Application of Max PP Power delivery problem feeder supply vertex = load demand vertex = cable segment edge =
Power delivery network Power delivery problem Determine whether there exists a switching so that all loads can be supplied. If not all loads can be supplied, we want to maximize the sum of loads supplied power. If not all loads can be supplied, we want to maximize the sum of loads supplied power. Application of Max PP Max Partition Problem