§1 Greedy Algorithms ALGORITHM DESIGN TECHNIQUES

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
C) between 18 and 27. D) between 27 and 50.
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Introduction to Algorithms
QUEUE Education is the best friend. An educated person is respected everywhere. Education beats the beauty and the youth. Chanakya.
Unit-iv.
Constraint Satisfaction Problems
1
1 Vorlesung Informatik 2 Algorithmen und Datenstrukturen (Parallel Algorithms) Robin Pomplun.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
and 6.855J Spanning Tree Algorithms. 2 The Greedy Algorithm in Action
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Summary of Convergence Tests for Series and Solved Problems
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
Custom Statutory Programs Chapter 3. Customary Statutory Programs and Titles 3-2 Objectives Add Local Statutory Programs Create Customer Application For.
CALENDAR.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
1 Outline relationship among topics secrets LP with upper bounds by Simplex method basic feasible solution (BFS) by Simplex method for bounded variables.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
The 5S numbers game..
COMP 482: Design and Analysis of Algorithms
Break Time Remaining 10:00.
Turing Machines.
Artificiel Bee Colony (ABC) Algorithme Isfahan University of Technology Fall Elham Seifossadat Faegheh Javadi.
1 Column Generation. 2 Outline trim loss problem different formulations column generation the trim loss problem master problem and subproblem in column.
PP Test Review Sections 6-1 to 6-6
1 Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Welcome to CSCA67 Discrete Mathematics for Computer Scientists
Priority Queues Two kinds of priority queues: Min priority queue. Max priority queue.
VOORBLAD.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
© 2012 National Heart Foundation of Australia. Slide 2.
Adding Up In Chunks.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
25 seconds left…...
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Week 1.
10 -1 Chapter 10 Amortized Analysis A sequence of operations: OP 1, OP 2, … OP m OP i : several pops (from the stack) and one push (into the stack)
Analyzing Genes and Genomes
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Essential Cell Biology
Chapter 15: Quantitatve Methods in Health Care Management Yasar A. Ozcan 1 Chapter 15. Simulation.
Clock will move after 1 minute
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Other Dynamic Programming Problems
Physics for Scientists & Engineers, 3rd Edition
Energy Generation in Mitochondria and Chlorplasts
Select a time to count down from the clock above
Distributed Computing 9. Sorting - a lower bound on bit complexity Shmuel Zaks ©
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
Chapter 5 The Mathematics of Diversification
 Review: The Greedy Method
Presentation transcript:

§1 Greedy Algorithms ALGORITHM DESIGN TECHNIQUES CHAPTER 10 ALGORITHM DESIGN TECHNIQUES §1 Greedy Algorithms  Optimization Problems: Given a set of constrains and an optimization function. Solutions that satisfy the constrains are called feasible solutions. A feasible solution for which the optimization function has the best possible value is called an optimal solution.  The Greedy Method: Make the best decision at each stage, under some greedy criterion. A decision made in one stage is not changed in a later stage, so each decision should assure feasibility. 1/7

1. A Simple Scheduling Problem §1 Greedy Algorithms Note: Greedy algorithm works only if the local optimum is equal to the global optimum. Greedy algorithm does not guarantee optimal solutions. However, it generally produces solutions that are very close in value (heuristics) to the optimal, and hence is intuitively appealing when finding the optimal solution takes too much time. 1. A Simple Scheduling Problem  The Single Processor Case Given N jobs j1 , j2 , …, jN , their running times t1 , t2 , …, tN , and one processor. Schedule jobs to minimize the average completion time. /* assume nonpreemptive scheduling */ 2/7

Best scheduling is to make { tik } nondecreasing. §1 Greedy Algorithms 〖Example〗 job time j1 j2 j3 j4 15 8 3 10 Schedule 1 j1 15 j2 23 j3 26 j4 36 Best scheduling is to make { tik } nondecreasing. Tavg = ( 15 + 23 + 26 + 36 ) / 4 = 25 Schedule 2 j3 3 j2 11 j4 21 j1 36 Tavg = ( 3 + 11 + 21 + 36 ) / 4 = 17.75 In general: ji1 ti1 ji2 ti1 + ti2 ji3 ti1 + ti2 + ti3 … … 3/7

 The Multiprocessor Case – N jobs on P processors §1 Greedy Algorithms  The Multiprocessor Case – N jobs on P processors 〖Example〗 P = 3 job time j1 j2 j3 j4 3 5 6 10 j5 j6 j7 j8 11 14 15 18 j9 20 An Optimal Solution Another Optimal Solution j1 3 j2 5 j3 6 j4 15 j5 14 j6 20 j7 30 j8 38 j9 34 j1 3 j4 13 j7 28 j2 5 j5 16 j8 34 j3 6 j6 20 j9 40  Minimizing the Final Completion Time An Optimal Solution j1 3 j2 5 j3 9 j4 19 j5 16 j6 14 j7 j8 34 j9 NP Hard 4/7

 jij must be processed by Pj and the processing time is tij . §1 Greedy Algorithms  Flow Shop Scheduling – a simple case with 2 processors Consider a machine shop that has 2 identical processors P1 and P2 . We have N jobs J1, ... , JN that need to be processed. Each job Ji can be broken into 2 tasks ji1 and ji2 . If there is an ai = 0, then we can schedule all the jobs with aj  0 first. Then we insert the jobs with ai = 0 to the front of the schedule list in arbitrary order. A schedule is an assignment of jobs to time intervals on machines such that  jij must be processed by Pj and the processing time is tij .  No machine processes more than one job at any time.  ji2 may not be started before ji1 is finished. Construct a minimum-completion-time 2 machine schedule for a given set of N jobs. Let ai = ti1  0, and bi = ti2 . 〖Example〗 Given N = 4, T1234 = ? 40 5/7

【Proposition】 An optimal schedule exists if min { bi , aj }  §1 Greedy Algorithms 【Proposition】 An optimal schedule exists if min { bi , aj }  min { bj , ai } for any pair of adjacent jobs Ji and Jj . All the schedules with this property have the same completion time. Algorithm { Sort { a1 , ... , aN , b1 , ... , bN } into non-decreasing sequence ; m = minimum element ; do { if ( ( m == ai ) && ( Ji is not in the schedule ) ) Place Ji at the left-most empty position ; else if ( ( m == bj ) && ( Jj is not in the schedule ) ) Place Jj at the right-most empty position ; m = next minimum element ; } while ( m ); } T = O( N log N ) 〖Example〗 Given N = 4, J1 J3 J4 J2 Sorting  { b2 a1 a2 b1 a3 b3 a4 b4 } T1342 = ? 38 6/7

Due: Monday, January 15th, 2006 at 10:00pm §1 Greedy Algorithms Bonus Problem 1 The Best ACT Due: Monday, January 15th, 2006 at 10:00pm Detailed requirements can be downloaded from http://10.71.45.99/list.asp?boardid=47 Courseware Download Hint: Carefully consider the range of integers to avoid RunTime Error. 7/7