• No results found

Chapter 3: Planning and Scheduling

N/A
N/A
Protected

Academic year: 2021

Share "Chapter 3: Planning and Scheduling"

Copied!
16
0
0

Loading.... (view fulltext now)

Full text

(1)

Chapter 3: Planning and Scheduling

September 11, 2013

(2)

Last time:

Scheduling tasks Critical-Path Schedules

(3)

Review

For a machine-scheduling problem

Tasks are performed by processors

Tasks are arranged in apriority listthat is independent of the

order requirements.

We call a task ready when all its predecessors in the

order-requirement digraph have been completed at that time.

When given a priority list we use the list-processing

algorithmto assign tasks to the processors.

We use the critical-path schedulingalgorithm to obtain a

priority list.

(4)

Independent Tasks

Now we deal with a special case, where the digraph has no edges, that is where the tasks are independent.

Example of independent tasks are: Homework assignments Making copies

(5)

Motivating Question

Question: What is the best schedule tasks of length 10, 15, 7, 4, 10, 5 on two machines?

(6)

Ways to arrive at a solution

Average-case analysis: Is the average of the completion times arrived at by using the list-processing algorithm with all the possible different lists close to the optimal possible completion time?

Worst-case analysis: How far from optimal is a schedule obtained using the list-processing algorithm with one particular priority list?

(7)

Decreasing-Time-List Algorithm

Decreasing-Time-List Algorithm

The list-processing algorithm applied to a list of task times arranged in order of non increasing size is called the

decreasing-time-list algorithm.

(8)

Motivating Question

Question: A radio station’s policy allows advertising breaks of no longer than 2 minutes, 15 seconds. What is the minimum number of breaks into which the following ads will fit (lengths in seconds): 80, 90, 130, 50, 60, 20, 90, 30, 30, 40?

(9)

Bin-Packing

Bin-Packing Problem

Thebin-packing probleminvolves finding the minimum number of bins of weight capacityW into which weights w1,w2,· · ·wn

(each less than or equal toW) can be packed without exceeding

the capacity of the bins.

(10)

Heuristic algorithms

next-fit (NF)- If the next weight doesn’t fit start a new bin.

first-fit (FF) - Put the next weight in the first bin that has room, if one doesn’t exist start a new bin.

worst-fit (WF)- Put the next weight in the bin that has the most room, if one doesn’t exist start a new bin.

Question: A radio station’s policy allows advertising breaks of no longer than 2 minutes, 15 seconds. What is the minimum number of breaks into which the following ads will fit (lengths in seconds): 80, 90, 130, 50, 60, 20, 90, 30, 30, 40?

(11)

Decreasing-Time Heuristic

next-fit decreasing (NFD) first-fit decreasing(FFD) worst-fit decreasing(WFD)

Question: A radio station’s policy allows advertising breaks of no longer than 2 minutes, 15 seconds. What is the minimum number of breaks into which the following ads will fit (lengths in seconds): 130, 90, 90, 80, 60, 50, 40, 30, 30, 20?

(12)

Practice Problems

Question 1: A radio station’s policy allows advertising breaks of no longer than 2 minutes, 15 seconds. What is the minimum number of breaks into which the following ads will fit (lengths in seconds): 60, 50, 40, 40, 60, 90, 90, 50, 20, 30, 30 ,50?

Question 2: It takes 4 seconds to photocopy on page. Manuscripts of 10, 8, 15, 24, 22, 24, 20, 14, 19, 12, 16, 30, 15, and 16 pages are to be photocopied. How many photocopy machines would be required, using the FFD algorithm, to guarantee that all

manuscripts are photocopied in 2 minutes or less? Would the solution differ if WFD were used?

(13)

Solution to Question 1

The sum of the lengths of the ad is 610 seconds. 610/135≈4.5,

the solution will have at least 5 breaks.

Using FF algorithm on list: 60, 50, 40, 40, 60, 90, 90, 50, 20, 30, 30 ,50 Bin 1: 60, 50, 20; Bin 2: 40, 40, 50; Bin 3: 60, 30, 30; Bin 4: 90; Bin 5: 90; Bin 6: 50;

(14)

Solution to Question 1, cont.

Using FFD algorithm on list: 90, 90, 60, 60, 50, 50, 50, 40, 40, 30, 30, 20 Bin 1: 90, 40; Bin 2: 90, 40; Bin 3: 60, 60; Bin 4: 50, 50, 30; Bin 5: 50, 30, 20; This solution is optimal.

(15)

Solution to Question 2

The photocopies times in decreasing order are: 120, 96, 96, 88, 80, 76, 64, 64, 60, 60, 56, 48, 40, 32. The bin size is 120.

Using the FFD algorithm we get: Bin 1: 120; Bin 2: 96; Bin 3: 96; Bin 4: 88, 32; Bin 5: 80, 40; Bin 6: 76; Bin 7: 64, 56; Bin 8: 64, 48; Bin 9: 60, 60;

There are nine printers needed. This solution is optimal since the sum is 980 and 980/120≈8.1

With WFD, the number of bins would not change but the placement of the items in the bin would change.

(16)

Next time

Quiz on Friday will be over 2.5 and 3.1-3.5 Friday we will talk about

Resolving Conflict via Coloring

References

Related documents

As shown in this study, loyalty to the organization resulting from merger or acquisition has different intensity level for employees in different hierarchical

This section outlines the method to find the best allocation of n distinguishable processors to m dis- tinguishable blocks so as to minimize the execution time.. Therefore,

Most companies recruit for full-time and internship positions, but some indicate Co-Op as a recruiting priority, while not attending Professional Practice

Statistical Inference, 77 J. The concentration index is sometimes applied to bad attributes, e.g., ill health, but the analysis in this Article generally assumes that the currency

Multiple seat options are available to create a comfortable experience and provide flexibility to set up differenti- ated seating areas based on the chair type used. In addition, a

The activity described below aims to teach high-intermediate and advanced learners of English how to understand American housing ads.. The main target group is members of the

“A monument to the artist” is more known to Krasnoyarsk citizens as the Monument to Andrey Gennadevich Pozdeev (1926-1998), the authorship belongs to the

If applicable, proficiency noted during laboratory exercises can be used to satisfy the Performance Testing requirements.. Record the testing results on Craft Training Report Form