Upload
dinhdieu
View
224
Download
0
Embed Size (px)
Citation preview
MISTA 2009
Preemptive scheduling with precedences and alternativeresources
Vladimır Dusa · Roman Bartak
Abstract This paper presents a search algorithm solving an elastic scheduling problem
with alternative resources, where a feasible schedule with minimal costs on resources
is demanded. The proposed technique is based on detecting ”problematic” precedence
constraints defined between activities processed on different resources. Assignment of
alternative resources is realized as an extension of the search algorithm using overload
checking. Preliminary experimental results show, that the proposed technique works
well for problems with a smaller number of precedence constraints.
1 Introduction
Nowadays it is more and more important to save as many resources as possible primarily
in larger companies, where production costs are measured in hundreds thousands of
dollars per month so in such companies each percent of savings can be very significant.
The assumed resources can be people in offices, machines in production, runways at
the airport etc.
Scheduling of (usually) human resources will be discussed in this paper. These
resources can be people working for example in construction or production processes
or office workers, whose work schedule depends on various projects. We do not need
to schedule their work in tiny details, but we only need to know if all resources have
enough time to process all given activities and when these activities start and when
they are finished. Thus we can schedule their work as if they could process the activities
simultaneously even if they do not work in such a way in reality. People can usually
interrupt their work and do something else in the meanwhile. For example an office
worker can process more projects simultaneously – he can begin with one activity, then
he must wait (for example for an answer from a customer) and in the meanwhile he can
process some other activity. The project manager usually knows what type of worker
Vladimır DusaCharles University, Faculty of Mathematics and Physics, Prague, Czech RepublicE-mail: [email protected]
Roman BartakCharles University, Faculty of Mathematics and Physics, Prague, Czech RepublicE-mail: [email protected]
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
518
he needs to process given activity, but it is not interesting who the person exactly is
in the planning phase. For example the project manager knows, that for a building of
a wall he needs a bricklayer for five days. At this moment it is not important, in fact,
who the person is. Also we know price of each resource work unit. For example one
bricklayer can cost 5 USD per hour but another can cost 10 USD per hour. Our goal is
to find a feasible schedule according to given constraints with the lowest possible costs
on assigned resources.
This paper describes a new approach for solving preemptive scheduling problems
with alternative resources based on detecting ”problematic” precedences between activ-
ities. There has been intensive research in non-preemptive scheduling, but preemptive
scheduling problems have received limited attention. Some results have been published
in [1], [2] and [3], where an approach using constraint programming for preemptive,
non-preemptive and mixed case is described. Another search algorithm solving pre-
emptive scheduling problem has been introduced in [5], where heuristic search has
been used. In [6] an approach minimizing changes in the schedule after adding a new
activity is introduced. The problem of alternative resources has been studied in [1],
where an ”optional activity” for each alternative resource is created, or also in [4],
where the problem of alternative resources in non-preemptive scheduling is presented.
None of these papers deal with preemptive scheduling with alternative resources and
objective function minimizing total cost on used resources together which is the main
topic of this paper.
A formal definition of the problem will be given in the next section. Then the
problem will be transformed to a problem of preemptive scheduling and it will be shown,
that it belongs to the class of NP-Complete problems. After that an algorithm solving
the preemptive problem will be introduced – firstly for the problem with only one
resource, then for the problem with more resources (where each activity has assigned
exactly one resource) and finally for the problem with alternative resources. Some
preliminary experimental results will be presented before conclusions.
2 Problem definition
2.1 Terms
As it has been mentioned, scheduling of a (usually) human resources will be assumed.
Activities to be processed will be elastic, which means that there is no need of constant
workload on such activity, but the workload of the resource during processing the ac-
tivity can vary in time between zero and maximum capacity of the resource. Resources
processing these activities will be cumulative, which means, that one resource can pro-
cess more activities at a time. Naturally the resources can not be overloaded. We have
given a set of alternative resources for each activity, from which exactly one resource
will process the activity. Each activity needs a given amount of energy of this resource
to be processed. Later we will use the term preemptive scheduling, which means that
all resources have maximum capacity equal 1 (the resource can process at most one
activity at a moment) and activities can be interrupted during their processing.
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
519
2.2 Problem given as elastic scheduling
Our scheduling problem is defined as follows: there is a finite set of tasks A to be pro-
cessed on a finite set of cumulative resources R. Capacity of resource k ∈ R is denoted
as cap(k) ∈ Z+, cost(k) ∈ Z denotes the price of one energy unit of resource k. We
assume discrete time given by time points t ∈ Z+. For each activity i ∈ A, ri denotes
the earliest possible start time (release time) and di the latest possible end time (dead-
line). Let ei be the energy needed to process activity i and ei(t) denotes the current
load of the resource assigned to activity i between time points t and t+1 (for example
see figure 1 where ei(ri) = 0, ei(ri + 1) = 3, ei(ri + 2) = 4, . . .). Let Mi ⊆ R be a set of
alternative resources of activity i. Between activities i, j ∈ A a precedence constraint
i → j can be defined, meaning end(i) ≤ start(j), where start(i) = min{t | ei(t) > 0},respectively end(i) = max{t | ei(t) > 0}+1. Activity i is called a predecessor of activity
j and analogically j is called a successor of activity i. We suppose that precedences do
not create a circle such as i → j → . . . → i. Each activity i ∈ A must be processed by
exactly one resource from its set of alternative resources. Let this resource be denoted
as R(i). The goal is to find exactly one resource R(i) ∈ Mi and ei(t) for each i ∈ A
and for each time point t such that:
1. No precedence constraint is violated.
2. Each activity i is processed in its time window that is ∀i ∈ A, ∀t : t < ri∨ t ≥ di ⇒ei(t) = 0.
3. No resource is overloaded:
∀t, ∀k ∈ R :∑
i∈A:R(i)=k
ei(t) ≤ cap(k)
4. There is enough energy allocated to each activity:
∀i ∈ A :∑
t
ei(t) = ei
5. Total cost of used resources∑
i∈A ei · cost(R(i)) is minimal.
2.3 Transformation of elastic scheduling to preemptive scheduling
A problem of elastic scheduling has been defined in the previous section. Let us assume
that we have only one resource in the problem (that is |R| = 1). The problem of elastic
scheduling on one resource can be easily transformed to preemptive scheduling problem
on one resource. Let us note that it is not common to use the term energy ei in the
preemptive scheduling and instead of it the term processing time pi is used. Also the
variable ei(t) collapses to a boolean variable Xi(t), that is equal 1 if the activity is
being processed between the time points t and t + 1 (a so called timetable variable).
Otherwise it holds Xi(t) = 0. Now we will describe the transformation between elastic
and preemptive scheduling on one resource (according to [1]):
Transformation 1 For an arbitrary problem of elastic scheduling P , let F (P ) be a
problem of preemptive scheduling on one resource k with maximum capacity cap(k)
defined on n activities 1′, . . . , n′, where ∀i ∈ {1, . . . , n} r′i = cap(k)ri, d′i = cap(k)di,
p′i = ei, where p′i denotes processing time of preemptive activity i′.
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
520
Theorem 1 [1] For an arbitrary problem of elastic scheduling P there exists a feasible
schedule if and only if there exists a feasible schedule for F (P ).
If there are more resources in the schedule, as in our case, we must modify the above
transformation. Let us assume now, that each activity in our problem has assigned
exactly one resource processing the activity (that is ∀i ∈ A : |Mi| = 1). Then we
can transform problem P to F (P ) by multiplying the release time and the deadline
of each activity by maxcap = maxk∈Rcap(k). All resources k ∈ R with capacity
cap(k) < maxcap must be occupied by some ”dummy” activities at specified locations,
which ensure that the resource will not be overloaded. On figures 1 and 2 we can
see the transformation from elastic to preemptive schedule. There must be created a
”dummy” activity for each succession time points of the preemptive schedule for each
resource. Such ”dummy” activity d ∈ {1, 2, . . .} for resource k will have Md = {k},rd = (d− 1) ·maxcap + cap(k), dd = maxcap · d and pd = dd − rd (these activities are
shown in the figure 2 as crossed parts of the schedule). All these ”dummy” activities will
be removed as soon the schedule is created. Thus we can look on the problem of elastic
scheduling on more resources as it would be a problem of preemptive scheduling on
more resources. We do this transformation, because it is easier to work with preemptive
scheduling than with elastic scheduling.
Fig. 1 Elastic schedule of a resource k
Fig. 2 Preemptive schedule of a resource k transformed from elastic schedule
2.4 Problem hardness
The problem of preemptive scheduling introduced in the previous section is a problem
belonging to the class of NP-Complete problems. The problem marked as [SS12] defined
in [7] is proved to be a member of NP-Complete class:
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
521
[Preemptive scheduling problem SS12] Let A be a set of activities with precedence
constraints, m ∈ Z+ be a set of resources, pi ∈ Z+ be processing time of each activity
i ∈ A and D be a common deadline for all activities. Question: Is there a feasible
preemptive schedule on m resources for A satisfying all precedence constraints and
deadline D?
There exists no polynomial algorithm for our scheduling problem defined in 2.3
unless P = NP , which is obvious when we consider an instance of our problem with
ri = 0 and di = D for all i ∈ A.
3 Solving approaches
We will introduce an algorithm solving a special case of preemptive problem containing
only one resource in the schedule (|R| = 1) in the first part of this section. Then we
will introduce an incomplete1 algorithm for another special case with more resources
but no alternative resources (|R| ≥ 1 and ∀i ∈ A |Mi| = 1). Finally, we will pro-
pose a branch-and-bound algorithm for solving the problem with more resources and
alternative resources for activities.
3.1 Problem with only one resource
For the problem of preemptive scheduling with one resource and no precedence con-
straints (defined as 1|ri; di; prmp| in α|β|γ notation), we can use the well known earliest
due date algorithm [8] which creates a so called Jacksons preemptive schedule (JPS)
[1]. This algorithm has one simple rule also known as earliest due date: For each time
point t, whenever an activity becomes available, schedule not yet finished activity i
with lowest di (activity i is available in time points t ≥ ri). As soon as the schedule
contains precedence constraints (but still only one resource), we can use the following
modification of the earliest due date algorithm, which is also a complete algorithm for
the problem with one resource and precedence constraints (1|ri; di; prmp; prec|):
3.2 Problem with no alternative resources
Until now, we considered only one resource in the problem. If there are more resources
in the problem (Mi|ri; di; prec; prmp| with |Mi| = 1), we can modify algorithm 1 as
follows:
If we try to create a schedule using algorithm 2, a feasible schedule may not be
found even though it exists. Figure 3 shows an example of four activities where p1 = 2,
p2 = 4, p3 = 4, p4 = 3 are being processed on two resources k1, k2 ∈ R. On the left
side of figure 3 an infeasible schedule created by algorithm 2 is shown. However as we
can see on the right side of figure 3, a feasible schedule exists.
The precedence constraints defined between activities being processed on different
resources make the problem hard. If we would have an instance of the problem, con-
taining no precedences between activities being processed on different resources, we
could create the schedule separately for each set of activities processed on the same
1 We say, that an algorithm is complete if it guarantees finding a feasible solution if someexists. Otherwise we say, that the algorithm is incomplete.
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
522
Algorithm 1: Jacksons preemptive schedule (JPS)
input : Scheduling problem instance Poutput: Feasible schedule if it exists, otherwise null
while there exists precedence constraint i → j such that di > dj − pj dodi ←− (dj − pj)
end
for t = mini∈A(ri) . . .maxi∈A(di − 1) doi ←− any not yet finished available activity i ∈ A with smallest di
if t = di thenreturn fail
endif i exists then
schedule activity i in time 〈t, t + 1〉end
endreturn scheduleActivity i is available in time point t, when t ≥ ri and all predecessors are finished.Activity i is finished if it has been scheduled to pi time points
Algorithm 2: JPS with more resources
input : Scheduling problem instance Poutput: Feasible schedule if it exists, otherwise null
while there exists precedence constraint i → j such that di > dj − pj dodi ←− (dj − pj)
end
for t = mini∈A(ri) . . .maxi∈A(di − 1) doforeach k ∈ R do
i ←− any not yet finished available activity i ∈ A(k) with smallest di
if t = di thenreturn fail
endif i exists then
schedule activity i in time 〈t, t + 1〉end
end
endreturn scheduleActivity i is available in time point t, when t ≥ ri and all predecessors are finished.Activity i is finished if it has been scheduled to pi time points
resource. Such algorithm would be complete, because no activity processed on one re-
source affects any other activity processed on another resource. Thus we shall focus
on the precedence constraints defined between activities being processed on different
resources.
Definition 1 Let A be a set of activities and P = {i → j|i, j ∈ A} be a set of all
precedence constraints. Set P ⊆ P defined as P = {i → j ⊆ P | R(i) 6= R(j)}is called a set of inter-resource precedence constraints. Precedence constraint
i → j /∈ P will be called intra-resource precedence constraint.
Theorem 2 Let P = Ø, then algorithm 2 is complete for the scheduling problem with
more resources and precedence constraints (Mi|ri; di; prec; prmp| with |Mi| = 1).
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
523
Fig. 3 Incompleteness of JPS with more resources
Proof Thanks to the fact, that P = Ø, algorithm 2 works as if the schedule would be
obtained for each resource separately by algorithm 1, because none of the schedules
of any resource affects schedule of another resource. Algorithm 1 is complete, thus
algorithm 2 is complete as well. ut
For the search algorithm, that will be introduced later, we need as few as possi-
ble precedence constraints in P . Now we will show, that not all of the inter-resource
precedence constraints from P must be ”problematic” and we will construct a smaller
set of precedence constraints P crit.
Definition 2 Let A be a set of activities and R be a set of resources. Let k ∈ R be a
resource. Then A(k) = {i | i ∈ A, k ∈ Mi} denotes set of activities being possibly
processed on resource k.
Definition 3 Let A be a set of activities with precedence constraints and R be a set of
resources. Let A−(i) = {l ∈ A(R(i))\{i} | dl > ri + pi ∧ dl ≤ di}. Let i → j ∈ P be an
inter-resource precedence constraint. Algorithm 2 has created a partial schedule, where
activity f ∈ A has failed2 to be scheduled then we call i → j critical precedence
constraint according to f in the partial schedule, if the following conditions are
fulfilled:
1. dj ≤ df
2. A−(i) 6= Ø
3. ∃ time point t ≥ max{ri + pi, rj} such that Xi(t) = 1
4. For some t satisfying point 3 one of the following conditions holds
(a) ∃m ∈ A such that R(m) = R(j) and dm ≥ dj and Xm(t) = 1
(b) ∀m ∈ A(R(j)) holds Xm(t) = 0.
ut
Let us explain definition 3 in more detail: A−(i) contains all activities different from
i being processed on the same resource as i, such that their deadlines lie between the
earliest end time of i and deadline of i. Such activities can be postponed to allow earlier
finish of i. The point 2 of definition 3 says that predecessor i has not been processed
in the partial schedule with the highest priority (there is another activity with earlier
deadline overlapping i and being processed on the same resource). Moreover activity i
is being processed in time point t, when successor j could already be processed, which
the point 3 says. It means, that there is a chance to finish activity i earlier, if it would
have higher priority in the algorithm 2, that created the partial schedule. This would
allow earlier start of successor j. However successor j could start earlier only, if resource
2 activity i ∈ A fails if there is not enough time to process i in its time window 〈ri, di〉
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
524
R(j) is processing another activity m with lower priority (that is dm ≥ dj) in time
point t (point 4a) or if the resource does not process any activity in time point t (point
4b).
Briefly speaking the precedence constraint i → j is critical, if activity i is being pro-
cessed in the time point, when activity j would be processed if there was no precedence
constraint between i and j and there is a possibility to finish activity i earlier.
Notation 1 Let A be a set of activities with precedence constraints and R be a set of
resources. Let algorithm 2 has created a partial schedule, where an activity f ∈ A has
failed to be scheduled. We will denote P crit(f) as a set of all critical precedence
constraints according to activity f.
Theorem 3 Let there be a scheduling problem with more resources and precedence
constraints (Mi|ri; di; prec; prmp| with |Mi| = 1). Let algorithm 2 has created a partial
schedule of this scheduling problem, where an activity f ∈ A has failed to be scheduled.
If it holds P crit(f) = ∅, then there does not exist a feasible schedule of the given
scheduling problem.
Proof As we have seen in figure 3, the earlier finish of activity 2 allowed earlier start of
activity 3, which led to a feasible schedule. Firstly we will show, that the predecessors
i in non-critical inter-resource precedence constraints i → j can not be finished earlier
in the partial schedule created by algorithm 2.
Let us consider inter-resource precedence constraint i → j ∈ P , such that dj ≤ df .
Since P crit(f) = Ø, one of the following conditions holds for i → j:
C1: A−(i) 6= Ø: If condition 3 of definition 3 is not fulfilled then i does not occupy any
time that can be used by j thus i does not delay j. Otherwise, if neither 4a nor 4b
in definition 3 is fulfilled then the delay of j is caused by activities on resource R(j)
with higher priority than j, but not by activity i. Hence even if activity i finishes
earlier, it would not allow earlier start of activity j.
C2: A−(i) = Ø: Since A−(i) = Ø, then it is not possible to finish activity i earlier,
because activity i has been processed with highest priority in the partial schedule,
thus it was finished as soon as possible. Hence end(i) ≤ start(j), there was also no
way to start activity j earlier.
Let us assume that failed activity f was processed on resource k. Now we will check
if activity f could be finished earlier in the partial schedule:
1. Either df − rf < pf then there is not enough time to finish activity f in its time
window.
2. Or df − rf ≥ pf then activity f was delayed and failed, because there is at least
one time point t ∈ 〈rf , df ) such that Xf (t) = 0. Let us consider these time points
t in descending order. Question is: why did not algorithm 2 schedule activity f in
time point t?
(a) Either there is no activity processed in time point t on resource k. Then there
must exist inter-resource precedence constraint i → f where activity i is not
yet finished in time point t. According to condition C1 and C2 activity i could
not be finished earlier thus activity f can not be processed in time point t.
(b) Or in time point t resource k processes an activity l 6= f such that
– either dl > df : according to the rules of algorithm 2 there is in time point
t non finished activity i with inter-resource precedence constraint i → f
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
525
(otherwise algorithm 2 would schedule activity f in time point t). In this
case we can use same idea proposed in point 2a. Let us note, that according
to the preprocessing of deadlines in algorithm 2 there can not exist intra-
resource precedence constraint i → f such that i is not finished in time
point t, while activity l is being processed in time point t. If an intra-
resource precedence constraint i → f existed it would hold di < df . Since
dl > df , it holds di < dl which implies, that activity i would be scheduled
in time point t instead of activity l, however it did not happen.
– or dl = df : Since activity f has failed it holds df < end(f) in the partial
schedule. If activity f was scheduled in time point t instead of activity l,
then this missing time point of activity l has to be scheduled in time point
end(f)− 1 or later in order to finish activity f earlier. Since end(f)− 1 ≥df = dl, then activity l would fail. Thus activity f can not be scheduled in
time point t.
– or dl < df : according to the rules of JPS activity l must be processed with
higher priority and activity f could not be processed in time point t. Now
there is a question if it was possible to finish activity l earlier in order
to schedule activity f in time point t. Answer to this question gives us
same consideration for l that we made for f now. So we can iteratively go
through activities processed on resource k until we meet any inter-resource
precedence constraint or begin of the schedule in time point 0 proposing
that no change in the schedule sustaining feasibility can cause earlier finish
of activity f .
ut
Now a search algorithm will be introduced, that finds a feasible schedule if such
a schedule exists (see algorithm 3). This algorithm uses algorithm 2, that tries to
create the schedule from the beginning to the end. In the moment, when algorithm 2
finds some activity f that fails, algorithm 3 looks into the set of critical precedence
constraints and tries to change time allocation of some activities predecessing f , which
can positively affect the time allocation of f . There are several ways how to do it so
the search algorithm needs to explore them.
Let us clarify algorithm 3 in more detail. First of all we try to create the schedule
using algorithm 2. Then if no feasible schedule has been found, algorithm 2 stopped
at first activity f , that failed. According to this activity we analyze the set of critical
precedence constraints, that could affect activity f . All such precedence constraints
are members of set P crit(f). If this set is empty, there is no feasible schedule and we
must backtrack. If P crit(f) is a nonempty set, then we will try to finish earlier the
activities, that are affecting the failed activity f . We will do it in such a way, that we
will successively decrease the deadline of all activities i such that i → j ∈ P crit(f).
Decreasing of the deadlines causes branching of the algorithm and is performed as
follows: Let i → j ∈ P crit(f) and let the set A−(i) contains m activities, then we will
try to change the deadline of activity i in m ways: for each activity q ∈ A−(i) we assign
di := dq−1. In such a way we must try all combinations of such changes of the deadline
of all activities i, where i → j ∈ P crit(f). Change of deadline of only several activities
is also considered as a combination. Decreasing of deadline involves new ordering of
the activities in algorithm 2, that may allow earlier finish of some predecessor of the
failed activity f .
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
526
Algorithm 3: Search algorithm
input : Scheduling problem instance Poutput: Feasible schedule if it exists, otherwise null
schedule ←− Algorithm2(P )if schedule is feasible then
return scheduleelse
f ←− failed activity in scheduleif P crit(f) 6= ∅ then
foreach problem modification P ′ of problem P according to P crit(f) doschedule ←− Algorithm3(P ′)if schedule != null then
return scheduleend
endreturn null (backtrack)
elseAccording to theorem 3 there is no feasible schedule for the problem Preturn null (backtrack)
end
end
Since the branching factor can be large (depending on the number of critical prece-
dence constraints), the search space can be huge: O(2|P |·(n−1)), where n = |A| (that is
upper bound assuming that all inter-resource precedence constraints i → j are critical,
while A−(i) contains all other activities than i (that is |A−(i)| = n−1). Then we have
to check n − 1 changes of deadline of predecessor i). Let us note that not all critical
precedence constraints are needed to be checked. Let us assume, that the search algo-
rithm is in the depth r of the search tree, and that activity f has failed. Then we do
not need to check all critical precedence constraints from the set P crit(f), but only
the ”new” critical precedence constraints, that are not members of the set of critical
precedences in upper levels of the search tree. These precedence constraints will be
used for branching later (or have been used already) in the upper levels of the search
tree.
3.3 Solving the optimization problem with alternative resources
3.3.1 Applying branch-and-bound technique
In the previous section we have presented search algorithm solving the special case of
the problem where |Mi| = 1 ∀i ∈ A (each activity has assigned exactly one resource
that will process the activity). Our goal is to solve the problem, where for each activity
i a resource from the set of alternative resources having |Mi| ≥ 1 must be chosen.
Let X = {R(1), . . . , R(n)} be a set of variables, where R(i) denotes the resource,
that processes activity i and n = |A|. Let M = {M1, . . . , Mn} be a set of sets of
alternative resources. Let the resources in each set of alternative resources be ordered
non descending according to their costs.
We denote our scheduling problem with alternative resources as a tuple SP =
(A, P, R, M), where A is a set of activities, P is a set of precedence constraints between
the activities, R is a set of resources and M is a set of all sets of alternative resources
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
527
(defined above). When solving problem SP, we can divide it into two subproblems
SP ′ = (A, P, R, M ′) and SP ′′ = (A, P, R, M ′′), where M ′ = {M1, . . . , M ′i , . . . , Mn}
and M ′′ = {M1, . . . , M ′′i , . . . , Mn} and it holds3 Mi = M ′
i ∪M ′′i and solve each sub-
problem separately. Now we can solve both subproblems separately. In particular,
whenever activity i having |Mi| > 1 is scheduled by algorithm 3, we choose the cheap-
est resource k ∈ Mi and we divide the problem into two subproblems where M ′i = {k}
and M ′′i = Mi\{k}. Then we solve these subproblems separately with algorithm 3. We
start with the cheapest resource k for each activity as a simple greedy heuristic for
minimizing total cost.
A bounding technique pruning the search space will be introduced now. A lower
bound LB(SP ) defined below will be checked during the search
LB(SP ) =∑
i∈A
pi ·min {cost(k) | k ∈ Mi}
This lower bound LB(SP ) is calculated as if each activity in the problem SP would
be processed on the cheapest resource from its set of alternative resources.
We remember the cost of the best solution found so far. It will be denoted as LB∗
and at the very beginning we set LB∗ = ∞. The lower bound LB will be calculated for
both subproblems during each branching. If it holds LB(SP ′) ≥ LB∗, (or LB(SP ′′) ≥LB∗), we do not need to solve the subproblem SP ′, (or SP ′′), because it does not
contain a better solution than the best solution found so far.
3.3.2 Resource consistency check
In the previous section we have introduced an extension of algorithm 3, that solves
the problem with alternative resources. This extension expands the branching factor of
algorithm 3 because for each resource in each set of alternative resources a new branch
is created. Size of the search space is now O(2|P |·(n−1) ·Πi∈A|Mi|). Whenever a set of
alternative resources Mi contains exactly one resource k, we can check if it is possible
to schedule parallel activities on the same resource k.
In [9] an overload checking for cumulative resources based on task intervals has
been introduced. We denote p(M) =∑
i∈P pi, rM = mini∈M ri and dM = maxi∈M di
for M ⊆ A. We define a set Pij = {l ∈ A | rl ≥ min{ri, rj}, dl ≤ max{di, dj}} for each
i, j ∈ A.
Resource consistency check is a technique finding Pij over i, j ∈ A such that rPij+
p(Pij) is maximal. If it holds p(Pij) > dPij−rPij
for such Pij , then no feasible schedule
exists. For more detailed description see [9].
Now we can use the above ideas to easily perform overload checking in the algo-
rithm 3 as follows: Whenever a resource is removed from set of alternative resources Mj
during the search procedure described in the previous section and only last resource
k remains in Mj , we will check if the resource k is not overloaded. We perform this
check by finding set Pij such that rPij+ p(Pij) is maximal. Let us note, that the set
Pij is constructed only over activities l ∈ A having Ml = {k} in the current node of
the search tree mentioned in section 3.3.1. If it holds p(Pij) > dPij− rPij
for such Pij
then there does not exist a feasible schedule where resource k processes activity i and
the current branch can be pruned.
3 U ∪V denotes disjunctive union (that is U ∩ V = Ø)
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
528
4 Preliminary experimental results
Performance of the algorithm described in the previous sections has been tested on
randomly generated data on AMD Duron 850 MHz. The code has been written in
C++. The data has been generated as follows4:
– Number of activities has been given by constant (50)
– Number of all resources has been given by constant (10)
– Capacity of each resource has been given randomly (4 ± 2)
– Number of alternative resources for each activity has been given randomly (7 ± 2)
– Processing time of each activity has been given randomly (14 ± 2)
– Size of the time window of each activity has been given randomly (10 ± 4)
Since the search algorithm is sensitive to the number of precedence constraints, all
parameters but number of precedence constraints has been fixed as described above.
There has been generated 4 × 40 instances of the problem (40 instances with 100
precedence constraints, 40 instances with 200 precedence constraints, etc). Results are
shown in table 1.
Table 1 Results of measurement
Number ofprecedences
Number of solutionsOptimum / Stopped5
Average time6 Average distancefrom lower bound7
100 35/5 6:40 3 %200 27/13 7:59 4 %300 16/24 9:00 7 %400 8/32 9:24 4 %
According to the assumption, results indicates that the search algorithm is sensi-
tive on the number of precedence constraints. The smaller number of precedence con-
straints in the instance was the more the algorithm was ”successful”. More precedence
constraints increases probability of being critical, which expands the search space.
5 Conclusion
A search algorithm solving elastic respectively preemptive scheduling problem with
alternative resources and minimizing resource cost has been introduced. This search
algorithm based on a detection of ”problematic” precedence constraints tries to finish
predecessors of a failed activity earlier, which can help the failed activity to be correctly
scheduled. Preliminary experiments have shown that the proposed algorithm is sensitive
to the number of precedence constraints, as we expected. The open question is whether
4 Numbers of activities, resources, capacities and sizes of alternative resources sets weretaken from average real life projects
5 Optimum means that the algorithm have finished before 10 minutes time limit.6 Average time has been calculated only from calculations reached optimum, that were longer
than 1 second.7 Average distance from the lower bound has been calculated as Sol−Min
Max−Min, where Sol
denotes the costs of the best solution found, Min equals to the LB (defined in 3.3.1) of thegiven instance of the problem. Max was defined analogically to the Min.
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
529
it is possible to further reduce the number of ”problematic” precedence constraints by
their more careful identification.
The branching factor in algorithm 3 depends also on the number of all possible
changes of the deadlines of activities, that can affect the failed activity. Future research
may focus on a heuristic function that predicts which changes of deadlines have higher
impact on finding a feasible schedule.
Acknowledgements The research is supported by the Czech Science Foundation under thecontract no. 201/07/0205.
References
1. Baptiste P., Le Pape C., Nuijten W., Constraint based scheduling: applying constraintprogramming to scheduling problems, Kluwer Academic Publishers, Boston, MA, (2001)
2. Baptiste P., Le Pape C., Resource Constraints for Preemptive Job-shop Scheduling, Con-straints: An international Journal, 3, 263-287 (1998)
3. Le Pape C., Baptiste P., Heuristic Control of a Constraint-Based Algorithm for the Pre-emptive Job-Shop Scheduling Problem, Journal of Heuristics, Vol. 5, 305-325, (1999)
4. Wolf A., Schlenker H., Realising the Alternative Constraint, LNCS, 3392/2005, 185-199(2005)
5. Zhao W., Ramamritham K., Stankovic J. A., Preemptive Scheduling Under Time and Re-source Constraints, IEEE Transaction on Computers, Vol. C-36, No. 8, (1987)
6. Zhou Q., Smith S. F., A Priority-Based Preemption Algorithm for Incremental Schedulingwith Cumulative Resources, Robotics Institute, Carnegie Mellon University (2003)
7. Garey M. R., Johnson D. S, Computers and intractability, W. H. Freeman and Co., SanFrancisco, Calif., (1979)
8. Brucker P., Scheduling algorithms (third edition), Springer-Verlag, Berlin, (2001)9. Wolf A., Schrader G., O(n log n) Overload Checking for the Cumulative Constraint and Its
Application, Lecture Notes in Computer Science, Springer, Berlin, (2006)
Multidisciplinary International Conference on Scheduling : Theory and Applications (MISTA 2009) 10-12 August 2009, Dublin, Ireland
530