210 likes | 396 Views
The Mathematics of Scheduling. Chapter 8. How long does it take to build a house?. It depends on Size of the house Type of construction Number of workers Kind of tools and machinery used
E N D
The Mathematics of Scheduling Chapter 8
How long does it take to build a house? It depends on • Size of the house • Type of construction • Number of workers • Kind of tools and machinery used • Ability to organize and coordinate the timing of people, equipment, and work so that things get done in timely way
How long does it take to build a house? • It takes 1100 man-hours to build an average American house • Given just one worker and assuming the worker can do every single job, it requires 1100 hours. • If we had 1100 equally capable workers, could we get the same house built in one hour? • Answer is no!!! Some inherent physical limitations to the speed with which a house can be built are outside of the builder’s control. • Some job cannot be speeded up beyond a certain point, regardless of how many workers one puts on that job. • Certain jobs can be stated only after certain other jobs have been completed (E.g. roofing can be started only after framing has been completed)
Scheduling Theory Designed to answer the questions • How fast could we build the house if we had only 10 equally capable workers? • If we needed to finish the project in one month, how many workers should we hire?
Basic Elements of Scheduling • The processors • The tasks • The processing times • The precedence relations
The Processors • It represents workers • It does not need to be human beings. • It can be a robot, a computer, an automated teller machine • We use the notation p1, p2, …pn to represent the processors
The Tasks • Task: Indivisible unit of work • A task will always be something that is carried out by a single processor. • At any particular moment in time through out the project, a given task can be in one of the four different states: • Ineligible (task cannot be started at this time because certain other requirements have not been met) • ready (task could be started at any time) • in execution (task is presently being carried out by one of the processors) • Completed.
The Processing Times • The processing time of a task represents the amount of time, without interruption, required by one processor to carry out the task. • Different processors work at the same rates (assumption for simplicity). • A processor cannot stop in the middle of a task. • Once the task is started, the processor must execute it without interruption.
The Precedence Relations • These are the restrictions on the order in which the tasks can be executed. • Example: task X precedes task Y means that task Y cannot be started until task X has been completed. Written as X → Y. • Independent tasks: when a pair of tasks X and Y have no precedence requirements between them, we can say that they are independent. (neither X → Y nor Y → X)
The Precedence Relations • When two tasks are independent, either one can be started before the other one, or they can both be started at the same time. • Precedence relations are transitive: if X → Y and Y → Z, then X → Z. Z X Y
The Precedence Relations • Precedence relations can be of two types: basic and implicit. • We cannot have a set of precedence relations that form a cycle. Y X Z W
Some possible Schedules • The project can be broken into four different tasks: A, B, C, D. • A takes 4 hours, B takes 5 hours, C takes 7 hours, D takes 3 hours. • Two processors are used for this project: P1 and P2. • Restriction: A → C (A precedes C).
0 1 2 3 4 5 6 7 8 9 10 11 12 P1 D(3) Idle A(4) B(5) C(7) P2 Some possible Schedules An Inefficient Schedule
Some possible Schedules 0 1 2 3 4 5 6 7 8 9 10 11 12 P1 B(5) Idle A(4) C(7) D(3) P2 An illegal Schedule
Some possible Schedules 0 1 2 3 4 5 6 7 8 9 10 11 12 P1 B(5) Idle A(4) Idle C(7) D(3) P2 An Optimal Schedule
Some possible Schedules 0 1 2 3 4 5 6 7 8 9 10 11 12 P1 C(7) A(4) B(5) D(3) Idle P2 Another Optimal Schedule
Directed Graphs (Digraphs) • A graph in which the edges have a direction associated with them is called a directed graph or digraph. • Digraphs are used to describe relationships between objects. • We cannot assume that the relationship is reciprocal. • In a digraph, the edges have directions, and we call them arcs. • An arc has a starting vertex and an ending vertex • We can write the arc as XY (which is different from YX). • If XY is an arc in the digraph, we cay that vertex X is incident to vertex Y, or Y is incident from X.
Directed Graphs (Digraphs) • If XY is an arc in the digraph, we cay that vertex X is incident to vertex Y, or Y is incident from X. • The arc YZ is said to be adjacent to arc XY because the starting point of YZ is the ending point of XY. • We can go from X to Z by the way of Y. • A path from vertex X to vertex W consists of a sequence of arcs XY, YZ, ZU, …, VW such that each arc is adjacent to the one before it and no arc appears more than once in the sequence. • We can go from X to W along the arcs in the graph.
Directed Graphs (Digraphs) • When the path starts and ends to the same vertex, we call it a cycle in the graph, just like circuits in a regular graph. • Cycles in a digraph can be written in more than one way – the cycle X, Y, Z, X is the same as the cycles Y, Z, X, Y and Z, X, Y, Z. • Each vertex in a digraph has an indegree and an outdegree. • The outdegree of X is the number of arcs that have X as their starting point (outgoing arcs). • The indegree of X is the number of arcs that have X as their ending point (incoming arcs).
Applications of digraph • Transportation: Vertices represent locations within a city, the arcs represent one-way streets. To represent a two-way street we use two arcs, one for each direction. • The Internet: Vertices represent sources of information, and the arcs represent the possible flows of information. • Tournaments: Vertices represent teams ( or players) and the arcs represent the games played. • Chain of commands: In corporation or military, we can use digraph to describe chain of commands. Vertices represent individuals and an arc from X to Y indicates that X can give orders to Y.
B a1 a2 a4 C A a5 a3 a6 a8 D a7 E Example of Digraph Vertices: A, B, C, D, E Arcs: a1, a2, a3, a4, a5, a6, a7, a8 A is incident to B and C A is incident from E as well as from C Indegree of vertex A is 2 Outdegree of vertex A is 2 Indegree of vertex C is 1 Outdegree of vertex C is 3 Several paths from A to D :A, C, D; A, C, E, D A, B, D A, C, A, B, D A, E, D is not a path from A to D Cycles: A, C, E, A (also can be written as C, E, A, C; E, A, C, E) A, C, A