An Efﬁcient Hybrid Algorithm for Energy Expenditure Estimation for Electric Vehicles in Urban Service Enterprises

: The article deals with the decision problems of estimating the energy expenditure of low-emission ﬂeets in urban service companies due to environmental safety. One of the most important problems of today’s transport policy of many city authorities is the ecological safety of its inhabitants. The basic measures are aimed at banning high-emission vehicles from city centers and promoting the introduction of zero-emission vehicles, such as electric or hybrid cars. The authors proposed an original approach to the decision model, in which the energy expenditure from the use of electric vehicles was deﬁned as a criterion function. The boundary conditions took into account limitations typical of an electric vehicle, e.g., maximum range or battery charging time. To solve the problem, the authors proposed an efﬁcient hybrid algorithm based on ant colony algorithm and genetic algorithm. The veriﬁcation was made for the example of a utility company serving a medium-sized city in the eastern part of Poland.


Introduction
The environmental security of urban life is closely related to sustainability as the ability to meet current needs without compromising future generations [1,2]. Particular attention is paid to the development of ecological means of transport, which are characterized by low emissions of harmful fumes such as electric and hybrid cars. Green mobility or the so-called electric mobility seems to be one of the best solutions to achieve both sustainability goals and mobility needs [3,4]. Many studies point to the effectiveness of electric cars [5] both in terms of the so-called zero local emissions, which is a great advantage for their use in densely populated cities, and in terms of consumers' willingness to pay for environmental safety [6]. Nevertheless, research is also being conducted on the production costs, autonomy and environmental impact of electric vehicle (EV) production, traffic, and recycling [7].
Due to the restrictions on conventional vehicles entering city centers, a number of analyses are being carried out in service companies on the viability of introducing electric vehicles, including an energy balance analysis using zero or low-emission fleets. Unfortunately, compared to conventional vehicles, electric vehicles require recharging at charging stations due to their limited battery capacity. This implies planning sustainable transport infrastructure in many aspects, including environmental, social, and economic aspects [8]. Moreover, the use of electric vehicles determines the development of modern infrastructure, including charging stations [9]. Ongoing research indicates that a modern and efficient transport system infrastructure both at a macro [10] and micro [11] scale favors the development of both the region of an area, urban centers, or entire countries. Many publications provide methods and tools to support the assessment of pollution and noise emissions [12], assessment of the impact of infrastructure on the quality of life [13], and assessment of the economic viability of a given investment project [14]. The introduction of innovative solutions in the field of transport means also determines the need for research in the field of infrastructural potential at the suppliers providing services to the inhabitants [15].

Routing Problem Including Electric Vehicles
It is a challenge for courier service companies or municipal transport companies and public transport to carry out analyses in order to assess the efficiency of routes and the feasibility of introducing electric vehicles. In this type of enterprise, the task completion problem is a complex decision problem. The task is to route the vehicle from the pick-up point (start of the journey) to the delivery point (end of the journey). First, travel routes (tasks) are determined, and then, in general, vehicles are assigned to these routes. The travel routing problem, combined with the vehicle-to-task allocation problem, is treated as an NP-hard problem (non-deterministic polynomial-time hard problem). NP-hard problems are computational problems for which finding solutions is not possible with polynomial computational complexity. The travel routing problems are related to the traveling salesman problem. In the light of the literature, there is no known effective algorithm that guarantees finding the optimal solution to the traveling salesman problem.
In the paper [49], the authors presented a very in-depth analysis of the state of the art of the Multi-Depot Vehicle Routing Problem (MDVRP), considering models including time windows, split delivery, heterogeneous fleet, periodic delivery, as well as pick-up and delivery. A similar analysis was conducted in the works [50,51]. A rather interesting approach of extending the classical VRP with Hybrid Vehicle Routing (HVRP) is presented in work [52]. The authors mapped the routes using a fleet in which both electric and conventional vehicles were distinguished. The authors assumed that the vehicle could change the drive mode at any time. The solution of Vehicle Routing Problems is carried out based on heuristic or metaheuristic optimization algorithms [53,54]. However, the problem of allocation of vehicles to tasks in service companies is presented in the context of determining the work schedules of vehicles and drivers. In this context, the scheduling process can be interpreted as the process of determining driver work schedules and vehicle schedules [55] or assigning drivers to work shifts. In the literature, these problems are referred to as Bus Driver Scheduling Problems and Crew Scheduling Problems [56][57][58]. In contrast, the allocation of vehicles to transport routes is referred to as the Vehicle Scheduling Problem [59]. In this problem, each vehicle must be assigned routes in the correct order so that the total cost of completing all routes is minimal. The routes interpreted as transportation tasks are known. The problem also lies in determining the minimum number of resources (vehicles, aircraft) to perform all routes.
In the paper [60], the authors presented the problem of routing and scheduling for electric vehicles. They developed an EVRP decision model with constraints relating to capacity, time windows, and pre-defined vehicle charge levels. The problem of determining the routes for electric vehicles taking into account the constraints on battery service life and battery replacement stations was presented by the authors of [61]. To measure the energy consumption and carbon dioxide emissions of electric vehicles, the authors proposed a decision model considering speeds, loads, and distances. They developed an adaptive genetic algorithm based on hill-climbing optimization and neighborhood search to solve the problem. Crossover and mutation probabilities are designed to adaptively adjust to changes in population fitness.
A rather interesting approach to the management of energy consumption was presented by the authors of the paper [62]. The authors presented the problem of vehicle routing in order to find the shortest path as well as the best location for building a storage center and charging station for electric vehicles. The estimated energy consumption of electric buses on the shortest circular route was calculated and compared for electric buses with different energy consumption rates. This makes it possible to plan delivery bus routes in such a way as to minimize the number of battery recharges, whereas energy management strategy for hybrid electric buses (HEBs) based on reinforcement learning (RL) was presented by the authors of the papers [63,64].
An optimization model for electric bus charging schedules that determines both planning and operational decisions while minimizing the total annual cost is presented in [65]. The authors implemented the model using an example of a real transit network in Davis, California. The authors showed that the vehicle operating range problem can be eliminated by adopting certain charging strategies. Comparative analyses have shown that the use of electric buses is more economical and environmentally friendly than diesel buses. On the other hand, the authors of the paper [66] presented the problem of electric vehicle routing with time windows and mixed fleet (E-VRPTWMF). They performed route optimization of a mixed fleet of electric commercial vehicles (ECVs) and conventional internal combustion commercial vehicles (ICCVs) based on an energy consumption model that accounts for speed, slope, and load distribution. To solve the decision problem, they developed an Adaptive Large Neighborhood Search algorithm enhanced with local search.
In the paper [67], the authors pointed out that in order to effectively manage the fleet of electric vehicles, it is necessary to develop algorithms that take into account the charging of vehicles at charging stations. They presented the problem of routing electric vehicles with time windows (E-VRPTW) along with the strategy of multiple or single charging during the route. In doing so, the authors considered a homogeneous fleet of EVs with limited charge and battery capacity, customer time windows, and full linear recharging at charging stations. They used a metaheuristic algorithm based on the ruin-recreate principle to solve the problem.
A rather important problem concerning electric vehicles was pointed out by the authors in paper [68]. In the article, they presented the problem of determining routes for electric vehicles taking into account the decisions concerning routing of vehicles and location of charging stations to support strategic decisions of logistics fleet operators. The authors have considered different charging options due to the constraints present Energies 2021, 14, 2004 5 of 23 in different decision situations of task execution. They presented alternative objective functions that minimize not only the distance traveled but also the number of vehicles needed and the number of charging stations deployed, as well as the total cost.
Similarly, the authors of the work [69] point to the need for the effective management of the delivery fleet in order to achieve high quality and timely deliveries in logistic distribution processes. The authors described the challenges that have arisen with the integration of electric vehicles into delivery processes, the characteristics of electric vehicles, and the latest energy consumption models. The paper indicates that to address these challenges, it was necessary to adapt effective heuristics and meta-heuristics relevant to the VRP problem. In the field of fleet management for urban public transport, the authors of the paper [70] indicated that the proper design of an electric bus network and fleet planning is important for a bus operator because this determines the purchase of the right number of electric buses at the right time. The authors analyzed the feasibility of operating electric buses as a replacement for conventional buses using the example of Malaysia. They investigated different scenarios of an electric bus operating system using traffic modeling software. The results obtained showed that the developed system of electric bus operation is more efficient with respect to conventional buses not only in terms of generating a higher profit margin for the bus operator but also in terms of better meeting the needs of passengers. The study shows that by using electric vehicles, the operator can carry more passengers per bus unit with lower energy consumption.
Similar conclusions were also reached by the authors of the study [71], who found that diesel buses significantly contribute to air pollution. They proposed a new life additional benefit-cost (NLABC) approach to solve the mixed bus fleet management (MBFM) problem. The NLABC analysis was the basis for developing a total-count program that maximizes the total net benefit of early replacement. The authors show that using this approach, both the optimal fleet size and its composition under budget constraints can be determined. In the comparative analysis, they presented four types of buses, including electric bus, compressed natural gas bus, hybrid bus, and diesel bus.
Having analyzed the literature, it may be stated that most of the publications concerning the routing of electric vehicles refer to enterprises providing passenger transportation services in urban or non-urban areas. The specificity of functioning of municipal service companies carrying out cargo transportation, e.g., courier transport or municipal services [72,73] and the complexity of the NP-hard problem impose the necessity of applying heuristic algorithms for determining the routes of electric vehicles in these enterprises. The routes in enterprises providing passenger transportation services are known and determined by the timetable, whereas the routes in municipal service companies carrying out cargo transportation must be determined. It is advisable to develop new algorithms suitable for to these companies.

General Assumptions for the Model
Analysis of the following assumptions was introduced to develop a decision model for estimating energy expenditure for electric vehicles in urban service enterprises: • A transportation network refers to an urban network where the point elements of the network are intersections and the linear elements are the roads between intersections. • A transportation task is interpreted as a travel route of an electric vehicle where the vehicle visits the individual sections of the transport network at which the cargo pickup or delivery points (collective points) are located. The task starts with the departure of the vehicle from a collective pick-up or delivery point, e.g., a cargo distribution point, and it ends at the same point.

•
Tasks are assigned to vehicles for a given working day.  • In the case of companies collecting cargo from suppliers, it was assumed that the cargo is located on a given section of the transport network. The volume of cargo in a given section is not greater than the capacity of the vehicle designed to pick it up. • A battery charging station can be located either at a collective point or on a particular section of the transport network.

•
The criterion function for determining the energy consumption of vehicles takes into account the energy required to overcome drag and rolling resistance forces. The forces generating the acceleration of the vehicle were not taken into account, as it was assumed that the vehicle moves with uniform motion on the sections. Accelerations due to the start of the vehicle travel have not been taken into account. The vehicle was assumed to be moving on a flat surface, so the uphill drag forces were also neglected. The energy expenditure due to vehicle lighting, air-conditioning etc. is not included in the criterion function

Model Parameters
The input data of the decision model are shown in Table 1. Table 1. Symbols used in the decision model.

S
The set of collective starting points of a vehicle route, e.g., cargo distribution points, dumps where s is an element of the S set.

I1
The set of intermediate points in the vicinity of a collective point, i.e., intersections defining different directions of vehicle travel routes, where i1 is an element of the I1 set.

I2
The set of all intermediate points, i.e., intersections in close and distant proximity to the collective point, where i2 , i2 are elements of the I2 set.

B
A set of electric vehicle battery charging stations, where b is an element of the B set.

VEH
The set of vehicles in the service enterprise, where veh is an element of the VEH set.

TYPE
The set of vehicle types in a service company that differ in cargo capacity, where type is an element of the TYPE set.

TASK
A set of transportation tasks to be completed on a given working day, where task is an element of the TASK set.

P
The set of periods with interpretations of the morning, midday, and afternoon peaks, where p is an element of the P set.
v veh,typ,p Speed of a vehicle of a given type during a given period of a working day, where V is the speed matrix.

n typ
The number of vehicles of a particular type in a service company, where N is a vector of the number of vehicles of a particular type.

t work,veh,typ
The vehicle operating time resulting from driver work restrictions, where T work is a matrix of vehicle operating time of a specific type.
The amount of cargo ordered to be taken from a given route segment or ordered to be delivered, where Q is the cargo size matrix.
c veh,typ The load capacity of a vehicle of a given type, where C is the vehicle load capacity matrix.
The time of loading or unloading in a given route section, depending on the type of vehicle, where T1 is a matrix of loading or unloading times depending on the services provided by the company.  The battery charging time of a vehicle of a given type at a given charging station, where T ch is a matrix of battery charging times of vehicles of a given type at a given charging station.
The distance between the collective point and the initial intermediate point of the vehicle route, where D1 is the distance matrix between the collective and the initial intermediate point. µ The coefficient of road friction was assumed to be identical on each section of the route, µ = 2.02 × 10 −5 .
A Vehicle frontal area, for each type of vehicle an identical frontal area is assumed, A = 20 m 2 .

Quantities Sought
For the problem posed in this way, decision variables were defined to determine the travel routes of individual electric vehicles, with the interpretation described in Table 2. Table 2. Decision variables of the model.

Symbol
Meaning The assignment of a vehicle of a certain type to a task, where X is a matrix defining the assignment of vehicles to tasks. If x veh,typ,task = 1, there is an assignment of a given vehicle to a task; otherwise, x veh,typ,task = 0. x1 s,i1,veh,typ,task,p A connection between a collective point and a route intermediate point made by a vehicle of a given type during a given period of the day in the task in progress, where X1 is a matrix specifying all these connections. If x1 s,i1,veh,typ,task,p = 1, the vehicle of the type performs the route between the collective point and the intermediate point; otherwise, x1 s,i1,veh,typ,task,p = 0.
x2 i2 ,i2 ,veh,typ,task,p A connection between intermediate points made by a vehicle of a given type during a given period of the day in the task in progress, where X2 is a matrix specifying all these connections. If x2 i2 ,i2 ,veh,typ,task,p = 1, the vehicle of a given type performs the route between intermediate points; otherwise, x2 i2 ,i2 ,veh,typ,task,p = 0. A connection between a route intermediate point and a collective point made by a vehicle of a given type during a given period of the day in the task in progress, where X3 is a matrix defining all these connections. If x3 i1,s,veh,typ,task,p = 1, the vehicle of the type performs the route between the intermediate point and the collective point; otherwise, x3 i1,s,veh,typ,task,p = 0.
Making a decision to charge a vehicle at a given station in a task in progress, where Y is a matrix specifying all decisions made to charge vehicles at given stations. If y veh,typ,b,task = 1, the vehicle of the given type charges the batteries at the given station; otherwise, y veh,typ,b,task = 0.

Restrictions
The model constraints take the following form: ∀veh ∈ VEH, typ ∈ TYP, task ∈ TASK, p ∈ P, Constraint (1) indicates that the disposable time capacity of the number of vehicles used must be greater than the sum of the completion times of all tasks including loading, unloading, and battery charging times of the vehicles. Whereas (2) refers to the completion time of all tasks for a single vehicle, which may not exceed the vehicle's working time resulting from the driver's work constraints. The next constraint (3) is the limit on the number of vehicles of a given type, while constraint (4) informs that the current task is performed by exactly one vehicle. The vehicle load capacity constraint (5) is very important, which describes that the load capacity of the vehicle during the task must not be exceeded. This constraint occurs in service companies where the cargo is brought to a collective point. The last two constraints are due to the range of the electric vehicle. The permissible driving distance of the electric vehicle shall not be exceeded, in case the charging station is located Energies 2021, 14,2004 9 of 23 at a collective point, Formula (6), or on a section of the transport network, Formula (7) applies.

Energy Expenditure as a Criterion
The energy expenditure resulting from the transportation tasks was determined as a criterion. Energy expenditure considers the energy used to overcome aerodynamic forces of drag and rolling resistance: where: • drag force: • rolling resistance force:

Preliminary Assumptions
The hybrid algorithm was developed to determine the energy expenditure of electric vehicles performing transportation tasks in urban service companies. In order to determine the energy expenditure, it is necessary to determine the vehicle travel routes. Two heuristic algorithms have been used to achieve this goal: i.e., ant colony algorithm [74,75] and genetic algorithm [76]. The hybrid combination of these two algorithms involves the initial determination of an initial population of admissible solutions by the ant colony algorithm, which is processed by the genetic algorithm in further steps. The hybrid combination of two heuristic algorithms also serves as a mechanism to verify the correctness of each algorithm and thus the quality of generated solutions. The mechanisms of these algorithms are different, so this increases the plane of finding the final solution.
Ant colony algorithms are algorithms whose working principle is to mimic the existence of ants in the natural environment. The deciding factor in each ant's route choice is pheromone, which is a chemical secreted by ants. Ants, given a choice of many routes, head for the one with the strongest concentration of pheromone possible.
Genetic algorithms use mechanisms based on the natural phenomena of selection, crossover, and mutation. An adaptation function is introduced to evaluate each individual (chromosome). The selection process involves selecting the best individuals for the next generation (iteration of the algorithm). The crossover process involves the exchange of genetic material between individuals of a population. Mutation involves a random rearrangement of genes, swapping their values or transposition. The crossover and mutation operators are designed to increase the search plane for the optimal solution. The random population generation is selected randomly or by other heuristic algorithms.
Ant colony algorithm and genetic algorithm are iterative algorithms; in successive iterations, the algorithms improve their solution. The algorithm runs until the stop condition is reached. The stop condition is a certain number of iterations. The number of ants in the population as well as individuals (chromosomes) is determined at the beginning of the implementation of the algorithms.

Operation of the Ant Colony Algorithm
According to the theory, in order to implement the ant colony algorithm, the task to be performed for the ant must first be specified. Its task is to determine the transportation tasks (travel routes) for individual electric vehicles. In order to determine the decision variables described in the mathematical model, the ant creates a route consisting of points defining the type of vehicles selected for the tasks and the number of vehicles of a given type, which are placed in layer 1, and points defining the transportation tasks with the interpretation of connections between intersections, which are placed in layer 2. Graphically, the elements of the ant's route are shown in Figure 1. The number of elements in layer I depends on the number of available vehicles in the service company, while the number of points in layer II depends on the accuracy of mapping point elements (intersections) in the urban network random population generation is selected randomly or by other heuristic algorithms.
Ant colony algorithm and genetic algorithm are iterative algorithms; in successive iterations, the algorithms improve their solution. The algorithm runs until the stop condition is reached. The stop condition is a certain number of iterations. The number of ants in the population as well as individuals (chromosomes) is determined at the beginning of the implementation of the algorithms.

Operation of the Ant Colony Algorithm
According to the theory, in order to implement the ant colony algorithm, the task to be performed for the ant must first be specified. Its task is to determine the transportation tasks (travel routes) for individual electric vehicles. In order to determine the decision variables described in the mathematical model, the ant creates a route consisting of points defining the type of vehicles selected for the tasks and the number of vehicles of a given type, which are placed in layer 1, and points defining the transportation tasks with the interpretation of connections between intersections, which are placed in layer 2. Graphically, the elements of the ant's route are shown in Figure 1. The number of elements in layer I depends on the number of available vehicles in the service company, while the number of points in layer II depends on the accuracy of mapping point elements (intersections) in the urban network The ant starts the route by selecting the type of vehicle and the number of vehicles of the indicated type that will carry out the designated transportation tasks. It is assumed that the ant is a representative of selected vehicles from layer I. When the ant determines the number of vehicles to be used for transportation tasks, the engagement time of the ant is determined, which is the sum of the allowable working times of all selected vehicles. The reselection by the ant of vehicles from layer I occurs when the designated engagement time of the ant is less than the total time of all transportation tasks (constraint of model (1)).
In the next steps, the ant visits individual customers (buyers, suppliers) to deliver the cargo or to pick it up and thus determines the transportation tasks (determination of the decision variables of the model X1, X2, X3, and Y). The start and end point of each transportation task is a collective point of cargo delivery or pick-up from which the ant starts assigning tasks.
An ant goes to the collective point from a route in several situations: • When it is fully loaded with cargo collected from customers (constraint of model (5)) or empty when all cargo is delivered to customers, • When all the customers have been served, • When the battery needs to be recharged at a charging station, if the station is located at a collective delivery point or pick-up point.
The ant also has the ability to recharge batteries at charging stations assigned to particular sections of the transport network. After the ant has mapped the entire route and  (Figure 1), the route is divided into transportation tasks. The task as defined in the mathematical model starts and ends at the collective point of cargo delivery or pick-up, so the tasks in the ant's route will be sequences of transport network sections defining the ant's route between the ant's departure from and return to the collective point.
Next, the transportation tasks are combined into sets of tasks and assigned to a vehicle of a certain type (determination of the decision variable X) in such a way that the permissible operating time of a given vehicle is not exceeded (constraint (2)). The number of task sets created corresponds to the actual number of vehicles used to carry out the transportation tasks.
The starting point of each ant's route is the collective pick-up or delivery point. The further route of the ant, and thus the selection of subsequent points on the route, occurs with a certain probability: where: τ yz (t)-intensity of the pheromone trace between y-th point of the ant's route (crossing) and z-th point (the next crossing) in t-iteration, η yz (t)-heuristic information: where: d(y, z)-distance between y-th point of ant's route and z-th point in t-iteration; α, β-effects of pheromones and heuristic data on ant behavior, Ω mr -set of all point elements of the transportation network, l-potential ant route points taken into account at the moment of choosing the next ant route point.
The transition of an ant from the y-th point of the route to the z-th point of the route can be presented in the following steps: step 1-computing the probability of transition from point y to potential points l, step 2-computing the distribution for each connection (y, l) and drawing a number from the interval [0, 1], step 3-choosing the transition route tr with the value of the distribution qtr satisfying the relation qtr − 1 < r ≤ qtr, where tr is the number of the route between the y-th point of the route and the z-th point of the route.
Once all ants have finished building routes, the pheromone trail is updated. A cyclic update was used in the process. Initially, the trace is assumed to be equally strong on the links between route points. In subsequent iterations, the pheromone trace is calculated using the formula: where: mr-another ant in the anthill mr ∈ MR, ρ-pheromone volatilization rate (0 < ρ ≤ 1) (0 < ρ ≤ 1), τ yz (t + 1)-pheromone reinforcement, for the first iteration takes a value at each connection equal to τ 0 . The first component of Formula (15) determines the pheromone volatilization rate, while the second component determines the pheromone reinforcement and takes the value (when the route (y, z) was used by the ant mr-(1); otherwise, 0-(2)): where: D mr (t)-total route traveled in t-iteration by mr-th ant performing all tasks, the route is the basis for the calculation of energy expenditure, criterion function (8); K mr (t)-penalty for exceeding the admissible working time by an individual vehicle (model constraint (2)) in the route created by mr-th ant in t-th iteration, the algorithm assumes that the penalty for exceeding is half of the accumulated pheromone on the route; According to Equation (16), the intensity of the pheromone increases when the denominator of the quotient tends to the minimum value. Wrong routes set by ants are not removed. The introduced penalty function gradually weakens the pheromone at the connection and thus reduces its attractiveness to ants. Removing the entire route could destroy those routes that would generate the best solution in further iterations.
The steps of the ant algorithm can be described as follows:

•
Step 1. Selection of vehicle type and their number by an ant. Based on the number of vehicles, the engagement time of the ant in the transport tasks is determined. When this time is exceeded and all customers (loading or unloading points) have not been served, the ant again indicates the type of vehicle and their number to complete the tasks.

•
Step 2. The ant determines transportation tasks and selects individual points of the route according to the calculated probability (13). In order to avoid searching the whole transportation network for loading or unloading points, at the beginning of each ant's route, a random order of visiting particular points is generated.

•
Step 3. Before each ant passes to the next point of the route, the distance resulting from the range of the electric vehicle constraint is controlled (6) and (7). After crossing the safety threshold, the ant heads to the charging station and then continues its route in accordance with the drawn order of visiting individual points.

•
Step 4. The capacity constraint (constraint (5)) is controlled before each ant's transition to the next point of the route. If the constraint is exceeded, the ant heads to a collective pick-up or delivery point.

•
Step 5. Each time the ant returns to the cargo pick-up or delivery point, constraint (1) is checked for the time of the ant's engagement in the transportation tasks. If the constraint is met, the ant starts creating a new route; if the constraint is not met, the last task (ant's route) is eliminated, and the ant performs step 1 and chooses again the type and number of vehicles.

•
Step 6. Steps 1-5 are repeated until the ant has created the entire route.

•
Step 7. The next ant in the population starts creating the route. Steps 1-6 are repeated until all routes have been completed by the ants in the population.

•
Step 10. Selection of the ant route with the highest pheromone intensity from all routes generated by ants from the population.

•
Step 11. Allocation of vehicles to a set of tasks within a vehicle type.
When allocating vehicles to tasks, constraint (2) resulting from the completion time of all tasks assigned to a single vehicle should be taken into consideration. The steps of the algorithm designed in this way also guarantee that the constraints arising from the execution of one task by one vehicle (4) are kept and the number of available vehicles (3) is preserved.

Operation of the Genetic Algorithm
The genetic algorithm is based on the initial population generated by the ant colony algorithm. The genetic algorithm acts as a tool to verify the results generated by the ant colony algorithm. The stages of the genetic algorithm can be represented as follows: • Stage 1. Determining the structure processed by the algorithm. A vector structure based on the tasks determined by the ant colony algorithm was used to represent the chromosome. The initial population consists of a finite number of these structures and forms a matrix structure. The number of individuals (vector structures) in the population is fixed at the beginning of the algorithm operation. Genes in the chromosome represent the section numbers of the transport network. Exemplary vector structures processed by the algorithm are shown in Figure 2.


Step 11. Allocation of vehicles to a set of tasks within a vehicle type.
When allocating vehicles to tasks, constraint (2) resulting from the completio of all tasks assigned to a single vehicle should be taken into consideration. The s the algorithm designed in this way also guarantee that the constraints arising fr execution of one task by one vehicle (4) are kept and the number of available vehi is preserved.

Operation of the Genetic Algorithm
The genetic algorithm is based on the initial population generated by the ant algorithm. The genetic algorithm acts as a tool to verify the results generated by colony algorithm. The stages of the genetic algorithm can be represented as follow  Stage 1. Determining the structure processed by the algorithm. A vector str based on the tasks determined by the ant colony algorithm was used to repres chromosome. The initial population consists of a finite number of these stru and forms a matrix structure. The number of individuals (vector structures) population is fixed at the beginning of the algorithm operation. Genes in th mosome represent the section numbers of the transport network. Exemplary structures processed by the algorithm are shown in Figure 2. where: F(k, t)-the function defining the length of the route in all transportation tasks; based on this function, the energy expenditure in all transportation tasks is determined; K(k, t)-penalty for exceeding the constraint on the completion time of all tasks for a single vehicle (2); the algorithm assumes that the penalty for exceeding halves the generated value of the adaptation function for a given vector structure; The adaptation function reaches maximum values when the denominator of the quotient tends to minimum values.

•
Stage 3. Selection. The selection process selects the best individuals (chromosomes) from populations, and they are then introduced into the next generation (iteration). The developed algorithm uses the known roulette method, in which linear scaling was applied to counteract premature algorithm convergence in the initial iterations. Scaling coefficient C = 2.0 has been adopted. • Stage 4. Crossover. According to the crossover probability parameter, the number of chromosomes to be crossed is selected. The crossover process involves randomly selecting a transportation task from the first chromosome ( Figure 3, task: (0,1,2,3,4,0)), identifying genes in the task to which customers are assigned (cargo pick-up and delivery points) e.g., 2 and 3, identifying a task with the same customers in the other chromosome (0,2,6,3,1,0), and exchanging transportation tasks between chromosomes. A prerequisite for the crossover process to take place is that the types of vehicles in both chromosomes are compatible. There is an automatic exchange of the number of vehicles between chromosomes. After the crossover process, it is necessary to check constraint (1) on the time of the ant's engagement in the tasks. If this constraint is not met, the crossover process is stopped. A graphic interpretation of the crossover process is shown in Figure 3. • Stage 5. Mutation. The mutation process involves the exchange of genes in a given chromosome structure. Mutation is infeasible because it generates an unacceptable solution.
The developed algorithm uses the known roulette method, in which linear scaling was applied to counteract premature algorithm convergence in the initial iterations. Scaling coefficient C = 2.0 has been adopted.  Stage 4. Crossover. According to the crossover probability parameter, the number of chromosomes to be crossed is selected. The crossover process involves randomly selecting a transportation task from the first chromosome ( Figure 3, task: (0,1,2,3,4,0)), identifying genes in the task to which customers are assigned (cargo pick-up and delivery points) e.g., 2 and 3, identifying a task with the same customers in the other chromosome (0,2,6,3,1,0), and exchanging transportation tasks between chromosomes. A prerequisite for the crossover process to take place is that the types of vehicles in both chromosomes are compatible. There is an automatic exchange of the number of vehicles between chromosomes. After the crossover process, it is necessary to check constraint (1) on the time of the ant's engagement in the tasks. If this constraint is not met, the crossover process is stopped. A graphic interpretation of the crossover process is shown in Figure 3. The principle of the algorithm can be presented in the following steps:


Step 1. Generation of the initial population with the ant colony algorithm,  Step 2. Chromosome update according to Equation (17).  Step 3. Selection of the best chromosomes for subsequent iterations using the roulette method.  Step 4. Crossover. The principle of the algorithm can be presented in the following steps:

•
Step 1. Generation of the initial population with the ant colony algorithm, • Step 2. Chromosome update according to Equation (17).

•
Step 3. Selection of the best chromosomes for subsequent iterations using the roulette method.

•
Step 5. Repeating steps 2-4 until the stop condition is reached. The stop condition is the number of iterations specified at the beginning of the algorithm.

•
Step 6. Selection of a chromosome from the population characterized by the maximum value of the adaptation function. This chromosome contains transportation routes characterized by the minimum energy expenditure of electric vehicles.

The Computational Complexity of the Algorithm
In order to determine the time efficiency of both algorithms, their computational complexity was estimated. The number of operations for each algorithm was determined based on the number of all its loops. The input data for both algorithms include the size of the population (MR), the number of iterations (N), and the number of genes in chromosomes (G). The computational complexity of the ant (AA) and genetic (GA) algorithm was presented in Table 3. In order to estimate the computational complexity, the notation O was determined [77]. The estimation consists in finding a function that limits the function that determines the number of loops in the algorithm. The main loops of algorithms that increase the computational complexity are presented in Table 4. Based on Table 3, it may state that the ant algorithm has the higher computational complexity than the genetic algorithm, which affects the longer operation time of the algorithm. Considering the fact that both algorithms have the polynomial computational complexity and the analyzed problem belongs to NP-hard problems, it may be stated that the generated solutions will be suboptimal solutions.

Model Input Data
The transport network proposed to test the performance of the proposed optimization algorithms is shown in Figure 4. The analyzed network is an urban network, so the point elements of this network are intersections, and additionally, a collective point was introduced to define the waste dump located in the non-urban area, and two vehicle charging points were defined. Municipal waste was located along road sections of the transportation network.  The utility company has nine DAF CF Electric 6 × 2 vehicles, which are characterized by a maximum total weight of 28 tons and load capacity of 7 tons, a battery capacity of 170 kWh, a maximum distance of driving without charging of 100 km in urban conditions, a battery charging time of 1.5 h; and 5 Renault Trucks electric vehicles with a battery capacity of 200 kWh, a range of 120 km of continuous driving in urban conditions, a maximum total weight of 26 tons, a load capacity of 6 tons, and a battery charging time of 2 h. The vehicles work one shift of 8 h. Municipal waste collection begins at 7:00 am. Two traffic peaks were assumed, i.e., the morning peak from 7:00 to 11:00 a.m. and the afternoon peak from 11:00 a.m. to 3:00 p.m., with the following average travel speeds: morning peak-25 km/h, midday peak-35 km/h. The amount of waste in individual sections of the transportation network is shown in Table 5. Waste loading times for a given section are shown in Table 6. Waste discharge time at the landfill was assumed to be 5 min. The distances between intersections in the transportation network are shown in Table 7; the opposite directions are characterized by the same values. The distance between the landfill and the starting points of the route is 0.4 km and 0.5 km.   The utility company has nine DAF CF Electric 6 × 2 vehicles, which are characterized by a maximum total weight of 28 tons and load capacity of 7 tons, a battery capacity of 170 kWh, a maximum distance of driving without charging of 100 km in urban conditions, a battery charging time of 1.5 h; and 5 Renault Trucks electric vehicles with a battery capacity of 200 kWh, a range of 120 km of continuous driving in urban conditions, a maximum total weight of 26 tons, a load capacity of 6 tons, and a battery charging time of 2 h. The vehicles work one shift of 8 h. Municipal waste collection begins at 7:00 am. Two traffic peaks were assumed, i.e., the morning peak from 7:00 to 11:00 a.m. and the afternoon peak from 11:00 a.m. to 3:00 p.m., with the following average travel speeds: morning peak-25 km/h, midday peak-35 km/h. The amount of waste in individual sections of the transportation network is shown in Table 5. Waste loading times for a given section are shown in Table 6. Waste discharge time at the landfill was assumed to be 5 min. The distances between intersections in the transportation network are shown in Table 7; the opposite directions are characterized by the same values. The distance between the landfill and the starting points of the route is 0.4 km and 0.5 km.     Table 7. Distances between intersections km.

Discussion of the Results for the Sensitivity Analysis of the Ant Colony Algorithm
The sensitivity analysis of the ant colony algorithm was carried out for the two variants described in Section 5.1. Both algorithms have been implemented in programming language C#. The following parameter values were assumed to test the ant colony algorithm α: 1; 3; 5; 10; 20, parameter β: 0.5; 1; 5 and parameter ρ: 0.2, 0.4, 0.6, 0.8. The test settings take into account typical values of parameters adopted in the process of algorithm implementation, e.g., α = 1, β = 0.5, ρ = 0.5 [74], and boundary values have been introduced in order to broaden the area of search for the best solution.
The ant colony algorithm is a probabilistic algorithm, so it can aim for different local optima in each run. For each test (Table 4), the algorithm was run 30 times, and then, the best value for that test was selected. Exemplary results of the ant colony algorithm for the parameters α = 1, β = 1, ρ = 0.8 are presented in Table 10. Based on the results presented in Table 9, it may be concluded that the ant colony algorithm is sensitive to parameter changes and directs its search to different regions of the space of admissible solutions. The task of the algorithm calibration process is to indicate such a region in the space of admissible solutions for which the algorithm will generate local optima or will set a global optimum. Graphic interpretation of the ant colony algorithm operation for exemplary settings (test 24, test 25) are shown in Figure 5. The convergence to the optimum starts after more than 100 iterations. Premature convergence of the ant colony algorithm in the initial iterations is minimized by updating the pheromone in each iteration of the algorithm. This action results in the determination of new attractive routes for ants and thus the search for different local optima. Beyond 100 iterations, the pheromone stagnates, and thus, the ants fail to set new solutions. The ant colony algorithm is a probabilistic algorithm, so it can aim for different local optima in each run. For each test (Table 4), the algorithm was run 30 times, and then, the best value for that test was selected. Exemplary results of the ant colony algorithm for the parameters = 1, = 1, = 0.8 are presented in Table 10. Based on the results presented in Table 9, it may be concluded that the ant colony algorithm is sensitive to parameter changes and directs its search to different regions of the space of admissible solutions. The task of the algorithm calibration process is to indicate such a region in the space of admissible solutions for which the algorithm will generate local optima or will set a global optimum. Graphic interpretation of the ant colony algorithm operation for exemplary settings (test 24, test 25) are shown in Figure 5. The convergence to the optimum starts after more than 100 iterations. Premature convergence of the ant colony algorithm in the initial iterations is minimized by updating the pheromone in each iteration of the algorithm. This action results in the determination of new attractive routes for ants and thus the search for different local optima. Beyond 100 iterations, the pheromone stagnates, and thus, the ants fail to set new solutions.

Discussion of Results for the Sensitivity Analysis of the Genetic Algorithm
For the sensitivity analysis of the genetic algorithm, the following values of pcross = 0.2; 0.4; 0.6; 0.8; 1.0 were adopted. The mutation parameter was not defined due to the generation of unacceptable solutions after the implementation of this process. The test parameters of the genetic algorithm settings along with the generated energy expenditure are shown in Table 11. The initial population is the final ant population generated in the last iteration of the ant colony algorithm. The minimum energy expenditure in the initial population is 211 [kWh]. Experimentally, the number of iterations of the algorithm was set to 200 repetitions, and the population size is set to 50 chromosomes.

Discussion of Results for the Sensitivity Analysis of the Genetic Algorithm
For the sensitivity analysis of the genetic algorithm, the following values of p cross = 0.2; 0.4; 0.6; 0.8; 1.0 were adopted. The mutation parameter was not defined due to the generation of unacceptable solutions after the implementation of this process. The test parameters of the genetic algorithm settings along with the generated energy expenditure are shown in Table 11. The initial population is the final ant population generated in the last iteration of the ant colony algorithm. The minimum energy expenditure in the initial population is 211 [kWh]. Experimentally, the number of iterations of the algorithm was set to 200 repetitions, and the population size is set to 50 chromosomes.  Table 7 shows that the minimum energy expenditure of 199 [kWh] was generated for a crossover parameter equal to p cross = 0.8. The energy expenditure was generated with three Renault vehicles and one DAF vehicle for a total route of 103 km. Results from Table 9 and 11 are the results generated in the last iteration of the algorithm and computed in accordance with criterion function (8) for the chromosome characterized by the maximum adaptation function (17). For small values of the crossover parameter (tests 1, 2), the genetic algorithm replicated the results of the ant colony algorithm because the population was not dominated by better individuals resulting from the crossover process. The genetic algorithm is also a probabilistic algorithm, so it can generate different solutions in each run.
For each test setting, the algorithm was also run 30 times, and then, the best value of the adaptation function for that test was selected and the energy expenditure was determined based on the minimum travel route of all vehicles performing the transportation tasks. Exemplary results of the genetic algorithm for the parameter p cross = 0.8 are presented in Table 12. The convergence to the optimum starts after more than 150 iterations, which is due to the high competition of individuals in the population and thus the emergence of new solutions in subsequent iterations. The consequence of strong competition between individuals in the population is that the algorithm achieves several local optima, Figure 6b.  220  231  220  201  216  241  215  220  224  213  220  223  199  223  215  221  212  215  229  234  223  203  230  221  218  218  237  206  232  218 Energies  Table 7 shows that the minimum energy expenditure of 199 [kWh] was generated for a crossover parameter equal to pcross = 0.8. The energy expenditure was generated with three Renault vehicles and one DAF vehicle for a total route of 103 km. Results from Table  9 and 11 are the results generated in the last iteration of the algorithm and computed in accordance with criterion function (8) for the chromosome characterized by the maximum adaptation function (17). For small values of the crossover parameter (tests 1, 2), the genetic algorithm replicated the results of the ant colony algorithm because the population was not dominated by better individuals resulting from the crossover process. The genetic algorithm is also a probabilistic algorithm, so it can generate different solutions in each run.
For each test setting, the algorithm was also run 30 times, and then, the best value of the adaptation function for that test was selected and the energy expenditure was determined based on the minimum travel route of all vehicles performing the transportation tasks. Exemplary results of the genetic algorithm for the parameter pcross = 0.8 are presented in Table 12. The convergence to the optimum starts after more than 150 iterations, which is due to the high competition of individuals in the population and thus the emergence of new solutions in subsequent iterations. The consequence of strong competition between individuals in the population is that the algorithm achieves several local optima, Figure 6b.  220  231  220  201  216  241  215  220  224  213  220  223  199  223  215  221  212  215  229  234  223  203  230  221  218  218  237  206  232  218 (a) (b) Figure 6. Operation of the genetic algorithm, (a) test settings 4, (b) test settings 3.
The calculation time of the ant algorithm in the analyzed case was on average 7.9 min, while for the genetic algorithm, it was 4.3 min. The algorithms were tested on a Dell core i7, 2.20 GHz, 8.00 GB. The genetic algorithm and the ant algorithm can be used to plan vehicle driving routes and determine vehicle work schedules due to the relatively favorable time of generating results. The calculation time of the ant algorithm in the analyzed case was on average 7.9 min, while for the genetic algorithm, it was 4.3 min. The algorithms were tested on a Dell core i7, 2.20 GHz, 8.00 GB. The genetic algorithm and the ant algorithm can be used to plan vehicle driving routes and determine vehicle work schedules due to the relatively favorable time of generating results.

Conclusions
The calibration process of the hybrid algorithm is a key process that affects the correctness and efficiency of the algorithm. This process directs the algorithm into different regions of the space of admissible solutions in order to search for potential local optima or global optima. The parameters for both algorithms were selected experimentally on the basis of the adopted test settings.
For complex decision problems, which is the problem of estimating the energy expenditure of electric vehicles in service companies, heuristic algorithms generate suboptimal solutions, i.e., near-optimal solutions. The probabilistic nature of the algorithms and the search of a limited space of acceptable solutions makes it impossible to determine the global optimum for complex decision problems.
Taking into account the fact that the analyzed problem is an NP-hard problem with many local minimums, it is necessary to use a set of mechanisms that prevent premature convergence of both algorithms to the first encountered local minimum. Premature convergence in the genetic algorithm is blocked by using linear scaling in the roulette method, whereas in the ant algorithm, it is blocked by using a cyclic updating pheromone trail at the beginning of each iteration.
In this paper, 60 test settings for the ant colony algorithm and five settings for the genetic algorithm were examined. The ant colony algorithm reached a local optimum of 211 [kWh]. The genetic algorithm further improved the result; the value of energy expenditure 199 [kWh] appeared three times, so it can be assumed that the solution generated by the genetic algorithm is a suboptimal solution. Considering the results generated by both algorithms, it can be concluded that the combination of these two heuristic algorithms with different operation gives an effective tool for determining the energy expenditure of vehicles in service companies.
For further research on the problem of determining the energy expenditure of electric vehicles in service enterprises, other variations of these algorithms should be applied, e.g., the use of anthill systems. In addition, the problem should be examined in stochastic terms by introducing random variables into the mathematical description.
The authors emphasize the fact that the important aspect of the carried out research is the comparison of the results of the proposed heuristics and their computational times with the result of the exact algorithm [78][79][80][81]. Due to the fact that we have focused strictly on the problem of determining the routes of delivery collection by electric vehicles, the analysis of the algorithm operation time was not presented in detail and can be considered in a future publication.
The results obtained in this paper can serve as the base results for testing other optimization algorithms.