Assignment 5
CSCI 3110: Design and Analysis of Algorithms
Due June 16, 2014
Banner ID: Name:
Banner ID: Name:
Banner ID: Name:
Assignments are due on the due date before class and have to
include this cover page. Plagiarism in assignment answers
will not be tolerated. By submitting their answers to this
assignment, the authors named above declare that its content
is their original work and that they did not use any sources for
its preparation other than the class notes, the textbook,
and ones explicitly acknowledged in the answers. Any suspected
act of plagiarism will be reported to the Faculty’s
Academic Integrity Officer and possibly to the Senate
Discipline Committee. The penalty for academic dishonesty may
range from failing the course to expulsion from the university,
in accordance with Dalhousie University’s regulations
regarding academic integrity.
This assignment studies a problem with applications in parallel
scheduling. You are given a set of jobs J1, J2, . . . , Jn you
want to run on your super powerful parallel computer with k
processors P1, P2, . . . , Pk. For each job Ji , you are given
a prediction ti of the amount of time it takes to run this job on a
single processor. A job cannot be split, that is, once
assigned to a given processor it needs to be run to completion
by this processor. Let S j be the set of jobs you choose
to run on processor Pj . Then processor Pj finishes its work in
Tj =
∑
Ji∈ S j
ti time. A schedule is a partition of the set
S = {J1, J2, . . . , Jn} into subsets S1, S2, . . . , Sk of jobs
assigned to processors P1, P2, . . . , Pk (that is,
⋃k
j=1 S j = S and, for all
j 6= j′, S j ∩ S j′ = ;). The makespan of this schedule is max{T1,
T2, . . . , Tk}, that is, the time at which the last processor
finishes its assigned work. In order to best utilize the computing
power of your parallel computer, you try to find a
schedule that minimizes the makespan. This problem turns out
to be NP-hard to solve, even with only two processors.
For such problems, we need to look for approximate solutions
or for special types of inputs for which the problem can be
solved exactly in polynomial time. This is the goal of this
assignment.
Question 1 (10 marks) Describe a simple greedy algorithm that
computes a 2-approximation of the optimal schedule.
In other words, if T∗ is the smallest possible makespan
achievable for the given set of jobs using k processors, then the
schedule produced by your algorithm should have a makespan
of at most 2T∗ . Your algorithm should run in O(kn) time.
Prove that the schedule produced by your algorithm has
makespan at most 2T∗ . To do so, you will probably want to use
two properties the minimum makespan T∗ must obviously
satisfy:
• T∗ ≥ 1
k
∑k
i=1 ti . (The processor doing the most amount of work must do
at least a 1/k fraction of the total amount
of work.)
• T∗ ≥ max{t1, t2, . . . , tn}. (The longest job needs to run on
some processor Pj , so this processor finishes no earlier
than the time it takes to complete this job.)
You should then prove that the schedule produced by your
algorithm has makespan at most 1
k
∑k
i=1 ti+max{t1, t2, . . . , tn}.
Question 2 (10 marks) Describe a modification of the above
greedy algorithm that computes an optimal schedule,
that is, one with the smallest possible makespan, provided the
given set of jobs satisfies the following condition: Let
t1, t2, . . . , tn once again be the predicted amounts of time it
takes to run jobs J1, J2, . . . , Jn, and let t
∗ = min{t1, t2, . . . , tn}.
You may assume that t∗ = 1. Then, for all 1 ≤ i ≤ n, ti is a
power of 2. Your algorithm should run in O(n lg n + kn) time.
Prove that it produces an optimal schedule.
1
Copy of Litware Sales.xlsx
Sheet1Litware, Inc.Semiannual Sales ReportSales
Representative January Bush,
Patricia11850$12,500$14,560$12,215$18,504$16,895Chisholm,
Martin1285012,50015,69811,02517,56811,875Cook, Cathan,
210082090021155115222512320357Tippett,
John956425800119569870698513789Turner,
Olinda109542075421563102541256825845Poe,
Deborah118501195615685165212587412456Singh,
Paul14856128991552414756189548796Smith-Bates,
Lorrin250112387123547205682158723879$ 117,943$
141,180$ 139,688$ 106,731$ 147,163$ 133,892
Sheet2
Copy of SFA Enrollment Update.xlsx
Sheet1School of Fine ArtFine Arts DepartmentEnrollmentCall
No.CourseFallFA 100Acrylics145FA104Basic Drawing231FA
107Bookbinding & the Artist's Book87FA
201Ceramics232FA204Figure Drawing187FA205Illustration
Techniques243FA206Introduction to Design and
Color221FA207Mixed-Media Collage121FA208Oil
Painting98FA321Portfolio Development158FA262Water
Color206
Sheet2School of Fine ArtsMedia Studies
DepartmentEnrollmentCall No.CourseFallMS 100Adobe
Illustrator322MS104Adobe Photoshop Illustration233MS
107Digital Photography156MS 201Flash446MS204Graphic
Fundamentals126MS205Job
Advantage778MS206Photography288MS207Photoshop: Basics
& Beyond987MS208Photoshop for
Photographers332MS321Using Adobe In Design267MS262Web
Design554
Sheet3
Copy of SFA Enrollment.xlsx
Sheet1Fall Quarter EnrollmentFine Arts DepartmentFall Quarter
EnrollmentFA100Acrylics145FA104Basic
Drawing231FA107Bookbinding & the Artist's
Book87FA201Ceramics232FA204Figure
Drawing187FA205Illustration
Techniques243FA206Introduction to Design and
Color221FA207Mixed-Media Collage121FA208Oil
Painting98FA321Portfolio Development158FA262Water
Color206
Sheet2Fall Quarter EnrollmentMedia Studies DepartmentMS
100Adobe Illustrator322MS104Adobe Photoshop
Illustration233MS 107Digital Photography156MS
201Flash446MS204Graphic Fundamentals126MS205Job
Advantage778MS206Photography288MS207Photoshop: Basics
& Beyond987MS208Photoshop for
Photographers332MS321Using Adobe In Design267MS262Web
Design554
Sheet3
Copy of Top Ten.xlsx
Sheet1Fortune Magazine*Top Ten Companies to Work
ForRankCompanyU. S. Employees% Minorities%
Women1Genentech181242502Wegmans3189015543Valero
Energy1658240404Griffin Hospital104910785W. L.
Gore453715406Container Store285729627Vision Service
Plan196830688J. M. Smucker293024449REI7443124010S. C.
Johnson and Son34041538*Data based on 2006 Rankings
Project 1-6, &F
Sheet2
Sheet3
Copy of Tailspin Toys.xlsx
Sheet1Tailspin ToysSecond Quarter Earnings April May June
TOTAL Sales $61,254$69,302$68,521 Cost of Goods Sold
$38,895$37,568$39,521 Gross Margin Marketing Expense
$2,154$2,852$2,822 Administrative Expense
$4,456$4,124$4,589Miscellaneous Expense $1,059$1,205$1,502
Total Expenses Net Income Before Taxes Federal Taxes
$4,995$8,008$6,830 Net Income After Taxes
Sheet2
Sheet3
Copy of Blue Yonder.xlsx
Sales HistoryBlue Yonder AirlinesAnnual Sales ( in
thousands)FY 2005FY 2006FY 2007FY 2008TotalCorporate
Contracts$1,039$1,253$1,427$1,454Sky Diving
$76$79$88$89Charter Flights$123$130$133$138Flight
School$205$208$207$199Total
Sales$1,443$1,670$1,855$1,880Percentage IncreaseFY 2006FY
2007FY 20082005-2008Corporate ContractsSky Diving Charter
FlightsFlight School
Copy of BY Financials.xlsx
Annual ExpensesBlue Yonder AirlinesExpenses (in
thousands)Expenses (in thousands)FY 2005FY 2006FY 2007FY
2008TotalCorporate Contracts$723$857$1,059$1,061$3,700Sky
Diving $59$62$72$74$267Charter
Flights$101$106$109$111$427Flight
School$142$147$148$144$581Total
Expenses$1,025$1,172$1,388$1,390$4,975
Annual SalesBlue Yonder AirlinesAnnual Sales ( in
thousands)FY 2005FY 2006FY 2007FY 2008TotalCorporate
Contracts$1,039$1,253$1,427$1,454$5,173Sky Diving
$76$79$88$89$332Charter
Flights$123$130$133$138$524Flight
School$205$208$207$199$819Total
Sales$1,443$1,670$1,855$1,880$6,848
IncomeBlue Yonder AirlinesIncome Before Taxes (in
thousands)Expenses (in thousands)FY 2005FY 2006FY 2007FY
2008TotalCorporate Contracts$316$396$368$393$1,473Sky
Diving $17$17$16$15$65Charter
Flights$22$24$24$27$97Flight School$63$61$59$55$238Total
Expenses$418$498$467$490$1,873
Copy of Financial History.xlsx
Sales HistoryFourth CoffeeAnnual Sales (in
thousands)20042005200620072008TotalCoffee and
Espresso$798$915$1,050$1,204$1,385$5,352Bakery$122$139$
151$174$196$783Coffee
Accessories$95$130$133$138$139$635Packaged
Coffee/Tea$101$132$129$137$135$634Deli
$205$208$207$199$202$1,021Total
Sales$1,321$1,524$1,670$1,852$2,057$8,425
Expense HistoryFourth CoffeeAnnual Expenses (in
thousands)20042005200620072008TotalCoffee and
Espresso$625$730$830$945$1,060$4,190Bakery$89$99$112$1
29$151$580Coffee
Accessories$75$98$96$102$100$471Packaged
Coffee/Tea$92$110$118$127$132$579Deli
$162$160$153$150$158$783Total
Expenses$1,043$1,197$1,309$1,453$1,601$6,603
IncomeFourth CoffeeIncome Before Taxes (in
thousands)20042005200620072008TotalCoffee and
Espresso$173$185$220$259$325$1,162Bakery$33$40$39$45$4
5$203Coffee Accessories$20$32$37$36$39$164Packaged
Coffee/Tea$9$22$11$10$3$55Deli
$43$48$54$49$44$238Income Before
Taxes$278$327$361$399$456$1,822
Bourne.pptx
Stephanie Bourne
President, Wide World Importers
2010 Business Person of the Year
Director, Twin Cities Chamber of Commerce
Governor’s Advisory Council member
Travel Tips.pptx
Travel Tips and Tricks
Sunny Day Travel, LLC
Where Do You Want to Go?
Sand and Sun
Adventure
Cruise
City
Sand and Sun
Sunscreen, sunscreen, sunscreen!
Pack for warm weather—but also for cool evenings
Take an extra swimsuit
Research local tours and charters in advance
Sand and Sun
Take flip-flops or other shoes that can get wet, and that dry
quickly
Beach time can be hard on your hands and feet
Pack a small first-aid kit for minor cuts
Take plenty of lotion for dry skin
Sunscreen and more sunscreen!
Sand and Sun 3
Adventure 1
Adventure 2
Adventure 3
Cruise 1
Cruise 2
Cruise 3
City 1
City 2
City 3
Enjoy Your Trip!
Assignment 5CSCI 3110 Design and Analysis of Algorithms.docx
Assignment 5CSCI 3110 Design and Analysis of Algorithms.docx

Assignment 5CSCI 3110 Design and Analysis of Algorithms.docx

  • 1.
    Assignment 5 CSCI 3110:Design and Analysis of Algorithms Due June 16, 2014 Banner ID: Name: Banner ID: Name: Banner ID: Name: Assignments are due on the due date before class and have to include this cover page. Plagiarism in assignment answers will not be tolerated. By submitting their answers to this assignment, the authors named above declare that its content is their original work and that they did not use any sources for its preparation other than the class notes, the textbook, and ones explicitly acknowledged in the answers. Any suspected act of plagiarism will be reported to the Faculty’s Academic Integrity Officer and possibly to the Senate Discipline Committee. The penalty for academic dishonesty may range from failing the course to expulsion from the university, in accordance with Dalhousie University’s regulations regarding academic integrity. This assignment studies a problem with applications in parallel scheduling. You are given a set of jobs J1, J2, . . . , Jn you want to run on your super powerful parallel computer with k processors P1, P2, . . . , Pk. For each job Ji , you are given a prediction ti of the amount of time it takes to run this job on a
  • 2.
    single processor. Ajob cannot be split, that is, once assigned to a given processor it needs to be run to completion by this processor. Let S j be the set of jobs you choose to run on processor Pj . Then processor Pj finishes its work in Tj = ∑ Ji∈ S j ti time. A schedule is a partition of the set S = {J1, J2, . . . , Jn} into subsets S1, S2, . . . , Sk of jobs assigned to processors P1, P2, . . . , Pk (that is, ⋃k j=1 S j = S and, for all j 6= j′, S j ∩ S j′ = ;). The makespan of this schedule is max{T1, T2, . . . , Tk}, that is, the time at which the last processor finishes its assigned work. In order to best utilize the computing power of your parallel computer, you try to find a schedule that minimizes the makespan. This problem turns out to be NP-hard to solve, even with only two processors. For such problems, we need to look for approximate solutions or for special types of inputs for which the problem can be solved exactly in polynomial time. This is the goal of this assignment. Question 1 (10 marks) Describe a simple greedy algorithm that computes a 2-approximation of the optimal schedule. In other words, if T∗ is the smallest possible makespan achievable for the given set of jobs using k processors, then the schedule produced by your algorithm should have a makespan of at most 2T∗ . Your algorithm should run in O(kn) time. Prove that the schedule produced by your algorithm has makespan at most 2T∗ . To do so, you will probably want to use two properties the minimum makespan T∗ must obviously
  • 3.
    satisfy: • T∗ ≥1 k ∑k i=1 ti . (The processor doing the most amount of work must do at least a 1/k fraction of the total amount of work.) • T∗ ≥ max{t1, t2, . . . , tn}. (The longest job needs to run on some processor Pj , so this processor finishes no earlier than the time it takes to complete this job.) You should then prove that the schedule produced by your algorithm has makespan at most 1 k ∑k i=1 ti+max{t1, t2, . . . , tn}. Question 2 (10 marks) Describe a modification of the above greedy algorithm that computes an optimal schedule, that is, one with the smallest possible makespan, provided the given set of jobs satisfies the following condition: Let t1, t2, . . . , tn once again be the predicted amounts of time it takes to run jobs J1, J2, . . . , Jn, and let t ∗ = min{t1, t2, . . . , tn}. You may assume that t∗ = 1. Then, for all 1 ≤ i ≤ n, ti is a power of 2. Your algorithm should run in O(n lg n + kn) time. Prove that it produces an optimal schedule. 1
  • 4.
    Copy of LitwareSales.xlsx Sheet1Litware, Inc.Semiannual Sales ReportSales Representative January Bush, Patricia11850$12,500$14,560$12,215$18,504$16,895Chisholm, Martin1285012,50015,69811,02517,56811,875Cook, Cathan, 210082090021155115222512320357Tippett, John956425800119569870698513789Turner, Olinda109542075421563102541256825845Poe, Deborah118501195615685165212587412456Singh, Paul14856128991552414756189548796Smith-Bates, Lorrin250112387123547205682158723879$ 117,943$ 141,180$ 139,688$ 106,731$ 147,163$ 133,892 Sheet2 Copy of SFA Enrollment Update.xlsx Sheet1School of Fine ArtFine Arts DepartmentEnrollmentCall No.CourseFallFA 100Acrylics145FA104Basic Drawing231FA 107Bookbinding & the Artist's Book87FA 201Ceramics232FA204Figure Drawing187FA205Illustration Techniques243FA206Introduction to Design and Color221FA207Mixed-Media Collage121FA208Oil Painting98FA321Portfolio Development158FA262Water Color206 Sheet2School of Fine ArtsMedia Studies DepartmentEnrollmentCall No.CourseFallMS 100Adobe Illustrator322MS104Adobe Photoshop Illustration233MS 107Digital Photography156MS 201Flash446MS204Graphic Fundamentals126MS205Job Advantage778MS206Photography288MS207Photoshop: Basics & Beyond987MS208Photoshop for Photographers332MS321Using Adobe In Design267MS262Web Design554 Sheet3
  • 5.
    Copy of SFAEnrollment.xlsx Sheet1Fall Quarter EnrollmentFine Arts DepartmentFall Quarter EnrollmentFA100Acrylics145FA104Basic Drawing231FA107Bookbinding & the Artist's Book87FA201Ceramics232FA204Figure Drawing187FA205Illustration Techniques243FA206Introduction to Design and Color221FA207Mixed-Media Collage121FA208Oil Painting98FA321Portfolio Development158FA262Water Color206 Sheet2Fall Quarter EnrollmentMedia Studies DepartmentMS 100Adobe Illustrator322MS104Adobe Photoshop Illustration233MS 107Digital Photography156MS 201Flash446MS204Graphic Fundamentals126MS205Job Advantage778MS206Photography288MS207Photoshop: Basics & Beyond987MS208Photoshop for Photographers332MS321Using Adobe In Design267MS262Web Design554 Sheet3 Copy of Top Ten.xlsx Sheet1Fortune Magazine*Top Ten Companies to Work ForRankCompanyU. S. Employees% Minorities% Women1Genentech181242502Wegmans3189015543Valero Energy1658240404Griffin Hospital104910785W. L. Gore453715406Container Store285729627Vision Service Plan196830688J. M. Smucker293024449REI7443124010S. C. Johnson and Son34041538*Data based on 2006 Rankings Project 1-6, &F Sheet2 Sheet3 Copy of Tailspin Toys.xlsx Sheet1Tailspin ToysSecond Quarter Earnings April May June TOTAL Sales $61,254$69,302$68,521 Cost of Goods Sold
  • 6.
    $38,895$37,568$39,521 Gross MarginMarketing Expense $2,154$2,852$2,822 Administrative Expense $4,456$4,124$4,589Miscellaneous Expense $1,059$1,205$1,502 Total Expenses Net Income Before Taxes Federal Taxes $4,995$8,008$6,830 Net Income After Taxes Sheet2 Sheet3 Copy of Blue Yonder.xlsx Sales HistoryBlue Yonder AirlinesAnnual Sales ( in thousands)FY 2005FY 2006FY 2007FY 2008TotalCorporate Contracts$1,039$1,253$1,427$1,454Sky Diving $76$79$88$89Charter Flights$123$130$133$138Flight School$205$208$207$199Total Sales$1,443$1,670$1,855$1,880Percentage IncreaseFY 2006FY 2007FY 20082005-2008Corporate ContractsSky Diving Charter FlightsFlight School Copy of BY Financials.xlsx Annual ExpensesBlue Yonder AirlinesExpenses (in thousands)Expenses (in thousands)FY 2005FY 2006FY 2007FY 2008TotalCorporate Contracts$723$857$1,059$1,061$3,700Sky Diving $59$62$72$74$267Charter Flights$101$106$109$111$427Flight School$142$147$148$144$581Total Expenses$1,025$1,172$1,388$1,390$4,975 Annual SalesBlue Yonder AirlinesAnnual Sales ( in thousands)FY 2005FY 2006FY 2007FY 2008TotalCorporate Contracts$1,039$1,253$1,427$1,454$5,173Sky Diving $76$79$88$89$332Charter Flights$123$130$133$138$524Flight School$205$208$207$199$819Total Sales$1,443$1,670$1,855$1,880$6,848 IncomeBlue Yonder AirlinesIncome Before Taxes (in thousands)Expenses (in thousands)FY 2005FY 2006FY 2007FY 2008TotalCorporate Contracts$316$396$368$393$1,473Sky
  • 7.
    Diving $17$17$16$15$65Charter Flights$22$24$24$27$97Flight School$63$61$59$55$238Total Expenses$418$498$467$490$1,873 Copyof Financial History.xlsx Sales HistoryFourth CoffeeAnnual Sales (in thousands)20042005200620072008TotalCoffee and Espresso$798$915$1,050$1,204$1,385$5,352Bakery$122$139$ 151$174$196$783Coffee Accessories$95$130$133$138$139$635Packaged Coffee/Tea$101$132$129$137$135$634Deli $205$208$207$199$202$1,021Total Sales$1,321$1,524$1,670$1,852$2,057$8,425 Expense HistoryFourth CoffeeAnnual Expenses (in thousands)20042005200620072008TotalCoffee and Espresso$625$730$830$945$1,060$4,190Bakery$89$99$112$1 29$151$580Coffee Accessories$75$98$96$102$100$471Packaged Coffee/Tea$92$110$118$127$132$579Deli $162$160$153$150$158$783Total Expenses$1,043$1,197$1,309$1,453$1,601$6,603 IncomeFourth CoffeeIncome Before Taxes (in thousands)20042005200620072008TotalCoffee and Espresso$173$185$220$259$325$1,162Bakery$33$40$39$45$4 5$203Coffee Accessories$20$32$37$36$39$164Packaged Coffee/Tea$9$22$11$10$3$55Deli $43$48$54$49$44$238Income Before Taxes$278$327$361$399$456$1,822 Bourne.pptx Stephanie Bourne President, Wide World Importers 2010 Business Person of the Year Director, Twin Cities Chamber of Commerce Governor’s Advisory Council member
  • 8.
    Travel Tips.pptx Travel Tipsand Tricks Sunny Day Travel, LLC
  • 10.
    Where Do YouWant to Go?
  • 11.
  • 12.
    Sand and Sun Sunscreen,sunscreen, sunscreen! Pack for warm weather—but also for cool evenings Take an extra swimsuit Research local tours and charters in advance
  • 13.
    Sand and Sun Takeflip-flops or other shoes that can get wet, and that dry quickly Beach time can be hard on your hands and feet Pack a small first-aid kit for minor cuts Take plenty of lotion for dry skin Sunscreen and more sunscreen!
  • 14.
  • 15.
  • 16.
  • 17.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.