greedy algorithm presentation 2011

Upload: naimamanzoor

Post on 16-Jul-2015

90 views

Category:

Documents


7 download

TRANSCRIPT

Greedy Approach

Attempt to find an optimal solution in each stage Make decision that appears to be best at that stage

It never reconsiders a decision once madeWhat is best now, may be worst later!! Fails to find a globally optimal solution

Bin-PackingINTRODUCTION:

Packing various items of certain sizes into a minimum number of bins with a fixed size Bin size is usually smaller than the sum of all objects

5 1 2 3 4 A B C

Application

Filling up containers Loading trucks with weight capacity Creating file backup in removable media Tapes and songs Breaks and commercials Bandwidth and packets Technology mapping in field-programmable gate array semiconductor chip design

Algorithm (Next-Fit)FOR all objects i = 1, 2, . . . , n do WHILE ( Current Bin !