Sei sulla pagina 1di 11

On Some Matching Problems Arising in

Vehicle Scheduling Models


A. A. Bertossi, P. Carraresi, and G. Gallo
Dipartimento di Informatica, Universitzl di Pisa, 56100 Pisa, Italy

Two bipatite matching problems arising in Vehicle Scheduling are considered: the capa-
citated matching and the multicommodity matching. For the former, given a reasonable
cost structure, we can exhibit a polynomial time algorithm, while the general case is
conjectured to be NP-hard. The latter problem is shown to be NP-hard. A heuristic
algorithm based on Lagrangean relaxation for the capacitated version of the multicom-
modity matching is also presented together with experimental results.

1. VEHICLE SCHEDULING AND MATCHING


In this paper two particular Matching Problems are considered, which arise
in Vehicle Scheduling. With the term Vehicle Scheduling we refer to that broad
class of optimization problems [l],[2], [5] in which vehicles must be assigned
to time-tabled trips in such a way that:
(i) each trip is run by one vehicle;
(ii) a given set of constraints is satisfied;
(iii) a cost function is minimized.
Let V = {uI,ut, . . . ,u,} be the set of trips. The ordered pair of trips (ui,uj)
is said to be a compatible pair of trips if the same vehicle can run trips uiand ui
in the sequence. The compatibility depends on the starting and ending times
and terminals of the trips. It is quite reasonable to assume that the set V with
the compatibility relation be a partially ordered set (poser).We assume through-
out that there is only one vehicle type, and that each vehicle can run each trip.
The simplest case of vehicle scheduling problem is the single depot problem;
in this problem all the vehicles are housed at the same depot, and no “a priori”

This work has been supported by the “Progetto Finalizzato Trasporti” of the Italian
National Research Council.

NETWORKS, Vol. 17 (1987) 271-281


0 1987 John Wiley & Sons, Inc. CCC 0028-3045/87/030271-11$04.00
272 BERTOSSI, CARRARESI, AND GALL0

bound on the number of vehicles is given. This problem can be formulated as


a matching problem as follows.
Consider the complete bipartite graph (S, T,A), where S and T are the node
sets and A is the arc set, with (SI = IT1 = n and IAl = n2. We assume A to be
partitioned into two subsets A l and AZ:
Al = { ( i , j ) : ( u , , ~ , is
) a compatible pair of trips},
A2 = A\Al
The graph (S,T,A) can be given a physical interpretation as follows. Nodes
i E S correspond to the ending terminals of the trips, nodes j E T correspond
to the starting terminals of the trips. As for the arcs, an arc ( i , j ) E A l corresponds
to the deadheading trip from the ending terminal of trip u, to the starting terminal
of trip u,, while an arc (i,j) E A2corresponds to the sequence of two deadheading
trips, the first from the ending terminal of trip u, to the depot, and the second
from the depot to the starting terminal of trip u,. It is easy to convince oneself
that a perfect matching, M ,for (S, T,A) corresponds to a feasible vehicle schedule
(and viceversa), with the number of vehicles in the schedule equal to IM f l Az(.
With a proper definition of the arc costs, ci,,the single depot vehicle scheduling
problem can be reduced to a minimum cost perfect matching problem. If c,, =
1 for ( i , j ) E Az and c,, = 0 otherwise, we get the minimum fleet size problem.
If the cost c,, is set equal to the actual cost of the deadheading trip represented
by arc (i,j) (gas, driver cost, etc.) plus the possible idle time cost, we get the
minimum operational cost problem. Of course any combination of these costs
could be used. Let a, ( i = 1, . . . ,n) and b, ( j = 1, . . . ,n) be defined as
follows:
1/2, in the case of the minimum fleet size problem,

[
a, = the cost of the deadheading trip from the ending terminal of u,
to the depot, for the minimum operational cost case;

b, =

then, one has:


1
1/2, in the case of the minimum fleet size problem,
the cost of the deadheading trip from the depot to the starting
terminal of u,, for the minimum operational cost case;

cil = a, + b,, for each (i,j) E A2.


Moreover, let us consider a vehicle which is scheduled to run trip u, imme-
diately after trip ui.There are two alternative possibilities: either to go from the
ending terminal of trip ui to the starting terminal of trip uj waiting there until
the starting time of the trip, or to go from the ending terminal of trip ui to the
depot and to leave thereafter in order to reach the starting terminal of trip uj
in due time. It is reasonable to assume that the cheaper of the two alternatives
will be chosen; then
cij5 a; + b,, for each ( i , j ) E A l .
In some cases one wants to find a minimum cost schedule with a bound on
the maximum number of vehicles used. This problem reduces to what will be
MATCHING PROBLEMS IN VEHICLE SCHEDULING 273

called in the following a capacitated matching problem, that is a minimum cost


perfect matching with a single additional constraint of the type IM fl A21 Ik ,
where k is a positive integer. This problem shall be dealt with in the following
section, where it is shown that it can be easily solved in polynomial time.
A much more difficult problem is the multiple depot vehicle scheduling, where
one has to determine the optimal schedule and to assign vehicles to depots at
the same time. It is not difficult to verify that this problem can be formulated
as the multicommodity matching presented in the third section. There it is proven
that the problem is NP-hard even for two depots. Finally a heuristic algorithm
based on Lagrangean relaxation for the capacitated version of this problem is
presented in the last section, together with experimental results.

2. CAPACITATED MATCHING
Let us restate the capacitated matching problem as follows:
min{cx: x E X,xij E {O,l}, V i,j}, (2.1)
where c is the cost vector, x is a vector of binary variables with xij = 1 if arc
(i,j) belongs to the matching M,xij = 0 otherwise, and X is the set defined by
the following constraints:

Now we show that with our assumptions, that is costs satisfying inequalities
(1.1) and (1.2), the capacitated matching problem is easy.
Introduce the network (“,Ao) having 2n + 2 nodes, lAll + 2n + 1 = e arcs
and a cost vector 8, where:
NO = {s} U S U T U {t}, Ao = Al U {(i,t):i E S } U {(s,j):
j E u {(t,~)},
c”,=cijV(i,j)EAl, d=aiViES, c$‘,=bjVjET, &=O.
All the arcs in Aohave unit capacity, except arc (6s) whose capacity is k. The
nodes in S are sources, each with unit input, the nodes in Tare sinks, each with
unit demand, and s and t are transshipment nodes. Let F denote the set of all
feasible flows in the network (No,Ao).By construction, each flow in F has value
equal to n . If P(f) is the cost of a flow f , then problem (2.1) is equivalent to:
min{c?(f): f E F}. (2.3)
Since the network (No,Ao)has integer capacities and nonnegative costs, a
minimum cost flow that solves (2.3) can be found in O(en log2+clnn)time [7].
Therefore also problem (2.1) can be solved with the same computational effort.
It is plain that the equivalence between (2.1) and (2.3) holds true even if A l
274 BERTOSSI, CARRARESI, AND GALL0

k=O Optimal Sol. k=2 Optinial Sol.


FIG. 2.1

does not represent a compatible set of trips. Unfortunately, if we also relax


conditions (1.1) and (1.2), then the Capacitated Matching problem (CM) becomes
much harder and the existence of an integral optimal solution for its continuous
relaxation is no more assured.
Consider the bipartite graph in Fig. 2.1, where the thick arcs are the only arcs
of A z , all of them with zero cost; the thin arcs have zero cost, except the arc
(3,3) whose cost is - 1; all the arcs needed to complete the graph are assumed
to have a very large cost. The optimal solution for k = 0 is shown, together
with the optimal solution for k = 2. It is easy to check that the unique optimal
solution for k = 1 is given by the convex combination of the optimal solutions
for k = 0 and k = 2 with multipliers equal to 1/2, and is not integer.
Papadimitriou and Yannakakis [6] conjecture the NP-Completeness of the
following 2-Constrained Cardinality Matching problem (2CCM): given the bipar-
tite graph (S,T,A) and two arc sets R, and R2, find a perfect matching M such
that IM n R1l 5 rl and IM f l RZ(5 rz, where rl and rz are positive integers.
It is easy to show that 2CCM reduces to the following instance of CM: find
a minimum cost perfect matching of (S,T,S x T), with the single constraint IM
n RII Irl, and with the costs

c,, = 1; if (i,j) E R2,


if ( i , j ) E A\Rz,
otherwise.
Clearly if the optimum for CM has value less than or equal to r2 then a solution
for 2CCM has been found, otherwise 2CCM is infeasible. Then the conjecture
follows that also the Capacitated Matching with arbitrary costs is NP-hard.

3. MULTICOMMODITY MATCHING
Let us consider the complete bipartite graph of Section 1, ( S , T,A), where A
is partitioned into the two disjoint sets A , and A Z ;assume further that m cost
functions CW A + 3,h = 1, . . . ,m, be given.
MATCHING PROBLEMS IN VEHICLE SCHEDULING 275

The Multicommodity Matching (MM) problem is to find a partition of {1,2,


. . . ,n}, say Zl,Z2, . . . ,I,, and m arc sets M 1 , M 2 ,. . . ,M,,such that:
(i) for h = 1, . . . , m , Mh is a perfect matching for the graph ($TI, x I,,);
(ii) 2,2(i,j)EMh
c f ) is minimum.
Notice that M = M I U M2 U U M,,, is a perfect matching for (S,T,A);
moreover some I h and hence some Mh may be empty.
In terms of Vehicle Scheduling concepts, the set corresponds to the set of
trips run by vehicles housed at the h th depot, while the matching Mh defines
the schedule of such vehicles.
As for the costs we may assume that, at least in vehicle scheduling applications,
the following relations hold for each h:

C(C )
I 5 a!")
= a!")
+ b r ) , ( i , j ) E Al,
+ b,"'),( i , j ) E A2,
where a!") is the cost of the deadheading trip from the ending terminal of trip
(3.1)

uito the h th depot, while by) is the cost of the deadheading trip from the h th
depot to the starting terminal of trip up
In vehicle scheduling applications it is of interest the Capacitated Multicom-
modity Matching (CMM) which is obtained from MM by addition of the follow-
ing constraints
IMh fl A21 5 kh, h = I, . . . ,m,
where k h is the capacity of the hth depot.
Now we show that the multicommodity matching problem is NP-hard, even
in the case in which assumptions (3.1) hold, and that it remains NP-hard also
if m = 2. As usual the proof is given for the decision version of the problem,
that is the problem in which one asks for a solution having cost not larger than
a given real value L.
The proof proceeds by means of a reduction from the One-in-Three Satisfi-
ability problem with un-negated variables, which is known to be NP-complete
(Garey and Johnson [4, 2591):
Given a set U of Boolean variables and a collection C of clauses over U such
that each C E C has only un-negated variables and IC(= 3, is there truth
assignment for LI such that each clause C in C has exactly one true variable?

Theorem 3.1. The 2-commodity matching problem is NP-hard.

Proof. Let C,,C2,. . . ,C, and u l , u2,. . . ' uP be the clauses and the variables
respectively for the above mentioned satisfiabllity problem. We construct an
instance of the 2-commodity matching problem as follows.
For each variable ui define the subgraph shown in Fig. 3.1, where o ( i ) is the
number of occurrences of ui in the clauses.
276 BERTOSSI, CARRARESI, AND GALL0

The basic subgraph

FIG. 3.1

All the arcs drawn in the basic subgraph belong to Al. For both the two
commodities, we set equal to 1 the cost of all the arcs in the subgraph but arc
( W ; , W ~ + whose
~) +
cost is o ( i ) 1. In the bipartite graph (S, T,A)all the subgraphs
are connected in series, since the “lowest nodes” of subgraph i coincide with
the “highest nodes” of subgraph i + 1.
In addition there are p nodes u1,u2, . . . ,up in S and p nodes u1,u2, . , . ,up in
T, corresponding to the clauses in C.For the jth occurrence of uithe arc (ii,u,),
where C, is the clause in which it occurs, belongs to Al, and, €or both the
commodities, has cost equal to 3p + q. All the remaining arcs belong to A2
(remember that we assume the graph to be complete).
Note that no sequence of arcs (yo,yl), (yl,y2), . . . ,(ym-1yYm), (ym,Yo) can
belong to A l for any m 2 0, thus A l represents a compatible set of trips.
The vectors 0 ,b(’),a(*),and b(2)are defined as follows:
if y = w q + l ,
= >, otherwise;
1, ify = wl,
= { L, otherwise;
ify = u , , j = 1,. . . , p ,
42) =
{ >, otherwise;
1 if y = i i , i = I, . . . ,q, j = 1, . . . , o ( i ) ,
biz) = { i, otherwise:
where L = (p + 1)(3p + q + 2).
The costs of the arcs of A 2 are defined accordingly to (3.1). It is easy to check
that the first inequality in (3.1)is verified for all the arcs of Al.
We claim that the resulting instance of the 2-commodity matching problem
MATCHING PROBLEMS IN VEHICLE SCHEDULING 277

has a solution whose cost is L if and only if the instance of the one-in-three
satisfiability is satisfiable.
(IF) Assume that there is a truth assignment such that each clause has exactly
one true variable. Then Zlis defined to contain wi, for all i = 1, . . . ,q + 1, and
il, . . . ,ioc9only for all i such that ui is false; Z2 contains all the remaining nodes.
The matching M1includes the arcs (wi,wi+l)for all ui true, and the arcs (wi,il),
(il,i2),. . . , (iHfi-l,io&h (idll,~i+i)for all ui false. Mi contains the arc (wq+i,wl)
E A2. Thus the overall cost of M 1is 3p + q + 2. The matching M2is defined
to contain all the arcs (ii,vr)E A, and (u,,ij) E A2 such that ui is true and C,
contains the jth occurrence of ui. The cost of the pair of arcs (ij,ur)and (ur,ii)
is 3p + q + 2. Since each clause contains exactly one true variable, there are
p such pairs in M2, and hence its cost is p ( 3 p + q + 2). Thus the overall cost
of the solution is L and the first part of the proof is completed.
(ONLY IF) Assume that the instance of the 2-commodity matching problem
has a solution with cost L. Consider nodes w1in S and w,+~in T; the unique
way to match these nodes without exceeding the cost bound L is to include in
the same node subset, say I,, for each i, wi and either all the nodes il, i2, . . . ,io(i)
or none of them. Correspondently M Ishall contain arc ( W ~ + ~ , Wand, ~ ) for each
i, either arc ( w ; , w ~ +or ] ) arcs (wi,il), (i1,i2), . . . , (io(i),i4i()i)( i ) - l , w i + l ) .For
o,
each i such that (wi,wi+,)E MI, M2 shall include the arcs (ii,ur) and (ur,ii) with
j = 1,2, . . . ,o(i) and r such that C, contains the jth occurrence of ui. Note
that any other choice of Z,, I,, MI, and M2 will lead to a cost larger than L. The
corresponding solution of the satisfiability problem is obtained by setting ui true
if and only if (wi,wi+l) E M1.Since each node u, is matched to exactly one node
corresponding to the occurrence of a true variable, the proof is so completed.

Clearly since Mh4 is a particular case of CMM, also the capacitated multi-
commodity matching is NP-hard. Note that we could have derived the proof of
Theorem 3.1 directly for the capacitated case just by giving capacity 1 to the
first depot and capacity p to the second. Lastly, one can readily check that
assuming a!") = bj") = 1/2 for all i and h and = 0 for all (i,j) E A , and h,
polynomial time solvability returns. Moreover, this holds even in the capacitated
case, since the solution of the resulting fleet size problem does not depend on
the capacities of the individual depots neither on the cost of deadheading trips.

4. HEURISTIC APPROACH TO THE CAPACITATED


MULTlCOMMODm MATCHING
We now turn our attention to the capacitated version of the multicommodity
matching, which is particularly relevant in the vehicle scheduling setting. Since
this problem is NP-hard, no optimal algorithm running in polynomial time is
expected to be found. Therefore, we present here a heuristic algorithm for this
problem based on Lagrangean relaxation.
278 BERTOSSI, CARRARESI, AND GALL0

The Capacitated Multicommodity Matching problem can be restated as fol-


lows:
min cc
2 c!) x!)
h i j

c i
xi!) = y p , V i,h,

c x(h)
i
11 = '
Yl( h ) V j,h,

2 xf) Ikh, V h,
(i.j)az

cyp
h
= 1, V i,

x ! ) , yih) E {O,l}, V i,j,h,


where
k, = the capacity of depot h;

I
1, if trip i is assigned to depot h ,
yp = 0, otherwise;
1, if trips i and j are run in the order
Ah) = by the same vehicle housed at depot h ,
11
0, otherwise,
and costs verify assumptions (3.1).
Consider the Lagrangean dual of (4.1), max,+(A), where +(A) is defined as
follows:

x!) = yjh), V i,h,


I

ci
xi*) = Yl@), V j,h,

c
(i,j)EA2
xih) 5 kh, Vh

x p , yl'"' E {OJ}, V i,j , h.


Observe that +(A) can be evaluated by solving m problems:
min 2 c cih) xf) - 2 A&)
i j I

ci
xp = yp, V i,

x(h)
'I = yp, V j, (4.3)
i
MATCHING PROBLEMS IN VEHICLE SCHEDULING 279

one for each h,


It is easy to check that problem (4.3) is equivalent to the following capacitated
matching problem:
min c2 dv) xf/)
i j

V i,

$' E {O,l}, V i,j,


d(h) =
1/2 A; - 1/2 Aj,
c$h) - i # j,
11
min(0, cf" - A;}, i = j,
A'2 = A2 - { ( i j ) : cF) - hi 2 0).
The value of the vector y(")is determined after the optimal solution x(") of
(4.4) as follows:
y p = 0,
r
1,
if dih) = 0 and.$) = 1,
otherwise.
Consequently, the function +(A) can be evaluated, for a given A, in polynomial
time by solving m capacitated matching problems as shown in Section 2.
The function +(A) is a concave piecewise linear function which can be max-
imized by a simple ascent procedure such as, for instance, the one described by
Carraresi, Gallo, and Rousseau [3], which is based on conjugate subgradients.
The solution of the problem max,+(h) yields a lower bound to the objective
function of problem (4.1) and a solution dh),Y ( ~ )h, = 1, . . . ,m,not necessarily
feasible, since some nodes may be exposed or assigned to more than one com-
modity.
It is easy to devise a greedy heuristic which tries to remove these infeasibilities,
thus yielding a feasible solution and hence an upper bound to problem (4.1).
The heuristic we have used is based on the following ideas.
Firstly we state and solve a single commodity minimum fleet size problem in
order to check the existence of a feasible solution to the original problem, that
is a solution with a number of vehicles less than or equal to the total capacity
of the depots. If the original problem is feasible, let y be the solution of max,+(A)
and let Ql = {i: &, yih)> 1) and Q2= {i: &, yih) = 0). We empty Q,and try to
empty Q2as follows:
i) Each i E Ql is assigned to only one among the commodities for which
yfh)= 1, in such a way that, if possible, the fleet size is reduced or, alternatively,
the decrease in the objective function is maximized.
ii) For each i E Q2,we set to 1 the variable y f h )which yields the minimum
increase in the objective function, provided that the capacity constraints are not
violated.
280 BERTOSSI, CARRARESI, AND GALL0

iii) If we do not succeed in emptying Q2,then the solution obtained from the
initial single commodity minimum fleet size problem is used, assigning the ve-
hicles to the depots in order to minimize the cost of the deadheading trips and
to satisfy the capacity constraints.
In order to evaluate the practical behavior of the proposed approach we run
the above procedure on some randomly generated problems. We considered 35
instances with 3 depots and 50 trips (for a total of about 200 hours of travelling
time). The distribution of the trips along the day and their lengths have been
generated according to real life data; in particular data from the Florence Transit
Company have been used.

TABLE I.
Problem Fleet size Total capacity Depot capacities % Error
RSl 27 60 15 20 25 1.08
30 10 10 10 .o
RS2 30 50 15 20 25 .33
30 10 10 10 .o
30 4 15 11 .o
RS3 26 60 15 20 25 .32
30 12 9 9 .10
RS4 28 50 15 10 25 .o
30 8 10 12 .O
28 7 15 6 .o
RS5 31 40 15 10 15 .51
35 15 10 10 3.42
35 12 11 12 .51
33 11 11 11 2.54
31 10 10 11 5.04
RS6 29 40 10 15 15 2.22
35 15 10 10 .o
35 12 12 11 .o
30 10 10 10 .8
29 12 8 9 .o
RS7 29 40 10 15 15 .o
35 12 12 11 .o
35 15 5 15 .21
29 10 7 12 .O
29 10 9 10 1.41
RS8 30 40 13 13 14 .O
35 12 12 11 .o
33 11 11 11 1.1
32 11 10 11 .59
30 10 10 10 .o
RS9 28 40 14 13 13 .06
33 11 11 11 .18
32 10 11 11 .21
30 10 10 10 2.85
28 8 10 10 2.70
Note. % error = (upper bound-lower bound) . 100/(lowerbound).
MATCHING PROBLEMS IN VEHICLE SCHEDULING 281

The computational results are reported in Table I. For each problem (column
1) the minimum fleet size is computed (column 2); different instances are con-
sidered by varying depot capacities (column 3: total capacity, column 4: indi-
vidual capacities) down to a total capacity approaching the minimum fleet size.
Finally in column 5 the value of the % error of the produced solution is reported,
where % error = (upper bound - lower bound) - 100/(lower bound). As one
can check the approach yields optimal solutions quite often, even when the total
capacity is close the minimum fleet size; moreover, the percentage of the error
is greater than 3% only in two cases.
It is worth remarking that such good results have been obtained by means of
rather naive algorithms such as the ones described above. This fact suggests that
CMM should not be too hard to solve to optimality, at least in vehicle scheduling
applications.

References
[l] L. Bodin and B. Golden, Classification in vehicle routing and scheduling. Networks
11 (1981) 97-108.
[2] P. Carraresi and G. Gallo, Network models for vehicle and crew scheduling. EJOR
16 (1984) 139-151.
[3] P. Carraresi, G. Gallo and J.-M. Rousseau, Relaxation approaches to large scale bus
driver scheduling problems. Transportation Res. 16B (1982) 383-397.
[4] M. R. Garey and D. S. Johnson, Computers and intractability: a guide to the theory
of NP-Completeness. W. H. Freeman, San Francisco (1979).
[5] J. K. Lenstra and A. H. G. Rinnooy Kan, Complexity of vehicle routing and sched-
uling. Networks 11 (1981) 221-227.
[6] C. H. Papadimitriou and M. Yannakakis, The complexity of restricted spanning tree
problems. Journal ACM 29 (1982) 285-309.
[7] R. E. Tarjan, Data structures and network algorithms, SIAM, Philadelphia (1983).

Received March, 1985.


Accepted October, 1986.

Potrebbero piacerti anche