Thesis Popova
Thesis Popova
Master Thesis
Student:
Elena Popova
Supervisors:
Dr. Miquel Àngel Piera
Dr. Liana Napalkova
September 2015
Abstract
This master thesis aims to analyze ground handling scheduling task in large scale airline
operations in order to collect results which might be used in contribution to the operational
efficiency of ground handling companies.
This work is focused on designing and developing of evolutionary computation algorithm
in Matlab for solving ground handling staff scheduling problem, which consists in finding the
schedule for all ground handling agents, such that the objective function is minimized and all the
constraints are satisfied. The objective function is built in a way that the number of unserviced
by some reason aircrafts is as small as possible, the workload is distributed equally and situations
when the agent is sent successively to gates located far from each other are mostly avoided. The
constraints that were taken into account are time windows of the tasks, working hours of the
staff and transportation time between the gates.
Since many factors could affect the processes which are performed during the turnaround, it
is not an easy task to make a full simulation, but in this paper was made an attempt to take at
least the main variables into consideration.
The analysis of problem solving methods was done in the theoretical part of the work in
order to choose the one, which is the most appropriate to the specifics of formulated problem.
Finally, two cases corresponding to two different implementations were considered in this the-
sis and their comparative analysis was conducted in order to allow more exhaustive exploration
and validation of the optimization method.
1
Table of contents
1 Introduction 4
1.1 State of the Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.1 Economic Aspects of Ground Handling . . . . . . . . . . . . . . . . . . . . 4
1.1.2 Impact of Turnaround Performance on Flight Delays . . . . . . . . . . . . 5
1.1.3 Manual vs. Automated Scheduling . . . . . . . . . . . . . . . . . . . . . . 6
1.1.4 Commercial Solution (INFORM) . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 Structure of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2
TABLE OF CONTENTS
6 Case Studies 38
6.1 Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.2 Case Study 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.2.1 Presentation of Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.2.2 Computational Time Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.3 Case Study 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.3.1 Presentation of Model Output . . . . . . . . . . . . . . . . . . . . . . . . 46
6.3.2 Computational Time Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 48
7 Analysis of Results 50
Annex A 56
3
Chapter 1
Introduction
4
1.1. STATE OF THE ART
USD80 billion per annum according to its trade association. By comparison, the airline industry
turned over around USD789 billion in 2014.
Since ground handling crews are located at the airport all the time, it is possible to call in
extra hands if needed. This has made the need for a good planning solution less pressing for
ground handling companies than airlines in the past. However, even small improvements in staff
planning of ground handling company could translate into large savings.
Statistics shows that an average delay per delayed flight in April 2015 appeared to be 27
minutes. 40% of delayed flights were delayed on departure and 39% of flights were delayed on
arrival (with a delay time > 5 minutes) [3]. More statistics concerning worldwide flight delays
could be found on www.flightstats.com/go/Media/stats.do/
Reasons for flight delays can be assigned to five main categories, which cover up to 90% of
potential flight delays: Late-arriving Aircraft, Air Carrier, National Aviation System, Extreme
Weather and Security [4].
• Late-arriving Aircraft: the previous flight using the same aircraft arrived late, causing the
present flight to depart late.
• Air Carrier: the cause of the cancellation or delay was due to circumstances within the
airline0 s control (e.g. maintenance or crew problems, aircraft cleaning, baggage loading,
fueling, etc.).
• National Aviation System: delays and cancellations attributed to the national aviation
system, such as heavy traffic volume or air traffic control.
5
1.1. STATE OF THE ART
On Figure 1.2 is given the distribution of delay causes, according to data of 14 major airlines in
USA.
As it could be seen from Figure 1.2, on one hand, the ground handling activities (which
are included in category ”Air Carrier Delay”) have a significant influence onto the air transport
performance, i.e. the delay in providing ground handling operations may result in delay of the
flight.
On another hand, the scheduled turnaround process is always disturbed if the airplane does
not arrive at the allocated gate on time. Ground handling agents have to consider the possible
delays to ensure reliable ground processes aiming to not let this delay propagate into the following
flight schedule.
This means that ground handling performance and aircraft performance in terms of delays
are strongly interrelated. That is another reason why ground staff scheduling plays an important
role.
6
1.1. STATE OF THE ART
ple, it is complicated to introduce the information, conveyed by telephone calls, written notices,
conversations between planners and scheduled personnel or by other means of communication.
Most optimization problems are NP-hard, so it is common to omit some restrictions to ob-
tain models that can be solved in reasonable time on the large instances required in real-life
applications.
In some cases it may be impossible to satisfy all the constraints, however computer-based
planning systems could be used to quickly examine different scenarios and find the least unde-
sirable solution. The possibility of fast validation of feasibility can save a lot of time. In most
real-life applications, schedules provided by automated systems are used as a decision support
tool for a planner, but they do not substitute the work of the planner completely.
Figure 1.3: INFORMs turnaround management system monitors and guides the progress of each aircraft
turnaround in real-time and foresees bottlenecks and possible delays.
7
1.2. OBJECTIVES
GroundStar is currently used by over 50 organizations in more than 150 airports worldwide.
Scheduling software is nowadays required to flexibly adapt to changes in work rules, problem
characteristics and sizes of operations. Clearly, the development of advanced planning systems
is a costly investment. Therefore many airlines, airports and ground handling companies resort
to generic software packages, such as the one presented by INFORM. However, the use of
generic software has a drawback: the solution is often not fully adapted to the realities of that
particular ground handling company using it. On one side, scheduling system could include
”extra” features; on another side, it could lack some. Therefore ground staff scheduling problem
remains actual up to this day.
1.2 Objectives
The objective of this master thesis is to analyze and solve ground handling scheduling prob-
lem in large scale airline operations in order to collect results which might be used in contribution
to the operational efficiency of ground handling companies.
In order to achieve this objective, the following tasks have been formulated:
4. Develop programming code for ground handling staff scheduling problem with the use of
evolutionary algorithms.
1.3 Methodology
In this master thesis ground handling staff scheduling problem was solved with the use
of evolutionary strategy algorithm with local heuristics. Programming code was developed in
Matlab, Release R2012a.
8
Chapter 2
Figure 2.1: Boeing 777 being serviced during a turnaround with the help of ground support systems and mobile
equipment [5]
In the next subsections each of GH operations will be reviewed in details in order to give
more thoroughful view on particular tasks that ground handlers are responsible for.
9
2.1. AIRCRAFT GROUND HANDLING ACTIVITIES
• mobile stairs
• passenger bridges.
A combination is also possible, e.g. a bridge attached to the aircraft door behind the crew cabin
and mobile stairs for the rear exit.
There are many advantages of using passenger bridges over the stairs. Firstly, passengers can
leave/board the aircraft more quickly. Secondly, passengers reach their aircraft safely without
getting lost, since their flow path is straight-forward. Thirdly, passengers are protected against
bad weather. At last, while the aircraft is being boarded or deplaned, other servicing activities,
including aircraft refueling and water supply, can be carried out simultaneously. In this case the
movement of the servicing vehicles across the apron is not obstructed. The safety of passengers
is also ensured as contact between them and servicing vehicles is avoided.
However, passenger bridges are more costly than mobile stairs and airline companies are
charged for using them. That is the reason why low cost carriers usually prefer mobile stairs or
even the aircraft0 s own stairs.
• fully mechanized: Elevating Transfer Vehicles (ETV), Automatic Storage and Retrieval
Systems, Transfer Vehicles.
10
2.1. AIRCRAFT GROUND HANDLING ACTIVITIES
The fully mechanized approach only really works with high volumes of containerized freight
and in a setting that can guarantee good maintenance skills. Even so, the whole terminal can
come to a halt if an ETV breaks down. Transfer Vehicles are powered roller conveyors mounted
on a carriage with bogies which are electrically driven along rails in response to a command
system. Mechanization is much more expensive in terms of first cost, but reduces the labor
requirement, causes less handling damage and less risk of mishandling.
2.1.6 Catering
Catering includes unloading of unused food and drinks from an aircraft, and loading of
fresh food and drinks for passengers and aircraft crew. Airlines meals are typically delivered in
trolleys. Empty or trash-filled trolleys from the previous flight are replaced by fresh ones. Meals
are usually prepared on the ground in order to minimize the amount of preparation (apart from
chilling or reheating) required in the air.
While some airlines provide their own catering, others have outsourced their catering to
third-party companies.
• Providing check-in counter services for the departing passengers, i.e. accepting baggage
that has to go in the aircraft0 s cargo hold and issuing boarding passes. Some low cost
airlines tend to use online check-in, which is the process when the passengers confirm
11
2.1. AIRCRAFT GROUND HANDLING ACTIVITIES
their presence on a flight via Internet and typically print their own boarding passes. By
Ryanairs0 policy, passengers who have lost/forgotten their printed boarding passes are
required to pay a Boarding Card Reissue Fee in order to receive a new one at the airport.
• Providing gate arrival and departure services. The handling agents are required to meet
a flight on arrival and guide passengers to baggage claim areas and terminal exit, as well
as provide departure services including boarding passengers, closing the flight, etc.
• Assistance of arriving and departing VIP, unaccompanied children, disabled and elderly
passengers from the point of arrival at the terminal through the whole process to the
aircraft boarding
• Staffing the Transfer Counters, Customer Service Counters, Airline Lounges, Lost and
Found, etc.
12
2.1. AIRCRAFT GROUND HANDLING ACTIVITIES
• De-icing is a procedure by which frost, ice, slush or snow is removed from an aircraft in
order to provide clean surfaces
For the de-icing procedures, fluids based on glycol are mostly used. However, if an aircraft
is covered with thick layers of snow, slush, etc. some airline companies are using an effective
and cheap ”mechanical” method – snow is simply brushed away.
13
2.2. THE IMPACT OF UNCERTAINTY ON GROUND HANDLING OPERATIONS
Figure 2.3 (a) represents normal activity, when no control action is required. Figure 2.3
(b) represents a delay appeared through a breakdown. In this case control is required and is
performed through the following actions:
• Assess the nature of the problem and realize how much time the problem will take to be
sorted out.
• Take corrective action: call equipment base and ask engineer to come to the aircraft or
call up a replacement loader.
• Advise all other activities which will be affected by the breakdown and give them instruc-
tions as necessary (e.g., notify movement control of a delay, tell passenger service to delay
boarding, etc.).
14
2.3. THE PLANNING HORIZON
In this thesis operational ground staff scheduling will be considered, the estimation of the
workload and the generation of staff timetables will be done at the beginning of the day or
several days before the day of operation. This means that the workload for the planning period
is calculated from a fixed flight schedule and known Service Level Agreements (SLAs) between
airlines and ground handling companies. SLA set the level of quality of the handling services,
including strictly definition of their order and time windows. In the event of failure to meet
specified standards, ground handling companies are charged compensation.
15
2.4. AIRPORT COLLABORATIVE DECISION MAKING (A-CDM)
As for example, the performance standards for delivery times of incoming luggage at Manch-
ester Airport, agreed between airlines and ground handling agents are the following:
180 or more 25 40
85 to 179 20 30
40 to 84 15 25
Up to 40 12 15
where the time refers to minutes after ATA (Actual Time of Arrival).
Source: www.caa.co.uk/docs/5/ergdocs/ccreportma/chapter5.pdf.
Real-time aspects like short-term schedule changes, flight delays or personnel sickness could
also be taken into account by rerunning the algorithm with new input data or by introducing
manual changes in the schedule.
Figure 2.5: Partners involved in A-CDM and their objectives [11] ATC – Air Traffic Control, CFMU – Central
Flow Management Unit
Airport CDM is now implemented in 35 European airports, the list could be found on
www.euro-cdm.org/airports.php.
As an example, for Paris Charles de Gaulle airport, where A-CDM has been implemented
since 2010, in 2013 departure times were respected more than 85% of the cases, against 80%
16
2.5. SYSTEM WIDE INFORMATION MANAGEMENT (SWIM)
before, the ground traffic became more fluid (taxiing times have been shortened by 2 to 4
minutes), daily consumption of fuel reduced in 14.5 tons [12].
Information sharing is the most powerful concept element in A-CDM. Clearly, there is a need
of proper managing of all that information. This could be done by System Wide Information
Management or SWIM – an enabler for A-CDM, which will be discussed in one of the next
sections.
17
2.5. SYSTEM WIDE INFORMATION MANAGEMENT (SWIM)
The NM B2B Web Services are provided in two ”flavors”: SOAP (Simple Object Access
Protocol) web services and non-SOAP web services. The payload is always XML (Extensible
Markup Language). Airspace data is predicated on the use of open data exchange standards.
Within the aviation community, these are primarily Aeronautical Information Exchange Model
(AIXM), Weather Information Exchange Model (WXXM) and Flight Information Exchange
Model (FIXM). All services make use of HTTPS (Hypertext Transfer Protocol). Access to NM
B2B Web Services requires strong authentication with digital certificates.
Up to end of 2014, 180 organizations have been entitled to access the NM B2B Web Services.
More than one hundred from which access the NM B2B Web Services daily [15].
To sum up, Airport Collaborative Decision Making (A-CDM) and System Wide Information
18
2.5. SYSTEM WIDE INFORMATION MANAGEMENT (SWIM)
Management (SWIM) are the two modern technologies for managing and real time sharing
information between aviation partners in order to improve the operational efficiency of each of
them. A-CDM and SWIM are not yet implemented in every airport, but from year to year they
are improved and spread up through Aviation Community.
19
Chapter 3
Figure 3.1
20
3.2. NOTATION
3.2 Notation
NW number of workers
W = {w1 ...wN W } set of workers
NT number of tasks
N Ti number of assigned tasks to worker i ∈ W
T = {t1 ...tN T } set of tasks
Ti = {ti1 ...tiN Ti } ⊆ T scheduled set of tasks performed by worker i ∈ W
NG number of gates
{0} depot
G = {g1 ...gN G} set of gates
Gi = {g1i ...gN i
Ti } ⊆ G scheduled set of gates visited by worker i ∈ W
aij time needed to move from gate i ∈ G to gate j ∈ G
bi duration of shift of worker i ∈ W
dij duration of task j ∈ Ti , i ∈ W
[sij , fji ] scheduled time of the task j ∈ Ti performed by worker i ∈ W
[csij , cfji ] initial time window for task j ∈ Ti , i ∈ W
[bsi , bf i ] shift hours of worker i ∈ W
• Flights
Timetable, which includes name of the airline, type of the aircraft, numbers of arrival and
departure flights, Scheduled Time of Arrival (STA), Scheduled Time of Departure (STD)
and the number of gate, where the aircraft will be serviced during its turnaround.
• Workers
Identification number of worker, his qualification, tasks that he is qualified to perform and
his working hours.
• Gates
Type of the gate (finger or remote) and the time needed to move from any gate to any
other.
21
3.4. OBJECTIVE FUNCTION
F itness = α1 ∗ F1 + α2 ∗ F2 + α3 ∗ F3 + α4 ∗ F4 , (3.1)
where α1 − α4 are weighting coefficients and F1 − F4 are objective functions.
X
F1 = max tti = max a0gi + agi gi + agi 0 (3.2)
i∈W i∈W 1 j j+1 N Ti
j=1..N Ti −1
tti – total traveling time of worker i ∈ W – is the time that worker spend on moving from
gate to gate during the day. By minimizing maximum of it, we are avoiding sending the same
agent successively to gates located far from each other.
X
F2 = max wti = max bi − dij − tti (3.3)
i∈W i∈W
j=1..N Ti
wti – total waiting time of worker i ∈ W – is the time that worker spend between performing
the tasks during the day. By minimizing maximum of it, we achieve equally distribution of the
workload between the workers of the same qualifications.
XX
F3 = P enalty1 = 1, f or i, j | fji < cfji (3.4)
i∈W j∈Ti
XX
F4 = P enalty2 = 1, f or i, j | bfi < cfji (3.5)
i∈W j∈Ti
P enalty1 – is the number of planes scheduled to be serviced out of required time windows.
P enalty2 – is the number of planes scheduled to be serviced out of workers0 shift.
(P enalty1 + P enalty2) is the total number of unserviced aircrafts, hence by minimizing it
we are leaving as few tasks uncompleted as possible.
With the aim to achieve a more flexible and accurate decision process, we are looking for a
solution representing the best compromise between the four objectives listed above.
22
3.6. CONSTRAINTS
3.6 Constraints
The following constraints should be respected:
where
fji = sij + dij ∀j ∈ Ti ∀i ∈ W (3.13)
Furthermore, some tasks may require several workers to cooperate. Cooperating agents have
to initiate work on the task simultaneously, which also has to be maintained in the schedule.
23
Chapter 4
Combinatorial optimization problems (COP) can be regarded as a search for the best element
in some set of discrete items. Determining the optimal solution of Vehicle Routing Problem with
Time Windows (VRPTW) is a NP-hard problem in combinatorial optimization, hence there is
no algorithm that can solve all problem instances efficiently in polynomial time. In principle,
exact algorithms can be used for solving relaxed problems, with smaller amount of input or with
less number of constraints. But as the size of NP-hard problem increases, the time needed to
solve it grows very fast. Therefore commercial solvers tend to use heuristics to tackle real world
VRPTW due to its size and the frequency that it may have to be solved.
24
4.2. HEURISTICS
4.2 Heuristics
A heuristic is defined by [Reeves, 1995] as a technique which seeks good (near-optimal)
solutions at a reasonable computational cost without being able to guarantee optimality, to
state how close to optimality a particular feasible solution is or, in some cases, even to guarantee
feasibility.
Heuristic algorithms that set routes from scratch are denoted as route-building, while al-
gorithms that try to improve solution on the basis of already built solutions are called route-
improving.
The first paper on route-building heuristics for the VRPTW is [Baker and Schaffer, 1989].
Their algorithm is an extension of the saving heuristic of the VRP [Clarke and Wright, 1964].
A similar heuristic based on the savings algorithm was developed in [Solomon, 1987] and [Lan-
deghem, 1988]. Another heuristic described in [Solomon, 1987] is a time-oriented, nearest-
neighborhood heuristic.
A problem of building one route at a time is usually that the routes generated in the latter
part of the process are of poor quality as the last unvisited customers tends to be scattered over
the geographic area. [Potvin and Rousseau, 1993] try to overcome this problem of the insertion
heuristics by building several routes simultaneously. The initialization of the routes is done
by using the insertion heuristic of [Solomon, 1987]. This method is better than the Solomon
heuristics but still the solutions are quite far away from optimum. [Russell, 1995] and [Antes
and Derigs, 1995] elaborate further on the insertion approach. In general, building several routes
at the same time results in better solutions than building the routes one by one [17].
In general the heuristics, as f.e. the ones of [Solomon, 1987] and [Landeghem, 1988], return
a solution fast. However, their solutions usually lack in quality: most of the time they differ
from optimum for more than 10%.
4.3 Metaheuristics
Metaheuristics is an iterative strategy designed to find, generate, or select a heuristic that
may provide a sufficiently good solution to an optimization problem, especially with incomplete
or imperfect information or limited computation capacity [18].
Metaheuristics do not guarantee that a globally optimal solution can be found on some
class of problems. However, by searching over a large set of feasible solutions, metaheuristics
can often find good solutions with less computational effort than basic heuristics and other
methods. Therefore, the success of these methods is the ability to ”solve in practice” some hard
combinatorial problems.
There are a wide variety of metaheuristics and a number of properties along which one can
characterize them.
One approach is to characterize the type of search strategy. One type of search strategy
is an improvement on simple local search algorithms: Simulated Annealing, Tabu search, It-
erated Local Search, Variable Neighborhood Search and Greedy Randomized Adaptive Search
Procedure (GRASP). The other type of search strategy has a learning component: Ant Colony
Optimization, Evolutionary Computation and Genetic Algorithms.
Metaheuristics could also be classified by single solution vs. population-based searches. Sin-
gle solution approaches focus on modifying and improving a single candidate solution: Simulated
Annealing, Iterated Local Search, Variable Neighborhood Search and Guided Local Search.
Population-based approaches maintain and improve multiple candidate solutions, often using
population characteristics to guide the search: Evolutionary Strategies, Genetic Algorithms and
Particle Swarm Optimization.
25
4.3. METAHEURISTICS
e − e0
P (accept) = exp , (4.1)
T
where T is the current temperature, e is the energy (or cost) of the current solution and
e0 is the energy of a candidate solution being considered. By reducing the temperature, the
acceptation of new solution becomes more and more selective.
The size of the neighborhood considered in generating candidate solutions can change over
the time or be influenced by the temperature, starting initially broad and narrowing while the
algorithm is executed.
Figure 4.1 provides a pseudo code listing of the main Simulated Annealing algorithm.
The convergence proof suggests that the system will always converge to the global optimum if
cooling period is long enough. The downside of this theoretical finding is that for some problems
the number of samples taken for optimum convergence to occur can be more than a complete
enumeration of the search space [21].
Restarting the cooling schedule with the best solution found so far can lead to improvements
in performance for some problems. The effectiveness of the algorithm and its computation
time could be improved by using a problem specific heuristic in choosing starting point for the
search, by parallelization or by hybridization with other algorithms such as Tabu Search or
Genetic Algorithms.
26
4.3. METAHEURISTICS
In spite of the success that Tabu Search has, there is not yet available theoretical support.
No study made it possible to prove the convergence of the method. In order to improve the
procedure, techniques of parallelization and combination with other approaches are proposed.
The hybridization of Tabu search and Simulated Annealing was proposed in [Osman, 1993] and
[Tuyttens et al., 1994], and the hybridization of Tabu Search and Genetic Algorithm in [Glover
et al., 1995].
27
4.3. METAHEURISTICS
Figure 4.3: A schematic of a fish school avoiding predator. (a) the school forms only one group, (b) the
individuals avoid the predator by forming a ”fountain” like structure, (c) the school is reformed [24]
The standard PSO algorithm works by having a population of candidate solutions, which
move around in the search space according to the particle0 s position and velocity. The movement
of a particle is guided by its own best-known position and the entire swarm0 s best-known position
in order to move all the particles toward the global best solution in the solution space. At each
iteration, the swarm0 s best-known position is updated. The process is repeated for a given
number of iterations.
Each iteration a particle0 s velocity is updated using:
vi (t + 1) = vi (t) + c1 ∗ rand() ∗ (pbest
i − pi (t)) + (c2 ∗ rand() ∗ (pgbest − pi (t))) , (4.2)
where vi (t + 1) is the new velocity for the ith particle, c1 and c2 are the weighting coefficients
for the personal best and global best positions respectively, pi (t) is the ith particle0 s position at
time t, pbest
i is the ith particle0 s best known position, and pgbest is the best position known to
the swarm. The rand() function generates an uniformly random variable ∈ [0, 1].
A particle0 s position is updated using:
Figure 4.4 provides a pseudo code listing of the standard Particle Swarm Optimization
algorithm.
28
4.3. METAHEURISTICS
The number of particles should be low, around 20-40. The speed with which a particle can
move (maximum change in its position per iteration) should be bounded, such as to a percentage
of the size of the domain. Particles may leave the boundary of the problem space and may be
penalized, be reflected back into the domain or biased to return back toward a position in the
problem domain. An inertia or momentum coefficient can be introduced to limit the change in
velocity.
where ηi,j is the maximizing contribution to the overall score of selecting the component, β is
the heuristic coefficient (commonly fixed to 1.0), τi,j is the pheromone value for the component,
29
4.3. METAHEURISTICS
α is the history coefficient, and c is the set of usable components. Greediness factor q 0 is used
to decide when to use the above probabilistic component selection and when to greedily select
the best possible component.
A local pheromone update is performed for each solution that is constructed to dissuade
following solutions to use the same components in the same order, as follows:
0
τi,j ← (1 − σ) ∗ τi,j + σ ∗ τi,j , (4.5)
where τi,j represents the pheromone for the component (i, j), σ is the local pheromone factor
0 is the initial pheromone value.
and τi,j
At the end of each iteration, the pheromone is updated and decayed using the best candidate
solution found so far as follows:
The local pheromone coefficient σ controls the amount of contribution history plays in a
components probability of selection and is commonly set to 0.1. The heuristic coefficient β
controls the amount of contribution problem-specific heuristic information plays in a components
probability of selection and is commonly chosen between 2 and 5. The decay factor ρ controls
the rate at which historic information is lost and is commonly set to 0.1. The greediness factor
q 0 is commonly set to 0.9. The total number of ants m is commonly set low, such as 10 [21].
30
4.3. METAHEURISTICS
• Genetic Algorithms (GA), developed by J. Holland [Holland, 1975] in the United States of
America, with refinements by K. De Jong [De Jong, 1975], J. Grefenstette [Grefenstette,
1986], [Grefenstette, 1987] and D. Goldberg [Goldberg, 1989]
Although simplistic from a biologist0 s point of view, these algorithms are sufficiently complex
to provide robust and powerful adaptive search mechanisms.
31
4.3. METAHEURISTICS
The size of the population must be large enough to provide sufficient coverage of the domain
and mixing of the useful sub-components of the solution [Goldberg, 1992]. The Genetic Algo-
rithm is classically configured with a high probability of recombination (95%-99% of the selected
population) and a low probability of mutation (1/L, where L is the number of components in
a solution) [Muhlenbein, 1992] [Back, 1993]. The fitness-proportionate selection of candidate
solutions to contribute to the next generation should be neither too greedy (to avoid the takeover
of fitter candidate solutions) nor too random.
32
4.3. METAHEURISTICS
The sample size (BoutSize) for tournament selection during competition is commonly chosen
between 5% and 10% of the population size. There is no requirement neither that the population
size has to be held constant, nor that only a single offspring can be generated from each parent.
Typically, Evolutionary Programming does not use any crossover as a genetic operator and uses
stochastic tournament to determine solutions to be chosen for the next population.
33
4.3. METAHEURISTICS
The pseudo code listing of (µ, λ) Evolution Strategy is provided on Figure 4.8.
Each of considered algorithms emphasizes different features as being most important for a
successful evolution process.
Both ES and EP are concentrated on mutation as the main search operator, while the role of
mutation in canonical GA is usually seen to be of secondary (if any) importance. On the other
hand, recombination that plays a major role in canonical GA, is missing completely in EP, and
is urgently necessary for use in connection to self-adaptation in ES.
Finally, both canonical GA and EP emphasize a necessarily probabilistic selection mecha-
nism, while from the ES point of view selection is completely deterministic without any evidence
for the necessity of incorporating probabilistic rules. In contrast, both ES and EP definitely ex-
clude some individuals from being selected for reproduction, i.e., they use extinctive selection
mechanisms, while canonical GAs generally assign a nonzero selection probability to each indi-
vidual.
In current thesis, Evolutionary Algorithms and, specifically, Evolution Strategies were chosen
for solving Vehicle Routing Problem with Time Windows. There are several reasons for that
decision. The main reason is that Evolutionary Algorithms operate on the big search space;
they are working not only with one solution, but with a population of solutions. Furthermore it
is possible to introduce changes in formulation of the problem, mute on new parameters into the
algorithm and add new constraints. The last but not least reason is the possibility of parallel
computing with the usage of clusters.
34
Chapter 5
(a) Select mating pool from the parent population to generate offsprings
(b) Mutate children
(c) Select the best individuals from the population of children and parents based on the
values of fitness function
(d) Use the selected individuals as parent population for the next generation.
Two case studies corresponding to two different implementations of algorithm will be con-
sidered in this thesis. The main difference of case study 2 compared to case study 1 is that all
the individuals generated initially or obtained as a result of applying genetic operators represent
feasible solutions, i. e. they satisfy all constraints described in section 3.6.
35
5.2. INITIAL POPULATION
5.2.2 Case 2
The initial population is no longer generated randomly (generateInitialPopulation(...), Annex
A). The route for the first vehicle is being created in the following way: the customer is added
to the end of the current route if and only if both time windows constraints and working hours
constraints as well as the ability to perform this particular task are satisfied (CheckTAS(...),
Annex A).. This procedure is repeated till there are no more customers that could be added
to the route. Then the same idea is applied to construct routes for other vehicles, though only
unvisited yet customers are considered. Each individual in population is generated in described
way. In this case the feasibility of initial solutions is kept.
36
5.6. FITNESS FUNCTION
• Mutation 1
Changing the order of visiting customers for the same vehicle, f. e.:
• Mutation 2
Swapping of parts of the routes between two different vehicles, f. e.:
As mutation 1, individual can undergo mutation 2 several times. The additional benefit
of this mutation is that part of the first route could be swapped with a zero part of the
second route (or the other way around), therefore mutation 2 will work as an insertion of
part of one route into another.
After the mutations, heuristic was added to speed up the convergence. The idea of heuristic
is to find the shortest non-zero route and add it in the end of other randomly chosen route.
This ”merging” helps to minimize the number of situations when a vehicle has to serve just 1-2
customers during the whole day.
5.5.2 Case 2
Here genetic operation replicates mutation 2 from the previous case with the difference that
mutation is only applied if it will not violate the feasibility.
5.6.2 Case 2
Since individuals in population satisfy a priori all necessary constraints, fitness function is
only introduced as the weighted sum of total travelling time and total waiting time.
Above were presented the most significant properties of two implementations of the Evolution
Strategies for VRPTW, considered in this thesis.
37
Chapter 6
Case Studies
All the experiments described in this chapter were conducted on the computer with the
following properties:
• Gates
G = {g1 ...g4 } – set of gates
g1 and g2 are of the type finger; gates g3 and g4 are of the type remote; The difference
between those two types of gates is that in cases when the aircraft is serviced on a remote
gate, there should be provided bus services for disembarking/boarding of passengers.
0 1 2 3 1
1 0 1 2 2
D(G) = 2 1 0 1 3
3 2 1 0 4
1 2 3 4 0
D(G) – cost distance matrix between the gates. The entry (D(G))ij is the time in minutes
spent by worker to move from the gate gi to gj , i, j = 1..5.
Gate g5 corresponds to the depot {0}.
It is considered that gates are located in line and on the same distance from each other;
therefore workers need 1 minute to move from gate 1 to 2 or 2 to 3, but 2 minutes to move
from gate 1 to 3 and so on.
38
6.1. INPUT DATA
• Flights
Flight timetable is presented in the following way:
In the table above STA stands for Scheduled Time of Arrival, which is presented in a way
”DHHMM”, where D is a day, HH refers to hours (24 hour time format) and MM denotes
minutes. STD stands for Scheduled Time of Departure and is also of type ”DHHMM”.
It is considered that turnaround time of aircrafts A330-200 operated by Vueling takes 45
min, while for A340-300 operated by Lufthansa it is 60 min.
• Workers
Working hours of ground handling agents are represented as following table:
Workers of the same qualification could be able to carry out different tasks. For example,
driver Alberto can perform both bus driving and pushback operations, while driver Manuel
is only able to do the bus driving.
39
6.1. INPUT DATA
• Tasks
The list of tasks, their duration and qualification of workers needed to perform these
tasks are determined for each type of aircraft separately. For example, for A330-200 this
information is performed in the following way:
There are also some parameters that have to be tuned before running the code: size of
population, maximum number of iterations, probability of choosing the best individual in
tournament selection, probabilities of mutations 1 and 2, as well as weights used in fitness
function.
40
6.2. CASE STUDY 1
for 8 workers of a qualfication ”refueler”, which could only perform one task ”refueling” and
whose working hours are the following:
The output of the model is performed as a schedule and is shown on Table 6.1:
41
6.2. CASE STUDY 1
Table 6.1: Output of the algorithm. Serviced in time aircrafts are highlighted in green, unserviced aircrafts are
highlighted in red
42
6.2. CASE STUDY 1
As it could be seen from Table 6.1 algorithm does not find a feasible solution: 11 aircrafts
out of 50 stay unserviced. If the number of iterations and population size is increased (as f. e.
till 5000), the number of unserviced aircrafts is smaller but even then the algorithm cannot find
the feasible solution. In case of big number of iterations and population size, the computational
time will increase to many hours, which will kill the utility of algorithm in real life.
Figure 6.1 shows tendency of fitness function of best individual in population on each iter-
ation. The value of fitness function decreases but in much slower tempo when increasing the
number of iterations.
From Figure 6.2 and Figure 6.3 could be seen that the algorithm immediately find solutions
with zero P enalty1 - number of planes scheduled to be serviced out of shift time, but looking for
solutions with zero P enalty2 - number of planes scheduled to be serviced out of required time
windows goes much slower. That make sense since at the beginning, the priority which one to
minimize was given to P enalty1 using weight coefficients in fitness function.
Figure 6.2: Number of planes scheduled to be Figure 6.3: Number of planes scheduled to be
serviced out of workers0 shift serviced out of required time windows
43
6.2. CASE STUDY 1
In order to measure on which functions the code spends the most time Profiler - graphical
user interface provided by Matlab - was used. Results, from which it is easy to see the most
time-consuming functions are shown on Figure 6.4.
Figures 6.5 and 6.6 present dependance of the run time of algorithm from number of iterations
and the size of population respectively. Number of iterations that were taken: 50, 100, 250, 500,
800, 1000 and 1500, while population size was 500. Population size considered: 50, 100, 250,
500, 800 and 1000, while number of iterations was 1000.
Easy to notice that the dependance is linear. From Figure 6.4 is clear, that functions with
longer execution time, such as GeneticOperators and Calculate start end are called once on
iteration and function CalculateFitness which appeals to both Penalty and WaitTravelTime is
called (the size of population * number of iterations) times. That explains the linear dependance.
44
6.2. CASE STUDY 1
Figure 6.5: Diagram showing the relationship between run time of the algorithm measured in seconds
and number of iterations
Figure 6.6: Diagram showing the relationship between run time of the algorithm measured in seconds
and size of population
45
6.3. CASE STUDY 2
for the same workers as in case 1 with the following working hours:
The output of the model is performed as a schedule and is shown on Table 6.2.
Figure 6.7 shows tendency of fitness function of best individual in population on each itera-
tion.
46
6.3. CASE STUDY 2
47
6.3. CASE STUDY 2
The most time-consuming functions are shown on Figure 6.8 - screenshot from Profiler report.
As in case 1 the longest takes the function GeneticOperators, though most of the time is spent
by the functions it appeals to. The function CheckTAS verifies that the time windows and
workers0 shift constraints are satisfied. It is the most important feature of the implementation
of the algorthm in case study 2, that is the reason why it is called such a big number of times.
The function generateInitialPopulation takes significant time, since the algorithm builds the first
feasible solution.
Figures 6.9 and 6.10 present dependance of the run time of algorithm from number of itera-
tions and the size of population respectively. Number of iterations that were taken: 50, 75, 100,
150, 200 and 250, while population size was 100. Population size considered: 50, 75, 100, 150,
200 and 250, while number of iterations was 200.
48
6.3. CASE STUDY 2
Figure 6.9: Diagram showing the relationship between run time of algorithm measured in seconds
and number of iterations
Figure 6.10: Diagram showing the relationship between run time of algorithm measured in seconds
and size of population
49
Chapter 7
Analysis of Results
In case study 1 the algorithm did not give satisfactory results, it was not able to find even the
feasible solution - schedule such that all aircrafts are serviced according to specified by Service
Level Agreement time windows.
The main reason for such a performance is that Evolution Strategies is a random search,
therefore it is in need of a large search space and big number of iterations. The drawback of
ensuring that is clearly the increased computational time which will make the algorithm no
longer beneficial for operational and real-time planning.
In this thesis, in order to improve the performance of algorithm in case study 1, the attempt
was made to use an insertion heuristic for initial population. However the experiment showed
that it does not make efficiency any better, since the high probability of applied genetic operators
renders it meaningless.
Figure 7.1 shows the solution obtained in case study 1 in the form of Gannt chart. It shows
the sequence of tasks that should be performed by each worker distributed in time.
50
The implementation of Evolution Strategies considered in case study 2 coped well with the
posed problem. It gave the feasible schedule for ground handling agents and it took comparable
short time to finish (9 minutes). The Gannt chart for this solution is presented on Figure 7.2.
From Figure 7.1 and Figure 7.2 could be seen that in both cases shift constraints are satisfied
for all the workers. However, in case study 2 tasks are distributed more uniformly, i. e. there
are no longer big gaps in work of ground handlers. Moreover, the best solution found by the
algorithm in case study 2 does not include schedule of the agent ”Alexey”, that means that
given tasks could be performed by less number of workers than given initially providing that all
necessary constraints are satisfied. Yet is another advantage in favor of the implementation of
the algorithm in case study 2.
51
Chapter 8
8.1 Conclusions
All the goals stated at the beginning of this master thesis (Section 1.2) were achieved.
The first step of the work was devoted to analysis of different aspects of the ground handling
staff scheduling problem: ground handling operations, their impact on flight delays, the eco-
nomic aspects, etc. In this work, those aspects were explained in such a form that even people
who are not familiar with the topic could get through it quickly, since it is crucial for correct
understanding of the problem.
On the next step the mathematical model was formulated in the form of Vehicle Routing
Problem with Time Windows (VRPTW). By definition the problem considered in this thesis
closely fits the VRPTW problem statement, in which ground handling employees and aircrafts
refer to vehicles and customers, respectively. The aircrafts have to be serviced at gates during
time windows specified by Service Level Agreement and according to flight schedule. The al-
gorithm was implemented in Matlab in a way that its main features – objective function and
constraints – are easy to be changed.
After thorough studies of problem solving methods, the most appropriate one – Evolution
Strategies – was chosen. There are several reasons for that decision. The main reason is that
Evolutionary Algorithms operate on the big search space; they are working not only with one
solution, but simultaneously with a population of solutions. Furthermore these algorithms are
characterized by flexibility due to the possibility to introduce changes in formulation of the
problem, mute on new parameters into the algorithm and add new constraints. The last but
not least reason is the possibility of parallel computing with the usage of clusters.
The algorithm was built in Matlab and two case studies were implemented. The main
difference between them is that the algorithm in the first case explores the whole solution space
to build each solution of the next population (using two types of mutation operators), finally
acting as a random search. In the second case it looks for each next solution only in the space of
feasible solutions (using a single type of mutation). The run time of the algorithm in case 1 took
11,4 minutes to execute 1000 iterations, while the algorithm with the same input data in case
2 found better solution in 200 iterations taking 9 minutes. Comparative analysis in Chapter 7
explains advantages of the algorithm 2 implementation over the algorithm 1 in more details.
The approach proposed in this work could be an alternative option to the generic software
packages widely used nowadays, such as the one presented by INFORM. The use of generic soft-
ware has a drawback: the solution is often not fully adapted to the realities of particular ground
handling company using it. On one side, scheduling system could include ”extra” features; on
another side, it could lack some. The algorithm considered in this master thesis is flexible and
could be adapted to specifics of the company: changes in work rules, problem characteristics
and sizes of operations. It should be noticed that run-time of the algorithm can be significantly
decreased when passing the code to C++ or Java (Matlab is often used for prototyping).
52
8.2. FUTURE WORK
53
Bibliography
[2] Slate Magazine: ”The Southwest Secret”, by Seth Stevenson, June 12 2012
[6] Yeung S. S. M., Yu I. T. S., Hui K. Y. L.: ”World at work: Aircraft cabin cleaning”,
Occupational and Environmental Medicine, 2005, p. 58 – 60
[7] Kazda A., Caves R. E.: ”Airport Design and Operation”, 2nd edition, Elsevier, Oxford,
2007, p. 183 – 184
[9] Marelli, S., Mattocks, G., Merry, R.:”The role of computer simulation in reducing airplane
turn time”, AERO Magazine 1, 1998
[10] Ashford N., Stanton H. P. M., Moore C. A.: ”Airport Operation”, 2nd edition
[12] Trabelsi S. F., Cosenza C. A. N., Cruz L. G. Z., Mora-Camino F., ICIEOM CIO: ”An oper-
ational approach for ground handling management at airports with imperfect information”,
2013
[15] Eurocontrol: NM B2B Web Services. Web interface for system-to-system interoperability,
January 15
[16] Nasser A. El-Sherbeny: ”Vehicle routing with time windows: An overview of exact, heuristic
and metaheuristic methods”, Journal of King Saud University (Science), 2010, p. 123 – 131
[18] Bianchi L., Dorigo M., Gambardella L. M., Gutjahr W. J.: ”A survey on metaheuristics
for stochastic combinatorial optimization”, Natural Computing: an international journal 8
(2), 2009, p. 239 – 287.
[19] Kirkpatrick S., Gelatt C. D., Vecchi M. P.: ”Optimization by simulated annealing”, Science,
May 1983, p. 671 – 680
54
BIBLIOGRAPHY
[20] Cerny V.: ”A thermodynamical approach to the travelling salesman problem: An efficient
simulation algorithm”, Journal of Optimization Theory and Applications, 1985, p. 41 – 51
[22] Glover F.: ”Heuristics for Integer Programming Using Surrogate Constraints. Decision
Sciences”, 1977, p. 156 – 166
[23] Glover F.: ”Future paths for integer programming and links to artificial intelligence”, Comp.
Oper. Res., 1986, p 533 – 549
[24] Dreo J., Petrowski A., Siarry P., Taillard E.: ”Metaheuristics for Hard Optimization: Meth-
ods and Case Studies”, 2003
[25] Baeck T., Schwefel H.-P.: ”An Overview of Evolutionary Algorithms for Parameter Opti-
mization”, Evolutionary Computation Volume 1, Number 1
[26] Schwefel H.-P.: ”Numerische Optimierung von Computer-Modellen mittels der Evolution-
sstrategie”, 26. Birkhäuser, Basel, 1977
55
Annex A
56
Archive(MaxIter)=struct('individual',[],'fitness',[],'waiting_time',[],
'travel_time',[]);
[Fitness_sort_C, I] = sort(Fitness);
P_best(1) = P(I(1));
Archive(1) = P_best(1);
%%% iterations
k=2;
for Niter = 1:(MaxIter-1)
[MatePool] = CreateMatingPool(PSize, P, pTournament, TSize);
[C] = GeneticOperators(PSize, Nveh, pMutation1, depot_gate, dist_gate,
CurrentTasks, CurrentWorkers, MatePool);
[C] = Calculate_start_end(C, PSize, Nveh, depot_gate, dist_gate,
CurrentTasks, CurrentWorkers);
for i=1:PSize
Individual = C(i).individual;
[Waiting_Time(i), Travel_Time(i), Fitness(i)] =
CalculateFitness(Individual, Nveh, depot_gate, wWait, wTravel,dist_gate,
CurrentTasks, CurrentWorkers);
Fitness_C(i) = Fitness(i);
C(i).fitness = Fitness(i);
C(i).waiting_time = Waiting_Time(i);
C(i).travel_time = Travel_Time(i);
Fitness(PSize+i) = P(i).fitness;
end
Wait_all = [Wait_all, Waiting_Time(1:PSize)];
Travel_all = [Travel_all, Travel_Time(1:PSize)];
%%% Merge P with C and take PSize of best, save them in P_new
P_new(PSize) = struct('individual',[],'fitness',[],'waiting_time',[],
'travel_time',[]);
57
a = J(i);
if a <= PSize
P_new(i) = C(a);
else
a = a-PSize;
P_new(i) = P(a);
end
end
P = P_new;
%end
end
Answer1(c) = Archive(MaxIter).fitness;
Answer2(c) = Archive(MaxIter).waiting_time;
Answer3(c) = Archive(MaxIter).travel_time;
end
end
tElapsed = toc(tStart);
disp(tElapsed);
fprintf(' Fitness WaitT TravelT \n');
format short
datasave = [Answer1 Answer2 Answer3];
disp(datasave);
end
for q=1:N
L = length(Timetable(1,n).individual(1,q).route);
for p=1:L
T{s,1} = CurrentWorkers(1,q).name;
T{s,2} = CurrentWorkers(1,q).qlf;
T{s,4} = ConvertToTime(Timetable(1,n).individual(1,q).start_time(p));
T{s,5} = ConvertToTime(Timetable(1,n).individual(1,q).end_time(p));
for m = 1:M
if Timetable(1,n).individual(1,q).route(p) == m
T{s,3} = CurrentTasks(1,m).task;
T{s,6} = CurrentTasks(1,m).flight;
T{s,7} = CurrentTasks(1,m).gate;
s = s+1;
end
end
end
end
s=1;
TT = dataset({T 'Name','Qualification', 'Task', 'Start', 'End', 'Flight',
'Gate'})
profile viewer
p = profile('info');
58
function [type_gate, dist_gate, workers, flights, SLA] = getInput(G,W,P,A)
59
end
function [workload] = estimateWorkload(P,W,A,flights,workers,type_gate,SLA)
j=1;
workload=struct('task',{},'qlf',{},'number_workers',{},'flight',{},'duration',
{},'op_start',{},'op_end',{},'gate',{});
for k = 1:P
current_STA = flights(k).STA;
current_STD = flights(k).STD;
current_type_gate = type_gate(flights(k).gate_number);
for i = 1:A
if (strcmp(flights(k).airline,SLA(i).airline) == 1) &&
(strcmp(flights(k).type_plane,SLA(i).type_plane) == 1)
% if gate is finger, not reading bus drivers
if (current_type_gate == 0) && (strcmp(SLA(i).task,'bus') == 0)
workload(j).task = SLA(i).task;
for n=1:W
if (strcmp(workload(j).task,workers(n).task{1}) == 1) ||
(strcmp(workload(j).task,workers(n).task{2}) == 1)
workload(j).qlf = workers(n).qlf;
end
end
workload(j).number_workers = SLA(i).number_workers;
workload(j).flight = flights(k).flight_arr;
workload(j).duration = SLA(i).duration;
workload(j).gate = flights(k).gate_number;
if (strcmp('STA',SLA(i).initial_start_trigger) == 1)
workload(j).op_start = current_STA + SLA(i).initial_start_time;
elseif (strcmp('STD',SLA(i).initial_start_trigger) == 1)
workload(j).op_start = current_STD + SLA(i).initial_start_time;
end
if (strcmp('STD',SLA(i).initial_end_trigger) == 1)
workload(j).op_end = current_STD + SLA(i).initial_end_time;
elseif (strcmp('STA',SLA(i).initial_end_trigger) == 1)
workload(j).op_end = current_STA + SLA(i).initial_end_time;
end
j=j+1;
% if gate is remote
elseif (current_type_gate == 1)
workload(j).task = SLA(i).task;
for n=1:W
if (strcmp(workload(j).task,workers(n).task{1}) == 1) ||
(strcmp(workload(j).task,workers(n).task{2}) == 1)
workload(j).qlf = workers(n).qlf;
end
end
workload(j).number_workers = SLA(i).number_workers;
workload(j).flight = flights(k).flight_arr;
workload(j).duration = SLA(i).duration;
workload(j).gate = flights(k).gate_number;
60
% calculating initial time windows
if (strcmp('STD',SLA(i).initial_end_trigger) == 1)
workload(j).op_end = current_STD + SLA(i).initial_end_time;
elseif (strcmp('STA',SLA(i).initial_end_trigger) == 1)
workload(j).op_end = current_STA + SLA(i).initial_end_time;
end
j=j+1;
end
end
end
end
end
P = struct([]);
Possible.route = struct([]);
Possible.pos_task = struct([]);
Possible.task = struct([]);
for i = 1:PSize
P(i).individual = struct([]);
for j=1:Nveh
P(i).individual(j).route = [];
P(i).individual(j).task = [];
end
Ntasks = length(CurrentTasks);
Todo = [1:Ntasks];
length_Todo = length(Todo);
Stock = [];
for j=1:Nveh
% save possible tasks
Possible.worker = j;
n = length(CurrentWorkers(j).task);
Possible.pos_task = double(CurrentWorkers(j).task{1}(1));
if n>1
for v = 2:n
if isempty(CurrentWorkers(j).task{v})==0
Possible.pos_task = [Possible.pos_task;
double(CurrentWorkers(j).task{v}(1))];
end
end
end
P(i).individual(j).pos_task = Possible.pos_task;
for k=1:length_Todo
Possible.route = [P(i).individual(j).route; Todo(k)];
% add tasks
m = length(Possible.route);
if m>0
ind = Possible.route(1);
Possible.task = double(CurrentTasks(ind).task(1));
if m>1
for u = 2:m
ind = Possible.route(u);
61
Possible.task = [Possible.task;
double(CurrentTasks(ind).task(1))];
end
end
end
% check constraints
[ans1, Possible] = CheckTAS(Possible, depot_gate, dist_gate,
CurrentTasks, CurrentWorkers);
if ans1 == 0
P(i).individual(j).route = Possible.route;
P(i).individual(j).start_time = Possible.start_time;
P(i).individual(j).end_time = Possible.end_time;
P(i).individual(j).task = Possible.task;
else
Stock = [Stock; Todo(k)];
end
end
Todo = Stock;
length_Todo = length(Todo);
Stock = [];
Possible.route = struct([]);
Possible.pos_task = struct([]);
end
if isempty(Todo) ~= 0
msg = 'Error: too many tasks.';
error(msg)
end
end
end
ans1 = 0;
m = length(Current.route);
i = Current.worker;
[Current] = Calculate_start_end_2(Current, depot_gate, dist_gate,
CurrentTasks, CurrentWorkers);
if m>0
current_dist = dist_gate(CurrentTasks(Current.route(m)).gate,
depot_gate); % time from gate to depot
current_late_end = CurrentWorkers(i).shiftend - current_dist; % time
worker should leave gate for depot
for j = 1:m
if Current.end_time(j) > CurrentTasks(Current.route(j)).op_end
ans1 = ans1 + 1; % finishing after TW penalty
end
if Current.end_time(j) > current_late_end
ans1 = ans1 + 1; % finishing after shift ends penalty
end
end
h = ismembc(Current.task, sort(Current.pos_task));
if ~all(h) == 1
ans1 = ans1 + 1; % not being able to do this task penalty
end
end
end
62
function [P] = Calculate_start_end(P, PSize, Nveh, depot_gate, dist_gate,
CurrentTasks, CurrentWorkers)
Current.start_time = [];
Current.end_time = [];
m = length(Current.route);
i = Current.worker;
if m>0
for j = 1:m
if j>1
current_end_time_prev = End_time(j-1);
current_dist = dist_gate(CurrentTasks(Current.route(j-
1)).gate,CurrentTasks(Current.route(j)).gate);
else
current_end_time_prev = CurrentWorkers(i).shiftstart;
current_dist =
dist_gate(depot_gate,CurrentTasks(Current.route(j)).gate);
end
current_duration = CurrentTasks(Current.route(j)).duration;
current_early_start = current_end_time_prev + current_dist;
current_op_start = CurrentTasks(Current.route(j)).op_start;
63
Start_time = max(current_early_start, current_op_start);
Current.start_time(j) = Start_time;
current_op_end = CurrentTasks(Current.route(j)).op_end;
End_time(j) = Start_time + current_duration;
Current.end_time(j) = End_time(j);
end
end
end
MatePool(PSize) = struct('individual',[],'fitness',[],'waiting_time',[],
'travel_time',[]);
rands = zeros(TSize);
for i = 1:PSize
for j = 1:TSize
rands(j) = randi(PSize);
end;
[Winner] = Tournament(P, rands, pTournament);
MatePool(i) = Winner;
end
end
R = length(rands);
Fitness = zeros(1,R);
for i=1:R
Fitness(i) = P(rands(i)).fitness;
end
rand3 = rand;
[~, J] = sort(Fitness);
if rand3<pTournament
Winner = P(J(1));
else
Winner = P(J(2));
end
end
64
function [C] = GeneticOperators(PSize, Nveh, pMutation1, depot_gate,
dist_gate, CurrentTasks, CurrentWorkers, MatePool)
%Mutation = swapping of customers between routes or inserting customer to
%route of other vehicle
C = MatePool;
for i = 1:PSize
% swapping of customers between routes
for j=1:Nveh
randM = rand;
if randM <= pMutation1
Current = C(i).individual(j);
Current.worker = j;
m = length(Current.route);
if m>0
rand1 = randi(m);
rand2 = randi(Nveh);
while rand2 == j;
rand2 = randi(Nveh);
end
a = Current.route(rand1);
aa = Current.task(rand1);
Current2 = C(i).individual(rand2);
Current2.worker = rand2;
n = length(Current2.route);
65
Current.route = Current.route([1:(rand1-1),
(rand1+1):m]);
Current.task = Current.task([1:(rand1-1),
(rand1+1):m]);
m = length(Current.route);
[~, Current] = CheckTAS(Current, depot_gate,
dist_gate, CurrentTasks, CurrentWorkers);
% adding in between
if n>1
iter2 = randperm(n-1,n-1); % full random string
for vv=1:(n-1)
v = iter2(vv);
Current2.route = [Current2.route(1:v)', a,
Current2.route((v+1):n)']';
Current2.task = [Current2.task(1:v)', aa,
Current2.task((v+1):n)']';
[ans4, Current2] = CheckTAS(Current2, depot_gate,
dist_gate, CurrentTasks, CurrentWorkers);
if ans4 == 0
C(i).individual(j).route = Current.route;
C(i).individual(j).task = Current.task;
C(i).individual(rand2).route = Current2.route;
C(i).individual(rand2).task = Current2.task;
break;
else
Current2.route =
C(i).individual(rand2).route;
Current2.task = C(i).individual(rand2).task;
end
end
end
66
C(i).individual(j).route = Current.route;
C(i).individual(j).task = Current.task;
C(i).individual(rand2).route = Current2.route;
C(i).individual(rand2).task = Current2.task;
break;
else
Current2.route = C(i).individual(rand2).route;
Current2.task = C(i).individual(rand2).task;
end
Current.route = C(i).individual(j).route;
Current.task = C(i).individual(j).task;
m = length(Current.route);
end
end
end
end
end
length_shift = zeros(1,Nveh);
sum_dur = zeros(1,Nveh);
Waiting_Time = zeros(1,Nveh);
Travel_Time = zeros(1,Nveh);
for i=1:Nveh
Current_route = Individual(i).route;
m = length(Current_route);
% traveling time
if m>0
Travel_Time(i) = Travel_Time(i) +
dist_gate(depot_gate,CurrentTasks(Current_route(1)).gate); % time from depot
at the beginning
Travel_Time(i) = Travel_Time(i) +
dist_gate(CurrentTasks(Current_route(m)).gate,depot_gate); % time to depot at
the end
if m>1
for j = 1:m-1
Travel_Time(i) = Travel_Time(i) +
dist_gate(CurrentTasks(Current_route(j)).gate,CurrentTasks(Current_route(j+1))
.gate);
% adding time between j and j+1
end
end
67
end
% waiting time
length_shift(i) = CurrentWorkers(i).shiftend -
CurrentWorkers(i).shiftstart;
% length of shift
if m>0
sum_dur(i) = CurrentTasks(Current_route(1)).duration;
if m>1
for j=2:m
sum_dur(i) = sum_dur(i) +
CurrentTasks(Current_route(j)).duration;
end
end
% sum of durations of tasks
if sum_dur(i)+Travel_Time(i) < length_shift(i)
Waiting_Time(i) = length_shift(i) - sum_dur(i) - Travel_Time(i);
end
%else
%Waiting_Time(i) = length_shift(i);
end
end
ans1 = max (Waiting_Time);
ans2 = max (Travel_Time);
end
function [OutTA_Time, OutShift_Time, PenaltyTA, PenaltyShift] =
Penalty(Individual, Nveh, depot_gate, dist_gate, CurrentTasks, CurrentWorkers)
OutTA_Time = 0;
PenaltyTA = 0;
OutShift_Time = 0;
PenaltyShift = 0;
for i = 1:Nveh
Current_route = Individual(i).route;
m = length(Current_route);
if m>0
current_dist = dist_gate(CurrentTasks(Current_route(m)).gate,
depot_gate); % time from gate to depot
current_late_end = CurrentWorkers(i).shiftend - current_dist; % time
worker should leave gate for depot
for j = 1:m
if Individual(i).end_time(j) >
CurrentTasks(Current_route(j)).op_end
OutTA_Time = OutTA_Time + Individual(i).end_time(j) -
CurrentTasks(Current_route(j)).op_end;
PenaltyTA = PenaltyTA + 1; % finishing after TW penalty
end
if Individual(i).end_time(j) > current_late_end
OutShift_Time = OutShift_Time + Individual(i).end_time(j) -
current_late_end;
PenaltyShift = PenaltyShift + 1; % finishing after shift ends
penalty
end
end
end
end
end
68