• Nie Znaleziono Wyników

Parallel algorithm for some single machine scheduling problems

N/A
N/A
Protected

Academic year: 2022

Share "Parallel algorithm for some single machine scheduling problems"

Copied!
10
0
0

Pełen tekst

(1)

ZESZYTY N A U K O W E POLITECHNIKI ŚLĄSKIEJ Seria: A U TO M ATYKA z. 134

2002 N r kol. 1554

Wojciech B O Ż E JK O 1, M ieczysław W ODECKI2 'Politechnika W rocław ska

2Uniwersytet W rocławski

PARALLEL ALGORITHM FOR SOME SINGLE MACHINE SCHEDULING PROBLEMS

S u m m ary . Problem o f scheduling a single m achine to m inim ize total w eighted late jo b can be described as follows: there are n jo b s to be processed, each jo b has an integer processing tim e, a w eight and a due date. The objective is to m inim ize the total weighted late job, where the late jo b is perform ed after its due date. The problem belongs to the class o f N P-hard problem s. In the paper, we propose sequential and parallel (for SIMD m odel com puting) branch and bound algorithm s based on elim ination criteria. Finally, the com putation results and discussion o f the perform ance o f algorithm s are presented.

ALGORYTM RÓW NOLEGŁY DLA PEW NEGO JEDNOM ASZYNOW EGO PROBLEMU SZEREGOW ANIA ZADAŃ

Streszczenie. W pracy zajm ujem y się problem em optymalizacji kolejności wykonywania zadań na jednej maszynie, w którym kryterium optymalności je st sum a kosztów zadań spóźnionych. Jest on oznaczany przez n|l||Ew,Ł// i należy do klasy problem ów silnie N P-zupelnych. Przedstawiam y algorytm równoległy (dla m odelu SIMD) oparty na m etodzie podziału i oszacowań, w którym wykorzystano kryteria eliminacyjne.

1. In tro d u ctio n

The single m achine w eighted num ber o f late jo b s problem know n as «|l|lZw iU/ is NP- hard (Karp [3]). This problem can be stated as follow: Each o f « jo b s (numbered 1 , . . . , n) is to be processed w ithout interruption on a single m achine w hich can handle only one jo b at a time. For each jo b i let p it dt w, be as follows: processing time, due date and w eight (which is the penalty incurred if the jo b is com pleted after its due date). The objective is to sequence the jobs so that the total penalty is minimized.

(2)

82 W . Bozejko, M. Wodecki

In the literature there are know n optim al algorithms to solve the above problem which use dynam ic program m ing (Lawler and M oore [4] - pseudopolynomial algorithm which requires 0 ( « m i n { ^ . p y ,m a x y{d; }}) time, Sahni [8] - when all weights are integer which

requires 0 ( n m in { ]> ^ p j , m aXj{d j}}) tim e). There are also branch and bound algorithm s (Villarreal and Bulfin [10], Potts and van W assenhowe [5],[6]). However considering that these algorithms are mem ory and tim e expensive it is very hard to calculate bigger problem s. Therefore, in the last years we can see intensive developm ent of approxim ate algorithm s especially those w hich use various ideas o f local search (tabu search, sim ulated annealing).

Sections 2 and 3 contain problem description and methods to solve them. N ext sections describe branch and bound algorithm and com puter sim ulations o f sequential and parallel algorithms.

2. P ro b le m fo rm u la tio n an d e n u m e ratio n schem e

Let N={1,2, ... ,«} be the set o f all tasks and 77 the set o f perm utations o f elements /

from N. For perm utation n e l l let us denote q, (C„0 = 'YJp ,u)) to be a due date o f the job i-1

i in perm utation n (i.e. w hen tasks are executed in order o f appearance in it). Then let us denote:

0, w henC , 1 [1, otherwise,

to be a tardiness o f the jo b and /( C ,j= w/U/ the penalty. The w eight (penalty) o f the perm utation is defined by:

% ) = E *

/-i

Therefore, w e have to calculate the optim al perm utation in our problem (which has minimal weight) in the set o f all perm utations 77.

For any set Q c N , we define P ( 0 ) = ^ iey p,.

G eneration process o f perm utations from set 77 w e w ill present as a search tree. We create this tree as follows. From the root node (zero level), w here no jo b s have been scheduled, w e branch to n different nodes on the first level, each node corresponding to a

(3)

Parallel Algorithm For Some Single. 83

specific jo b being scheduled in the n-th position. Each o f these nodes leads to n- 1 new nodes on the second level, corresponding to one o f the rem aining n- 1 jo b s filling the (n -l)-th position.

Each node tc from k-\h level (k = 0,l,2,...,n) is characterized by a set o f fix e d jo b s S'M={n{k+\),n(k+2),...,7t{n)) and fr e e jo b s Sx =(n{\),n(2),...rfk)) where |5 ,| = A, S ’,kjSk = N

and S'„ nS, = 0. Producing new perm utation p from n (new node on (A-l)-th level o f tree) consists in fixing on k-th position in P one o f the free jo b s from the set S K, i.e. change positions o f fixed jo b w ith the jo b w hich is on Ar-th position in n and include it in the set o f fixed jobs S°p . R em aining jo b s on the same positions are in both perm utations. Obviously in each successor o f perm utation p the jo b fixed on k-th position in P will still remain.

1 2 k - 1 k k + 1 n - 1 n < - p o s itio n

n = ff(2 ),....,x j k - 1 ) , * ( * ) , x { k + 1),.... -1), n {h j)

' X

y.

3. E lim inations c rite ria

Each node n in the search tree is characterized by a set S„ o f unscheduled jobs.

We define a precedence relation, that this, a partial order on the jo b ’s set S m such that an optimum sequence exists that satisfies this precedence relation.

This relation will be denoted by 91, and i91j means that jo b i m ust be perform ed before job j , ( ije S x ). In this case jo b j is called descendant o f jo b i and jo b i is called an ascendant o f job j . Sets A ,= {/'eSx: i91j) and B r ije S ,.: j91i) will, respectively, denote indices o f the descendants and the ascendants o f jo b i e S„. In the following, w e restricted ourselves to schedules w hich satisfy the precedence constrains. By determ ining so m any o f these precedence relation 91, w e present theorems on so-called eliminations criteria.

T h eo rem 1 [1], I f for a jo b l e S x we have:

dj>P(Sj),

then we only have to consider schedules whereby / com es last am ong the jobs in T h e o re m 2 [9]. If for two jo b s ije S „ we have:

d,>P(SM j), then we only have to consider schedules whereby i precedes j .

(4)

84 W. Bozejko, M . Wodecki

T h e o re m 3 [2], I f for two jo b s i je S „ w e have:

d,<dj, wj> Wj, p:<pj, then w e only have to consider schedules whereby i precedes j .

T h e o re m 4. I f jo b s i j e S x and:

P (B j) + p j > max {o', : l e S x and w, / p, > Wj / p s , then we only have to consider schedules whereby i precedes j .

These theorem s are checked in every node o f a search tree.

4. L o w er b o u n d

Let n be a node o f the tree H on /c-th level, S = jy r(l),...,;?(/:)} - the set o f free jo b s and S ’ = [7t{k + l),...,;r(rt)} - the set o f fixed jobs. A lower bound LB o f the costs o f all possible

schedules generated from n can b e defined as follow:

L B (x ) = F ( S ' ) + L B ( S ) , where:

o)>

/«*+1

is the cost o f executing fixed jo b s from the set 5” and LB(S) is the lower bound o f executing free jo b s from the set S. W e will calculate LB(S) using two methods.

A Low er B o u n d fro m the greedy method.

Low er bound LBG (S) o f free jo b s execution costs can be calculated as follows:

A lg o rith m L B G

L B G (S ) := 0; W : = S \p := P (W )\

Execute k times:

if there exists i s W such as d t > P (W ) then W and p ?= p - p , else

L B G (S ):= L B G (S ) + m m { /(/? ) } and p : = p - m a x { p ,}

It is easy to prove that for any perm utation y o f jo b s from the set S, F (y ) > L B G (S ).

A L ow er B ound fro m the Assignm ent Problem.

(5)

Parallel Algorithm For Some S ingle.. 85

Let

T,(q) = m i n { P ( 0 : g c S \ { 5 , u 4 u { / } } ,

where q = \Q\ . N ext

tj = P (B j) + p , + T ,( j - \ B ,\ + 1), |S ,|l j l \ S \ A \ ,

and

^ f o r | 5 (| < ; < | 5 \ 4 | ,

oo f o r l< y s |jB y |a n d |5 \y 4 ( |< y ^ k .

A lower bound LBAP(S) o f the free jo b s execution from the set S is equal to the optim al solution o f the follow ing assignm ent problem:

k k Minimize: E Z c!/*i/>

k

for Xy e {0,1}, Yjxu = 1> / = 1«2 k and =1, / = 1 ,2 ,...,* .

/«I 7-1

In paper [7] the low er bound for n| 1 |Zw/7/ problem is calculated similarly.

Let LB(S) = m a x {LBG (S), LBAPQS)).

T heorem 5. If

LB{k) £ F ( n ) , then permutation «'can be eliminated.

5. B ranching ru le

W e w ill set jo b s from the candidate set K on k-th position in perm utation rr(|S,,|=£):

K { * ) = S \ { j B , . /-I For each jo b l e K let us denote the following indication:

A( 0 = /v(c;-p (+jPi)+ g E /^)(C.U)) - / f (Cf),

y-r+1 j» r +1

where I = /r(r) and q = ;r(&).

T h eo rem 6. I f /? is a perm utation generated from 7rby fixing o f the jo b !eK(rr) on the position k, then:

(6)

86 W. Bozejko, M. Wodecki

F(jB) = F ( x ) + A(l).

Therefore, expression F(n)+A(!) is a perm utation w eight generated from x by fixing free jo b s on ¿-th position. W hile the algorithm progresses we w ill choose jo b s that after fixing will generate perm utation - direct successor w hich has the sm allest possible weight (i.e. w hich has the sm allest A(i), is. K(t,r ) ).

6. B ra n c h a n d b o u n d alg o rith m

The starting point o f the algorithm (the root o f solutions tree H) is a perm utation /r0, and the set o f free jo b s 5 ,o = N . Let us assum e n < -r r 0 as the best solution and let upper bound U B = F \x ). The tree level is h = 0.

Let 7rbe a perm utation (node) on h-th level o f the tree H. The set o f free jo b s S x = \k\ , k = n-h.

S T E P 1: {Low er bound)

I f lower bound L B {x ) > F (x " ) th e n go to STEP 4 S T E P 2: {U pper bound)

I f F ( x ) < UB th e n UB <- F ( x ) , n n ; STEP 3: {Calculations}

I f K(rz) = 0 th e n go to STEP 4 Select a jo b I e K (jc) , such that:

¿ ( 0 =ieK( x)

G enerate new perm utation ¡5 (node in H) by selecting the jo b / on the k- th p o sitio n . Let h < - h + \-,k < r -n -h ; x < - J3;

Go to STEP 1.

S T E P 4: {Backtrack}

I f ;ris the root o f the tree { n is an optim al solution) th e n E X IT .

I f perm utation iz was generated from ¡5 by fixing free jo b / e K { x ) then:

h <r- h - 1; k < - n - h\ K ( n ) •<- K (jr) \ {/}, goto S T E P 3.

The quality o f solutions calculated by branch and bound algorithm depends also on starting point. B elow we present heuristic algorithm w hich calculates this solution.

A lg o rith m A H (heuristic algorithm).

Enum erate jobs, such as d, s d2... s d, . Let / to a current time.

Set W<—0 ; /< -0;

f o r i 1 to n do b egin

(7)

Parallel A lgorithm For Some Single. 87

if t+pi < di then

Set: W<r-W^J {i},t< r-t+ pi;

else

Create set: Q = {/ e W : Y ,P i~ Pi + A s 41;

jt.i if Q * 0 then

Create set: V = {_/ e g : w, > «>,};

if K * 0 th e n

Set ¿ e K such as w*=max{w/: l e V} and set W<—W \ {&}u{/}; t<—t - pk+pi', end;

Execute jo b s from the set W (in order o f appearance), next execute the rem aining jobs in any order.

The AH algorithm requires O(nlogn) time.

7. A lgorithm P a ralleliz a tio n

Parallel algorithm was implem ented for SIMD model o f parallel processors without shared memory. Each processor has its ow n local memory w ith short tim e o f access;

Communication betw een processors is very slow (comparing to local-memory access).

The m ain idea o f parallel algorithm is to m ake concurrent search process on solution’s tree H. Each processor has set o f vertex to search and local value o f upper bound UB. If every processor had the newest value o f the best upper bound in every moment, the speedup (comparing to sequential algorithm) w ould be the greatest. B ut broadcasting o f upper bound costs - the tim e o f com m unication between processors is very long. T hat’s why frequency o f communication betw een processors (broadcasting o f the new est value o f upper bound) have to be low. In our im plem entation the processor is getting a new value o f UB w hen it w ants to broadcast its ow n re* and (independently) after some period o f tim e (or num ber o f iterations BroadcastJter).

Com parison results o f som e B ro a d c a s tjte r for parallel algorithm can be seen in Table 2.

Scheme o f p a ra lle l a lg o rith m for each processor begin

Heap : heap; {local for each processor}

w hile H eap o NULL begin

iz:= Get (Heap)\

(8)

88 W. B oiejko, M. W odecki

{Upper Bound}

if F {k) < UB then begin

UB <— F ( n ) , tt <- J t ;

b ro a d c a s t n* to o th e r p rocessors;

end;

Select a jo b / e K { n ) , such that A (/) = min {A,}, ieK(x)

Generate new perm utation J3 (node in H) by selecting the jo b I on the

£-thposition. Let h < - h + \ ; k < - n - h ' , . Put {Heap, p)\

end;

end.

8. C o m p u te r sim u lation s

Test problem s were generated as follows [7]. For each jo b i, an integer processing time Pi w as generated from the uniform distribution [1, 100] and, for weighted tardiness problems, an integer w eight w as generated from the uniform distribution [1, 10]. Problem hardness is likely to depend on the relative range o f due dates (RDD) and on the average tardiness factor (TF). H aving com puted P = i p t and selected values o f RDD and TF from the set {0.2, 0.4, 0.6, 0.8, 1.0}, an integer due date di from the uniform distribution [P (l - T F - R D D /2 ) , P(1 - TF + RDD/2)] was generated for each jo b i. Five problem s were generate for each of the 25 pairs o f values o f RD D and TF, yielding 100 problem s for each value o f n.

Table 1 Num ber o f iterations

n

num ber o f processors

1 2 4

20 1542 2287 2930

25 5654 6052 7468

30 22985 18006 15913

35 91587 66321 79854

40 293122 226892 224632

The algorithm w as im plem ented in Ada95 language and run on Sun Enterprise 4x400M H z com puter under Solaris 7 operating system. Tasks o f Ada95 language were executed in parallel as system threads.

There are average results o f iteration num ber o f algorithm for each num ber of processors in Table 1. As w e can see parallel algorithm makes less num ber o f iterations than

(9)

Parallel Algorithm For Some Single.. 89

the sequential algorithm for large problem size («>25). In parallel algorithm the num ber o f iterations is counted as the sum o f iterations for every processor - so the speedup w e can get, may be greater than P, w here P is number o f processors.

Table 2 Com paring o f num ber o f iterations and execution

tim e for one random problem instance («=12, R D D = T F = 1.0,4 and 1 processors)

4 - processors implementation

Broadcast iter iterations time (sec.)

1 208118 37

10 200434 14

100 205357 14

500 206889 9

1000 196128 9

5000 207699 9

10000 205983 11

20000 206750 11

1 - processor implementation______

I 247046 I 29

As we have said before, the frequency o f com m unication between processors (broadcasting o f the new est value o f upper bound) have to be low. The best value for our computer was 1000 iteration, but B ro a d ca stJter value strongly depends on m achine and communication speed.

9. Conclusions

This paper gives a practical sequential and parallel branch and bound algorithm for the total weighted late jo b problem . Preliminary calculation let us suppose that increase num ber of processors cause to m ake possible to solve larger instances (more than 50 jobs), especially when we will use stronger low er bounds and additional elim ination criteria.

LITERATURA

1. Elmaghraby S.E.: The One-M achine Sequencing Problem w ith Delay Costa, Journal o f Industrial Engineering, 19(1968) pp. 105-108.

2. Emmons H.: O ne-M achine Sequencing to M inim ize Certain Functions o f Job Tardiness, Operations Research, 17(1969), pp. 701-705.

(10)

90 W. Bożejko, M. Wodecki

3. K arp R.M .: Reducibility am ong Com binatorial Problems, Com plexity o f Computations, R.E. M illerand J.W . Thatcher (Eds.), Plenum Press, N ew York, 1972, pp.85-103.

4. Law ler E.L., M oore J.M .: A Functional Equation and its Applications to Resource A llocation and Sequencing Problems, M anagem ent Sci., 16(1969), pp.77-84.

5. Potts C.N., V an W assenhove L.N.: A Branch and Bound Algorithm for the Total W eighted Tardiness Problem, O perations Research, 33(1985), pp.177-181.

6. Potts C.N., V an W assenhove L.N.: A lgorithm s for Scheduling a Single M achine to M inim ize the W eighted N um ber o f Late Jobs, M anagem ent Science, vol. 34, N o.7, 1988, pp.843-858.

7. Rinnoy Kan A .H .G., B.J. Lageweg, Lenstra J.K.: M inim izing total costs in one-machine scheduling, Operations Research, 25(1975) pp.908-927.

8. Sahni S.K.: A lgorithm s for Scheduling Independent Jobs, J.Assoc. Comput. Match., 23(1976), p p .l 16-127.

9. Shw im er J.: O n the n-job, one-machine sequencing-independent scheduling problem with tardiness penalties: A branch and bound solution, M anagem ent Sci., 18 B(1972) pp.301- 313.

10. Villareal F.J., Bulfin R.L.: Scheduling a Single M achine to M inim ize the Weighted N um ber o f Tardy Jobs, IE Trans., 15(1983), pp.337-343.

Recenzent: Prof, dr hab. inż. Tadeusz Sawik

S treszczenie

W pracy rozpatrujem y problem u kolejnościowy polegający na uszeregow aniu n zadań na jednej maszynie. M aszyna ta, w dowolnej chwili, może wykonywać co najwyżej jedno zadanie. D la zadania i niech p , , w ,, d, b ęd ą odpowiednio: czasem wykonania, w agą funkcji kosztów oraz wym aganym terminem zakończenia (linią krytyczną). Jeśli ustalona jest kolejność w ykonyw ania zadań i C,-jest terminem wykonania zadania i (i- l,2 ,...,n ), to U, =1, gdy Cj>di, a 0 w przeciw nym przypadku nazywa się spóźnieniem, natom iast w,Ui je st kosztem spóźnienia zadania. Rozw ażany problem polega na w yznaczeniu takiej kolejności w ykonyw ania zadań, która zm inim alizuje sumę kosztów spóźnień w,Ur N ależy on do klasy problem ów silnie NP-zupełnych. Przedstawiam y algorytm równoległy (dla modelu obliczeń SIAD) oparty na m etodzie podziału i ograniczeń, w którym wykorzystano kryteria eliminacyjne. Pozw alają one na znaczne zm niejszenie zbioru rozw iązań dopuszczalnych. Przy większej liczbie procesorów, w rozsądnym czasie, m ożna tym algorytmem rozwiązywać średnich rozm iarów przykłady.

Cytaty

Powiązane dokumenty

Abstract—A parallel EAX-based algorithm for minimizing the number of routes in the vehicle routing problem with time windows is presented.. The main contribution is a novel

Keywords-parallel memetic algorithm, parallel processes co- operation schemes, genetic and local search algorithms, vehicle routing problem with time windows..

Table 3 contains the histograms of numbers of solutions 7 produced by the algorithm with the total travel distance y worse by 0-1%, 1-2% etc. than the distance y min of the

Postanowienie to sygnowane było osobiście przez Josipa Broza Titę, sprawującego wówczas funkcję premiera Demokratycznej i Fe ­ deracyjnej Jugosławii (DFJ, jednocześnie

(0.5, 1], when the network throughput is large, the output’s CAP length is grad- ually increased. It can be seen from Fig. 4 that in the preset dedicated slot sequence 1...

By choosing appropriately the subsequences of the auxiliary sequences, we can apply the results of Section 1 where the auxiliary sequences converge superlinearly to 0. This technique

S4: For the processing unit j, introduce a processing unit resource place p j (j = 1, 2,. , m) (processing unit) are intercon- nected, and so are all the activities that share the

During our work on the Polish-Bulgarian-Russian corpus, we have come across a number of issues, which we regard as characteristic of multilingual corpora: (1)