Approximation Algorithms (3)

Southgiri·2025년 8월 4일

SNUON Algorithm

목록 보기
7/7

Subset-Sum Problem

Subset-Sum Proble/m

  • An instance of the subset-sum problem is a pair (S,t)(S,t)
    • SS is a positive integer set {X1,X2,,Xn}\{X_1,X_2,\dots,X_n\}
    • tt is a positive integer
  • Whether there exists a subset of SS that adds up exactly to the target value tt
  • e.g.)
    • S={1,2,7,14,49,54},t=58S=\{1,2,7,14,49,54\},t=58
    • The subset S={2,7,49}S'=\{2,7,49\} is a solution

Exponential Time Exact Algorithm

Preliminary

  • Given a integer set SS and a integer xx
    • S+x={s+x:sS}S+x=\{ s+x:s\in S\}
    • e.g.) S={0,1,5,9},S+2={2,3,7,11}S=\{0,1,5,9\},S+2=\{2,3,7,11\}
  • PiP_i denote the set of all possible summation values by selecting a subset of {x1,x2,,xi}\{x_1,x_2,\dots,x_i\}
    • e.g.) S={1,4,5},P1={0,1},P2={0,1,4,5},P3={0,1,4,5,6,9,10}S=\{1,4,5\}, P_1=\{0,1\}, P_2=\{0,1,4,5\}, P_3=\{0,1,4,5,6,9,10\}
    • Pi=Pi1(Pi1+xi)P_i=P_{i-1}\cup(P_{i-1}+x_i)
  • LiL_i denote a sorted list containing every element of PiP_i whose value is not more than tt
  • MERGELISTS(L,L)MERGE-LISTS(L,L') returns the sorted list that is merge of its two sorted input lists with duplicate values removed
    • Runs in time O(L+L)O(|L|+|L'|)

Algorithm


Approximation

Fully Polynomial Time Approximation Scheme

  • Polynomial in 1/ϵ1/\epsilon as well as in the size of the input

Trimming

  • If two values in LL are close, maintain only one value
  • To trim a list LL by δ(0<δ<1)\delta(0<\delta < 1) means
    • For every removed element yy, there is an element zz still in trimming result LL' satisfying y1+δzy\displaystyle{{y}\over{1+\delta}} \leq z \leq y
  • e.g.)
    • δ=0.1\delta=0.1
    • L=<10,11,12,15,20,21,22,23,24,29>L=<10,11,12,15,20,21,22,23,24,29>
    • L=<10,12,15,20,23,29>L'=<10,12,15,20,23,29>
      • 1111 is represented by 10(11/1.11011)10(11/1.1 \leq 10 \leq 11)
      • 21,2221,22 are represented by 2020
      • 2424 is represented by 2323
  • Scan LL in monotonically increasing order
  • If it is the first element of LL or
    if it cannot be represented by the most recent number placed into LL'

APPROX-SUBSET-SUM

  • Given input SS, a target integer tt and an approximation parameter ϵ\epsilon
  • Return a value zz whose value is within a 1+ϵ1+\epsilon factor of the optimal solution


Fully polynomial time approximation scheme

  • Proof
    • Every element of LiL_i is a memeber of PiP_i
    • Therefore, the value zz^* is the sum of some subset of SS
    • yPny^* \in P_n denote an optimal solution
    • zyz^* \leq y^*
    • Need to show
      1. yz1+ϵ\displaystyle{{y^*}\over{z^*}} \leq 1+\epsilon
      2. Running time is polynomial in both 1/ϵ1/\epsilon and the size of the input

0개의 댓글