Approximation Algorithms
Approximation Algorithms
Pratyay Kuila
F ( I ) OPT ( I )
Max , f ( n)
OPT ( I ) F ( I )
An Approximate Solution:
Let c(A) denote the total cost of the edges in the subset A ⊆ E.
c(u, v)
c(A) = (u,v)∈A
The cost function c satisfies the triangle inequality if for all vertices
u, v, w ∈ V, c(u, w) ≤ c(u, v) + c(v, w).
Minimize W ={ Wi | ∀mi M }
Without loss of generality, we may assume that at least one machine (specially
mi ) is assigned by two tasks or more (Why?).
This implies that , τr ≤ OPT (I)/2 as tr is the least execution time task (How?).
Therefore, before assignment of tr, finish time of mi was (Wi τr), which is less
than or equal to OPT(I).
So,
Wi τr ≤ OPT (I).
i.e., Wi ≤ OPT (I) + τr .
i.e., Wi ≤ OPT (I) + OPT (I) /2 [ As, τr ≤ OPT (I)/2]
i.e., Wi ≤ 1.5OPT (I)
So, the algorithm is never more than a factor 1.5 from optimal solution.
Therefore it is a 1.5-Approximation algorithm.
Algorithm: 2-ApproxTaskScheduling
=============================================
Step 1: Sort the tasks T = {t1, t2…, tn} in decreasing order on their
finishing time τi .
Step 2: for i =0 to p
CT [i]=0;
Step 3: while (T ≠ NULL) do
3.1: Select successive task (say ti) from T.
3.2: Select the machine (say mk) from Gi with minimum
completion time, CT.
3.3: CT [k]=CT [k]+ τi.
3.4: Assign ti to mk and delete ti from T.
Step 3: Stop.
So, the algorithm is never more than a factor 2 from optimal solution.
Therefore it is a 2-Approximation algorithm.
X S
S C
We say that C covers X.
While U≠ Φ
{
Select an S ∈ F that maximizes |S ∩ U |
U U S
C C {S }
}
Return C
}
• Greedy Approximate Solution of the previous problem is {S1, S4, S5, S3}
• Approximation ratio?