An Iterative Algorithm for the Management of an Electric Car-Rental Service

Themanagement of a car-rental service becomesmore complex as long as one-way bookings between different depots are accepted. These bookings can increase the operational costs due to the necessity ofmoving vehicles fromone depot to another by the company staff in order to attend previously accepted bookings. We present an iterative model based on flows on networks for the acceptance of bookings by a car-rental service that permits one-way reservations. Our model lets us also recover the movement of the fleet of vehicles between the depots over the time. In addition, it also permits including restrictions on the amount of cars managed at every single depot. These results can be of interest for an electric car-rental service that operates at different depots within a city or region.


Introduction
Car rentals can admit bookings where the pick-up and dropoff location can coincide or not.If bookings are only admitted when both locations coincide, their management is not as complicated as if bookings are only accepted when the locations are different (one-way bookings).When this happens, these companies face much more difficulties in order to cope with the management of their fleet of vehicles, since these bookings could entail a huge increment of operational costs due to deadhead times.Nevertheless, in order to offer a high level of service thier policy is to accept bookings without a deep examination of its consequences on the operational costs [1].
The use of fully electric vehicles (FEV) is fostered by government authorities in order to contribute to the lowering of the current pollution levels [2].This comes jointly with a gradual phasing out of conventionally-fuelled vehicles from the urban environment [3].Some references concerning the adoption of these new transportation devices can also be found in [4,5].
The easiest way to implement a rental service of electric vehicles is to make the users return them at the place where the cars have been picked off.This is done in order to be sure that every car has its own parking place with a charging point.Therefore, an improvement in the process of acceptance of bookings that consider one-way trips between different stations and try to avoid, as far as possible, the amount of staff dedicated to the rearrangement of vehicles between the depots is of particular interest in order to facilitate and extend their use among the potential users.Therefore, a social benefit is obtained as long as the number of reservations of these shared vehicles is increased and the number of private cars running is reduced.
Flows and networks were firstly used in the air industry for solving fleet routing problems, see for instance [6][7][8][9].The problems that can be solved using them range from schedule design, flight assignment [10], and crew scheduling [11] to scheduling of air cargo alliances [12].Their techniques have been also considered in the management of car-rental services in order to answer questions of strategic and tactical decisions, revenue and capacity management, and pricing, see for instance [1,[13][14][15].
We suppose that a simulation of bookings for a car-rental service is given.We model the process of acceptance/rejection of those petitions.This depends on having a car available at the departure point (without leaving unattended any other previously scheduled booking from that place) and on having an empty parking space at the arrival destination.We assume that an answer should be given as fast as possible to the client.Therefore, we will answer each petition before considering the next one.We do not consider the case that a rejected booking can turn to be admissible after some other booking has been accepted.As we said before, the general practice in the car-rental industry is to accept bookings and later to optimize the management of the fleet of vehicles.
The car-rental services considered in the frame of this paper are managed with a little different policy.We assume that one of these services does not need to compete with other services and it is just an optional element inside the mobility network of an urban area, where other means of transport are offered to the citizens.Therefore, if a booking should be rejected because of the lack of available cars or empty parking slots, then we reject it since we consider that this will have a low impact on the service perception of prospective users, as long as other means of transport can be used.In this way we determine which bookings should be admitted without falling on deadhead times due to the rearrangement of cars by the car-rental service staff.
The paper is organized as follows.In Section 2 we introduce some basics of graph theory about flows and networks.We also present time-expanded networks.Our model for managing the bookings using a network is presented in Section 3. Section 4 is devoted to explain the theoretical background that backs our computational method.A first algorithmic approach based on Ford-Fulkerson algorithm is presented in Section 5. We will see that the problem that arises can be stated in terms of finding an admissible flow on a network with minimum capacities at certain edges.Later, an iterative method based on a simplification of the auxiliary network defined for considering the admissibility of the flow will be given in Section 6.This method lays on a solution of certain shortest path problem.An analysis of the results is reported in Section 7. Finally in Section 8 we discuss the contribution of the model to the management of a service in order to offer a cheaper rental service, which will contribute to extend its use for the movements within an urban area.Our algorithm helps to determine if it is advisable to increase the fleet of vehicles or the size of the parking at a certain depot, attending to the increments of cost and to the number of additional bookings accepted.

Preliminaries
A directed graph  = (, ) is given by a set of nodes  and a set of ordered pairs of nodes (arcs).If an arc connects the node  with the node V, we will simply denote it by (, V).We recall that a 5-tuple  = (, , , , ) is named network if it is a directed weakly connected graph where  is the set of nodes,  is the set of arcs,  is a node with outgoing degree positive (at least one edge departs from it) usually called source,  is a node with ingoing degree positive (at least one edge arrives to it) usually called sink, and  is a function from  to N that assigns to every edge (, V) ∈  a value (, V) that will represent the maximum capacity permitted on this edge.Given a network , we can consider flows on them.A flow  is a function  :  → N such that (, V) ≤ (, V) for every (, V) ∈ , and for every V ∈  \ {, } the sum of the values of the flow on the edges with V as initial node coincides with the sum of the flows on the edges with V as final node; that is, Condition ( 1) is usually known as the conservation law of the flow.The value of the flow  on , (), is defined as the sum of the flows on the adjacent arcs to  (or to ): A flow  on  is said to be maximum if it has the maximum value among all possible flows that can be defined on .We refer the reader to [16][17][18][19][20][21][22][23][24] for general information on flows and networks and graph theory.
In particular, we are going to consider time-expanded networks, also called time-space networks [18,25].In these networks, the inner nodes of the network (not the sink nor the source) represent locations at certain times.The source is connected with all locations at the initial time and all locations at the final time are connected with the sink.This is also the structure used for dealing with problems in which the flow emerges from several sources and leaves at several sinks.Now, we transform this network into a one timeexpanded network in which we reply cities as many times as time periods we are going to consider, see Figure 1.Nodes in each column represent the same city and each level represents the same time period for different cities.
In this model we also consider another value associated with each arc named its minimum capacity.The minimum capacity is a function  :  → N. The flow through every edge (, V) ∈  must verify (, V) ≤ (, V) ≤ (, V).We denote a network  with minimum capacities as  = (, , , , , ), where  is the set of nodes,  the set of edges,  the source,  the sink, and ,  the minimum and maximum capacities, respectively.Networks with maximum and minimum capacities cannot always admit a flow that respects the upper and lower bounds.It is compulsory that, for every node V ∈ , the sum of the maximum capacities of all the edges that arrive to V was greater than or equal to the sum of the minimum capacities of all the edges that depart from it.Consider If not, the conservation law never holds.
In the next section, we proceed to explain in detail the steps that let us construct a model for deciding whether to accept or reject a booking attending to the distribution of cars at the departure depot and the existence of empty parking places at the arrival one.

A Car-Rental Booking Model
Suppose that our car-rental service operates with only one type of car.Let  be the number of locations (depots) and assume that depot  starts with a given number of cars   .Let  0 be the total number of cars of the company; that is,  0 = ∑  =1   .In addition, we suppose that depot  has   parking slots at its location to park the cars that are not used by any client and are recharging and waiting to be reserved.We assume that this number cannot be increased along the time.
The set of nodes  will consist of ,  (the source and the sink) and all the possible combinations of locations and times {V , : 1 ≤  ≤ ; 1 ≤  ≤ ℎ} where V , represents the location  at time   .
The set  is formed by four types of arcs.The first three are the following ones.
(i) (, V ,1 ), 1 ≤  ≤ , that connect the source with the depots at the first instant of time.
(iii) (V ,ℎ , ), 1 ≤  ≤ , that connect the depots at the last time to the sink.
Our objective is to know if we can accept a booking of  cars between two determined depots at two different time moments under the restrictions of having enough vehicles at the departure depot and free space at the arrival one.We define a booking by a 5-tuple  = (  ,   ,   ,   , ), where 1 ≤   ,   ≤ , 1 ≤   <   ≤ ℎ, and  ∈ N, with   being the pick-up depot,   being the pick-up time,   being the dropoff city,   being the drop-off time, and  being the number of cars to be reserved.Each booking  = (  ,   ,   ,   , ) is converted into a new edge from node V   ,  to node V   ,  .This will be the fourth type of arcs of our network.Now, we analyze which capacities are necessary to model the movement of the cars along the time and to accept only admissible bookings.
We have supposed that depot  has   parking spaces.To set this restriction we assign   as maximum capacity to the edge (V , , V ,+1 ) 1 ≤  ≤ , 1 ≤  ≤ ℎ, and every node of the form V ,ℎ , 1 ≤  ≤ , must be connected with the sink  by an edge with   as maximum capacity.
Finally we must assign a minimum capacity to arcs (, V ,1 ).If not, the cars at a depot  could not be considered in the parking in the future.In Figures 2 and 3 every edge (, V) ∈  has a 3-tuple ((, V), (, V), (, V)) associated with it where  and  are the minimum and maximum capacities, respectively, and  denotes the flow.If we suppose that arcs (, V ,1 ) have assigned minimum capacity equal to the number of cars of every depot,   , we will avoid the aforementioned problem.The following example shows the necessity of a minimum capacity for the edges that represent the starting time at every parking.
Example 1. Suppose that we start with 6 cars at depot 1 at time  = 1 and with 7 cars at depot 2 at time  = 1 too.We also consider that we have 7 and 8 parking slots, respectively, at each one of these depots.Let us suppose that we have to decide whether the booking (2, 1, 1, 2, 3) could be accepted or not.
In Figure 2 we have a piece of a network without minimum capacities in the edges (, V 1,1 ) and (, V 2,1 ).In this case, there is a flow of 3 cars across the edge (V 2,1 , V 1,2 ), and therefore the booking would be accepted.Nevertheless, there are 6 cars parked at slot 1 during all periods of time and this is not taken into account.If they were, then the proposed booking cannot be accepted as it is indicated in Figure 3, since we will have a total number of 9 cars that arrive to node V 1,2 .This is not possible since the conservation law fails due to the fact that the maximum capacity of the only edge that departs from For edges representing bookings, we also have to consider that the minimum and maximum capacity must coincide in order to be sure that the cars follow the booking itinerary and do not stay at the parking of the picking up depot.Next example shows the necessity of minimum capacity for edges associated with bookings.
In Figure 4 we have a piece of a network without minimum capacities at the edge (V 1,2 , V 2,3 ).In this case, we cannot be sure that the flow of 1 unit that corresponds to this booking will traverse the edge, and therefore the car will go from depot 1 to depot 2 at those times.We can only ensure this if we assign a minimum capacity of 1 unit to this edge, as it is shown in Figure 5.

Existence of an Admissible Flow on the Network
The flow over the network that we have already presented simulates the movement of the cars over time.As we said before, a flow through a network with minimum capacities (0, 5, 7) (0, 7, 8) could not be admissible.Firstly, the initial number of cars at every depot must be smaller or equal to the number of parking slots at each depot; that is,   ≤   for  = 1, . . ., .
Secondly, a list of bookings, which is in fact a list of new edges to be added to the former network, could result into a network without any admissible flow.Now, we start with the initial network  that contains only the first three types of edges that were previously mentioned.This network has the following values as maximum capacities at their edges: In addition, we also set the following minimum capacities: Then, the following flow results in being admissible on this network: Now, let us suppose that we have an ordered list of  bookings requests { 1 , . . .,   }, where each booking is given by its corresponding 5-tuple.Consider that these bookings have arrived to us in advance to  1 , for instance through the website of the car-rental company.We have to decide whether we can accept them or not.The acceptance of each booking depends on the acceptance or not of the previous ones.We assume that all bookings must be answered following a first-in/first-out criterion, which is the closest approach to the management of bookings that arrive through a web service.
We start with the first booking request  1 = (  1 ,   1 ,   1 ,   1 ,  1 ) and we add the corresponding edge from node with maximum and minimum capacities equal to  1 .
In order to know if there exists an admissible flow in the network  = (, , , , , ) with the additional edge corresponding to booking  1 , we define an auxiliary network   and apply Ford-Fulkerson algorithm on it.The explanation of Ford-Fulkerson algorithm can also be found in [16,18,19,21].
The use of this network   in order to determine the existence of an admissible flow on a network with minimum capacities is given by the following result that can be found either in [16, page 83] or in [21, page 92].Its application provides us with a theoretical support for modeling our problem.
Theorem 3. Let  = (, , , , , ) be a network and let one consider its auxiliary network   defined as follows.
(1) The set of nodes of   consists of the nodes of  and two new auxiliary nodes   ,   that will be the source and the sink, respectively, of the network   .
(2) To define   we consider all the edges of  and we add a new one from  to , with infinite capacity.
(4) We also set all the minimum capacities of   to zero.
Let   be a flow of maximum value   (  ) on   , and let   (, ) be the flow of   through the edge (, ).There exists an admissible flow of value   (, ) on  if and only if   (  ) = ∑ (,V)∈ (, V).
Remark 4. The proof of Theorem 3 shows how to construct the admissible flow; we just have to define (, V) =   (, V)+ (, V) for every edge (, V) in the initial network , and its value will be   (, ).
To sum up, the network   obtained when considering also the first booking  1 has  ∪ {  ,   } as the set of nodes,   as the source,   as the sink, and the following edges with their corresponding maximum capacities.These new capacities are defined as: We have eliminated the edges that should appear on   with maximum capacity equal to 0. If there exists a maximum flow on this network of value   (  ) = ∑  =1   + S T ).
If yes, then we keep these two edges on   .
Example 5. Suppose that we have two depots, 1 and 2, with  1 cars at depot 1 and  2 cars at depot 2. We consider each depot at two different times,  = 1 and  = 2. Suppose that we have a booking of  1 cars from depot 1 at time  1 to depot 2 at time  2 .In Figure 6 we have the initial network  with the minimum and maximum capacities at every edge.The flow is not indicated at any arc.In Figure 7 we have the corresponding auxiliary network   where we have reduced the minimum capacities 0 of the arcs as it is indicated in (7).
We recall that the arcs with maximum capacity equal to 0 are also removed.
After dealing with  1 , we pass to next booking  2 = (  2 ,   2 ,   2 ,   2 ,  2 ) and we proceed as before, adding two new edges to   with capacity  2 : If for dealing with an arbitrary booking  = (  ,   ,   ,   , ), one (or two) of the edges (V   ,  ,   ) and (  , V   ,  ) are already defined on   ; what we have to do is to sum  to the existing maximum capacity of that edge and test the admissibility of   .If the booking should not be accepted, then we just have to decrease the maximum capacity of that edge on , leaving the edge with the previous capacity.
Remark 6.Our model lets us cancel a booking some time after it was already accepted.It is sufficient to decrease the maximum capacity along the corresponding edge in as many units as the booking indicates, removing it if, afterwards, its Figure 7: Auxiliary network   .maximum capacity is 0. But we have to check if doing this we get a network without an admissible flow.On one hand, this could happen with one-way bookings when the car was required to be at another city in the future for being used for another booking departing from there.In this case, the car must be moved there by the company staff.On the other hand, the lack of an admissible flow on the network can also come from the necessity of needing more parking spaces available at the departure city during part of the time that the car was reserved.

Algorithm for Computing the Admissibility of the Network 𝑁
In this section we explain how we define the graph of   in order to maximize the flow on this network.The Ford-Fulkerson algorithm provides a solution for the quest of a maximum flow between a source and a sink on a network.As we have mentioned in the previous section, the acceptance of a booking depends on verifying whether a certain network  with minimum capacities admits a flow or not, and this can be reduced to find a maximum flow on an auxiliary network   .The following algorithm shows how to define   and how to use it in order to accept or reject a reservation.
(1.2) For every 1 ≤  ≤ ,   stands for the number of parking places available at depot .
(1.3)For every 1 ≤  ≤ ,   denotes the initial number of cars at depot .
(1.5) The network   will have ℎ + 4 nodes; that is,  depots at ℎ different times plus 4 nodes for , ,   , and   .
(1.7) Set { 1 , . . .,   } as a list of bookings.Set  = 1, which will be the counter for the reservations.
(1.8) Set Λ = 0, which will accumulate the number of cars in accepted bookings.
Step 2. Initilialize  For every 1 ≤ ,  ≤ ℎ + 4, we define the following: Remark. , = 0 can represent the lack of an edge or the existence of an edge with capacity equal to 0.
Step 4. We finish when all the bookings have been processed.
In order to reduce the computational cost of the above algorithm we have analyzed its implementation based on the notion of a residual network.Let  = (, , , , ) be a network with a flow  over .Without loss of generality, we assume that each pair of nodes is connected in just one sense, either (, V) ∈  or (V, ) ∈  but not at the same time.We define the residual network   as the network   = (, E, , , c), with the same nodes, source, and sink as .The set of arcs E consists of all the arcs of the form (, V) such that either (, V) or (V, ) belong to ; that is, every arc of  is maintained and it has also an associated arc in the opposite sense.Besides, the new capacities, c, on this new set E are defined as We define an -augmenting path on   as a path from  to , namely, p, such that all the edges in this path have positive capacity.We define the capacity of p, namely, cp as the minimum of the capacities of all the arcs in p.The flow is maximum when there is not an -augmenting path on   .
Let us consider the network    associated with the network   defined in previous algorithm with the initial flow defined in (6), which results in being admissible in   .Then, the new adjacency matrix   = (  , ) that corresponds to the network    will be After each booking   = ( , ,  , ,  , ,  , ,   ), we look for an  augmenting path p from   to   in the residual network associated with the network    .The residual one is updated following the indications in (10).For the sake of clarity, we provide, in Figure 8, the residual network of   in Example 5 after the first iteration of Step (3.1) in the algorithm.The edges with 0 capacity and the labels of all the nodes except   and   have been removed in order to get a neater picture.

A Simplified Algorithm for Computing the Admissibility of a Flow on a Network
We refer again to Example 5.The nodes that stand for the drop-off depot before the drop-off time, the nodes that refer to the pick-up depot before the pick-up time, and  can be removed because if some of them appear in an augmenting path, they do it in a cycle, and this cycle can be erased from the -augmenting path without decreasing its capacity.Therefore, the only way to find an -augmenting path without cycles from   to   is to consider the following path: Therefore, a simplification of the residual network in what concerns to this booking can be seen in Figure 9.Such a path exists if the following conditions are fulfilled whether  1 ≤  1 −  1 and  1 ≤  2 .So by checking them we can omit the restrictions given by the arcs (  , V 2,2 ) and (V 1,1 ,   ), and the network   is reduced to the time-space part plus the initial sink , see Figure 10.Taking this into account, Step 3 in the algorithm of Section 5 can be significantly simplified.Let us take a booking (  ,   ,   ,   , ).In order to accept it, we only have to find, if there exists, a path that connects the node V   ,  with the node V   ,  with capacity greater than or equal to .Such a path can be easily found using a shortest path algorithm, like Dijkstra's, is to be considered in order to decide whether to accept or not the booking . This is accepted if we find an -augmenting path from   to   to be increased in  1 units.The arcs in the augmenting path are represented in green.The booking (V 1 , 1, V 2 , 2,  1 ) will be accepted if there is an -augmenting path from V 2 at time  = 2 to V 1 at time  = 1 to be increased in  1 units.The arcs in the -augmenting path are represented in green.
in the residual network associated with   .This path will be of the form Further information concerning Dijkstra's algorithm can be found, for instance, in [16,18,19,21,24].
We point out that the use of a shortest path algorithm prevents us from getting an -augmenting path with cycles.With respect to the previous algorithm, we modify the steps indicated below but considering the matrix   previously defined.
Step 2  .Initialization of In the same way as in (12), but restricting ourselves to the new dimensions of   , we omit ,   ,   , and their adjacent arcs.
Step 3    Step 4  .We finish when all the bookings have been processed.

Some Additional Considerations about the Model
In our assumptions we have considered that we start the scheduling of bookings from scratch starting on time  1 , but this is only the real case once in the company lifetime.The interval of time  1 , . . .,  ℎ must be finite.Nevertheless, we can consider that before running the algorithm on the model we have already confirmed some bookings that started before  1 and some that will finish after  ℎ .In order to introduce them in our model: We have also considered that we are dealing with only one type of car.If our fleet has several types of cars ordered in increasing category as  1 ≺  2 ≺ ⋅ ⋅ ⋅ ≺   , we will propose a model with -layers.In the lower one we have a network for cars of type  1 , in the one above of it we deal with the cars of type  2 , and so on.We should point out that in this case the number of parking spaces is shared by several types of cars.Sometimes the clients could ask for a car of low type, for instance  1 , and the company could have none of those cars available of this layer for renting.However, we can try to see if we can offer him a car of type  2 .If this is the case, we can confirm the booking and grant the client with an upgrade when he arrives to the pick-up depot.The client will be happy and the service have accepted a booking that otherwise could be lost.

Results and Discussion
The proposed model simulates the flow of the fleet of vehicles of a car-rental service without staff dedicated to move cars from one location to another one, as could sometimes be needed to do due to one-way bookings.This model has the advantage that let us recover the flow of cars across the depots along the time, as it is indicated in Remark 6.
The model is based on determining the admissibility of a flow on a network with minimum capacities.Its implementation is backed by Theorem 3. In our first model every new booking only requires defining at most one new edge on the auxiliary network and applying the well-known Ford-Fulkerson algorithm on it.Later, a simplification of the network permits us to solve the problem using a shortest path algorithm.
On one hand, Ford-Fulkerson algorithm can be easily computed on a network with Mathematica © by using the command NetworkFlow [network, source, sink] of the Combinatorica package.In our case, network would be the graph associated with   ,   would be the source, and   would be the sink.The complexity of Ford-Fulkerson algorithm is O(|E| ⋅ (  )), where E is the set of edges in the network   and (  ) is the maximum flow on it, see for instance [19,  ), which is independent of the number of cars considered and only depends on the set of vertex   and the set of edges E, [19,20,26].
On the other hand, the shortest path between two nodes in a network can be easily computed with Mathematica using FindShortestPath [network, source, sink] of the Combinatorica package, with the same values for network, source, and sink as before.There are several algorithms for solving the shortest path problem between two points.The well-known Dijkstra algorithm has a cost O(|| 2 ) when it is implemented with lists.The order of the cost can be reduced if it is implemented with binary heaps, O((|E|) log ||), or with Fibonacci heaps, O(|E| + || log ||), see [19,20,26].Therefore, the simplification proposed of the algorithm shown in Section 6 can provide much more better computational results.
This can be seen on a simulation carried out over timeexpanded network of 6 depots at 20 different times and 500 bookings.The computations were performed on a computer with a processor of 2.50 GHz and 3.25 Gb of RAM using Mathematica © 8.0.The comparison of the execution times of each one of these methods is presented in Table 1.We observe a significant improvement in the computational time required to solve the problem if we use the simplified algorithm based on the search of shortest paths using the residual network.
Finally, this model let us simulate if it is profitable for the company that manages the service to invest or not, either in more cars or in more parking slots, taking into account the historic of petitions of bookings received.This can be done using a list of all the requests of bookings received during a period of time, despite they were accepted or not.We analyze, with the historical data of petitions, if when we increase the maximum and minimum capacities at one or some of the edges (, V ,1 ) the number of accepted bookings is increased, and whether the new expected incomes coming from these bookings are enough to invite us to invest.Analogously, we can consider if there is a significant increment of benefits if we augment the number of parking spaces at one or some depots.Both types of analysis can be jointly considered.

Figure 1 :
Figure 1: A time-expanded network with  depots at  times.Arcs in green represent bookings of cars and arcs in black represent staying at the parking of each depot.

Figure 2 :
Figure 2: Without minimum capacities on the arcs that depart from .

Figure 4 :
Figure 4: Without minimum capacities on the arcs that represent a booking.

Figure 5 :
Figure 5: With minimum capacities on the arcs that represent a booking.

Figure 8 :
Figure 8: The network of Example 5 after the first iteration of Step (3.1) in the algorithm.The arcs in black belong to   , and the arcs with a purple (dashed) line represent the additional edges to be considered with the former ones of   in order to have the residual network of   .

Figure 9 :
Figure9: A simplified version of the residual network of Example 5 is to be considered in order to decide whether to accept or not the booking (V 1 , 1, V 2 , 2,  1 ).This is accepted if we find an -augmenting path from   to   to be increased in  1 units.The arcs in the augmenting path are represented in green.

Figure 10 :
Figure 10: A more simplified version of the residual network of Example 5.The booking(V 1 , 1, V 2 , 2,  1 ) will be accepted if there is an -augmenting path from V 2 at time  = 2 to V 1 at time  = 1 to be increased in  1 units.The arcs in the -augmenting path are represented in green.

Table 1 :
Comparison between the 2 algorithms for 6 cities at 20 different times.Therefore, every time a booking  = (  ,   ,   ,   , ) is accepted we add at most two more new edges and the flow is increased in , which is the number of cars in the booking.An implementation using Edmonds-Karp algorithm has a complexity O(|| ⋅ |E|2