Algorithm Design Methods Spring 2007 CSE, POSTECH.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

Unit-iv.
Algorithm Design Methods (I) Fall 2003 CSE, POSTECH.
 Review: The Greedy Method
1 LP Duality Lecture 13: Feb Min-Max Theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Greedy Algorithms.
GRAPH BALANCING. Scheduling on Unrelated Machines J1 J2 J3 J4 J5 M1 M2 M3.
Chapter 5 Fundamental Algorithm Design Techniques.
Greed is good. (Some of the time)
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Algorithms + L. Grewe.
Chapter 4 The Greedy Approach. Minimum Spanning Tree A tree is an acyclic, connected, undirected graph. A spanning tree for a given graph G=, where E.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
Lecture 7: Greedy Algorithms II Shang-Hua Teng. Greedy algorithms A greedy algorithm always makes the choice that looks best at the moment –My everyday.
Dealing with NP-Complete Problems
Approximation Algorithms
The Theory of NP-Completeness
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
Week 2: Greedy Algorithms
Fundamental Techniques
Lecture 7: Greedy Algorithms II
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
IT 60101: Lecture #201 Foundation of Computing Systems Lecture 20 Classic Optimization Problems.
Introduction to Job Shop Scheduling Problem Qianjun Xu Oct. 30, 2001.
Chapter 1. Formulations 1. Integer Programming  Mixed Integer Optimization Problem (or (Linear) Mixed Integer Program, MIP) min c’x + d’y Ax +
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Approximation Algorithms These lecture slides are adapted from CLRS.
Greedy Methods and Backtracking Dr. Marina Gavrilova Computer Science University of Calgary Canada.
1 Short Term Scheduling. 2  Planning horizon is short  Multiple unique jobs (tasks) with varying processing times and due dates  Multiple unique jobs.
For Wednesday No reading No homework There will be homework for Friday, as well the program being due – plan ahead.
CSCI 256 Data Structures and Algorithm Analysis Lecture 6 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Greedy Algorithms. What is “Greedy Algorithm” Optimization problem usually goes through a sequence of steps A greedy algorithm makes the choice looks.
Algorithm Design Methods 황승원 Fall 2011 CSE, POSTECH.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Chapter 11 Approximation Algorithms Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.
1 Approximation algorithms Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij TexPoint fonts used in EMF. Read the TexPoint manual.
© The McGraw-Hill Companies, Inc., Chapter 1 Introduction.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
1 Ch18. The Greedy Methods. 2 BIRD’S-EYE VIEW Enter the world of algorithm-design methods In the remainder of this book, we study the methods for the.
Exhaustive search Exhaustive search is simply a brute- force approach to combinatorial problems. It suggests generating each and every element of the problem.
The Theory of NP-Completeness
8.3.2 Constant Distance Approximations
Some Topics in OR.
Hard Problems Some problems are hard to solve.
Algorithm Design Methods
Design and Analysis of Algorithm
Greedy Algorithms / Interval Scheduling Yin Tat Lee
Heuristics Definition – a heuristic is an inexact algorithm that is based on intuitive and plausible arguments which are “likely” to lead to reasonable.
Neural Networks for Vertex Covering
Exam 2 LZW not on syllabus. 73% / 75%.
Richard Anderson Lecture 28 Coping with NP-Completeness
Course Contents: T1 Greedy Algorithm Divide & Conquer
Lecture 11 Overview Self-Reducibility.
Richard Anderson Lecture 30 NP-Completeness
Richard Anderson Lecture 6 Greedy Algorithms
Chapter 1. Formulations (BW)
Richard Anderson Autumn 2016 Lecture 7
Richard Anderson Lecture 7 Greedy Algorithms
Algorithm Design Methods
Topic 15 Job Shop Scheduling.
EE5900 Advanced Embedded System For Smart Infrastructure
Lecture 6 Greedy Algorithms
Algorithm Design Methods
The Theory of NP-Completeness
Richard Anderson Winter 2019 Lecture 7
Richard Anderson Autumn 2015 Lecture 7
Advance Algorithm Dynamic Programming
Chapter 1. Formulations.
Algorithm Design Methods
Presentation transcript:

Algorithm Design Methods Spring 2007 CSE, POSTECH

Algorithm Design Methods Greedy method Divide and conquer Dynamic programming Backtracking Branch and bound

Some Methods Not Covered Linear Programming Integer programming Simulated annealing Neural networks Genetic algorithms Tabu search

Optimization Problem A problem in which some function (called the optimization/objective function) is to be optimized (usually minimized or maximized) It is subject to some constraints.

Machine Scheduling Find a schedule that minimizes the finish time. – optimization function … finish time – constraints Each job is scheduled continuously on a single machine for an amount of time equal to its processing requirement. No machine processes more than one job at a time.

Bin Packing Pack items into bins using fewest number of bins. – optimization function … number of bins – constraints Each item is packed into a single bin. The capacity of no bin is exceeded.

Min Cost Spanning Tree Find a spanning tree that has minimum cost. – optimization function … sum of edge costs – constraints Must select n-1 edges of the given n vertex graph. The selected edges must form a tree.

Feasible and Optimal Solutions A feasible solution is a solution that satisfies the constraints. An optimal solution is a feasible solution that optimizes the objective/optimization function.

Greedy Method Solve problem by making a sequence of decisions. Decisions are made one by one in some order. Each decision is made using a greedy criterion. A decision, once made, is (usually) not changed later.

Machine Scheduling LPT Scheduling. Schedule jobs one by one in decreasing order of processing time. Each job is scheduled on the machine on which it finishes earliest. Scheduling decisions are made serially using a greedy criterion (minimize finish time of this job). LPT scheduling is an application of the greedy method.

LPT Schedule LPT rule does not guarantee minimum finish time schedules. (LPT Finish Time)/(Minimum Finish Time) <= 4/3 – 1/(3m) where m is number of machines. Minimum finish time scheduling is NP-hard. In this case, the greedy method does not work. Greedy method does, however, give us a good heuristic for machine scheduling.

Container Loading Ship has capacity c. m containers are available for loading. Weight of container i is w i. Each weight is a positive number. Sum of container weight > c. Load as many containers as possible without sinking the ship.

Greedy Solution Load containers in increasing order of weight until we get to a container that does not fit. Does this greedy algorithm always load the maximum number of containers. Yes. May be proved using a proof by induction. (see Theorem 13.1, p. 624 of text.)

Container Loading With 2 Ships Can all containers be loaded into 2 ships whose capacity is c (each)? – Same as bin packing with 2 bins (Are 2 bins sufficient for all items?) – Same as machine scheduling with 2 machines (Can all jobs be completed by 2 machines in c time units?) – NP-hard

0/1 Knapsack Problem Hiker wishes to take n items on a trip. The weight of item i is w i. The knapsack has a weight capacity c. When sum of items weights <= c, all n items can be carried in the knapsack. When sum of item weights > c, some items must be left behind. Which items should be taken out?

0/1 Knapsack Problem Hiker assigns a profit/value p i to item i. All weights and profits are positive numbers. Hiker wants to select a subset of the n items to take. – The weight of the subset should not exceed the capacity of the knapsack. (constraint) – Cannot select a fraction of an item. (constraint) – The profit/value of the subset is the sum of the profits of the selected items. (optimization function) – The profit/value of the selected subset should be maximum. (optimization criterion)

0/1 Knapsack Problem Letx i =1 when item i is selected and letx i =0 when item i is not selected. maximize Sigma(i=1…n) p i x i subject to Sigma(i=1…n) w i x i <= c

Greedy Attempt 1 Be greedy on capacity utilization (select items in increasing order of weight). n = 2, c = 7 w = [3, 6] p = [2, 10] Only 1 item is selected. Profit/value of selection is 2. It is not best selection.

Greedy Attempt 2 Be greedy on profit earned (select items in decreasing order of profit). n = 3, c = 7 w = [7, 3, 2] p = [10, 8, 6] Only 1 item is selected. Profit/value of selection is 10. It is not best selection.

Greedy Attempt 3 Be greedy on profit density (p/w) (select items in decreasing order of profit density). n = 2, c = 7 w = [1, 7] p = [10, 20] Only 1 item is selected. Profit/value of selection is 10. It is not best selection.

Greedy Attempt 3 Be greedy on profit density (p/w). – works when selecting a fraction of an item is permitted. – Select items in decreasing order of profit density; if next item doesnt fit, take a fraction to fill knapsack. n = 2, c = 7 w = [1, 7] p = [10, 20] Item 1 and 6/7 of item 2 are selected.

0/1 Knapsack Greedy Heuristics Greedy Attempt 4 Select a subset with <= k items. If the weight of this subset is > c, discard the subset. If the subset weight is <= c, fill as much of the remaining capacity as possible by being greedy on profit density. Try all subsets with <= k items and select the one that yields maximum profit.

0/1 Knapsack Greedy Heuristics First sort into decreasing order of profit density. There are O(n k ) subsets with at most k items. (C(n,1) + C(n,2) + C(n,3) + … + C(n,k)) Try a subset takes O(n) time. Total time is O(n k+1 ) where k > 0. (best value – greedy value) / best value <= 1/(k+1)

0/1 Knapsack Greedy Heuristics