Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICS 353: Design and Analysis of Algorithms

Similar presentations


Presentation on theme: "ICS 353: Design and Analysis of Algorithms"— Presentation transcript:

1 ICS 353: Design and Analysis of Algorithms
King Fahd University of Petroleum & Minerals Information & Computer Science Department ICS 353: Design and Analysis of Algorithms Approximation Algorithms

2 Reading Assignment M. Alsuwaiyel, Introduction to Algorithms: Design Techniques and Analysis, World Scientific Publishing Co., Inc Chapter 15, Sections 1, 2,

3 Introduction Approximation algorithms attempt to find solutions that are “close enough” to the optimal solution, in polynomial time. Most approximation algorithms are based on greedy heuristics Will only see few examples

4 Terminology and Definitions
A combinatorial optimization problem  is a minimization problem or a maximization problem consisting of three components: A set D of instances I  D,  a finite set S(I) of candidate solutions for I.   S(I)  a value f() called the solution value for  If  is a minimization problem, I  D, then an optimal solution *  S(I) satisfies……..

5 Terminology and Definitions (Cont.)
An approximation algorithm A for an optimization problem  is a (polynomial time) algorithm such that given an instance I  D, it outputs some solution   S(I) Notation f ()  A(I) f (*)  OPT(I)

6 Example: Bin Packing Problem
Problem Statement: Given a collection of items {u1, u2, …, un} with sizes {s1, s2, …, sn} where i, 1  i  n, 0 < si  1, these items must be packed into the minimum number of bins of unit capacity. D : S : f () : Possible Approximation Algorithm:

7 Relative Performance Bounds
Let  be a minimization problem and I an instance of . Let A be an approximation algorithm to solve . The approximation ratio RA(I) is defined by If  is a maximization problem, …

8 Absolute and Asymptotic Performance Ratios
The absolute performance ratio RA for the approximation algorithm A is defined by The asymptotic performance ratio RA for the approximation algorithm A is defined by

9 The Bin-Packing Problem
Four Heuristics First Fit Best Fit First Fit Decreasing Best Fit Decreasing

10 The Bin-Packing Problem
Example: Consider the following items u1, u2, u3, u4, u5, u6, u7 with sizes .2, .5, .4, .7, .1, .3, .8 What is the optimal packing strategy? .8 .2 .3 .7 .5 .4 .1

11 The Bin-Packing Problem
First Fit (FF): Bins are indexed 1, 2, …, all initially empty Items are packed in the order u1, u2, …, un Packing Strategy: To pack item ui, find the least index j such that bin j contains at most 1 – si, and add item ui to the items packed in bin j.

12 The Bin-Packing Problem
Best Fit (BF): Bins are indexed 1, 2, …, all initially empty Items are packed in the order u1, u2, …, un Packing Strategy: To pack item ui, find the index j such that bin j is filled to level l  1 – si, and l is as large as possible

13 The Bin-Packing Problem
First Fit Decreasing (FFD): Bins are indexed 1, 2, …, all initially empty Items are first ordered by decreasing order of size ui1, ui2, …, uin Packing Strategy: same as FF method.

14 The Bin-Packing Problem
Best Fit Decreasing (BFD): Bins are indexed 1, 2, …, all initially empty Items are first ordered by decreasing order of size ui1, ui2, …, uin Packing Strategy: same as BF method.

15 The Bin-Packing Problem (Cont.)
Theorem: RFF < 2 Theorem: For all instances I of the bin packing problem, BF(I)  (17/10)OPT(I) Theorem: For all instances I of the bin packing problem, FFD(I)  (11/9)OPT(I) + 4

16 Euclidean Traveling Salesman Problem
Problem Statement: Given a set S of n points in the plane, find a tour  on these points of shortest length. NP-Hard Problem Greedy Approach (Nearest Neighbor NN Heuristic): Let p1 be an arbitrary starting point Find p2 closest to p1 and visit it. Repeat step 2 until all vertices are visited. RNN =  RNN(I) = NN(I) / OPT(I) = O(log n)

17 Euclidean Traveling Salesman Problem
Better Solution (MST Heuristic) Construct A minimum cost spanning tree T. Construct a multigraph T’ from T by making two copies of each edge in T. Find an Eulerian tour e An Eulerian tour is a cycle that visits every edge exactly once. Convert e into the desired Hamiltonian tour  by tracing e and deleting those vertices that have already been visited.

18 MST Heuristic Example: Theorem: RMST < 2


Download ppt "ICS 353: Design and Analysis of Algorithms"

Similar presentations


Ads by Google