BUS SCHEDULING AS A GRAPH COLORING PROBLEM BUS SCHEDULING AS A GRAPH COLORING PROBLEM

The fundamental vehicle-scheduling problem (VSP) is usually formulated as a matching problem for which there exists a polynomial algorithm. The formulation of VSP as a graph coloring problem may seem not to be practical since a graph coloring problem is NP-hard and it is not a good idea to solve a polynomial problem using a non polynomial algorithm. However, no polynomial algorithms have been found for generalizations of VSP and hence the graph coloring formulation offers good approximation algorithms for their solution


Introduction
In recent vehicle scheduling papers many new scheduling problems arise namely in connection with multiple bus scheduling.Problems of heterogenous fleet are treated in [1], [2], many general problems of fleet management are described in [3].Peško in [7] deals with multicommodity bus scheduling, in [9] with special fleet optimization problem, my paper [6] designes a graph theory approach to two bus scheduling problem.Many arising problems are NP-hard-a comprehensive overview of NP-hard transportation problems is in [8].
Standard vehicle scheduling is a polynomial problem, which can be polynomially reduced to a matching problem.However, its generalizations are no longer polynomial.This paper brings a graph coloring formulation of a fleet minimization problem.Such formulation is of no use for standard scheduling, but for its generalizations (for two bus scheduling problem) it offers a non polynomial algorithm which can be used as a heuristic, since it offers a good feasible solution in any stage of computing.
Trip s is an arbitrary quadruple s ϭ (dp, ap, dt, at) where dp, ap are the departure place and arrival place of the trip s and dt, at are departure time and arrival time of the trip s.Trip is a travel from a starting point to a finishing point of a route and is considered to be an elementary amount of the work of a bus.
We will say that the trip s i precedes the trip s j and we will write s i ՞ s j if the trip s j can be linked after the trip s i into a running board for one bus.If s i ϭ (dp i , ap i , dt i , at i ), s j ϭ (dp j , ap j , dt j , at j ), then it holds s i ՞ s j if and only if where M (ap i , dp j ) is the travel time from arrival place of s i to departure place of s j .Relation ՞ is irreflexive and transitive.
Running board, or running board of a bus is an arbitrary nonempty sequence T ϭ s 1 , s 2 , …, s m of trips with property: The number m will be used for length of running board T. We will write s i → s j , if both trips s i , s j are provided by the same bus and the trip s i is linked immediately behind the trip s j .Note that s i → s j implies s i ՞ s j .
For any given set S ϭ {s 1 , s 2 , … s n } of trips with precedence relation ՞ we can construct a bus schedule.Bus schedule of the set S of trips is a set of running boards so that every trip of the set S occurs exactly in one running board of O.

To every bus schedule
-the cost of bus schedule O is assigned.We will say that the cost C(O) is separable if it can be expressed as a sum of costs of all running boards T 1 , T 2 , …, T k , i. e.
where c(T i ) denotes the cost of running board T i .In most simple cases the cost of running board T ϭ s 1 → s 2 → … → s m is the sum of all linkage costs: The fundamental vehicle-scheduling problem (VSP) is usually formulated as a matching problem for which there exists a polynomial algorithm.The formulation of VSP as a graph coloring problem may seem not to be practical since a graph coloring problem is NP-hard and it is not a good idea to solve a polynomial problem using a non polynomial algorithm.However, no polynomial algorithms have been found for generalizations of VSP and hence the graph coloring formulation offers good approximation algorithms for their solution.

BUS SCHEDULING AS A GRAPH COLORING PROBLEM BUS SCHEDULING AS A GRAPH COLORING PROBLEM
The linkage cost denoted c(s i , s j ) represents mainly dead mileage expenses, however, it may include waiting costs and other penalties as well.
In this case we will say that the cost c(T) is linear.We will say that the cost C(O) of bus schedule O is linear, if C is separable and the cost c of running board is linear.

Two fundamental bus scheduling problems
The general goal of vehicle scheduling optimization is to find the bus schedule O with minimum cost C(O).However, it showed useful to decompose the optimization process into two stagesminimization of the number of used buses and the minimization of the bus schedule cost provided the minimum number (or any feasible fixed number) of vehicles is used.This approach follows from practical experience when bus operators demand in most cases the bus schedule with a minimum number of vehicles.
There are two classical fundamental bus scheduling problems:

Fundamental problem I (FP I)
To find a bus schedule with a minimum number k 0 of running boards (i.e. with a minimum number of vehicles).

Fundamental problem II (FP II)
From all bus schedules with the given number k of running boards to find a bus schedule with a minimum total cost.(In most cases k ϭ k 0 , where k 0 is the minimum number of vehicles obtained by FP I.)

Mathematical model for linear bus schedule cost
For linear bus schedule cost C(O) and k ϭ k 0 we have the following mathematical model.

Let's denote
Let x ij ʦ {0,1} be a decision variable.If x ij ϭ 1 and s i ՞ s j it means that the trip s j is linked after the trip s i in a running board and d ij Ͻ ϱ represents the corresponding linkage cost.If x ij ϭ 1 and s i s j it means that the trip s i is the last trip of a running board and the trip s j is the first trip in another (or maybe the same) running board.In this case dij ϭ ϱ.So the sum ⌺ ij d ij .x ij includes all linkage costs and as many items d ij .x ij ϭ ϱ as the number of running boards represented by variables x ij .
The mathematical model for FP II can be formulated as follows: (7) subject to for i, j so that x ij ʦ {0, 1} Conditions (8) say that each trip can have only one predecessor and only one successor.Last formulation is a matching problem for which we have several effective polynomial algorithms.The same model works for FP I, too, but it can be even simplified by setting For k Ͼ k 0 the model for FP II can be several ways -one of them is the following.Replace ϱ by a great number K in (6) and

Heuristic approaches for regular bus schedule cost
There are many practical cases when the cost of bus schedule is separable but no longer linear.Thus for return bus scheduling problem, when the cost of bus schedule T ϭ s 1 → s 2 → … → s m includes travel cost from arrival place of s m to departure place of the FP II is NP-hard.Other example of similar problems are a multiple depot bus scheduling problem, bus scheduling with special conditions such as constraints for working time, safety break, meal break etc.For none of them any polynomial algorithm has been found till now.
The FP I doesn't depend on the form of objective function, so the matching model gives us the solution with a minimum number of buses.We take this solution as the starting one for one of following neighbourhood search heuristic procedures: • horizontal splitting -neighbourhood obtained from existing solution by combining trips of two running boards • vertical splitting -neighbourhood obtained by combining heads and tails respectively bodies and mids of all running boards from the existing bus schedule.
The vertical splitting leads to the multiple application of matching algorithm.From many practical experiences it follows that the mentioned procedures are very successful for separable bus schedule cost.
for i, j such that s i ՞ s j otherwise 0, ϱ,

Graph coloring model for FP I
Let S be a set of trips with precedence relation ՞.We will say that the trips s 1 ʦ S, s 2 ʦ S are incompatible if s 1 s 2 and s 2 s 1 .Otherwise we will say that the trips s 1 , s 2 are compatible.Let G ϭ ϭ (V, E) be a graph with vertex set V ϭ S and edge set E defined In other words the edge set E is the set of all incompatible pairs of trips from S.
Let T ϭ s 1 → s 2 → … → s m be a running board with the trips from S. Then for every couple s i , s j , i ϭ 1, 2, …, m, j ϭ 1,2, …, m, i j it holds s i ՞ s j or s j ՞ s i and consequently (s i , s j ) E -the set V T of all trips from running board T is an independent subset of vertices in graph G.
On the other hand the given independent subset of trips V T ʕ V, for arbitrary pair s i ʦ V T , s j ʦ V T it holds s i ՞ s j or s j ՞ s i -՞ is a complete ordering of finite set V T and hence the trips from V T can be ordered into a linear ordered sequence -running board T.
In the terminology of graph coloring problem the subset V T ʕ V is a running board if and only if all vertices from V T can be colored by the same color.Then FP I can be formulated as follows: To solve FP I means to find a coloring of the graph G with a minimum number of colors.

Exact graph coloring algorithm
The following exact graph coloring algorithm comes from the outstanding Demel's book [4].Suppose V ϭ {1, 2, …, |V|} n ϭ |V|.Let V x be the set of all neighbours of the vertex x in graph G.
F(x) is the lowest feasible color number for vertex x.Provided the vertex x is colored with color B[x], G(x) is the lowest feasible color number greater than B[x] which can be used for vertex x.The bad news is that this algorithm is not polynomial and there is no hope that it finishes in reasonable time even for the smallest real word instances.The good news is that after executing Step 1 at least once we have a feasible (but not necessary optimum) solution in the array RECORD[ ], so the algorithm can be interrupted in any time (after executing Step 1. at least once) and the coloring stored in array RECORD[ ] can be used as a suboptimum solution.This algorithm was implemented in C-language and practical experiences showed that it was able to find optimum relatively fast, but there still remained plenty of computing to confirm that there is no better solution.Since the matching model for FP I is exact and very fast, in this stage this approach is of no practical importance.
There are graph coloring algorithms with better performance e.g.methods based on constraint programming in [5], but the investigation how to modify them for two bus type problem is not finished yet.

Two bus type problem
Suppose we have two types of buses say type 1 and type 2 with different capacities C 1 Ͼ C 2 and different costs of running board c 1 Ͼ c 2 .The set S of all trips consists of two disjoint subsets S ϭ ϭ S 1 ʜ S 2 , S 1 ʝ S 2 ϭ л.The trips from S 1 can be performed only by buses of the type 1, because they need higher capacity.The trips from S 2 can use both types of buses.
A type of the bus has to be assigned to every running board T ϭ s 1 → s 2 → … → s m .If for some the trip s i from running board T it holds s i ʦ S 1 the running board T has to be accomplished by a bus of the type 1 (otherwise T is infeasible).If the running board T ϭ s 1 → s 2 → … → s m consists only of elements of the subset S 2 it is possible to assign to it both types of buses.However, the better solution is to use smaller type 2 because it is less expensive.So we define the cost c(T) of running board T as follows The cost of bus schedule O ϭ {T 1 , T 2 , …, T k } is separable, i.e. it holds (4).
The general two bus type problem is to find a bus schedule with a minimum cost C(O).
The original idea was the same as in a single bus type case described in section 4 of this paper -first to solve FP I (to find the bus schedule with a minimum number of buses regardless of the bus type) and then to use heuristics for minimization of the cost C(O).But the described heuristics working well in most of a single bus type cases failed in a two-bus type problem.The main reason is probably in the fact that there are not enough simple if T contains least one trip from S 1 if all trips from T are from S 2 paths from solution with a larger number of vehicles of the type 1 to the solution with a lower number.Another reason is that the objective function C(O) doesn't express the "distance" of the existing solution to the solution with a lower number of buses of type 1 and hence the neighbour searching procedure cannot distinguish which solution is "closer" to diminishing the number of vehicles of the type 1.If we start from the existing solution with an optimum fleet structure we could avoid the described problems.
There are several possible analogies of FP I for two-bus type scheduling.
Fundamental Two Bus-type Problem a (FTBP Ia).For k 1 -the minimum number (or any given feasible number) of buses of the type 1 to find a bus schedule with a minimum number k of all buses.
Fundamental Two Bus-type Problem b (FTBP Ib).For k -the minimum number (or any given feasible number) of all buses to find a bus schedule with a minimum number k 1 of buses of the type 1.
Formulation of the analogy of FP II.for the two-bus type case is the following: Fundamental Two Bus-type Problem II (FTBP II).From all bus schedules with given numbers k 1 , k 2 of running boards of the type 1 and type 2 to find a bus schedule with a minimum cost C(O).
Both FTBP Ia and FTBP Ib seem to be NP-hard, but I didn't succeed to prove this nor to find mentioned problems can be formulated as a known graph theory problem -list coloring problem.
The list coloring problem is the following generalization of a graph coloring problem: Let G ϭ (V, E) be a graph, V ϭ {v 1 , v 2 , …, v n }, let C 1 , C 2 , …, C n be sets of colors where C i is a set of feasible colors for vertex v i (list of allowed colors for v i ).The problem is to find a feasible coloring -to assign for every v i ʦ V a color from C i such that no two adjacent vertices are assigned the same color.
We can define a further generalization of the list coloring problem -the minimum list coloring problem: Given a graph G ϭ (V, E) and a list of allowed C 1 , C 2 , …, C n to find a feasible coloring with minimum total number of used colors.
Let G ϭ (S 1 ʜ S 2 , E) be the graph with vertex set S 1 ʜ S 2 and edge set E containing all incompatible pairs of different trips from S 1 ʜ S 2 .By solving the FP I for the set of the trips S 1 we obtain k 1 -the minimum number of large buses of the type 1.For vertices v i ʦ S i set C i ϭ {1, 2, …, k 1 } for set C j ϭ {1, 2, …, n}.Then to solve FTBP Ia means to solve the minimum list coloring problem in graph G with list of allowed colors C 1 , C 2 , …, C n .
The following modification of the exact graph coloring algorithm was designed for the mentioned special case of minimum list coloring problem.Similarily to the exact coloring algorithm this algorithm will not finish in reasonable time, but it offers a feasible good solution in array RECORD in any time after executing Step V at least once.
Palúch * * Stanislav Palúch Faculty of Management Science and Informatics, University of Žilina, Slovakia The graph theory formulation of FP II with given number k of running boards leads to the minimum cost flow problem with the given flow magnitude equal to k.
F MAX :ϭ max 1 Յ x Յ n {B[x]}.Copy array B[ ] into array RECORD[ ]. • Step VII.Find in array B[ ] the lowest y such that B[y] ϭ FMAX.• Step VIII.Set x :ϭ max kʦP(y) {k}.• Step IX.If x ϭ 1, STOP.Chromatic number of graph G is (G) ϭ FMAX and the corresponding optimum graph coloring of G is in array RECORD[ ]. • Step X.If G(x) Ն FMAX or if G(x) Ͼ (max 1ՅiϽx {B[i]} ϩ 1), set x :ϭ x Ϫ 1 and Goto Step IX.Otherwise set B[x] :ϭ G(x), z :ϭ x ϩ 1. • Step XI.B[z] :ϭ F(z).If B[z] Ն FMAX,set y :ϭ z and Goto Step VIII.If z Ͻ n set z :ϭ z ϩ 1 and repeat Step XI.If z ϭ n we have a new better solution.Goto Step VI.
Set G 1 ϭ (S 1 , E 1 ) were E 1 is the set of all incompatible pairs of different trips from S 1 .Set G ϭ (V, E) where V ϭ S 1 ʜ S 2 and where E is the set of all incompatible pairs of different trips from V.. Sort the vertex set V so that vertices from S 1 proceed all vertices from S 2 .Suppose V ϭ {1, 2, …,|V|}, n Ϫ |V|.• Step II.Solve FP I for the set of vertices S 1 to find k 1 • Step III.Use exact graph coloring algorithm for the graph G 1 and stop it as soon as you find the first feasible solution with k 1 colors.Keep result coloring in array RECORD[ ].
•Step I.•Step IV.Set P(x) :ϭ V x പ {1, 2, …, x Ϫ 1} (16)F(x) :ϭ min{ii ʦ C x , 1 Յ i, ᭙j ʦ P(x) i B[j]} (13) G(x) :ϭ min{ii ʦ C x , B[x] Ͻ i, ᭙j ʦ P(x) i B[j]} (14) F(x)is the lowest feasible color number for vertex x with respect to color list C x .Provided the vertex x is colored with color B[x], G(x) is the lowest feasible color number greater than B[x] which can be used for vertex x with respect to color list C x .Functions F(x), G(x) are set minimums.Remember that if the set is empty the corresponding minimum ϩ ϱ.Since C x ϭ {1, 2, …, n} for x ʦ S 2 then F(x) Յ ϱ for all x ʦ S 2 .• Step V. Set B[x] :ϭ RECORD[x] for all x ʦ S 1 and sequentially for every x ʦ S 2 B[x] :ϭ F(x).(Let's note that it can never happen F(x) ϭ ϱ for x ʦ S 2 .)• Step VI.Set