• No results found

1,if h 0,otherwise

j i ij

(s ) d

x

= ®­

=

¯

where i denotes the driver index, and j denotes the shift index. Using the rules described above, the IP model of the driver rostering is: 60 1 1 j w j ij s S w i w wt( s ) x maxweekwt ( i t, w n ) ∈ ∀ ∀ ⋅ ≤ ⋅ ≤ ≤ ≤ ≤

¦

(1)

where wt(fj) is the working time of shift fj given in minutes, nw is

the number of shifts in week w, and maxweekwt is the maximum allowed weekly working hours for a driver.

7 24 60 60 1 1 j w j ij s S w i w wt( s ) x minweekwrt ( i t, w n ) ∈ ∀ ∀ ⋅ ⋅ − ⋅ ≥ ⋅ ≤ ≤ ≤ ≤

¦

(2)

where minweekrt is the minimal weekly resting time of a driver given in hours. The product 7⋅24⋅60 gives the length of a week in minutes. , ( ) ( ) 60

0

j k k j ik ij s s S j k st s et s minshiftrt

i

x x

∀ ∈ ≠ − < ⋅

¦

=

(3)

where minshiftrt is the number of minimum resting hours of a driver between two consecutive shifts. The starting time of the shift is denoted by st(sk) while the ending time of the shift is

(1 , 1 ) d contwd j k d k ij s S i d x contwd i t d n contwd + = ∀ ∈ ∀ ∀ ≤ ≤ ≤ ≤ ≤ −

¦

* (4)

where contwd is the maximum number of consecutive working days allowed in a given term.

days 1 1 j m ij s S i m x ( m ) minmonthrd ( i t, m numofmonths ) ∀ ∈ ∀ ∀ ≤ − ≤ ≤ ≤ ≤

¦

(5)

where days(m) gives the number of days in month m, minmonthrd gives the number of minimum resting days in a month, and

numofmonths gives the number of month of the planning period.

Sunday sundays 1 1 j m j q ij s S s S q i m x ( m ) minnumofsunday ( i t, m numofmonths ) ∀ ∈ ∈ ∀ ∀ ≤ − ≤ ≤ ≤ ≤

¦

* (6)

where q denotes the Sundays in the given month, sundays(m) gives the number of Sundays of month m, and minnumofsunday is the minimum number of Sundays that are needed to be assigned as resting days each month.

Given the constraints above, our objective function is:

¦¦

=t =

i n j ij ij

x

c

1 1

min

where cij is the cost of driver i executing shift j.

Solving the above model by using an IP solver would give the optimal solution for the problem. However, a huge disadvantage of this method is that the running time of the solver grows exponentially to the size of the problem. Because of this, a data instance taken from a real-life situation can have a running time up to several months (a problem of such magnitude has several million variables). On the other hand, a decision support system can not apply a solution method with such a slow running time. This is not acceptable, as companies would like to execute the methods several times using different parameter settings, and compare the results to choose the driver roster that fits their situation the best.

To satisfy the above requirements, a different method is needed, which gives a near-optimal solution, but has an extremely fast running time. As mentioned before, greedy-based heuristics are known for these propterties.

3.2 Greedy algorithm

Greedy algorithms are usually known to provide solution faster for our problem than other optimization methods. Though it comes with the cost that the greedy choice property guarantees

especially a proper selection method for the initial set of drivers can improve the global solution too.

Initially the driver set is defined. Each driver has a contract type which defines the working hours for a day in average of a given time interval (in our case it is two months). Our method uses an initial set of drivers calculated by a seperate algorithm. This gives an estimate driver number, considering the existing different types of driver contracts and uses the number of employed drivers for the given day as an upper bound As a first step, depending on their total working time, the shifts can be divided into sets, which helps in giving this estimation. Usually the resulting number helps us to achieve a good quality solution, but this estimation can be greater then the actual number of drivers available for the company. The second step uses the ratio between these different contract types. The estimate values are modified, using pre-set upper bounds: if the value is greater than its upper bound, then it is decreased to the upper bound, and their differenc is converted to a different contract type (either with greater, or with smaller working hours) which can be increased. The ratios of conversion are in case of 4-, 6- and 8-hours contracts:

• 2 contracts of 4 hours can be converted into 1 contract of 8 hours;

• 3 contracts of 4 hours can be converted into 2 contracts of 6 hours;

• 4 contracts of 6 hours can be converted into 3 contracts of 8 hours.

These conversions can be applied both ways, eg. if the maximum number of drivers with 8-hour contracts is exceeded, they can be converted either to drivers with 4-hour or 6-hour contracts. Considering the total daily working time, the above mentioned rules can be applied, as they are all equivalent conversions. This means that for example an 8-hour long shift can either be executed by a driver with a contract of 8-hours, or 2 drivers with a contract of 4-hours. The resulting number now can be applied as an initial input for the number of drivers used by the greedy heuristic.

Then the rostering algorithm iterates through every day of the planning period. Each day, the daily shifts are assigned to feasible drivers, who are chosen according to a certain strategy (fitness, random).

Let S be the set of shift, and D the set of drivers. Our greedy algorithm for the driver scheduling problem is:

GREEDY_DR(S,D) for days i=1..n

S’=unassigned shifts of day(i)

while S’≠∅

sj=Select_shift(S’)

D’=drivers of D, who can execute sj

dk=Select_driver(D’,sj)

assing si to dk

S’=S’\{sj}

end while end for

executing the chosen shift. For example the shifts can be selected randomly or sequently by the calendar, and the drivers can be selected randomly, with a first fit approach, or by using a fitness function minimizing the over and undertime to determine the best driver for the shift.

Our experience shows that a cost value of driver number combinations in the search space more or less strictly decreasing, while the minimal area is well determinable and the direction of the decrease is easily recognizable in every point. The estimate values given by our special method in the initial step is close to this minimal area. Executing the greedy algorithm (GREEDY_DR) above sequentially, using a neighbour step in the driver combination (increasing the number of drivers in a contract type in case of overtime and decreasing in case of undertime) with an expected lower cost can lead us to a solution closer to the optimum.

4 TEST RESULTS

The presented methods have been implemented and tested in Matlab using a general pc, implementations under different programming environments might give slightly different results. The running time of the vehicle scheduling method is a few seconds for a daily schedule, which adds up to 2-3 minutes to a planning period of 2 months. It can be improved by using parallel execution. The driver rostering method has a running time of around 2 minutes, which gives us a total running time around of 4-5 minutes (depending on the problem size).

We have tested our methods on instances provided by Tisza Volán Zrt. The present practice of the company uses 264 drivers for this planning period. Our results are summarized in Table 1 (the number of drivers, and the differences between the drivers average daily working hours and their required working hours by their contract type).

Table 1. Driver numbers and average working hour differences from the contract types. Test cases show different

contract type settings. Number of drivers min. difference (h) max. difference (h) average difference (h) Test1 225 -0,05003 -0,00223 -0,01164 Test2 228 -0,1052 0,07445 0,000724 Test3 223 0 0,0626 0,013213 Test4 231 0 0,10063 0,026401 Test5 226 -0,09693 -0,00023 -0,02735 Test6 228 0,0032 0,054267 0,017737 It can be clearly seen, that the methods resulted in a significant decrease in the number of drivers, while the average daily working hours of a driver always stay close to the contract type of the driver. The table only shows the total number of drivers for

each instance, however, this is always a sum of the drivers with different type of contracts.

Each instance stands for a driver schedule with different cut and join methods, for which we determined the inital set of drivers, and executed some iterations of the driver rostering algorithm until it improves the cost. The results we get after the last iteration are the solutions of the problem. All values in the columns are averages, which are calculated using the following method: the monthly working time of each driver is divided by the number of workdays in that month, resulting in a daily average working time. Table 1 contains the minimum, maximum and average differences from the corresponding contract types. Negative numbers represent undertime, while positive numbers represent overtime.

All test results (except for Test2) contain drivers of all 3 contract types (8, 6 and 4 hours). The number of drivers with 6-hour contracts is 4 in all cases, while the number of drivers with 4-hour contracts greatly vary: 7 in Test4, 4 in Test3, 2 in Test5, 1 in Test1 and Test6, and 0 in Test2.

The company always has higher number of drivers in their roster, than they actually need. This way they always have enough drivers, when needed (e.g sending people on vacation, or unforeseen events).

5 CONCLUSION AND FUTURE WORK

This paper shows our results for solving the problems of both driver scheduling and driver rostering in public transportation. The algorithms we presented for the problems are both based on the greedy strategy which guarantees a fast running time, while the algorithms themselves give promising results on real-life instances. The algorithm can execute different optimization strategies through the process, and then compare the solutions accordingly. This flexibility makes it more useful in industrial usage.

Further improvement of the results is possible, using well chosen heuristic techniques on the output of the driver rostering algorithm. Currently a local-search based heuristic is being perfected and tested which is able to correct a shift if it conflicts a rule. This heuristic introduces a cost-function to every crucial rule of the driver rostering, with certain weights depending on the importance of the rule, and our goal is to minimize these costs. The heuristic examines each day of the planning period, and is able to swap the shifts of any two drivers on the given day. The shifts are swapped, if it decreases the overall cost of the rostering, and the algorithm has several termination criteria.

The introduced greedy methods are part of a research and development project, currently in the research phase. The Matlab implementation is mainly for research purposes, the methods will be implemented in the final project using a C++ enviroment.