SlideShare une entreprise Scribd logo
1  sur  14
Chapter 8

Approximation Algorithms
(Part II)

1
Outline



Scheduling Independent tasks
Bin packing

2
Scheduling independent tasks








An instance of the scheduling problem is defined by a
set of n task times, ti, 1≤ i ≤ n, and m, the number of
processors.
Obtaining minimum finish time schedules is NPcomplete.
The scheduling rule we will use is called the LPT
(longest processing time) rule.
Definition: An LPT schedule is one that is the result of
an algorithm, which, whenever a processor becomes
free, assigns to that processor a task whose time is the
largest of those tasks not yet assigned.

3
Example




Let m = 3, n = 6 and (t1, t2, t3, t4, t5, t6) = (8, 7, 6, 5, 4,
3). In an LPT schedule tasks 1, 2 and 3 respectively.
Tasks 1, 2, and 3 are assigned to processors 1, 2
and 3. Tasks 4, 5 and 6 are respectively assigned to
the processors 3, 2, and 1.
The finish time is 11. Since Σ ti /3 = 11, the schedule
is also optimal.
678

11

P1

1

6

P3

2

5

P3

3

4

4
Example


Let m = 3, n = 6 and (t1, t2, t3, t4, t5, t6, t7) = (5, 5, 4, 4, 3,
3, 3). The LPT schedule is shown in the following
figure. This has a finish time is 11. The optimal
schedule is 9. Hence, for this instance |F*(I) –
F(I)|/F*(I) = (11-9)/9=2/9.

4 5
P1

1

8
5

11
7

9
1

3
4

P2

2

6

2

P3

3

4

5

(a) LPT schedule

6

7

(b) Optimal schedule
5


While the LPT rule may generate optimal schedules for
some problem instances, it does not do so for all
instances. How bad can LPT schedules be relative to
optimal schedules?



Theorem: [Graham] Let F*(I) be the finish time of an
optimal m processor schedule for instance I of the task
scheduling problem. Let F(I) be the finish time of an LPT
schedule for the same instance, then
|F*(I)-F(I)|/F*(I) ≤ 1/3 – 1/(3m)

The proof of this theorem can be referred to the book
“Fundamentals of Computer Algorithms”, E. Horowitz and
S. Sahni, Pitman Publishing, 1978.

6
Bin Packing









We are given n objects which have to be placed in
bins of equal capacity L.
Object i requires li units of bin capacity.
The objective is to determine the minimum number
of bins needed to accommodate all n objects.
Example: Let L = 10, n = 6 and (l1, l2, l3, l4, l5, l6) = (5, 6,
3, 7, 5,4)
The bin packing problem is NP-complete.

7
Four heuristics






One can derive many simple heuristics for the bin
packing problem. In general, they will not obtain
optimal packings.
However, they obtain packings that use only a
“small” fraction of bins more than an optimal
packing.
Four heuristics:





First fit (FF)
Best fit (BF)
First fit Decreasing (FFD)
Best fit Decreasing (BFD)

8
First-fit and Best-fit


First-fit




Index the bins 1, 2, 3,… All bins are initially filled to level 0.
Objects are considered for packing in the order 1, 2, …, n.
To pack object i, find the least index j such that bin j is filled
to the level r (r ≤ L – li). Pack I into bin j. Bin j is now filled to
level r + li.

Best-fit


The initial conditions are the same as for FF. When object i
is being considered, find the least j such that bin j is filled to
a level r (r ≤ L – li) and r is as large as possible. Pack i into
bin j. Bin j is now filled to level r + li.

9
Example
6

(a) First Fit

3
1

5

1

2

4
5

(b) Best Fit

3
4
2

6

10
First-fit decreasing and Best-fit decreasing


First-fit decreasing (FFD)




Reorder the objects so that li ≥ li+1, 1 ≤ i ≤ n. Now
use First-fit to pack the objects.

Best-fit decreasing (BFD)


Reorder the objects so that li ≥ li+1, 1 ≤ i ≤ n. Now
use First-fit to pack the objects.

11
Example
3

6

4

2

5

1

(c) First Fit Decreasing and Best Fit Decreasing

FFD and BFD do better than either FF or BF on this
instance. While FFD and BFD obtain optimal packings on
this example, they do not in general obtain such a
packings.
12
Theorem


Let I be an instance of the bin packing problem and let
F*(I) be the minimum number of bins needed for this
instance. The packing generated by either FF or BF uses
no more than (17/10)F*(I)+2 bins. The packings
generated by either FFD or BFD uses no more than
(11/9)F*(I)+4 bins.



This proof of this theorem is long and complex (given by
Johnson et al., 1974).

13
Appendix: A Taxonomy of Algorithm
Design Strategies
Strategy name
Examples
---------------------------------------------------------------------------------------Bruce-force
Sequential search, selection sort
Divide-and-conquer
Quicksort, mergesort, binary search
Decrease-and-conquer
Insertion sort, DFS, BFS
Transform-and-conquer
heapsort, Gauss elimination
Greedy
Prim’s, Dijkstra’s
Dynamic Programming
Floyd’s
Backtracking
Branch-and-Bound
Approximate algorithms
Heuristics
Meta-heuristics
14

Contenu connexe

Tendances

String matching algorithms-pattern matching.
String matching algorithms-pattern matching.String matching algorithms-pattern matching.
String matching algorithms-pattern matching.Swapan Shakhari
 
Cs6503 theory of computation may june 2016 be cse anna university question paper
Cs6503 theory of computation may june 2016 be cse anna university question paperCs6503 theory of computation may june 2016 be cse anna university question paper
Cs6503 theory of computation may june 2016 be cse anna university question paperappasami
 
Cs6503 theory of computation november december 2016
Cs6503 theory of computation november december 2016Cs6503 theory of computation november december 2016
Cs6503 theory of computation november december 2016appasami
 
Cs6503 theory of computation november december 2015 be cse anna university q...
Cs6503 theory of computation november december 2015  be cse anna university q...Cs6503 theory of computation november december 2015  be cse anna university q...
Cs6503 theory of computation november december 2015 be cse anna university q...appasami
 
Cs6503 theory of computation april may 2017
Cs6503 theory of computation april may 2017Cs6503 theory of computation april may 2017
Cs6503 theory of computation april may 2017appasami
 
A Concurrent Language for Argumentation
A Concurrent Language for ArgumentationA Concurrent Language for Argumentation
A Concurrent Language for ArgumentationCarlo Taticchi
 
Timed Concurrent Language for Argumentation: an Interleaving Approach
Timed Concurrent Language for Argumentation: an Interleaving ApproachTimed Concurrent Language for Argumentation: an Interleaving Approach
Timed Concurrent Language for Argumentation: an Interleaving ApproachCarlo Taticchi
 
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeksBeginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeksJinTaek Seo
 
Enhancing user experiences with reactive extensions tccc10
Enhancing user experiences with reactive extensions   tccc10Enhancing user experiences with reactive extensions   tccc10
Enhancing user experiences with reactive extensions tccc10Bryan Anderson
 
32 -longest-common-prefix
32 -longest-common-prefix32 -longest-common-prefix
32 -longest-common-prefixSanjeev Gupta
 
Generazione Automatica di Test - S. Vuotto (Università di Sassari)
Generazione Automatica di Test - S. Vuotto (Università di Sassari)Generazione Automatica di Test - S. Vuotto (Università di Sassari)
Generazione Automatica di Test - S. Vuotto (Università di Sassari)Sardegna Ricerche
 
Answer True/False and explain for each part. (Short Answer) 1. Say that w...
Answer True/False and explain for each part. (Short Answer)     1. Say that w...Answer True/False and explain for each part. (Short Answer)     1. Say that w...
Answer True/False and explain for each part. (Short Answer) 1. Say that w...licservernoida
 

Tendances (17)

Model toc
Model tocModel toc
Model toc
 
String matching algorithms-pattern matching.
String matching algorithms-pattern matching.String matching algorithms-pattern matching.
String matching algorithms-pattern matching.
 
Cs6503 theory of computation may june 2016 be cse anna university question paper
Cs6503 theory of computation may june 2016 be cse anna university question paperCs6503 theory of computation may june 2016 be cse anna university question paper
Cs6503 theory of computation may june 2016 be cse anna university question paper
 
Cs6503 theory of computation november december 2016
Cs6503 theory of computation november december 2016Cs6503 theory of computation november december 2016
Cs6503 theory of computation november december 2016
 
Cs 62
Cs 62Cs 62
Cs 62
 
Cs6503 theory of computation november december 2015 be cse anna university q...
Cs6503 theory of computation november december 2015  be cse anna university q...Cs6503 theory of computation november december 2015  be cse anna university q...
Cs6503 theory of computation november december 2015 be cse anna university q...
 
Slides
SlidesSlides
Slides
 
Cs6503 theory of computation april may 2017
Cs6503 theory of computation april may 2017Cs6503 theory of computation april may 2017
Cs6503 theory of computation april may 2017
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
 
A Concurrent Language for Argumentation
A Concurrent Language for ArgumentationA Concurrent Language for Argumentation
A Concurrent Language for Argumentation
 
Timed Concurrent Language for Argumentation: an Interleaving Approach
Timed Concurrent Language for Argumentation: an Interleaving ApproachTimed Concurrent Language for Argumentation: an Interleaving Approach
Timed Concurrent Language for Argumentation: an Interleaving Approach
 
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeksBeginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
Beginning direct3d gameprogrammingmath02_logarithm_20160324_jintaeks
 
Enhancing user experiences with reactive extensions tccc10
Enhancing user experiences with reactive extensions   tccc10Enhancing user experiences with reactive extensions   tccc10
Enhancing user experiences with reactive extensions tccc10
 
Tsp is NP-Complete
Tsp is NP-CompleteTsp is NP-Complete
Tsp is NP-Complete
 
32 -longest-common-prefix
32 -longest-common-prefix32 -longest-common-prefix
32 -longest-common-prefix
 
Generazione Automatica di Test - S. Vuotto (Università di Sassari)
Generazione Automatica di Test - S. Vuotto (Università di Sassari)Generazione Automatica di Test - S. Vuotto (Università di Sassari)
Generazione Automatica di Test - S. Vuotto (Università di Sassari)
 
Answer True/False and explain for each part. (Short Answer) 1. Say that w...
Answer True/False and explain for each part. (Short Answer)     1. Say that w...Answer True/False and explain for each part. (Short Answer)     1. Say that w...
Answer True/False and explain for each part. (Short Answer) 1. Say that w...
 

Similaire à Chap8 part ii

Approximation algorithms
Approximation algorithmsApproximation algorithms
Approximation algorithmsGanesh Solanke
 
Bin packing problem two approximation
Bin packing problem two approximationBin packing problem two approximation
Bin packing problem two approximationijfcstjournal
 
BIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMS
BIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMSBIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMS
BIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMSijfcstjournal
 
7f44bdd880a385b7c1338293ea4183f930ea
7f44bdd880a385b7c1338293ea4183f930ea7f44bdd880a385b7c1338293ea4183f930ea
7f44bdd880a385b7c1338293ea4183f930eaAlvaro
 
data structures and algorithms Unit 4
data structures and algorithms Unit 4data structures and algorithms Unit 4
data structures and algorithms Unit 4infanciaj
 
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf DfghhjkkjjjjmkkkjnjjjjmmmkBinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf DfghhjkkjjjjmkkkjnjjjjmmmkShivaniSharma335055
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiouvafopoulos
 
Ch-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsCh-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsMAHERMOHAMED27
 
algorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptxalgorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptxkassahungebrie
 
An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...
An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...
An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...Joe Andelija
 
1 chapter1 introduction
1 chapter1 introduction1 chapter1 introduction
1 chapter1 introductionSSE_AndyLi
 
Hardness of approximation
Hardness of approximationHardness of approximation
Hardness of approximationcarlol
 
A novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimizationA novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimizationeSAT Publishing House
 

Similaire à Chap8 part ii (20)

Approximation algorithms
Approximation algorithmsApproximation algorithms
Approximation algorithms
 
Bin packing
Bin packingBin packing
Bin packing
 
04greedy 2x2
04greedy 2x204greedy 2x2
04greedy 2x2
 
Bin packing problem two approximation
Bin packing problem two approximationBin packing problem two approximation
Bin packing problem two approximation
 
BIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMS
BIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMSBIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMS
BIN PACKING PROBLEM: TWO APPROXIMATION ALGORITHMS
 
7f44bdd880a385b7c1338293ea4183f930ea
7f44bdd880a385b7c1338293ea4183f930ea7f44bdd880a385b7c1338293ea4183f930ea
7f44bdd880a385b7c1338293ea4183f930ea
 
data structures and algorithms Unit 4
data structures and algorithms Unit 4data structures and algorithms Unit 4
data structures and algorithms Unit 4
 
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf DfghhjkkjjjjmkkkjnjjjjmmmkBinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
BinPacking.pdf Dfghhjkkjjjjmkkkjnjjjjmmmk
 
Exam100412
Exam100412Exam100412
Exam100412
 
12-greedy.ppt
12-greedy.ppt12-greedy.ppt
12-greedy.ppt
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
 
Ch-2 final exam documet compler design elements
Ch-2 final exam documet compler design elementsCh-2 final exam documet compler design elements
Ch-2 final exam documet compler design elements
 
algorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptxalgorithm assignmenteeeeeee.pptx
algorithm assignmenteeeeeee.pptx
 
An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...
An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...
An Exact Exponential Branch-And-Merge Algorithm For The Single Machine Total ...
 
1 chapter1 introduction
1 chapter1 introduction1 chapter1 introduction
1 chapter1 introduction
 
Module 3_DAA (2).pptx
Module 3_DAA (2).pptxModule 3_DAA (2).pptx
Module 3_DAA (2).pptx
 
Hardness of approximation
Hardness of approximationHardness of approximation
Hardness of approximation
 
A novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimizationA novel work for bin packing problem by ant colony optimization
A novel work for bin packing problem by ant colony optimization
 
Sol69
Sol69Sol69
Sol69
 
Sol69
Sol69Sol69
Sol69
 

Plus de Loc Tran

đạI học quốc gia thành phố hồ chí minh
đạI học quốc gia thành phố hồ chí minhđạI học quốc gia thành phố hồ chí minh
đạI học quốc gia thành phố hồ chí minhLoc Tran
 
Chap4 new (tran dai's conflicted copy 2013 04-02)
Chap4 new (tran dai's conflicted copy 2013 04-02)Chap4 new (tran dai's conflicted copy 2013 04-02)
Chap4 new (tran dai's conflicted copy 2013 04-02)Loc Tran
 
Chap2 new (tran dai's conflicted copy 2013 04-02)
Chap2 new (tran dai's conflicted copy 2013 04-02)Chap2 new (tran dai's conflicted copy 2013 04-02)
Chap2 new (tran dai's conflicted copy 2013 04-02)Loc Tran
 
Chap1 new (tran dai's conflicted copy 2013 04-02)
Chap1 new (tran dai's conflicted copy 2013 04-02)Chap1 new (tran dai's conflicted copy 2013 04-02)
Chap1 new (tran dai's conflicted copy 2013 04-02)Loc Tran
 
Appendix b 2
Appendix b 2Appendix b 2
Appendix b 2Loc Tran
 
Appendix a 2
Appendix a 2Appendix a 2
Appendix a 2Loc Tran
 

Plus de Loc Tran (13)

đạI học quốc gia thành phố hồ chí minh
đạI học quốc gia thành phố hồ chí minhđạI học quốc gia thành phố hồ chí minh
đạI học quốc gia thành phố hồ chí minh
 
Chap8 new
Chap8 newChap8 new
Chap8 new
 
Chap7 new
Chap7 newChap7 new
Chap7 new
 
Chap6 new
Chap6 newChap6 new
Chap6 new
 
Chap5 new
Chap5 newChap5 new
Chap5 new
 
Chap4 new
Chap4 newChap4 new
Chap4 new
 
Chap4 new (tran dai's conflicted copy 2013 04-02)
Chap4 new (tran dai's conflicted copy 2013 04-02)Chap4 new (tran dai's conflicted copy 2013 04-02)
Chap4 new (tran dai's conflicted copy 2013 04-02)
 
Chap3 new
Chap3 newChap3 new
Chap3 new
 
Chap2 new
Chap2 newChap2 new
Chap2 new
 
Chap2 new (tran dai's conflicted copy 2013 04-02)
Chap2 new (tran dai's conflicted copy 2013 04-02)Chap2 new (tran dai's conflicted copy 2013 04-02)
Chap2 new (tran dai's conflicted copy 2013 04-02)
 
Chap1 new (tran dai's conflicted copy 2013 04-02)
Chap1 new (tran dai's conflicted copy 2013 04-02)Chap1 new (tran dai's conflicted copy 2013 04-02)
Chap1 new (tran dai's conflicted copy 2013 04-02)
 
Appendix b 2
Appendix b 2Appendix b 2
Appendix b 2
 
Appendix a 2
Appendix a 2Appendix a 2
Appendix a 2
 

Dernier

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Dernier (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

Chap8 part ii

  • 3. Scheduling independent tasks     An instance of the scheduling problem is defined by a set of n task times, ti, 1≤ i ≤ n, and m, the number of processors. Obtaining minimum finish time schedules is NPcomplete. The scheduling rule we will use is called the LPT (longest processing time) rule. Definition: An LPT schedule is one that is the result of an algorithm, which, whenever a processor becomes free, assigns to that processor a task whose time is the largest of those tasks not yet assigned. 3
  • 4. Example   Let m = 3, n = 6 and (t1, t2, t3, t4, t5, t6) = (8, 7, 6, 5, 4, 3). In an LPT schedule tasks 1, 2 and 3 respectively. Tasks 1, 2, and 3 are assigned to processors 1, 2 and 3. Tasks 4, 5 and 6 are respectively assigned to the processors 3, 2, and 1. The finish time is 11. Since Σ ti /3 = 11, the schedule is also optimal. 678 11 P1 1 6 P3 2 5 P3 3 4 4
  • 5. Example  Let m = 3, n = 6 and (t1, t2, t3, t4, t5, t6, t7) = (5, 5, 4, 4, 3, 3, 3). The LPT schedule is shown in the following figure. This has a finish time is 11. The optimal schedule is 9. Hence, for this instance |F*(I) – F(I)|/F*(I) = (11-9)/9=2/9. 4 5 P1 1 8 5 11 7 9 1 3 4 P2 2 6 2 P3 3 4 5 (a) LPT schedule 6 7 (b) Optimal schedule 5
  • 6.  While the LPT rule may generate optimal schedules for some problem instances, it does not do so for all instances. How bad can LPT schedules be relative to optimal schedules?  Theorem: [Graham] Let F*(I) be the finish time of an optimal m processor schedule for instance I of the task scheduling problem. Let F(I) be the finish time of an LPT schedule for the same instance, then |F*(I)-F(I)|/F*(I) ≤ 1/3 – 1/(3m) The proof of this theorem can be referred to the book “Fundamentals of Computer Algorithms”, E. Horowitz and S. Sahni, Pitman Publishing, 1978. 6
  • 7. Bin Packing      We are given n objects which have to be placed in bins of equal capacity L. Object i requires li units of bin capacity. The objective is to determine the minimum number of bins needed to accommodate all n objects. Example: Let L = 10, n = 6 and (l1, l2, l3, l4, l5, l6) = (5, 6, 3, 7, 5,4) The bin packing problem is NP-complete. 7
  • 8. Four heuristics    One can derive many simple heuristics for the bin packing problem. In general, they will not obtain optimal packings. However, they obtain packings that use only a “small” fraction of bins more than an optimal packing. Four heuristics:     First fit (FF) Best fit (BF) First fit Decreasing (FFD) Best fit Decreasing (BFD) 8
  • 9. First-fit and Best-fit  First-fit   Index the bins 1, 2, 3,… All bins are initially filled to level 0. Objects are considered for packing in the order 1, 2, …, n. To pack object i, find the least index j such that bin j is filled to the level r (r ≤ L – li). Pack I into bin j. Bin j is now filled to level r + li. Best-fit  The initial conditions are the same as for FF. When object i is being considered, find the least j such that bin j is filled to a level r (r ≤ L – li) and r is as large as possible. Pack i into bin j. Bin j is now filled to level r + li. 9
  • 11. First-fit decreasing and Best-fit decreasing  First-fit decreasing (FFD)   Reorder the objects so that li ≥ li+1, 1 ≤ i ≤ n. Now use First-fit to pack the objects. Best-fit decreasing (BFD)  Reorder the objects so that li ≥ li+1, 1 ≤ i ≤ n. Now use First-fit to pack the objects. 11
  • 12. Example 3 6 4 2 5 1 (c) First Fit Decreasing and Best Fit Decreasing FFD and BFD do better than either FF or BF on this instance. While FFD and BFD obtain optimal packings on this example, they do not in general obtain such a packings. 12
  • 13. Theorem  Let I be an instance of the bin packing problem and let F*(I) be the minimum number of bins needed for this instance. The packing generated by either FF or BF uses no more than (17/10)F*(I)+2 bins. The packings generated by either FFD or BFD uses no more than (11/9)F*(I)+4 bins.  This proof of this theorem is long and complex (given by Johnson et al., 1974). 13
  • 14. Appendix: A Taxonomy of Algorithm Design Strategies Strategy name Examples ---------------------------------------------------------------------------------------Bruce-force Sequential search, selection sort Divide-and-conquer Quicksort, mergesort, binary search Decrease-and-conquer Insertion sort, DFS, BFS Transform-and-conquer heapsort, Gauss elimination Greedy Prim’s, Dijkstra’s Dynamic Programming Floyd’s Backtracking Branch-and-Bound Approximate algorithms Heuristics Meta-heuristics 14