Modification of the Clarke and Wright Algorithm with a Dynamic Savings Matrix

. Te goods collection and delivery process often relates to distribution logistics problems. Te task is to deliver goods from warehouses to customers under specifc circumstances. Eforts to optimize the process are largely aimed at reducing overall costs of goods transportation. Among the prominent algorithms for solving the basic type of the delivery (or collection) problem, which includes a single depot and a homogeneous vehicle feet, is the algorithm developed by Clarke and Wright in 1964. Tis algorithm minimizes transportation costs by maximizing the savings achieved through merging multiple routes into one. Tis paper primarily aims to solve the pickup and delivery problem where the goods must be delivered and empty packaging collected in a single process. Te request of a customer can be routed from the depot or from another customer. Similarly, the destination of the request may be the depot or another customer. Unlike the original version of the Clarke and Wright algorithm, the initial routes are created to satisfy delivery orders, and therefore, the same customer can occur in multiple routes. Consequently, a situation may arise in which two routes containing one or more common vertices must be combined during the calculation. Furthermore, these vertices need not be the outermost vertices of the routes. Tis situation cannot be addressed by using the original version of the Clarke and Wright algorithm, and that is why we propose its modifcation. Merging routes through inner vertices means that the cost savings depend on the confgurations of the routes, and therefore, they cannot be calculated a priori. Instead, the dynamic savings matrix must be used.


Introduction
Te transportation of goods and people is an integral part of the everyday world, involving signifcant expenditures on vehicle fuels and maintenance each day.Clearly, this sector provides ample opportunities for cost optimization through advancements in technology, transportation network infrastructure, and sophisticated planning.In practical terms, the challenges to be addressed include the efcient transport of goods under specifc conditions, aiming for minimal costs, the shortest possible time, or maximizing profts.Te utilization of mathematical methods and optimization approaches proves convenient for addressing these complex problems.
Two types of problems are frequently encountered in goods logistics and distribution.Te frst one is the vehicle routing problem (VRP), where goods are transported from/ to a depot, such as goods from warehouses to customers and packaging material from customers back to the warehouses.Te other problem is the pickup and delivery problem (PDP), where goods are transported between customers.In distribution, multiple vehicle types are typically involved.Te problems usually involve many other parameters, including time constraints (e.g., limited duration of a route, time windows for goods delivery to customers, mandatory driving breaks for rest, and maximum driving time for a vehicle), maximum route length, maximum number of customers serviced within a route, or maximum load dimensions.
Te distribution problems are too complex to be tractable using a single method for their solution.Instead, a suitable combination of methods and procedures must be applied.A heuristic approach is usually adopted when addressing complex problems.Many real-world problems have been successfully solved by operations research methods, allowing costs to be reduced by 5% to 20% [1], with the additional advantage of reducing greenhouse gas production, mainly CO 2 .
Tis paper addresses a problem where the distribution processes encountered in both problems mentioned above occur; i.e., the goods are transported from/to a depot as well as among customers.Both good unloading and loading can occur at the customer's site.Te goods loading/unloading costs and time demands are known as well.Te objective is to identify vehicle routes that minimize the total goods delivery costs.A specifc food distribution problem was chosen to validate the algorithm within a case study.Te goods fow consists largely (∼80%) of transports from the depot to various customers, mostly food sellers.Te remaining fraction of the fow consists of goods transport between customers and collection from the customers.Figure 1 illustrates the fow of goods.

Literature Review
We commence with the formal description of the classical VRP involving a single depot and a homogeneous vehicle feet.Te problem can be efectively represented using graph theory.Te classical VRP is defned on a directed graph G � (V, A), where V � 0, 1, . . ., n { } is the vertex set and A � (i, j): i, j ∈ V, i ≠ j   is the arc set.Vertex 0 represents a depot where a set of identical vehicles, each with a capacity Q, is available.Each customer situated at vertex i ∈ V\ 0 { } is associated with a nonnegative demand q i ≤ Q.A cost matrix c ij is defned on A. When the cost matrix is symmetric, i.e., c ij � c ji for all i, j ∈ V, it is common practice to defne the problem on an undirected graph G � (V, E) where E � [i, j]: i, j ∈ V, i < j   is the edge set.Te travel cost c ij may represent the length or travel time along the edge [i, j].Te objective is to determine a set of vehicle routes starting and ending at the depot, ensuring that each customer is visited by precisely one vehicle, the total demand of any route does not exceed Q, and the total routing cost is minimized [2].
Te simplest VRP variant involves one depot and one vehicle type with a known capacity.Te aim is to identify vehicle routes meeting these constraints while minimizing the goods delivery.In the simplest case, the cost is directly proportional to the distance travelled (sometimes it is immediately this distance).However, real-world situations often necessitate the application of more complex VRP variants involving multiple vehicle types and/or multiple depots.An overview of the various problem modifcations and methods to address them can be found in the monograph [3].
Numerous heuristic approaches exist to tackle general VRPs, aiming to fnd a suboptimal problem solution.Te methods not only difer in their selected approaches but also in the specifc class of problems for which they were devised.
Pioneering work was conducted by Dantzig and Ramser in 1959, focusing on the identifcation of fuel tank truck routes between a large-volume terminal and service stations.Tey achieved a near-optimal solution using a method based on a linear programming formulation [4].A well-known and frequently used heuristic algorithm for solving vehicle routing problems was developed by Clarke and Wright in 1964 [5].Tis algorithm is designed to solve the classical VRP as defned previously.It is a constructive heuristic that gradually merges simple tours into more complex ones by applying a savings criterion, referring to the distance savings achieved by combining two routes into one.Te advantages of the algorithm include its simplicity, short computing time, and easy implementation.
Since its development in 1964, the Clarke and Wright algorithm has undergone many improvements and modifcations for specifc problems, such as the multidepot problem [6] or scenarios where vehicles do not return to the depot [7].Various modifcations to the original saving criterion have been proposed in the literature [8].Gaskell [9] and Yellow [10] parameterized the formula to enhance the algorithm's exploration ability.Paessens [11] introduced another term to allow merging customers with very diferent distances from the depot, while Altınel and Öncan [12] enhanced the criterion by incorporating customers' demands in addition to distance.Other modifcations involve combining the algorithm with Monte Carlo simulation [13,14].Plenty of practical applications of the Clarke and Wright algorithm have been reported in the literature.Sarmah et al. [15] successfully applied the algorithm to the solid municipal waste collection problem for 15 municipality districts of Bilaspur (India).Jiang et al. [16] focused on optimizing the vehicle routing for baggage pickup in airport terminals.Noteworthy results were obtained when comparing the Clarke and Wright algorithm with other methods.Destyanto et al. [17], for instance, compared nearest

2
Journal of Advanced Transportation neighbour heuristics with the Clarke and Wright algorithm in the medicinal drug distribution area, demonstrating that the Clarke and Wright algorithm is the most efective tool for tackling this distribution problem.Metaheuristics represent a distinct approach to solving VRPs, functioning as heuristic methods that form a superstructure above other heuristics types.Well-known metaheuristics include genetic algorithms, tabu search, simulated annealing, and ant colony optimization.Tese methods emulate natural phenomena, such as animal behaviour or genetic processes.
Metaheuristics, either independently or in conjunction with the Clarke and Wright algorithm, have been applied to solve problems across various application areas.For instance, Escobar et al. [18] utilized a hybrid approach to the VRP; here, they initially found the problem solution using the Clarke and Wright algorithm and then optimized it using tabu search metaheuristics.Addressing the mail delivery problem, Huang et al. [19] developed two integer models for the delivery service.Teir heuristic algorithm is a combination of the Clarke and Wright algorithm with a tabu search metaheuristic.Zhai et al. [20] focused on combining the Clarke and Wright algorithm with ant colony optimization.Berghida and Boukra [21] and Pan et al. [22] also employed a combination of metaheuristics to address the VRP.
Heuristics and metaheuristics prove to be practical approaches for addressing real-world pickup and delivery problems [23].A common technique involves creating an initial set of routes using an insertion heuristic.Customers are gradually inserted into the routes based on a time-spatial proximity criterion.Subsequently, either local search or a metaheuristic is applied to improve the solution.A simpler variant of the problem, featuring one depot but simultaneous chilled food pickup and delivery, was addressed by Ji et al. [24] using their own heuristics based on a genetic algorithm.Chun-Hua et al. [25] also developed a genetic algorithm to handle simultaneous pickups and deliveries, considering time windows and setting penalties for delayed delivery.Chen and Fang [26] approached the simultaneous pickup and delivery problem using a two-layer discrete particle swarm optimization, with the frst phase dedicated to vehicle assignment and the second phase focused on identifying optimal routes.Yu and Lin [27] took a diferent approach, successfully employing simulated annealing metaheuristics for the PDP.Sathyanarayanan et al. [28] used a modifed genetic algorithm to solve the combined problem with multiple depots and stochastic vehicle routing.
While the literature overview illustrates the frequent use of the Clarke and Wright algorithm and its combination with metaheuristics for routing problems with various parameters and constraints, to our knowledge, the Clarke and Wright algorithm has not been applied to solve the PDP.In this paper, we aim to fll this gap by proposing a new heuristic method based on the Clarke and Wright algorithm.Tis choice is motivated by several factors.Te most important is the algorithm's computation speed.
Metaheuristics may provide a better solution, but the computation takes a long time.When faced with a problem that occurs in operational management, we need to fnd a solution quickly even at the expense of its lower quality.Another advantage of the Clarke and Wright algorithm is that it makes easy to add additional constraints to the problems, such as time windows for handling goods, a maximum route travel time, a maximum number of stops on the route, mandatory breaks for the driver's rest, and load temperature regime combinations.Tis algorithm can be relatively easily implemented and modifed.

Materials and Methods
Te problem to be solved is a single depot PDP with a heterogeneous vehicle feet.Customers' requests are specifed through delivery orders.Te delivery order data include the dispatch and destination locations of the goods, along with the quantity of goods to be delivered.A customer, as well as a depot, may serve as the pickup point for one request and, simultaneously, as the delivery point for another request.Multiple orders can have the same pickup points and/or destinations.Both unloading and loading operations are conceivable at a customer's site.Moreover, the cost of loading and unloading operations at each pickup and delivery location is also given, afecting the total cost to be minimized.We propose a solution method for the basic version of the problem where time windows are not specifed.
Although we will solve the problem heuristically, a mathematical programming formulation can be useful for a better understanding of the problem and its features.Te formulation stems from the graph model of the problem [23].Let us defne a network in which nodes correspond to the depot, pickup points, and delivery points.Diferent nodes may represent the same geographical location.If the request is dispatched from the depot, an artifcial node corresponding to the pickup operation is added to the network.Delivery to the depot is modelled in a similar way.Let r be the number of requests.We denote the set of pickup nodes by P � 1, . . ., r { } and the set of delivery nodes by { } be the set of all nodes inclusive the depot and A � V × V be the set of all feasible arcs.Request i consists of transporting q i units from node i to r + i.Consequently, let l i � q i and l r+i � −q i .Let K be a set of vehicles, Q k be the capacity of vehicle k, and c ijk be the travel cost between nodes i and j related to vehicle k.
Te mathematical model involves two types of decision variables: binary variables x ijk that equal to 1 if vehicle k travels through the arc (i, j) ∈ A and 0 otherwise and variables y ik giving the load of vehicle k after the service at node i have been completed.Te linear programming formulation is as follows: Te objective function (1) minimizes the total travel cost.Constraints (2) ensure that each pickup location is visited.Constraints (3) impose that the delivery location is visited if the pickup location is visited and that the visit is performed by the same vehicle.Constraints (4) are the fow conservation constraints.Constraints ( 5) and ( 6) adjust the vehicle load during a route and, simultaneously, prevent a route from being separated into subtours that do not contain a depot.Constraints (7) and ( 8) are the capacity intervals at pickup and delivery nodes.Te initial vehicle load is imposed by (9).Finally, constraints (10) defne binary variables.

Te Clarke and Wright Algorithm. Te Clarke and
Wright algorithm operates on a graph where vertices correspond to individual customers, not the requests.Te formal description of the graph was provided at the beginning of the Literature Review Section.
Te algorithm starts with the initial solution, consisting of elementary routes.An elementary route, in the form of depot ⟶ serviced vertex ⟶ depot, is created for each serviced vertex.Tis initial solution is then modifed, and routes are merged to achieve the maximum savings in the total cost.Te savings, denoted as λ ij , indicate how much the cost is reduced by combining two routes into one (Figure 2), as expressed by the equation: Since the savings remain constant throughout the algorithm, they can be computed a priori.Te savings are recorded in a matrix of dimension (n + 1) × (n + 1).In each iteration, the maximum element in the savings matrix must be; it determines the routes that can be joined, provided that the problem constraints are respected.Te basic constraint relates to vehicle capacity: two routes can be merged into one only if the vehicle used can carry all the goods delivered via the two routes.After each step of the algorithm, more complex routes visiting two or more vertices may emerge.Te routes can only be joined through their outermost vertices, the frst after the depot or the last one before the depot.Connecting additional routes to vertices within the existing routes is not possible.

Modifcations of the Clarke and Wright Algorithm.
We modify the Clarke and Wright algorithm in the following ways: (1) Te orders can be directed to/from any vertex (2) A customer may be visited by multiple vehicles, meaning one vertex may occur in multiple routes (3) Routes can be merged at any common vertex (4) Te savings resulting from joining routes depend on the confguration of the routes, necessitating changes during the algorithm run and repeated calculation, leading to a dynamic savings matrix Te algorithm is adapted to situations where the routes obtained by the initial solution can lead to the same vertices.In contrast to the basic Clarke and Wright algorithm variant, the initial solution is based on the delivery orders rather than the customers.Each route in the initial solution satisfes one order.Te goods for one order can be managed by one vehicle (this need not be tested).However, multiple orders can be directed to the same network vertex.Tus, a situation can occur where two routes containing one or more identical vertices must be joined during the computation.Tis is a problem that cannot be solved using the original Clarke and Wright algorithm and its numerous modifcations encountered in literature [8][9][10][11][12].
Te calculation of savings is a next modifcation of the algorithm.In the original version of the Clarke and Wright algorithm, the savings are calculated in the initialization phase based on graph edge weighting and are independent of the confguration of the routes being combined.In the problem addressed here, savings are afected by multiple factors.Tey are calculated from the costs of the routes being combined, including a fxed cost component and a variable cost component.Tese savings depend not only on the distance but also on the number of units of goods to be loaded/ unloaded and other factors, such as the cost of having the vehicle driven to the ramp or the cost of the vehicle idle time during the loading/unloading operations.Furthermore, the savings accruing from route joining depend on the order of the vertices on the resulting route.Hence, the savings accruing from the potential combination of the newly created route with the existing routes must be calculated after each route combination performed.Tis afects the savings matrix in such a way that the savings for the newly created route are calculated and stored in a new row and column, while the rows and columns for the routes from which the new route was formed are eliminated from the matrix.In this way, the saving matrix becomes a dynamic matrix.

Initial Solution.
Each order specifes the pickup vertex (dispatch site) and the delivery vertex (destination).Te dispatch site can be the depot (typically) or any other vertex, and the same applies to the destination.In addition, the amount of goods to be delivered is defned.Te orders are categorized into three groups.Te initial solution is constructed with respect to these groups: (1) Group 1 includes delivery orders with the depot as the dispatch site.Te initial route for the order is depot ⟶ delivery vertex ⟶ depot.(2) Group 2 encompasses pickup orders where the depot is the destination point.Te initial route is depot-⟶ pickup vertex ⟶ depot.(3) Group 3 involves orders where the depot is neither the dispatch site nor the destination site.Instead, the goods are transported between two nondepot vertices.Te initial route is depot ⟶ pickup vertex ⟶ delivery vertex ⟶ depot.

Saving Matrix.
As in the Clarke and Wright algorithm, the saving matrix must be set up frst.Te saving matrix has dimensions of the number of orders × number of orders, and it is not symmetric.Each matrix row and column represents one route, with every route originating and terminating at the depot.Te matrix elements include 2 items: the savings and the potentially newly created route.Te initial saving matrix is shown in Table 1.
Te following symbols will be used to describe a route: (i) m is the number of vertices within a route (ii) v tk is the k-th vertex on the route t (iii) v t1 is the frst vertex on the route t representing the depot, which is the vehicle's starting point (iv) v tm is the last vertex on the route t representing the depot, which is the vehicle's fnish point 3.5.Saving Calculation.Te value of the savings λ ij is obtained from the costs of the joined routes i and j, as shown in the equation: 3.6.Cost of a Route.Te cost of a route comprises four items: the cost of vehicle travel along the route, the cost of servicing the vertices on the route, the waiting cost, and the vehicle deployment cost.Te total time of the route must also be determined for the total cost calculation.Terefore, the servicing times in the vertices and the time of travel between the vertices must also be determined.
Cost factors are the same for each route: (i) cost_v is the vehicle deployment cost (price) (ii) cost_t is the travel cost (price/km) (iii) cost_w is the waiting cost (hourly price) 3.7.Distance Matrix.Tis matrix includes the distances d ij (lengths of the shortest paths) between the vertices i, j ∈ V. Te frst distance matrix row and column represent the depot.
3.8.Travel Time Matrix.Tis matrix includes the travel times t ij between the vertices i, j ∈ V. Te frst travel time matrix row and column represent the depot.
3.9.Vertex Parameters.Te loading/unloading cost in vertex k on route t is as follows: (i) cost_fx (v tk ) is the fxed cost (e.g., transport document inspection fee) (ii) cost_var (v tk ) is the variable cost per transported goods unit Te loading/unloading time in vertex k on route t is as follows: (i) t_fx (v tk ) is the fxed time (e.g., driving the vehicle in for handling) (ii) t_var (v tk ) is the variable time per transported goods unit Te requirements in vertex k on route t are as follows: (i) C_n (v tk ) is the number of units of goods loaded in vertex v tk (the sum of loaded units of goods from all orders on route t for which the vertex is the dispatch point) (ii) C_v (v tk ) is the number of units of goods unloaded in vertex v tk (the sum of unloaded units of goods from all orders on route t, for which the vertex is the destination)

Service times in the Vertices on the Route and Servicing
Cost.Te service time in v tk consists of the fxed and variable parts, where the latter is dependent on the number of loaded and unloaded units of goods equation: Te service cost in the route vertex v tk also consists of a fxed component, independent of the number of loaded/ unloaded units (e.g., the cost of having the vehicle driven to the ramp), and a variable component that depends on the number loaded/unloaded units, such as the cost of the vehicle idle time during the loading/unloading operations.Tese costs are directly proportional to the vertex servicing time equation: 3.11.Cost of Travel between Two Vertices.Te cost of travel between vertices v t,k−1 and v tk depends on the distance travelled equation: Te waiting cost is expressed by the equation:  3).Variant 1: Te last vertex (before the depot) of one route coincides with the frst vertex (after the depot) of the other route, and this common vertex serves to join the routes together.For example, routes D-1-2-3-D and D-3-4-D create route D-1-2-3-4-D (Figure 4).Te diference between variants 0 and 1 is that in variant 0, the routes have no common vertex (except the depot), while in variant 1, they share one vertex (except the depot).Te procedure in variants 1, 2, and 3 can be further generalized to multiple common vertices.In the future, we could consider modifying the algorithm in such a way that the number of common vertices to be examined for both routes will be the algorithm's parameter.One can expect that such exploration would improve the solution quality but increase the computing time.In our experiments, we did not investigate the sensitivity of the algorithm to this parameter.
Te procedure of selecting the routes to be joined follows the principle of the Clarke and Wright algorithm.Te maximum positive element is identifed in the saving matrix.Tis element determines the routes that can (while meeting the constraints of the problem) be combined into one (in the following description of the algorithm, we consider the only constraint regarding the vehicle capacity).If the routes cannot be joined, the saving matrix element is not flled out and will not be considered for the selection of the maximum savings.
Te modifed Clark and Wright algorithm operates with a dynamic saving matrix.In contrast to the classical Clark and Wright algorithm, which calculates savings solely from    Journal of Advanced Transportation distances and considers savings only between outermost vertices of the routes, the modifed algorithm computes savings from costs that depend on various factors, including the confguration of the resulting route and the quantity of goods loaded and unloaded along the route.Tis distinction leads to variable savings throughout the calculation.When two routes are combined, the quantity of goods must be recalculated, resulting in changes to the costs of other routes that could potentially be combined in subsequent iterations.
A new route is created and included in the matrix to replace the merged routes.Tus, after each of these operations, the saving matrix must be updated.Te two rows and columns pertaining to the joined routes must be removed from the matrix, and simultaneously, a row and a column corresponding to the new route are added.Tis dynamic adjustment in matrix dimension occurs during the execution of the algorithm.Te algorithm terminates when no positive savings are present in the saving matrix.

Algorithm Implementation.
In this section we describe the implementation of the algorithm.Te notation used is given in Table 2 and the functions are summarized in Table 3.
Te basic concept of the modifed approach is described by Algorithm 1.
Algorithm 2 creates the initial routes R from the set of all orders O by using the functions test vehicle capacity on route and create route.
Algorithm 3 calculates the saving matrix.Te input parameters include the vehicle t x and the set of all routes R. Te algorithm uses the function update save matrix, which is described in detail by using a pseudocode in Algorithm 4.
Algorithm 5 uses a loop (which runs until no positive savings are present in savings matrix A) in which the next route with the currently highest savings s cost is selected and the route s route is added to the set of all routes R. Te initial routes r s index i and r s index j (now joined into the new one) are removed from the set of routes and from matrix A by the function remove row and column(↓↑A, ↓i, ↓j).
Algorithm 4 handles the process of joining the routes r i and r j into a new potential route r new .Te procedure examines the specifc variants where the end vertices of r i may coincide with the starting vertices of r j .Te following variants are tested: (1) is Last And First Vertex Same Only (2) are 2 Last And 2 First Vertex Same (3) are 3 Last And 3 First Vertex Same Furthermore, the function is R2 Sub Set R1 In Direction is used to examine whether the vertices of route r j make up a subset of route r i in the same direction.If coinciding vertices in the right position according to the above conditions are identifed, those vertices on the new route r new are joined together by using the function joined vertex.If the new route r new meets the vehicle capacity constraint (test vehicle capacity on route), the new savings (new cost) are calculated by the function get route cost and saved in the saving matrix A.

Use of the Modified Clarke and Wright
Algorithm in a Case Study 4.1.Case Study.Te case study aimed to assess the efectiveness of the modifed Clarke and Wright algorithm in the context of distribution logistics, particularly in the intelligent management of goods transport fows.Te successful implementation of this algorithm has the potential to enhance efciency, improve planning dynamics, optimize routing, and consequently lead to better utilization of vehicles transport capacity.Tis, in turn, could result in reduced CO 2 emissions, improved overall operating economy, and increased competitiveness.
For the case study, collaboration was stablished with MD Logistika a.s., a company specializing in the pickup and delivery of foods in the Czech Republic and transboundary trade.Te company handles schedules for numerous vehicles daily, managing 500-700 delivery orders from various clients.Operational planning at MD Logistika involves addressing multiple constraints, including vehicle loading capacities, time windows for loading/unloading, drivers' rest breaks, ramp assignment, and the limitations on travel duration and distances for both route components and entire routes.Challenges such as a shortage of qualifed staf for expert planning and the absence of comprehensive planning software that considers all constraints are prominent.
Currently, MD Logistika planners do not use any decision support tool and manually construct distribution plans.Te primary aim of the study was to contribute to the innovation of the planning process.Te goal was to develop a rapid algorithm capable of solving a relaxed version of the problem in a matter of seconds.Upon validation of its results by decision-makers, the algorithm could be refned, adapted to more complex problems with practical constraints, and potentially implemented in planning software.In the initial phase, the case study focused on transport capacity-related constraints, with time windows not being specifed.

Input Data.
Input data analysis is a crucial step in preparing for computational experiments.In the case of MD Logistika, the analysis focused on various aspects of their business data, including feet information and customer details.

Fleet Information.
Te feet used for the computation experiments was taken from the real operation at MD Logistika, consisting of approximately 200 trucks.Te majority (85%) of vehicles in the feet have a capacity of 33 transport units (pallets), while the remaining vehicles (15%) have capacities between 10 and 21 transport units.Te primary parameters considered for each vehicle included the transport capacity and price per travelled kilometre.

Customer Information.
Customer information was also derived from real data.Customers are primarily food product sellers.Key information includes their fxed costs 8 Journal of Advanced Transportation

Results and Discussion
In the case study collaboration with MD Logistika, ten scenarios were devised, each corresponding to a specifc day of operation.Tese scenarios captured real-world daily requirements consisting of 600 to 700 delivery orders.Te algorithm processed each day consecutively with the goal to optimize the initial routes that were set up based on the delivery orders.Te scenarios are presented in Table 4 as follows: (1) Number of initial routes: Tis indicates the initial set of routes established based on the delivery orders for each day.
(2) Final number of routes: After the optimization process using the modifed Clarke and Wright algorithm, the fnal number of routes is determined.(3) Percentage of routes reduced: Tis metric refects the percentage reduction in the of routes achieved through the optimization process.It provides insights into the algorithm's efectiveness in consolidating routes.(4) Total computing time: It is the time taken for the algorithm to complete the optimization process for each scenario.
Tese scenarios and their associated metrics help evaluate the algorithm's performance in real-world scenarios, providing valuable insights into route optimization, reduction efciency, and computational speed.
Te evaluation of the experiments in the case study focused on various optimization results, as outlined in Table 5. Te key optimization metrics are as follows: (1) function reduce(↓↑A, ↓t remove row and column(A, s index i , s index j ) (10) add Row And Column(A) (11) for each i ∈ 1, . . ., |A| { } do (12) for each j ∈ 1, . . ., |A| { } do (13) if(i ≠ j) (14) update save matrix(↓↑A, ↓i, ↓j, ↓t x ) (15) end ( 16) end (17) end (18) s � find max save(↓A, ↓|A|) (19) end (20) end ALGORITHM 5: Route reduction.resenting the total distance travelled by the vehicles (4) Te number of processed orders is the count of delivery orders that were successfully processed and incorporated into the optimized routes (5) Te number of delivered pallets is the count of pallets that were successfully transported on the optimized routes (6) Te number of remaining orders is the count of orders that were not included in the optimized routes due to capacity constraints.(7) Te number of remaining pallets is the count of pallets that were not included in the optimized routes, indicating any unprocessed or pending items.
Tese metrics collectively provide a comprehensive overview of the algorithm's performance, including cost efciency, order processing capability, and the overall impact on the goods transportation process.Te ability to handle various aspects of the real-world logistics challenges is crucial for the algorithm's practical utility.
Te above table demonstrates that in each of the scenarios, the algorithm was unable to plan all delivery orders, mainly due to the inadequate capacity of the feet available for the relevant day.Goods dispatch planners confrmed that this situation is not uncommon in everyday practice.Since the proportion of orders that could not be processed is at the level of 1%, the company solves each problem individually by outsourcing the delivery.For the algorithm, this shortcoming can be eliminated by extending the input feet.Furthermore, the mean cost of satisfying the orders is about CZK 1,341 thousand, (STD CZK 81 thousand), the mean summary length of all routes is 54.4 thousand km (STD about 3.5 thousand km), and the mean number of orders processed daily is 637 (STD 16).
As a result of a more detailed analysis of the scenarios, Table 6 includes the average number of stops on a route and the average length and duration of a route for each scenario.
In the case study, the Clarke and Wright algorithm modifcation was tested on a selected subproblem, primarily focusing on the constraints posed by the limited transport capacity.Since our algorithm was not designed to account for all practical constraints, such as limitations associated with the use of the loading ramps, driver's breaks for rest, and time windows allocated to goods loading/unloading operations, it was not possible to directly compare the numerical results with real schedules.
Te main conclusion resulting from empirical testing is that despite utilizing the dynamic saving matrix concept, one of the algorithm's favourable key properties is retained: the relatively short computing time.If it becomes evident that the new algorithm maintains low computing complexity even after the inclusion of all constraints compelled by realworld circumstances, it will be feasible to use it in everyday dispatch planning practice, and moreover, in real time, owing to its potential high speed.Furthermore, if the algorithm is to be integrated into the daily work of dispatchers, a comprehensive software tool must be set up to include not only the algorithm itself but also basic input/output control, preferably transformed into a textual and graphic format.Journal of Advanced Transportation

Conclusions
Te objective of this paper was to outline a modifcation of the Clarke and Wright algorithm tailored for application in delivery order-oriented distribution logistics.Te proposed modifcation was then put to the test within a case study utilizing real internal data from MD Logistika company.Te algorithm was tested on a selected subproblem, with a specifc focus on constraints related to transport capacity.Te expert assessment of the results by MD Logistika's operative planning professionals provided evidence that the outcomes are reasonable, especially concerning the total cost per route-a crucial parameter for efcient and competitive goods delivery.In essence, the accuracy of the modifcations made to the Clarke and Wright algorithm has been afrmed.Consequently, additional real-world constraints can be gradually incorporated into the algorithm during the subsequent stages of research.As a result, the operational planning dispatchers may soon have access to an efcient software tool, aiding them in planning large-scale goods delivery with signifcantly reduced costs and stafng requirements compared to common industry practices.

Figure 2 :
Figure 2: Basic principle of the Clarke and Wright algorithm.
remove row and column (↓↑A, ↓i, ↓j) Tis function removes the i-th row and j-th column and the j-th row and i-th column from matrix A add row and column (↓↑A) Tis function adds a new row and a new column to matrix A Journal of Advanced Transportation depot.Te goods are transported on pallets, with each pallet representing one transport unit.Te data includes the number of transported pallets and the loading/unloading site.

Table 1 :
Initial savings matrix-frst iteration of savings calculation.

Table 2 :
Explanatory notes.cost , s route, s index i , s index j ) Savings are defned by means of four parameters: s cost , which is the cost savings of route s route ;s route , which is the route consisting of vertices, and s index i , s index j , which are the coordinates in matrix A A Saving matrix

Table 3 :
Functions.Tis function creates the initial routes R from the set of all orders O.It uses the functions test vehicle capacity on route and create route save matrixte (↓t x, ↓R) Tis function creates the saving matrix.It uses the function update save matrix reducete (↓↑A, ↓t x ) In the loop (until no positive savings are present in matrix A), the function selects the next route with the largest savings s cost and adds route s route to the set of all routes R. Te initial routes r s index i and r s index j (now joined into one) are removed from the set of routes and from savings matrix A by the function remove row and column(↓↑A, ↓i, ↓j) create routete (↓v 1 , ↓v 2 , ↓v 3 ) create routete (↓v 1 , ↓v 2 , ↓v 3 , ↓v 4 ) Tis function creates the initial route r i .Te input parameters are the vertices of the new route.A variant of this function is selected based on information whether the operation is delivery, pickup, or goods transport between customers create savete (↓s cost , ↓s route, ↓s i , ↓s j ) Tis function creates savings s.Te input parameters are the route savings, the route consisting of vertices and coordinates s i , s j in matrix A test vehicle capacity on routete (↓r i , ↓t x ) If the capacity of vehicle t x on route r i was not exceeded in any of the vertices (where goods are loaded/unloaded), this function returns true; otherwise, it returns false update save matrixte (↓↑A, ↓i, ↓j, ↓t x ) Tis function joins routes r i and r j into a new potential route r new and consecutively evaluates the specifc variants where the end vertices of r i and starting vertices of r j Last And 3 First Vertex Same Furthermore, the procedure examines if the vertices of route r j constitute a subset of route r i in the same direction: (4). is R2 SubSet R1 In Direction If identical vertices are identifed in the right position according to the above conditions, then those vertices are combined together for the new route r new by means of the function joined vertex.If the vehicle capacity is met on the new route r (test vehicle capacity on route), the function get route cost is used to calculate the new savings new cost, which are then saved in the savings matrix A find max save (↓A, ↓|A|) Tis function returns the highest savings s from matrix A joined vertext ↓(v 1 , ↓v 2 ) Tis function returns the new vertex obtained by joining vertices v 1 and v 2 is Last And First Vertex Same Only (↓r i , ↓r j ) Tis function returns true if v i,|r i |−1 � v j,2 i.e., if the last serviced vertex of route r i (before returning to the depot) coincides with the frst serviced vertex on route r j (after the depot) are 2 Last And 2 First Vertex Same (↓r i , ↓r j ) Tis function returns true if v i,|r i |−2 � v j,2 ∧v i,|r i |−1 � v j,3 are 3 Last And 3 First Vertex Same (↓r i , ↓r j ) Tis function returns true if v i,|r i |−3 � v j,2 ∧v i,|r i |−2 � v j,3 ∧v i,|r i |−1 � v j,4is R2 Sub Set R1 In Direction (↓r i , ↓r j )) Tis function returns true if the vertices of route r j are subsets of route r i in the same direction get route cost (↓r i ) Tis function returns the cost of route r i

Table 4 :
Efectiveness of the optimization procedure.