EPIT 2007 Approximation Algorithms 1 EPIT 2007 Independent

  • Slides: 61
Download presentation
EPIT 2007 Approximation Algorithms 1

EPIT 2007 Approximation Algorithms 1

EPIT 2007 Independent Set Instance: G=(V, E), k N Question: Is there an independent

EPIT 2007 Independent Set Instance: G=(V, E), k N Question: Is there an independent set of size k in G (i. e. a subset V’ V such that no two vertices in V’ are joined by an edge) ? This problem is NP-Complete Instance: G=(V, E) Question: Find an independent set of maximal cardinality NP-hard 2

EPIT 2007 Definition of Approximation Algorithms Find a «good solution» in polynomial-time What is

EPIT 2007 Definition of Approximation Algorithms Find a «good solution» in polynomial-time What is a good solution? Let S be a solution given by a heuristic Let S* be an optimal solution The aim: S/S*≈1 3

EPIT 2007 Another problem: vertex cover Instance: G=(V, E), k N Question: Find a

EPIT 2007 Another problem: vertex cover Instance: G=(V, E), k N Question: Find a set cover of edges with minimal size (i. e. a subset V’ V such that, for each edge {u, v} E, at least one of u and v belongs to V’). 4

EPIT 2007 These two problems seem to be equivalent independent set = vertex cover

EPIT 2007 These two problems seem to be equivalent independent set = vertex cover and vertex cover = independent set Max independent set ≈ Min vertex cover An existence of an independent set of size k <=> an existence of the vertex cover of size n-k. 5

EPIT 2007 In fact these two problems are very different in term of approximability:

EPIT 2007 In fact these two problems are very different in term of approximability: there exists an algorithm for the vertex cover which gives a solution S to a factor two of a optimal solution S* at most => 2 S/S* No constant ratio exists for the independent set 6

EPIT 2007 Definition An algorithm A is (n)-approximated If Max (S/S*, S*/S) (n) For

EPIT 2007 Definition An algorithm A is (n)-approximated If Max (S/S*, S*/S) (n) For all instances of size n of the problem where S is the solution given by A and S* an optimal solution. 7

EPIT 2007 FPTAS and PTAS Q PTAS: >0, A such that A is (1+

EPIT 2007 FPTAS and PTAS Q PTAS: >0, A such that A is (1+ )approximated. Moreover, if the complexity of A is polynomial in 1/ , then Q FPTAS. 8

EPIT 2007 Some problems of PTAS Cover of points by minimum number of circles

EPIT 2007 Some problems of PTAS Cover of points by minimum number of circles of radius r Knapsack problem 9

EPIT 2007 APX and no-APX Q APX: R, A such that A is a

EPIT 2007 APX and no-APX Q APX: R, A such that A is a approximation algorithm Q no-APX : R, there exists no A such that A is approximation algorithm 10

EPIT 2007 Some problems APX and no-APX Vertex cover of a graph is APX

EPIT 2007 Some problems APX and no-APX Vertex cover of a graph is APX Travelling salesman problem is APX Independent set of maximum cardinality is no. APX Vertices coloring is no-APX 11

EPIT 2007 The world if N NP No-APX FPTAS APX P 12

EPIT 2007 The world if N NP No-APX FPTAS APX P 12

EPIT 2007 An absolute approximation Algorithm The edge coloring of a graph: It exists

EPIT 2007 An absolute approximation Algorithm The edge coloring of a graph: It exists a 4/3 -approximated algorithm Vizing’s theorem : It is always possible to color the edges with (G)+1 colors 13

EPIT 2007 An absolute approximation Algorithm This result is the best possible Indeed :

EPIT 2007 An absolute approximation Algorithm This result is the best possible Indeed : the problem to know if a graph with (G)=3 can be colored with 3 colors is NP-complete. It is easy to see that an algorithm -approximated with <4/3 permits to solve this problem. 14

EPIT 2007 An absolute approximation Algorithm Indeed if the solution is c<4 then c*

EPIT 2007 An absolute approximation Algorithm Indeed if the solution is c<4 then c* ≤ 3, and the graph can be colored with 3 colors. If the solution is c 4, since c/c*<4/3 we have c*>3 and the graph cannot be colored with 3 colors. 15

EPIT 2007 The problem of the k-center Instance: Let V be a set of

EPIT 2007 The problem of the k-center Instance: Let V be a set of n sites, D be a matrix where dij is the distance between site i and site j, and let k N. Problem : Find S V, |S|=k which minimizes maxi V(dist(i, S)) with dist(i, S)=minj S(dij) 16

EPIT 2007 Remark There exists no -approximated algorithm with <2. Proof : If such

EPIT 2007 Remark There exists no -approximated algorithm with <2. Proof : If such an algorithm existed, it could be used to solve the problem of the existence of a dominating set of size k. 17

EPIT 2007 Some definitions We call Gd=(V, Ed) the graph where {i, j} Ed

EPIT 2007 Some definitions We call Gd=(V, Ed) the graph where {i, j} Ed if and only if d dij. Let G=(V, E), we call G 2=(V, E’) the graph such that {i, j} E’ if and only if either {i, j} E or k such that {i, k} E and {k, j} E. 18

EPIT 2007 Here is a 2 -approximated algorithm: Sort the dij : d 1

EPIT 2007 Here is a 2 -approximated algorithm: Sort the dij : d 1 < d 2 < … < dm , i : =0 Repeat i : = i+1 ; d : = di Construct Gd 2 Find a maximal stable S of G 2 d until k |S| Take S as solution 19

EPIT 2007 Remark : 1. Let i 0 be the value of the last

EPIT 2007 Remark : 1. Let i 0 be the value of the last i in the loop. Then all the sites are at distance at most 2 di 0 from S. 2. The optimal solution is at least di 0. 3. Indeed Gd 2 with d=di 0 -1, has a stable of cardinality at least k+1. 20

EPIT 2007 Conclusion Thus the algorithm is a 2 -approximated. That is the best

EPIT 2007 Conclusion Thus the algorithm is a 2 -approximated. That is the best possible result. 21

EPIT 2007 Most of the scheduling problems are NP-Hard Take the following simple problem:

EPIT 2007 Most of the scheduling problems are NP-Hard Take the following simple problem: Instance: Independent tasks (no precedence constraint), each task ti has a processing time pi Question: Scheduling these tasks on two processors while minimizing the length of the schedule 22

EPIT 2007 This problem is NP-Hard (partition is a particular case). But there exists

EPIT 2007 This problem is NP-Hard (partition is a particular case). But there exists a FPTAS 23

EPIT 2007 A intermediate problem Let be the sum problem: a list E of

EPIT 2007 A intermediate problem Let be the sum problem: a list E of n integers, an integer t. The goal is to find a sublist E’ E which the sum of the integers in E’ is maximum but less than t (Find E’ E, such that max(∑ i E’ i) t) 24

EPIT 2007 A pseudo-polynomial-time algorithm L 0 = {0} L 1 = {0, e

EPIT 2007 A pseudo-polynomial-time algorithm L 0 = {0} L 1 = {0, e 1 } Li = Li-1 {x | y Li-1, x=y+ei, x t} The solution is expressed as y*= max (Ln) The complexity order of this algorithm is in O (n * min(t, 2 n)) 25

EPIT 2007 How can we reduce the size of the lists? The idea is

EPIT 2007 How can we reduce the size of the lists? The idea is to filter the list Example. Suppose that the two integers 45 and 47 are in a list Li. The sum which we would able to reach from 45 will be closed to their from 47. Thus 45 will represent 47 26

EPIT 2007 How do we reduce the size of the lists ? Filtering (L,

EPIT 2007 How do we reduce the size of the lists ? Filtering (L, ) consists in suppressing all the integers y in L such that there exists an integer z in L with y z (1 - )y Example: L = {0, 1, 2, 4, 5, 11, 12, 20, 21, 23, 24, 25, 26} and =0. 2 27

EPIT 2007 How do we reduce the size of the lists ? Filtering (L,

EPIT 2007 How do we reduce the size of the lists ? Filtering (L, ) consists in suppressing all the integers y in L such that there exists an integer z in L with y z (1 - )y Example: L = {0, 1, 2, 4, 5, 11, 12, 20, 21, 23, 24, 25, 26} and =0. 2. Then Filtering(L, )= {0, 1, 2, 4, 11, 20, 26} 28

EPIT 2007 How do we reduce the size of the lists ? We are

EPIT 2007 How do we reduce the size of the lists ? We are given the pseudo-polynomial algorithm, and in each step we filter with = /n. Let L’i be the intermediate lists. Then the approximated solution is y = max(L’n) 29

EPIT 2007 The sizes of the lists are small L’i = {0, z 1

EPIT 2007 The sizes of the lists are small L’i = {0, z 1 , z 2 , … zm+1} we have by construction : zi/ zi-1 > 1/(1 - ) and t zm+1 and z 1 1 Thus t zm+1/z 1 = i=2. . m+1 zi/ zi-1 (1/(1 - ) )m 30

EPIT 2007 The sizes of the lists are small Thus t (1/(1 - )

EPIT 2007 The sizes of the lists are small Thus t (1/(1 - ) )m log (t) - m * log (1 - ) Finally m < n log(t)/ (because - log(1 -x)>x) 31

EPIT 2007 The sizes of the lists are small 1. m < n log(t)/

EPIT 2007 The sizes of the lists are small 1. m < n log(t)/ 2. the size of the lists is in O(m) The algorithm becomes polynomial. 32

EPIT 2007 The error is small We can prove by induction that : y

EPIT 2007 The error is small We can prove by induction that : y Li , z L’i such that y z (1 - )i y 33

EPIT 2007 The error is small We can prove by induction that : y

EPIT 2007 The error is small We can prove by induction that : y Li , z L’i such that y z (1 - )i y This result is true for i=n and y=y* 34

EPIT 2007 The error is small We can prove by induction that : y

EPIT 2007 The error is small We can prove by induction that : y Li , z L’i such that y z (1 - )i y This result is true for i=n and y=y* z L’n z (1 - )n y* 35

EPIT 2007 The error is small z L’n z (1 - )n y* and

EPIT 2007 The error is small z L’n z (1 - )n y* and y z Conclusion: y / y* (1 - /n)n 1 - 36

EPIT 2007 Back to our problem Let B be the sum of the processing

EPIT 2007 Back to our problem Let B be the sum of the processing time of all the tasks. P 1 P 2 B/2 The solution S is B/2+ If pi becomes ei and t=B/2 : the solution S’ is B/2 - 37

EPIT 2007 Back to our problem B/2 The solution S is B/2+ , S*

EPIT 2007 Back to our problem B/2 The solution S is B/2+ , S* is B/2+ with If pi becomes ei and t=B/2 : the solution S’ is B/2 - and the best solution S’* is B/2 - It suffices to note that S/S*<S’*/S’ to show that our problem is FPTAS 38

EPIT 2007 A non-APX problem Instance: Some tasks with the same processing times and

EPIT 2007 A non-APX problem Instance: Some tasks with the same processing times and some incompatibility constraints. Question: Find a optimal schedule satisfing the incompatibility constraints. Let G be the conflict graph where vertices represent tasks a scheduling ≈ vertex coloring. 39 This problem is not APX

EPIT 2007 An APX problem without PTAS Scheduling on a given number of processors

EPIT 2007 An APX problem without PTAS Scheduling on a given number of processors Instance: Let G=(V, A) be a d. a. g. with the chronological constraints and let m be the number of processors Question: Minimize the length of the schedule 40

EPIT 2007 No -approximated algorithm if <4/3 We are going to show that :

EPIT 2007 No -approximated algorithm if <4/3 We are going to show that : Even if the graph is bipartite and the duration of all the tasks is equal to 1, knowing whether the graph can be scheduled in time 3 is an NP-complete problem The proof of this result suffices to conclude 41

EPIT 2007 The proof The problem of well-balanced independent set in bipartite graphs is

EPIT 2007 The proof The problem of well-balanced independent set in bipartite graphs is NP-complete Instance : G=(V 1 V 2, E) a bipartite graph Question : does there exist an independent set S in G such that |S|=|V 1| and |V 1|=|V 2| and |V 1 S|= |V 2 S|? 42

EPIT 2007 X with |X|=n W with |W|=n/2 Y with |Y|=n T with |T|=n/2

EPIT 2007 X with |X|=n W with |W|=n/2 Y with |Y|=n T with |T|=n/2 The edges of G Complete Graph 43

EPIT 2007 X with |X|=n W with |W|=n/2 Y with |Y|=n T with |T|=n/2

EPIT 2007 X with |X|=n W with |W|=n/2 Y with |Y|=n T with |T|=n/2 Scheduling this DAG in three steps on n processors is equivalent to showing the existence of a well-balanced independent set in the graph G. 44

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with |T|=n/2 Scheduling in 3 steps : no idle time 45

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with |T|=n/2 Scheduling in 3 steps : no idle time Step 1 : W and X 1 ( X 1 X, |X 1|=n/2) must be executed. 46

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with |T|=n/2 Scheduling in 3 steps : no idle time Step 1 : W and X 1 ( X 1 X, |X 1|=n/2) must be executed. Step 3 : T and Y 1 ( Y 1 Y, |Y 1|=n/2) must be executed. 47

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with |T|=n/2 Scheduling in 3 steps : no idle time Step 1 : W and X 1 ( X 1 X, |X 1|=n/2) must be executed. Step 2 : X 2 and Y 2 ( |X 2|=|Y 2|=n/2 ) must be executed. Step 3 : T and Y 1 ( Y 1 Y, |Y 1|=n/2) must be executed. 48

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with

EPIT 2007 X with |X|=n W with |W|=n/2 m=n Y with |Y|=n T with |T|=n/2 Scheduling in 3 steps : no idle time Step 2 : X 2 and Y 2 ( |X 2|=|Y 2|=n/2 ) must be executed. X 2 Y 2 is a well balanced independent set in the graph G 49

EPIT 2007 2 -approximated list scheduling Graham’s Theorem : all lists scheduling is a

EPIT 2007 2 -approximated list scheduling Graham’s Theorem : all lists scheduling is a 2 approximation for this problem. Proof: We can construct by induction a path in the d. a. g. such that at all the times, either a task in the path is executing or all the processors are working. 50

EPIT 2007 2 -approximated list scheduling construction of the path Take as t 1

EPIT 2007 2 -approximated list scheduling construction of the path Take as t 1 one of the tasks finishing at the end of the scheduling, and take as tk any predecessor of tk-1 which finishing last among all its predecessors. The construction is achieved when we arrive at a source (task with no predecessor) 51

EPIT 2007 2 -approximated list scheduling The sum of the times when all the

EPIT 2007 2 -approximated list scheduling The sum of the times when all the processors are working is smaller than the duration of the optimal scheduling and the rest of the time is smaller than the longer of the path and so the duration of the optimal scheduling. This concludes the proof. 52

EPIT 2007 Some remarks We have seen that the constraints of incompatibility yield a

EPIT 2007 Some remarks We have seen that the constraints of incompatibility yield a very difficult problem (non-APX) but the chronologic constraint yield an easier problem (often APX) but even polynomial if the number of processors is not bounded. 53

EPIT 2007 Other constraints Communication delays It is reasonable to assume that two tasks

EPIT 2007 Other constraints Communication delays It is reasonable to assume that two tasks executing on two different processors need to comunicate and this takes a certain delay. As a first approximation, we suppose that this delay is always equal to 1 like the duration of each task. 54

EPIT 2007 Communication delay : UET-UCT When the number of processors is not bounded,

EPIT 2007 Communication delay : UET-UCT When the number of processors is not bounded, the problem become APX and the duplication techniques permit to reduce sensitively the complexity (Colin-Chretienne show that the problem remain polynomial). Without duplication a lower bound of 7/6 has been found (Hoogeveen, Lenstra, Veltman). 55

EPIT 2007 Communication delay : UET - UCT Munier and Co have given a

EPIT 2007 Communication delay : UET - UCT Munier and Co have given a 4/3 -approximated algorithm. Their idea is to solve a linear problem which gives a solution smaller that the solution of the original problem. A rounding technique permit to give a realistic solution. 56

EPIT 2007 Communication delay: UET - UCT i cij j If di is the

EPIT 2007 Communication delay: UET - UCT i cij j If di is the starting time of i: dj di + 1 + cij where cij is equal to 0 only for one successor task of ti. The problem then amounts to giving each arc a value cij equal to 0 or 1, with the constraints that, for each task at most one incoming (resp. outcoming) arc has the value 0. 57

EPIT 2007 Communication delay : UET - UCT ti cij tj If every cij

EPIT 2007 Communication delay : UET - UCT ti cij tj If every cij takes its value in [0, 1] the problem becomes easy : the sum of the cij (resp. cji ) for a fixed i must be greater than the out-degree (resp. in-degree) minus 1. To find a realistic solution the integer value of the arc is 0 only if cij < 1/2. 58

EPIT 2007 Communication delay : UET - UCT ti cij tj The rounding step

EPIT 2007 Communication delay : UET - UCT ti cij tj The rounding step distends the path by a factor at most 4/3. Indeed suppose a path of length (k+1) with x arcs such that cij < ½ (i. e the cost of the path in the real solution is greater than 3/2 k 1/2 x+1). After rounding, the cost is 2 k-x+1. The ratio is always smaller of 4/3. 59

EPIT 2007 Unbounded vs. bounded number of processors Technique : folding. (each step of

EPIT 2007 Unbounded vs. bounded number of processors Technique : folding. (each step of the unbounded scheduling where x tasks are executing is transformed into x/m steps for the scheduling with m processors. Without communication : a polynomial problem becomes 2 -approximated algorithm With the uet-uct model : a -approximated algorithm becomes a ( +1)-approximated algorithm. 60

EPIT 2007 Other ratios have been used for approximation problems, the differential ratio for

EPIT 2007 Other ratios have been used for approximation problems, the differential ratio for example. Other constraints and other models : there is no small communication time (thin granularity i. e. more possibility of parallelism) 61