a heuristic approach for scheduling of electrical...

61
A heuristic approach for scheduling of electrical buses Department of Mathematics, Linköping University Rasmus Lindberg LiTH-MAT-EX--2020/03--SE Credits: 16 Level: G2 Supervisor: Nils-Hassan Quttineh, Department of Mathematics, Linköping University Examiner: Elina Rönnberg, Department of Mathematics, Linköping University Linköping: May 2020

Upload: others

Post on 11-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

A heuristic approach for scheduling of electricalbuses

Department of Mathematics, Linköping University

Rasmus Lindberg

LiTH-MAT-EX--2020/03--SE

Credits: 16

Level: G2

Supervisor: Nils-Hassan Quttineh,Department of Mathematics, Linköping University

Examiner: Elina Rönnberg,Department of Mathematics, Linköping University

Linköping: May 2020

Page 2: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 3: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Abstract

The planning process of public transit systems have for long been a subjecttreated in operations research. In recent years, research within the public tran-sit area focus on adapting this planning process for electric vehicles. This thesisevaluates a heuristic approach to the vehicle scheduling problem for electricalbuses without the use of any licensed software.

Among the previous research is an article that presents a mathematical modelfor scheduling of electrical buses using AMPL and CPLEX. However, due tonot finding optimal solutions for all instances of the problem, the question of aheuristic approach is raised. Literature studies indicate that large neighbour-hood search (LNS)-based heuristics have shown previous success for schedulingof vehicles. Results from the implementation of a constructive heuristic com-bined with an LNS-heuristic are compared with the results from the mathe-matical model and CPLEX. We see some success using the heuristic approach.However, the method we compare against still provide better solutions for al-most all instances. More specifically, the difference between the results (numberof buses needed) increases with an increasing complexity of the problem. Fi-nally, due to the lacking results, some recommendations are given for improvingthe performance of the heuristic.

Keywords:Vehicle scheduling, electrical buses, heuristics

URL for electronic version:http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-165681

Lindberg, 2020. iii

Page 4: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 5: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Acknowledgements

I would like to to thank my supervisor Nils-Hassan Quttineh and my examinerElina Rönnberg for their support throughout the work on this thesis. Thediscussions together with the recommendations of articles and heuristics allowedme to continuously try new and improved heuristics during the implementation.

Lindberg, 2020. v

Page 6: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 7: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Nomenclature

• Program: The Python software handling the writing and loading of data,the heuristic and setups.

• VSP: Vehicle Scheduling Problem.

• LNS: Large Neighbourhood Search.

• ALNS: Adaptive Large Neighbourhood Search

Lindberg, 2020. vii

Page 8: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 9: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Contents

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Earlier work 52.1 Summary of the problem . . . . . . . . . . . . . . . . . . . . . . . 52.2 Mathematical model . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Heuristics 93.1 Introduction to heuristics . . . . . . . . . . . . . . . . . . . . . . 93.2 Constructive heuristics . . . . . . . . . . . . . . . . . . . . . . . . 103.3 Metaheuristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.4 Neighbourhood Search methods . . . . . . . . . . . . . . . . . . . 10

4 Implementation 134.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.3 Preprocessing and reading data . . . . . . . . . . . . . . . . . . . 174.4 Heuristics in the program . . . . . . . . . . . . . . . . . . . . . . 17

5 Results 235.1 Results from earlier work . . . . . . . . . . . . . . . . . . . . . . 235.2 Overview of the results . . . . . . . . . . . . . . . . . . . . . . . . 245.3 A closer look at the heuristic . . . . . . . . . . . . . . . . . . . . 265.4 Illustration of a solution . . . . . . . . . . . . . . . . . . . . . . . 28

Lindberg, 2020. ix

Page 10: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

x Contents

6 Discussion 316.1 Comparing the results . . . . . . . . . . . . . . . . . . . . . . . . 316.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.3 How good is the heuristic approach . . . . . . . . . . . . . . . . . 346.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

A In-data 37

References 45

Page 11: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Chapter 1

Introduction

1.1 Background

That the world and especially the developed countries, are moving towards amore environmentally conscious future is nothing new. What is new, is all thedifferent ways the society, through people, corporations and different levels ofgovernment can change to promote a more environmentally-friendly future. Fol-lowing the widespread use of buses as a means of public transport throughout allof Sweden, a good way of reducing the carbon footprint of local municipalitiescould be to look over the emissions caused by buses in public transport. In thisthesis, we specifically study the use of a fleet of electrical buses.

As the use of buses, of course, creates a mathematical scheduling problem ofits own, the use of electrical buses, in this case, could arguably create a slightlymore advanced Vehicle Scheduling Problem (VSP). To give a brief background,a planning process for public transit systems is generally considered to be con-sisting of four parts. In [2], Ceder outlines in the activities (1) Network routedesign, (2) Timetable development, (3) Vehicle Scheduling, (4) Crew Schedul-ing.

Although the focus of this thesis lies on Vehicle Scheduling, it is important tomention the complexity of the planning process for public transit systems. TheVehicle Scheduling is focused on scheduling vehicles to the (often during thisstage) available timetable. Consider a finished timetable where a public trans-port vehicle should be able to pick up and deliver passengers at a certain pointin time. Since the requirements of the timetable need to be met, that is, thevehicle (bus in this case) needs to be at the specified places at the specified time.

Lindberg, 2020. 1

Page 12: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

2 Chapter 1. Introduction

Ceder explains the VSP as a problem whose aim is to create sequences of trips,called vehicle blocking. The expression comes from the act of blocking togethera vehicles revenue and non-revenue generating activities. Furthermore, he de-scribes the two different fundamental activities that a vehicle can be assignedto; it can transport passengers as part of a trip or it can deadhead to somedestination to ready itself for some other trip specified in the timetable [2].

The revenue-generating activities are the buses transporting passengers fromone point to another (without consideration to some degree of variation in thenumber of passengers on a bus). The non-revenue-generating activities are sim-ply deadheading, that is the bus travelling from one point to another withoutthe regard of trying to complete a job, just readying itself for some job in thefuture.

Some earlier work has already been done with the purpose of scheduling electri-cal buses, see for example [5]. More research covering the planning process forpublic transit systems of electrical buses can also be found in [14, 16, 17].

1.2 PurposeThe purpose of this thesis is to implement and evaluate the efficiency of aheuristic solution method for the VSP. The evaluation will be conducted througha comparison with already existing results. This new method should not relyon software that requires an expensive license, like AMPL or CPLEX that for asingle commercial or governmental user has a combined cost of $14,500 [1] (orGAMS that is in a similar price range [3]). Hence, this thesis is trying to answerthe following questions:

1. Is it possible to create a heuristic solution method without the use oflicense-required software?

2. If so, are the new solutions competitive compared with existing results?3. What kind of heuristic should be used?

1.3 MethodThe heuristic should be tested on provided in-data and the results are comparedwith already existing, best known, results. The program itself will be writtenusing Python 3.7 and some free modules specified in the Chapter 4. In- andout-data is managed using Microsoft Excel.

Page 13: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

1.4. Limitations 3

Which heuristics to try and what to focus on have been decided through discus-sions with Nils-Hassan Quttineh and Elina Rönnberg. The focus should be onchoosing and implementing a heuristic method for VSP. This heuristic shouldcreate feasible solutions for all problem instances. The heuristic considered is acombination of a constructive method and an LNS approach.

1.4 LimitationsThe limitations of this thesis are the following:

• The work is limited to 10 weeks.• The program is written in the programming language Python 3.7, due to

prior experience and the ease of using the language.• The in-data used for testing is the same as the one used in the model

described in the Chapter 2.• Solutions produced by the heuristic introduced in this thesis should be

feasible for the mathematical model described in Chapter 2.

1.5 OutlineIn Chapter 2 earlier work by Häll et al. [5] is summarised as to provide an in-troduction to the optimisation problem. Chapter 3 consists of literature studiesof heuristics, this is to motivate the implementation, which is then described inChapter 4. The results from the implementation and the earlier work are thenpresented in Chapter 5. They are then compared in the discussion in Chapter6. Chapter 6 also concludes this thesis as well as provides some ideas for furtherwork in this area.

Page 14: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 15: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Chapter 2

Earlier work

As mentioned in the background, some earlier work in this area has alreadybeen done. The following Chapter, unless otherwise stated, is in its entiretybased on the work of Häll et al. [5].

2.1 Summary of the problemThe optimisation problem described in [5] can be summarised as follows.

• Given a specific number of jobs, the buses in a town would collectively doall of them.

• Buses drive according to some schedule that lets them do all the jobs.• Given the information about the jobs and how long a bus is able to drive,

what is the least amount of buses that is needed and how should theybe used? In other words, what should the previously mentioned schedulelook like?

Expanding on the problem, if the buses where electrical they could also be quick-charged (more alternatives are discussed by Häll et al. in [5]) at some stationswhere charging equipment can be placed. A solution to this problem answersthe questions outlined below.

1. What is the least amount of buses that can be used?2. How would the planning look for these buses?3. Where should the quick-charging equipment be placed?

Lindberg, 2020. 5

Page 16: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

6 Chapter 2. Earlier work

2.2 Mathematical modelThe mathematical model given in [5] is defined by Table 2.1 and equations(2.1)–(2.13).

Table 2.1: Indices and SetsIndices and sets

K set of charging alternatives kL set of bus lines lI set of trips i (all departures for all lines)A set of arcs (i, j, k), possible combinations of trips i and j, and charging

alternatives k

ParametersQ Number of available charging stationsS Safety margin between tripsC Charging capacity of busesqki Energy added by charging option k at charging node iτk Time needed to perform charging option kai Start node for trip ibi Stop node for trip isi Start time for trip idi Distance covered by trip iti Time required to perform trip iei Energy required by trip iDij Deadheading distance between bi and ajTij Time required to go from bi to ajEij Energy required to go from bi to aj

Binary variablesxkij equals 1 if a bus performs trip i, charge according to k and travel to

node ajwl equals 1 if charging is available at the beginning of line l

Continuous variablesyi Energy-level record at node ai after chargingyi Energy-level record at node bi after charging

Page 17: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

2.2. Mathematical model 7

The set A takes care of a lot of the detail of the problem and is defined asA =

{i, j ∈ I, k ∈ K : si + ti + τk + Tij + S ≤ sj

}. The earlier described op-

timisation problem is solved with the charging alternative quick charging de-scribed in [5] for 5 minutes. Given a specific number of available chargingstations (Q), the goal of minimising the number of buses and to decide theplacement of the charging equipment, the Mixed Integer Programming (MIP)is written as follows.

min z =∑

(0,j,k)∈A

xk0,j (2.1)

subject to ∑(i,j,k)∈A

xkij = 1, i ∈ I (2.2)

∑(i,j,k)∈A

xkij = 1, j ∈ I (2.3)

∑(i,j,k)∈A

eixkij ≤ yi, i ∈ I (2.4)

∑(i,j,k)∈A

Eijxkij ≤ yi, i ∈ I (2.5)

yi ≤ yi − ei + qki + C(1− xkij), (i, j, k) ∈ A (2.6)

yj ≤ yi − Eij + qkj + C(1− xkij), (i, j, k) ∈ A (2.7)

∑(i,j,k)∈A:qki >0

xkij ≤ wl, l ∈ L, i ∈ I : bi = l (2.8)

∑(i,j,k)∈A:qkj >0

xkij ≤ wl, l ∈ L, j ∈ I : aj = l (2.9)

∑l∈L

wl ≤ Q (2.10)

xkij ∈ {0, 1}, (i, j, k) ∈ A (2.11)

wl ∈ {0, 1}, l ∈ L (2.12)

Page 18: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

8 Chapter 2. Earlier work

0 ≤ yi, yi ≤ C, i ∈ I (2.13)

The depot node is assigned 0 (the number of buses that leaves the depot equalsthe number of buses used).

The objective function in (2.1) is to minimise the number of buses used. Con-straints (2.2) and (2.3) guarantees that each trip is done exactly one time while(2.4) and (2.5) makes sure that there is sufficient energy to perform a trip. Con-straints (2.6) and (2.7) record the energy levels. Further, constraints (2.8) and(2.9) suppresses charging activities where no charging equipment is availablewhile constraint (2.10) limits the number of charging stations. Lastly, con-straints (2.11) - (2.13) define the variables.

Even though this model is capable of producing results it is described as weakdue to constraint (2.7), which are of big M-type. Those contributes to makeit difficult to find optimal solutions for instances of the problem. A lot of theresults from this model are also not proven optimal, and the run-time of thetests has been limited using to AMPL and CPLEX for one hour.

This leaves the opportunity of trying to solve this problem using heuristics in-stead, which will be described further in the next chapter.

Page 19: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Chapter 3

Heuristics

3.1 Introduction to heuristicsThe word heuristic is derived from the Greek word heuriskien which means todiscover. This is an accurate description of the word considering its uses oftrying to discover an answer. More specifically to optimisation; a heuristic isa type of solution method that is often used when trying to solve some harderproblems. The characteristics of a heuristic solution method are outlined below.

1. Heuristics are able to generate a solution within a specified solution time.2. It does not guarantee a good solution.3. It is usually hard to determine if the solution produced by the heuristic is

optimal or not.

The book Optimeringslära [6] classify optimisation algorithms as optimisingand non-optimising algorithms, where heuristics are a part of the latter. Themain difference being that for an optimising algorithm an optimal solution isguaranteed, given sufficient computation time, regardless of changes in the in-data.

Further, they describe that a heuristic can be viewed as a rule-of-thumb, wherethe heuristic is the solution method for a specific kind of problem. Oftentimesthe structure and characteristics of the problem are exploited to find a goodsolution, quickly. So why should a heuristic be used? Often there are multiplereasons to why using a heuristic seems like a favourable approach:

1. An optimising algorithm is too slow.2. An optimising algorithm takes up too much memory.

Lindberg, 2020. 9

Page 20: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

10 Chapter 3. Heuristics

3. We are not sure of the in-data, so finding a near-optimal solution is suffi-cient.

4. A simple heuristic could be understood by people who have not studiedoptimisation. So the solution-procedure could often be explained easily[6].

In this thesis, we focus on two types of heuristics: constructive heuristics andmetaheuristics.

3.2 Constructive heuristicsAs described in [6], a constructive heuristic is a method where the startingpoint is an infeasible solution. After this, we iterate and for each iteration adda component to the solution (assigning a certain value to the variable added inthe iteration) until the solution is feasible and we have our result.

The order of the variables and the values that are assigned to them often impactshow good the result is. A lot of different methods of choosing which values thatshould be assigned to which variables exist, a common one is what we call agreedy algorithm

3.3 MetaheuristicsIn [6], Lundgren et al. write that the solution from a constructive heuristic canoften be quite bad. So to get a better result one could simply create multiplesolutions and then choose the best one. The problem here is that this may takeboth time and computation power. To get around this problem, metaheuristicswhere created. Metaheuristics could limit or guide the solution in the searchspace in some manner, compared to generating random solutions in the wholesearch space. The result of this is a faster algorithm which oftentimes deliversbetter solutions [6].

3.4 Neighbourhood Search methodsPisinger and Ropke writes in [8] about how the use of Large NeighbourhoodSearch (LNS)-based heuristics have shown great results when trying to solvedifferent VSP. Further, they describe LNS as a way for search-methods to explorethe neighbourhood through heuristics.

Page 21: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

3.4. Neighbourhood Search methods 11

Large Neighbourhood SearchIn [8], LNS is described as a metaheuristic that destroys and repairs a solutionto try and improve it. An important distinction is that of not mixing up LNSwith its class Very Large Neighbourhood Search. Whereas the former has aneighbourhood defined by the methods destroy and repair, the latter has aneighbourhood often predefined as a subset of solutions.

In the destroy method, the solution is destroyed by stochastically removing someparts of it. The repair method in turn creates a new solution by building upthe parts that where destroyed, hopefully in a new way.

Adaptive Large Neighbourhood SearchThis is an extension on the previously described LNS. In the Adaptive LargeNeighbourhood Search (ALNS) heuristic the methods for destroy and repair arenot constant. Instead, some stochastic element combined with different weightschoose the specific method that should be used each iteration. In [8] this issummarised as allowing multiple neighbourhoods to coexist in one search.

Ropke and Pisinger expands on ALNS in [15] by discussing the its use of multipleunrelated neighbourhoods. This extends the LNS approach which typically onlyvaries the search depth of a single neighbourhood. Further, they also discusshow an ALNS approach could be improved even further through implementingmetaheuristics at the top level of an already existing ALNS.

Page 22: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 23: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Chapter 4

Implementation

This chapter will describe the implementation of our heuristic using Python.The problem at hand is based on the VSP described in the Chapter 2, withsome small alterations outlined below.

1. A bus only charges after a completed job if the end node has a chargingstation. In the mathematical model in [5], a bus can deadhead to a nodeand charge there as well.

2. The implementation rely on the user of the program to input which nodesare classified as charging stations, whereas it is computed in the mathe-matical model in [5].

The first alteration could prove itself to be a huge restriction in terms of howgood the objective function value will be. However, those alterations were chosendue to the limitation of this thesis.

4.1 RequirementsThe requirements (modules) needed to run the program are listed in Table 4.1.No module requires a purchased license. An important module is the copy-module. Since an assignment in Python is only creating a binding betweenan object and a target, to be able to do real copies we need to introduce thefunction deepcopy from the copy-module when handling lists of classes.

Lindberg, 2020. 13

Page 24: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

14 Chapter 4. Implementation

Table 4.1: Modules for the Python programModule Summaryopenpyxl Used to read/write to Excel files [4].pandas Used for data analysis in Python. It also provides some data-

structures [9].numpy Used for computation in Python, contains mathematical func-

tions that are otherwise unavailable [7].copy As assignment does not copy an object in Python, some special

functions are needed to create a copy [10].sys Used for accessing variables used by the interpreter [12].time Used for providing time-related function [13].random Used for generating pseudo-random numbers [11].

4.2 ClassesTo ease the coding three main classes have been used; TimeDist, Job and Bus.

TimeDistThe class TimeDist, as described in Table 4.2, is a matrix that describes differentvalues a bus (described in Table 4.4) needs to read in order to evaluate a job.Most importantly, it contains the energy-values of the matrix for doing the jobitself, but also the time-values of the matrix to evaluate deadheading.

Table 4.2: The class TimeDistTimeDist

Time What time it takes for a Bus to travel from point i to point j inminutes.

Distance The distance between i and j in kilometres.Energy The energy it takes to travel from i to j.lambda The lambda value in the energy equation (4.1).

Page 25: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

4.2. Classes 15

The Energy needed to travel from point i to point j is calculated as

Energyij = λE ∗ ET ∗Distanceij + (1− λE) ∗ ED ∗ Timeij (4.1)

where ET is the energy (in kWh) it takes for a bus to travel one kilometre andED the energy (in kWh) it takes for a bus to travel for one minute. These aregiven from input of two matrices and can be seen in Appendix A. The λE-valueis a constant regulating how time and distance should be weighted, it is alsogiven as an input.

JobExcept for the obvious attributes of a job that are available via the providedin-data, some could use a more in-depth description. All attributes are outlinedin Table 4.3. For job number n, the class attribute available jobs in the programis a list of all jobs available after job n is complete. So for all jobs in availablejobs that are not yet assigned to a bus, the program iterates over them to checkwhether a bus could have time to deadhead (if needed) to a and be there no laterthan Start time. This also includes a safety margin of 5 minutes (specified inthe in-data) to give room for varying traffic. It does not include jobs in the listwith a Start time greater than 2 hours after job n is complete to avoid havinga bus unused for too long.

Table 4.3: The class JobJob

Number The dedicated number of the job.a The starting point of the job (the first bus station).b The ending point of the job (the last bus station).Start time The start time of the job.Time The time it takes to complete the job.End time The end time of the job (Start time+ Time).Distance The total distance that needs to be travelled to complete the

job.L The bus line the job is a part of.Availablejobs

A list of other jobs available with regards to time after thejob itself is complete.

Availablejobs aftercharging

A list of other jobs available with regards to time after thejob itself is complete and the bus has charged.

Page 26: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

16 Chapter 4. Implementation

Available jobs after charging are the same as Available jobs with the added timeit would take for the bus to do one charge-cycle at its current position aftercompleting job n. Aside from these two attributes and End time, all attributesin the class are an input specified for some problem instance.

BusTable 4.4 describes the attributes of a class representing a bus. The Batteryis important since it is limiting the possibility of a bus driving longer thanphysically possible with its equipped battery, it is also needed to handle thecharging. The attribute Max battery is an input, that is also needed to make surethat overcharging of a battery does not happen (that is Battery ≤ Maxbattery).The Joblog contains details of what jobs the bus has already completed, with allthe information specified in Table 4.3. The Chargelog contains details of whenand where the bus should be charging, if it should do so. Job log and Charge logare the two attributes that make up the schedule for the buses in the solution.

Table 4.4: The class BusBus

Number The dedicated number of the bus.Battery The battery level of the bus.Max battery The maximal battery level of the bus.Job log A list of the jobs the bus have already completed, which

is important to have when wanting to inspect the resultsafterwards.

Position The current position of the Bus.Charge log Details regarding where the bus should be charging (if there

are any).Time The current time.

Page 27: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

4.3. Preprocessing and reading data 17

4.3 Preprocessing and reading dataThe settings for the model, such as the energy level of the buses (Q), the pa-rameters to the function describing energy loss and the jobs for the model arewritten in a specific manner in different Excel files. How the input is written isimportant since the program can only handle Excel files of a specific format.

After this, all the jobs that are provided as in-data are initiated, including thepreprocessing activity of generating all the lists of available jobs. Though thiscould seem like an unnecessary action it saves a lot of computation power withthe cost of only some memory. Worth noting is that these available jobs onlyconsider the the time when deciding inclusion.

4.4 Heuristics in the programAs concluded in [5], heuristics could be a good approach for this problem, butwhich heuristics should be used?

To find a feasible solution for this problem is trivial. A constructive heuristicis used where each bus is allocated to a job, starting from nothing, adding avariable bus and assigning it to a job, then adding a new bus and assigning thisto some other job. This is repeated until each job is assigned to a bus and theresults is (obviously) a feasible solution, even if it is a bad one. How to improvethis solution is described below.

Solution without chargingIn order to improve upon the simple feasible solution, a more advanced construc-tive heuristic is used. As seen in Figure 4.1, the start is still from an infeasiblesolution. A bus is then added, and we assign a job to that bus. Then we iterateby searching for feasible available jobs (feasible according to time and batterylevel). The first feasible job (if there is one) is then assigned to the bus. Theprocess of searching for feasible jobs is continued with a new list of available jobsuntil a point is reached where there are no feasible jobs that can be assigned tothe bus. The list of available jobs is sorted to the one next in time (sorting withrespect to the starting time of future jobs, and the time to deadhead to saidjobs starting point), if Y < 0.5, where Y ∈ [0, 1). Adding buses and assigningthem to jobs is repeated until all jobs are assigned to buses. We thus have afeasible solution with the solution having an objective value equal to or lowerthan the objective value for the trivial constructive heuristic described above.

Page 28: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

18 Chapter 4. Implementation

Figure 4.1: Diagram of the code used for constructing a solution without charg-ing.

Solution with chargingWe now consider the possibility of charging at a given number of nodes. Thisis described in Figure 4.2. Here, a bus always look at the node it is positionedat, that is, the ending point b of the last assigned job. If charging equipment isavailable at this position, the bus may choose to charge for a specified amountof time in order to increase its battery level. Given that using the availablecharging equipment does not leave the bus with an empty list of available jobs,the bus may choose to use the charging equipment. If the battery level is under25, the bus always chooses to use the charging equipment. Should the batterylevel exceed 25 the bus calls a stochastic variable X ∈ [0, 1), if X < 0.5 the buschooses to charge. The stochastic variable X takes on new values every time itscalled. Available jobs is sorted in the same way as in Solution without charging.

Page 29: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

4.4. Heuristics in the program 19

Figure 4.2: Diagram of the code used for constructing a solution with charging.

Page 30: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

20 Chapter 4. Implementation

Large neighbourhood search-heuristicImproving from the earlier constructive heuristics, the metaheuristic LNS isimplemented (see Figure 4.3).

First a number of max iterations, and a start value for a destroy rate (how manypercent of the solution to destroy), is given by the input. A main solution iscreated using some constructive heuristic and some repair-method (where theones illustrated in Figures 4.1 and 4.2 works as both). A copy of the solution isthen created, and part of it destroyed by randomly erasing some buses accordingto the destroy rate. The consequence of this is that some jobs are currently notassigned to any bus, and the new solution is thus infeasible. A heuristic isnow called, creating a partial solution for the unassigned jobs, which is thencombined the infeasible solution, together creating a feasible new solution. Theobjective values of the old main solution and the new solution are compared, ifthe new one is better than the old solution (want to minimise), the main solutionis discarded in favour of the new one. If not, the new solution is discarded.

This metaheuristic runs for a specified number of iterations (given in the in-data), where the final solution presented is the best found. It is also worth notingthat in order to not get stuck at some local optimum, a check is implementedin the heuristic. After some large number of iterations, where the new solutionsfail to improve upon the old one, the percentage regulating how much of thesolution is destroyed is increased (up to a maximum value) with the hope ofescaping the local optimum for the possibility of finding a solution closer to theglobal optimum.

Page 31: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

4.4. Heuristics in the program 21

Figure 4.3: Diagram of the destroy and repair-heuristic.

Page 32: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 33: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Chapter 5

Results

The results from the program described in Chapter 4 is presented and comparedwith the results from [5], in order to answer questions posed when formulatingthe purpose of this thesis.

5.1 Results from earlier workResults of the mathematical model in Chapter 2 are presented below in Ta-ble 5.1 and 5.2 for 70 different problem instances. In these tables bold textindicates that the solution is proven optimal. The notation is from the ear-lier described mathematical model. That is, Q being the number of chargingequipment available, and C being the maximum battery level of a bus.

Table 5.1: Number of buses needed in the best found solutions for 100 jobs.Jobs 100 Q

0 1 2 3 4C 30 75 63 53 49 41

35 63 50 41 35 3440 48 42 39 35 3245 42 36 33 32 3150 41 35 30 29 2955 33 31 29 28 2860 30 28 28 28 28

Lindberg, 2020. 23

Page 34: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

24 Chapter 5. Results

Table 5.2: Number of buses needed in the best found solutions for 116 jobs.Jobs 116 Q

0 1 2 3 4C 30 88 73 62 56 45

35 73 58 50 42 3740 56 48 43 39 3545 49 43 39 37 3450 48 41 36 32 3155 38 36 33 31 3060 35 33 30 29 29

As described in [5], the model is implemented with AMPL and CPLEX solver(version 12.5), and with the technical specifications outlined in Table 5.3.

Table 5.3: Technical specifications of the server usedModel HP DL160 server running LinuxProcessor Two 6-core Intel Xeon CPUsMemory 72GB RAMTime limit 1 hour

5.2 Overview of the resultsIn the this section, the objective values of the best found solutions by the heuris-tic in Chapter 4 are presented. Since the solutions are achieved through heuris-tics, it is worth noting that the program has been stopped after 20,000 iterations.The details for the computer that ran the program is given in Table 5.4. Therun-time for the program was approximately 10-20 minutes, with the run-timeincreasing in accordance with an increasing complexity of the problem.

Page 35: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

5.2. Overview of the results 25

Table 5.4: Technical specifications of the computer usedModel MacBook Air, 13-inch, Early 2015Processor 1.6 GHz Intel Core i5Memory 8 GB 1600 MHz DDR3Iteration limit 20,000

The results from the heuristic presented in Figure 4.3, iterating 20,000 times,are presented in Table 5.5 and 5.6. The two tables use the same notation as themathematical model and results from [5]. The same problem instances are alsoused. In these tables italics indicates that the solution is as good as the one inTable 5.1 and 5.2 respectively. The localisation of charging equipment matchesthe localisation for the best found solutions by the mathematical model in [5].For more information about the problem instances, see Appendix A.

Table 5.5: Number of buses needed in the best found solutions for 100 jobs.Jobs 100 Q

0 1 2 3 4C 30 75 65 66 60 50

35 63 52 48 46 4340 50 47 46 44 4245 46 45 44 43 4150 45 43 39 37 3655 41 38 36 36 3460 37 36 34 34 33

Page 36: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

26 Chapter 5. Results

Table 5.6: Number of buses needed in the best found solutions for 116 jobs.Jobs 116 Q

0 1 2 3 4C 30 88 75 77 66 58

35 73 61 57 52 4740 58 53 51 48 4845 54 52 52 46 4650 52 48 46 44 4455 45 43 41 40 3960 41 40 40 39 37

We can observe some troubling data in Table 5.5 and 5.6, namely for the instanceC = 30 and Q = 2. The solution for both these instances is worse than thesolutions with a more constrained Q. This could depend on the placing onthe charging equipment leading the heuristic to some local optima. Furtherexamination could be done by letting the heuristic iterate longer, to see if itcould find a more reasonable solution, where a loosened constraint leads tolesser buses in the solution.

5.3 A closer look at the heuristicIn Figure 5.1 a graphical illustration of the heuristic generating an optimal so-lution. Optimal since it has been proven optimal in [5]. Note that the heuristickeeps trying to find better solutions for approximately 19,000 iterations, sinceit does not know if it has reached a global optimum or not.

In Figure 5.2 (the same problem as in Figure 5.1 but with doubled number ofiterations) we also see that a majority of the New solutions objective values arefar from the Best from approximately 38,000 iterations and onward, so whathappens? It is a change in volatility of the different generated solutions, morespecifically, the heuristic is trying to change its neighbourhood through adapt-ing the destroy and repair-method by increasing the percentage of destroyedsolution, like explained in Chapter 4. This is used as a method to try andprevent the heuristic from getting stuck in a local optimum.

Page 37: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

5.3. A closer look at the heuristic 27

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Iterations 104

72

73

74

75

76

77

78

79

80

81

Be

st

fou

nd

so

lutio

n

72

73

74

75

76

77

78

79

80

81

Ne

w s

olu

tio

n

Jobs=116, C=35, Q=0

Best

New

Figure 5.1: Generating an optimal solution.

0 0.5 1 1.5 2 2.5 3 3.5 4

Iterations 104

72

73

74

75

76

77

78

79

80

81

82

Be

st

fou

nd

so

lutio

n

72

73

74

75

76

77

78

79

80

81

82

Ne

w s

olu

tio

n

Jobs=116, C=35, Q=0

Best

New

Figure 5.2: Stress test with 40,000 iterations.

This adaptive method is easily understood by inspecting the graph inFigure 5.3. As the settings in these tests are set to adapt the destroy-percentagefor every 2,000 iterations having an unimproved best solution, black arrowsindicate whenever the destroy-percentage increase. We also see that the best

Page 38: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

28 Chapter 5. Results

found solution often seems to be positively effected by this, meaning it has mostlikely moved from a local optimum to one closer to the global.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Iterations 104

50

52

54

56

58

60

62

64

Best fo

und s

olu

tion

50

52

54

56

58

60

62

64

New

solu

tion

Jobs=116, C=40, Q=2

Best

New

Figure 5.3: Graphic description of the solutions generated through the heuristic.

5.4 Illustration of a solutionRecall the original problem presented in [5] by Häll et al., what the heuristic istrying to create is a schedule for the buses. An assembly of an output from theprogram for the problem specified as 100 jobs, the maximum battery capacityof a bus, C = 55, and the number of charging equipment available Q = 3, ispresented as a Gantt schedule in Figure 5.4. Including the predefined safetymargin of 5 minutes between a job and the next one, we can easily concludethat the solution is feasible through inspection. Note that this solution is notan optimal one, it is merely used to demonstrate what a feasible output fromthe program looks like.

Page 39: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

5.4. Illustration of a solution 29

Figure 5.4: Gantt Schedule of the solution for 100 jobs, C = 55 and Q = 3. Thetime is given in minutes and the bars are presented as;’Job’: ’Start time’ -> ’End time’.

Page 40: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 41: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Chapter 6

Discussion

In this chapter, the results from the two different approaches (see Chapter 2and Chapter 5) will be compared and analysed. Further, some weaknesses inthe implementation are raised, the heuristic approach is discussed and furtherwork suggested.

6.1 Comparing the results

Using the summarised results presented in Tables 5.1, 5.2, 5.5 and 5.6 for the 70problem instances, the difference of how good solutions are for each instance areplotted in Figure 6.1 and 6.2 respectively. The graphs illustrate subtracting theresults from the mathematical model in [5] from the results from the heuristicapproach. Thus, a higher value on y-axis means that the heuristic approach isfailing at finding good solutions.

Lindberg, 2020. 31

Page 42: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

32 Chapter 6. Discussion

0 1 2 3 4

Q

0

2

4

6

8

10

12

14

16

18

20D

iffe

rence in #

buses

Comparison between results for jobs=100

30

35

40

45

50

55

60

Figure 6.1: Difference between results for 100 jobs

0 1 2 3 4

Q

0

2

4

6

8

10

12

14

16

18

20

Diffe

ren

ce

in

#b

use

s

Comparison between results for jobs=116

30

35

40

45

50

55

60

Figure 6.2: Difference between results for 116 jobs

From inspection of Figures 6.1 and 6.2 we see that the heuristic approach is goodfor low values of charging stations Q and max battery capacity C. With increas-ing Q and C the difference increases with the complexity (number of possiblesolutions) of the problem. Considering the relative simplicity of the heuristic

Page 43: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

6.2. Implementation 33

approach compared to the multitude of mathematical approaches CPLEX hasaccess to, the difference in performance is expected.

Another important thing to notice is that the mathematical model in [5] isstopped from generating more solutions if an optimal solution is not found af-ter an hour. When trying to find a solution through the heuristic approach aspecification of iterations is instead made beforehand since the program can notknow if a solution is optimal. The run-time for the program on the computerspecified in Table 5.4 is approximately 10–20 minutes. Considering the differ-ence in computing power for testing it is possible that the program might havebeen able to produce a slightly better result than the one presented now if runon a better server or computer. At the same time, looking at Figure 5.2, theheuristic might just continue to generate bad solutions when fed with a highernumber of max iterations in the settings. So we can suspect that the heuristicin some manner has a difficulty of finding better local optima after reaching acertain point.

6.2 ImplementationLike mentioned earlier, the specifications for the computers producing the dif-ferent results, as well as the run-times, are different, so they could not possiblybe fairly comparable. At the same time, it could be interesting to improve therun-time for future work in this area. From the implementation in Chapter 4we know that the deepcopy function used is responsible for a majority of theprograms run-time. As earlier described in Chapter 5, the run-time increaseswith the complexity of the problem. The function has to copy more classes, themore jobs in the problem instance. It is also used more, the higher the destroy-percentage is, that is another argument for why the heuristic starts with a lowdestroy-percentage. However, this is a problem for the implementation andcould be improved in a number of ways outlined below.

• Writing better code; more specific, threading, etc.• Using other modules.• Using other programming languages.

Like noted in Chapter 4, it is important to keep in mind the altered rules forheuristic in the program. The fact that a bus can not deadhead to node withcharging equipment will obviously effect how close to the best found objectivevalues for the mathematical model in [5] the heuristic can get, to some extent.

Page 44: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

34 Chapter 6. Discussion

Taking account of the different constraints, the heuristic in this thesis couldnever be fairly comparable to the mathematical model in [5].

6.3 How good is the heuristic approachFor problems of lower complexity, a heuristic approach initially seems like asuccessful approach. However, with an increasing complexity, the differencebetween the program and the CPLEX solver increases. At the same time, theprogram provides a better solution than the feasible solution where every job isassigned to a unique bus.

Figures 5.1, 5.2 and 5.3 show that the plot for the best solution has a steeperdescent (the number of iterations it takes for the heuristic to find a bettersolution is relatively short). From this, we can discuss how important the firstmain solution in the program is? Obviously, a good greedy heuristic provides agood start point, but some metaheuristic is still needed. The latter is also thepart of the program that is using most of the computing power.

From Pisinger and Ropke’s conclusion in [8], and from the results in this thesis, itis clear that an LNS-heuristic seems to be effective in finding good solutions. Theincreasing destroy-percentage also seems to be an effective method for escapinglocal optima.

So if the destroy-method seems effective, why are the solutions still worse thanthe ones provided as a comparison? The computing power and the number ofiterations could be a possible bottleneck. But what is even more interesting,something that is not examined as thoroughly in this thesis, is the repair-methodand an even more adaptive destroy-method. So to change the heuristic to a moreALNS-method, some possible improvements are listed below.

• The destroy-method currently destroys buses as part of the solution ina somewhat random manner. Some part of the solution that is deemedgood is saved from destruction at higher destroy-rates. However, this isonly implemented in a simple manner and could thus be improved bydiscussing what a good part of the solution should include. A change inthe destroy-method could guide the it to some bad part of the solution.An example could be weighting the likelihood of destroying a bus to thetime it is not utilised. A possible downside is, of course, the possibility ofgetting stuck in local optima. However, the downside could be addressedthrough having the guided destruction-method depend on the heuristicbeing stuck (like with the destroy-percentage) or due to some stochasticvariable.

Page 45: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

6.4. Conclusion 35

• The repair-method, could try to repair the solution in a more greedy way.As the repair-method now only implements some amount of greedinesstrying to do as many jobs as possible, it could be improved. Right now,the list of available jobs are sometimes sorted according to the one nextavailable (in time). An improved heuristic might sort the jobs in someother way before trying to assign one to a bus. The sorting could be donein several ways; according to the next job in time (as it is done now), thenext job with the least deadhead-time to it, the job with the least energycost for deadheading and doing the job, or some other way. The sortingmethod could then be decided through weighting the different methodsand deciding with a stochastic variable. A randomness of the sortingmethod would add a deeper layer to the heuristic.

Worth noting is that sometimes the objective value for a solution is better thanthe objective value for a problem instance with a lower Q. As mentioned ear-lier, these results also indicate that the heuristic is stuck in some local optimaor affected by the localisation of the charging equipment. During the implemen-tation a support for the latter was found. Even if some localisation of chargingequipment proved to be optimal when solving with CPLEX, the objective valuesof the heuristic approach could be positively affected by changing the localisa-tion of the charging equipment. It might also be that if the CPLEX tried tosolve the problem with the same constraints as the heuristic is facing, it mightsuggest different placing of the charging equipment.

6.4 ConclusionTo revisit the purpose of this thesis, it is possible to create a feasible heuristicmethod using only Python 3.7 and free modules, thus removing a dependencefrom license-required software. However, even if the solutions are better thanthe trivial feasible solution, the solutions from the mathematical model in [5]using AMPL and CPLEX-solver are still better for complex problem instances.So it would not, at least in this state, deem competitively comparable.

The fact that the constraints for the heuristic approach are more restrictivemakes it hard to compare the results directly. Further work on improving theheuristic might be able to prove competitive results for a problem with the sameconstraints as the mathematical model in [5]. The greedy heuristic combinedwith an ALNS-heuristic is effective, but other heuristics could, of course, providebetter or similar results as well.

Page 46: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 47: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Appendix A

In-data

Table A.1: NodesNode Name0 Depot1 S22 T23 S34 T35 S56 T57 S98 T9

Lindberg, 2020. 37

Page 48: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

38 Appendix A. In-data

Table A.2: Distance MatrixNode 0 1 2 3 4 5 6 7 80 . . . . . . . . .1 . . 10.4 1.5 6.2 7.8 7.7 12.5 5.32 . 9.4 . 11.9 10.5 9.9 7.5 2.7 9.63 . 1.6 11.4 . 8.6 4.0 8.0 11.1 5.64 . 5.8 9.3 8.6 . 8.3 5.9 9.8 2.45 . 5.1 10.0 11.6 11.6 . 11.3 10.9 7.86 . 7.7 6.5 6.6 6.6 11.6 . 6.3 5.67 . 10.9 2.7 9.8 9.8 10.7 6.8 . 8.38 . 5.7 9.2 2.3 2.3 9.5 5.8 8.3 .

Table A.3: Time MatrixNode 0 1 2 3 4 5 6 7 80 . . . . . . . . .1 . . 46 4 10 8 10 18 82 . 47 . 12 12 13 8 3 103 . 3 11 . 35 6 10 12 84 . 9 10 33 . 11 9 12 65 . 8 14 11 11 . 35 14 106 . 11 7 11 11 34 . 8 97 . 12 3 12 12 14 8 . 268 . 9 9 6 6 9 8 28 .

Page 49: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

39

Table A.4: Jobs = 100Job number a b s d t L0 0 0 0 0.0 0 01 1 2 24 10.4 46 22 1 2 34 10.4 46 23 1 2 44 10.4 46 24 1 2 54 10.4 46 25 1 2 64 10.4 46 26 1 2 74 10.4 46 27 1 2 84 10.4 46 28 1 2 94 10.4 46 29 1 2 104 10.4 46 210 1 2 114 10.4 46 211 1 2 124 10.4 46 212 1 2 134 10.4 46 213 1 2 144 10.4 46 214 1 2 154 10.4 46 215 1 2 164 10.4 46 216 2 1 2 9.4 47 217 2 1 12 9.4 47 218 2 1 22 9.4 47 219 2 1 32 9.4 47 220 2 1 42 9.4 47 221 2 1 52 9.4 47 222 2 1 62 9.4 47 223 2 1 72 9.4 47 224 2 1 82 9.4 47 225 2 1 92 9.4 47 226 2 1 102 9.4 47 227 2 1 112 9.4 47 228 2 1 122 9.4 47 229 2 1 132 9.4 47 230 2 1 142 9.4 47 231 2 1 152 9.4 47 232 2 1 162 9.4 47 233 3 4 5 8.6 35 334 3 4 15 8.6 35 335 3 4 25 8.6 35 336 3 4 35 8.6 35 3

Page 50: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

40 Appendix A. In-data

37 3 4 45 8.6 35 338 3 4 55 8.6 35 339 3 4 65 8.6 35 340 3 4 75 8.6 35 341 3 4 85 8.6 35 342 3 4 95 8.6 35 343 3 4 105 8.6 35 344 3 4 115 8.6 35 345 3 4 125 8.6 35 346 3 4 135 8.6 35 347 3 4 145 8.6 35 348 3 4 155 8.6 35 349 3 4 165 8.6 35 350 3 4 175 8.6 35 351 4 3 5 8.6 33 352 4 3 15 8.6 33 353 4 3 25 8.6 33 354 4 3 35 8.6 33 355 4 3 45 8.6 33 356 4 3 55 8.6 33 357 4 3 65 8.6 33 358 4 3 75 8.6 33 359 4 3 85 8.6 33 360 4 3 95 8.6 33 361 4 3 105 8.6 33 362 4 3 115 8.6 33 363 4 3 125 8.6 33 364 4 3 135 8.6 33 365 4 3 145 8.6 33 366 4 3 155 8.6 33 367 4 3 165 8.6 33 368 4 3 175 8.6 33 369 5 6 23 11.3 35 570 5 6 43 11.3 35 571 5 6 63 11.3 35 572 5 6 83 11.3 35 573 5 6 103 11.3 35 574 5 6 123 11.3 35 5

Page 51: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

41

75 5 6 143 11.3 35 576 5 6 163 11.3 35 577 6 5 1 11.6 34 578 6 5 21 11.6 34 579 6 5 41 11.6 34 580 6 5 61 11.6 34 581 6 5 81 11.6 34 582 6 5 101 11.6 34 583 6 5 121 11.6 34 584 6 5 141 11.6 34 585 6 5 161 11.6 34 586 6 5 181 11.6 34 587 7 8 7 8.3 26 988 7 8 37 8.3 26 989 7 8 67 8.3 26 990 7 8 97 8.3 26 991 7 8 127 8.3 26 992 7 8 157 8.3 26 993 7 8 187 8.3 26 994 8 7 1 8.3 28 995 8 7 31 8.3 28 996 8 7 61 8.3 28 997 8 7 91 8.3 28 998 8 7 121 8.3 28 999 8 7 151 8.3 28 9100 8 7 181 8.3 28 9

Page 52: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

42 Appendix A. In-data

Table A.5: Jobs = 116Job number a b s d t L0 0 0 0 0.0 0 01 1 2 24 10.4 46 22 1 2 34 10.4 46 23 1 2 44 10.4 46 24 1 2 54 10.4 46 25 1 2 64 10.4 46 26 1 2 74 10.4 46 27 1 2 84 10.4 46 28 1 2 94 10.4 46 29 1 2 104 10.4 46 210 1 2 114 10.4 46 211 1 2 124 10.4 46 212 1 2 134 10.4 46 213 1 2 144 10.4 46 214 1 2 154 10.4 46 215 1 2 164 10.4 46 216 1 2 174 10.4 46 217 1 2 184 10.4 46 218 1 2 194 10.4 46 219 2 1 2 9.4 47 220 2 1 12 9.4 47 221 2 1 22 9.4 47 222 2 1 32 9.4 47 223 2 1 42 9.4 47 224 2 1 52 9.4 47 225 2 1 62 9.4 47 226 2 1 72 9.4 47 227 2 1 82 9.4 47 228 2 1 92 9.4 47 229 2 1 102 9.4 47 230 2 1 112 9.4 47 231 2 1 122 9.4 47 232 2 1 132 9.4 47 233 2 1 142 9.4 47 234 2 1 152 9.4 47 235 2 1 162 9.4 47 236 2 1 172 9.4 47 2

Page 53: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

43

37 2 1 182 9.4 47 238 2 1 192 9.4 47 239 3 4 5 8.6 35 340 3 4 15 8.6 35 341 3 4 25 8.6 35 342 3 4 35 8.6 35 343 3 4 45 8.6 35 344 3 4 55 8.6 35 345 3 4 65 8.6 35 346 3 4 75 8.6 35 347 3 4 85 8.6 35 348 3 4 95 8.6 35 349 3 4 105 8.6 35 350 3 4 115 8.6 35 351 3 4 125 8.6 35 352 3 4 135 8.6 35 353 3 4 145 8.6 35 354 3 4 155 8.6 35 355 3 4 165 8.6 35 356 3 4 175 8.6 35 357 3 4 185 8.6 35 358 3 4 195 8.6 35 359 3 4 205 8.6 35 360 4 3 5 8.6 33 361 4 3 15 8.6 33 362 4 3 25 8.6 33 363 4 3 35 8.6 33 364 4 3 45 8.6 33 365 4 3 55 8.6 33 366 4 3 65 8.6 33 367 4 3 75 8.6 33 368 4 3 85 8.6 33 369 4 3 95 8.6 33 370 4 3 105 8.6 33 371 4 3 115 8.6 33 372 4 3 125 8.6 33 373 4 3 135 8.6 33 374 4 3 145 8.6 33 3

Page 54: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

44 Appendix A. In-data

75 4 3 155 8.6 33 376 4 3 165 8.6 33 377 4 3 175 8.6 33 378 4 3 185 8.6 33 379 4 3 195 8.6 33 380 4 3 205 8.6 33 381 5 6 23 11.3 35 582 5 6 43 11.3 35 583 5 6 63 11.3 35 584 5 6 83 11.3 35 585 5 6 103 11.3 35 586 5 6 123 11.3 35 587 5 6 143 11.3 35 588 5 6 163 11.3 35 589 5 6 183 11.3 35 590 5 6 203 11.3 35 591 6 5 1 11.6 34 592 6 5 21 11.6 34 593 6 5 41 11.6 34 594 6 5 61 11.6 34 595 6 5 81 11.6 34 596 6 5 101 11.6 34 597 6 5 121 11.6 34 598 6 5 141 11.6 34 599 6 5 161 11.6 34 5100 6 5 181 11.6 34 5101 6 5 201 11.6 34 5102 7 8 7 8.3 26 9103 7 8 37 8.3 26 9104 7 8 67 8.3 26 9105 7 8 97 8.3 26 9106 7 8 127 8.3 26 9107 7 8 157 8.3 26 9108 7 8 187 8.3 26 9109 8 7 1 8.3 28 9110 8 7 31 8.3 28 9111 8 7 61 8.3 28 9112 8 7 91 8.3 28 9

Page 55: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

45

113 8 7 121 8.3 28 9114 8 7 151 8.3 28 9115 8 7 181 8.3 28 9116 8 7 211 8.3 28 9

Page 56: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 57: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Bibliography

[1] AMPL Optimization inc. AMPL STANDARD PRICE LIST. 2020. url:https : / / ampl . com / products / standard - price - list/ (visited on01/17/2020).

[2] Avishai Ceder. Public Transit Planning and Operation: Modeling, Practiceand Behavior. Elsevier, Butterworth-Heinemann, July 2015, pp. 4–7.

[3] GAMS Development Corp. 2020. url: https://www.gams.com/products/buy-gams/ (visited on 03/20/2020).

[4] Eric Gazoni and Charlie Clark. OpenPyXL - A Python library to read/writeExcel 2010 xlsx/xlsm files. 2020. url: https://openpyxl.readthedocs.io/en/stable/ (visited on 01/20/2020).

[5] Carl H. Häll et al. “Adjustments of public transit operations planningprocess for the use of electric buses”. In: Journal of Intelligent Transporta-tion Systems 23.3 (2019), pp. 216–230. doi: 10.1080/15472450.2018.1488131. eprint: https://doi.org/10.1080/15472450.2018.1488131.url: https://doi.org/10.1080/15472450.2018.1488131.

[6] Jan Lundgren, Mikael Rönnqvist, and Peter Värbrand. Optimeringslära.3:5. Studentlitteratur AB, 2003.

[7] NumPy Developers. NumPy. 2020. url: https://numpy.org/ (visited on01/20/2020).

[8] David Pisinger and Stefan Ropke. “Large Neighborhood Search”. In: Sept.2010, pp. 399–419. doi: 10.1007/978-1-4419-1665-5_13.

[9] PyData Development Team. Pandas - Python Data Analysis Library. 2020.url: https://pandas.pydata.org/ (visited on 01/20/2020).

[10] Python Software Foundation. Copy - Shallow and deep copy operations.2020. url: https://docs.python.org/2/library/copy.html (visitedon 01/20/2020).

Lindberg, 2020. 47

Page 58: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

48 Bibliography

[11] Python Software Foundation. Random - Generate pseudo-random num-bers. 2020. url: https://docs.python.org/3/library/random.html(visited on 01/20/2020).

[12] Python Software Foundation. Sys - System-specific parameters and func-tions. 2020. url: https://docs.python.org/3/library/sys.html(visited on 01/20/2020).

[13] Python Software Foundation. Time - Time access and conversions. 2020.url: https://docs.python.org/3/library/time.html (visited on01/20/2020).

[14] Josephine Reuer, Natalia Kliewer, and Lena Wolbeck. “The Electric Ve-hicle Scheduling Problem - A study on time-space network based andheuristic solution approaches”. In: CASPT 2015 (Conference on AdvancedSystems in Public Transport 2015). Rotterdam, Netherlands, July 2015.

[15] Stefan Ropke and David Pisinger. “An Adaptive Large NeighborhoodSearch Heuristic for the Pickup and Delivery Problem with Time Win-dows”. In: Transportation Science 40.4 (2006), pp. 455–472. doi: 10.1287/trsc.1050.0135. eprint: https://doi.org/10.1287/trsc.1050.0135.url: https://doi.org/10.1287/trsc.1050.0135.

[16] Yusheng Wang et al. “Optimal recharging scheduling for urban electricbuses: A case study in Davis”. In: Transportation Research Part E: Lo-gistics and Transportation Review 100 (Apr. 2017), pp. 115–132. doi:10.1016/j.tre.2017.01.001.

[17] Chao Zhu, Xiaohong Chen, and Jiamin Xie. “Optimization Model for Lo-cating Electric Bus Charging Stations”. In: Oct. 2013, pp. 1545–1551. isbn:978-0-7844-1315-9. doi: 10.1061/9780784413159.224.

Page 59: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 60: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department
Page 61: A heuristic approach for scheduling of electrical busesliu.diva-portal.org/smash/get/diva2:1429614/FULLTEXT01.pdfA heuristic approach for scheduling of electrical buses Department

Linköping University Electronic Press

CopyrightThe publishers will keep this document online on the Internet – or its possiblereplacement – from the date of publication barring exceptional circumstances.

The online availability of the document implies permanent permission foranyone to read, to download, or to print out single copies for his/her own useand to use it unchanged for non-commercial research and educational purpose.Subsequent transfers of copyright cannot revoke this permission. All other usesof the document are conditional upon the consent of the copyright owner. Thepublisher has taken technical and administrative measures to assure authentic-ity, security and accessibility.

According to intellectual property law the author has the right to be men-tioned when his/her work is accessed as described above and to be protectedagainst infringement.

For additional information about the Linköping University Electronic Pressand its procedures for publication and for assurance of document integrity,please refer to its www home page: http://www.ep.liu.se/.

UpphovsrättDetta dokument hålls tillgängligt på Internet – eller dess framtida ersättare –från publiceringsdatum under förutsättning att inga extraordinära omständig-heter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, laddaner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat förickekommersiell forskning och för undervisning. Överföring av upphovsrätten viden senare tidpunkt kan inte upphäva detta tillstånd. All annan användning avdokumentet kräver upphovsmannens medgivande. För att garantera äktheten,säkerheten och tillgängligheten finns lösningar av teknisk och administrativ art.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsmani den omfattning som god sed kräver vid användning av dokumentet på ovanbeskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådanform eller i sådant sammanhang som är kränkande för upphovsmannens litteräraeller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se för-lagets hemsida http://www.ep.liu.se/.

© 2020, Rasmus Lindberg