#### Abstract

The dynamic and stochastic vehicle routing problem (DSVRP) can be modelled as a stochastic program (SP). In a two-stage SP with recourse model, the first stage minimizes the a priori routing plan cost and the second stage minimizes the cost of corrective actions, performed to deal with changes in the inputs. To deal with the problem, approaches based either on stochastic modelling or on sampling can be applied. Sampling-based methods incorporate stochastic knowledge by generating scenarios set on realizations drawn from distributions. In this paper we proposed a robust solution approach for the capacitated DSVRP based on sampling strategies. We formulated the problem as a two-stage stochastic program model with recourse. In the first stage the a priori routing plan cost is minimized, whereas in the second stage the average of higher moments for the recourse cost calculated via a set of scenarios is minimized. The idea is to include higher moments in the second stage aiming to compute a robust a priori routing plan that minimizes transportation costs while permitting small changes in the demands without changing solution structure. Additionally, the approach allows managers to choose between optimality and robustness, that is, transportation costs and reconfiguration. The computational results on a generic dynamic benchmark dataset show that the robust routing plan can cover unmet demand while incurring little extra costs as compared to the preplanning. We observed that the plan of routes is more robust; that is, not only the expected real cost, but also the increment within the planned cost is lower.

#### 1. Introduction

The basic task in freight transport is to ship goods from one location to another one, which are typically represented by depots and geographically dispersed points, respectively. Hence, a combinatorial optimization problem arises, which is known as vehicle routing problem (VRP). The VRP aims to determine a set of vehicle routes to perform transportation requests with a given vehicle fleet at minimum cost, that is, to decide which vehicle handles which customer order in which sequence. In this kind of problem, one typically assumes that the values of all inputs are known with certainty and do not change. However, in today’s economy, one issue needs to be integrated: customers desire more flexibility and fast fulfillment of their orders. Besides that, the recent developments in information technology permit a growing amount of available data and both control of a vehicle fleet and management of customer orders in real-time. This context calls for real-time decision support in vehicle routing, motivating a version of the VRP, the so-called dynamic and stochastic vehicle routing problem.

The DSVRP is a generalization of the VRP, where parts or all necessary information regarding inputs is stochastic and the true values become available at runtime only. Usually, the dynamic and stochastic VRP is modelled either as a* Markov decision process* or as a* stochastic program* [1]. An MDP consists of a finite set of states, a finite set of actions, representing the nondeterministic choices, and a transition function that given a state and an action provides the probability distribution over the successor states [2]. Differently, SP determines a feasible solution for all possible outcomes [3]. All stochastic program formulations call for the determination of an a priori routing plan. Based on DSVRP models, different solution methods have been developed to address the problem. Usually, solution methods are classified into one of two families:* stochastic modelling* or* sampling*. In* stochastic modelling* approaches, the stochastic knowledge is formally included into the problem formulation, but they are highly technical in their formulation and require to efficiently compute possibly complex expected values. On the other hand,* sampling* has relative simplicity and flexibility on distributional assumptions, while its drawback is the massive generation of scenarios to accurately reflect reality [4, 5]. These approaches sample the probability distributions to generate scenarios that are used to make decisions. Different authors have proposed sampling-based approaches in the context of stochastic VRP, for instance, the Multiple Scenario Approach (MSA) proposed by Bent and Van Hentenryck [6] and Sample Average Approximation (SAA) method applied in Verweij et al. [7].

In this paper, we formulate the dynamic and stochastic capacitated vehicle routing problem, where the demands are stochastic and dynamic, as a two-stage stochastic program model. Similar to the sampling-based methods, we also make use of scenarios in the proposed robust solution approach. However, different from MSA, the scenarios are generated only once at the beginning of the planning stage and, different from SAA, we do not minimize the average of the second stage cost of a set of sample scenarios. The idea of the robust approach is to address uncertainty using higher moments calculated via scenarios, permitting the solution to be able to adapt to situations when the real demand is greater than expected. Our aim is to develop a solution approach such that the routing plan is robust against small changes in the inputs, that is, allowing to compensate for changes in the input without losing structural properties and optimality. For that, the remainder of the paper is organized as follows. Section 2 provides a brief literature review dedicated to vehicle routing problem, with an emphasis on the stochastic and dynamic vehicle routing problem. In Section 3 the problem formulation is described. This is followed in Section 4 by a description of the robust solution approach. Computational results are reported in Section 5, and, last, Section 6 concludes with a summary and an outlook for future work.

#### 2. Literature Review

The VRP is a generalization of the Traveling Salesman Problem (TSP). The TSP is a well-studied problem, in which the goal is to minimize the total distance traveled by the salesman while visiting a group of cities and returning to the first visited city. In this problem each city is visited exactly once by the salesman. The vehicle routing problem, in its turn, consists of designing a routing plan to attend to all customers with a given vehicle fleet at minimum cost. Mathematically, the VRP reads as follows.

*Definition 1 (vehicle routing problem). *Consider a set of vehicles and a fully connected graph , where is the set of vertices representing customer locations ( is the depot of vehicles) and is the set of arcs. With every arc is associated a nonnegative distance matrix . In some contexts, can be interpreted as a travel cost or as a travel time. Moreover, let be a binary variable taking the value 1 if arc is used by vehicle and the value 0 otherwise. Then, we callthe vehicle routing problem.

Within Definition 1, (2) assures that each client is visited only once. Constraint (3) guarantees that vehicles must leave the depot. The initial and termination condition are expressed by (4), insuring that the route starts and ends at the depot. Constraint (5) ensures that the same vehicle comes in and comes out for each one of its customers, and (6) guarantees that all variables are binary. Beyond the VRP classical formulation, a number of side constraints complicate the problem. These could for instance be time constraints on time windows or on capacities of the vehicles, which result in the Vehicle Routing Problem with Time Windows (VRPTW) or the most studied version of the vehicle routing problem, the capacitated vehicle routing problem (CVRP), respectively. In the CVRP a nonnegative demand () is attached to each customer and the sum of demands of any vehicle route may not exceed the vehicle capacity [8]. Thus, the constraint as follows is included in Definition 1:

In contrast to the basic definition of the VRP, most real-life applications have to be analyzed with regard to two aspects: evolution and quality of information [9]. Evolution of information refers to the fact that in some problems the available information may change during runtime. Quality of information indicates possible uncertainty on the available data [5]. Based on these aspects, there are four classes of VRP shown in Table 1.

In the* static and deterministic* class, all necessary data is known in advance and time is not taken into account explicitly. Hence, no updates of routing plans are required. These conditions apply, for example, for the classical VRP; compare Definition 1. In the* static and stochastic* setting, a part of the data is modelled as random variable and respective realizations are only revealed during the execution of the plan. The routes are designed before starting the execution of the plan and only minor changes are allowed afterwards. Applications in this class do not require any technological support. The three most studied respective cases are stochastic customers, where a customer needs to be serviced with a given probability [10, 11]; stochastic times, in which either service or travel times are modelled by random variables [8, 12]; and stochastic demands [13, 14]. The most studied problem in this class is the CVRP with stochastic demands (VRPSD). In comparison to capacitated VRP, the difference is that for the CVRPSD the demand is a random variable . The* dynamic and deterministic* class, also called online or real-time [15], is characterized by parts or all the inputs being unknown and revealed dynamically during the design or execution of the routing plans. In this setting, no stochastic information about the future is known; for example, the location of a customer may be unknown until that customer request is serviced [16]. For these problems, vehicle routes are defined in an ongoing fashion, requiring technological support for real-time communication between the vehicles and the decision-maker (e.g., using mobile phones and global positioning systems) [5]. The problem is solved on an event driven basis, that is, once an information becomes available at time instant . Hence, in this category, the set of known customer locations, that is, the nodes of the graph , are a time varying function . For practical dynamic and deterministic VRP (DDVRP) applications with time-critical decisions, the task of evaluating every possible decision at each time step is extremely challenging; compare, for example, [17]. The most prominent applications in this class are the dynamic dial-a-ride problems, where customers have immediate (online) requests, which occur when they desire to be collected as soon as possible [15]. Last, in the* dynamic and stochastic* setting, parts or all inputs are unknown and revealed dynamically during the execution of the routes. However, in contrast with the latter problem, the difference is that, in addition to efficiently handling dynamic events, stochastic knowledge about the revealed data is available. The integration of stochastic information can increase the look-ahead capability, reliability, and robustness of an optimization system [15]. In this class, the Capacitated Dynamic and Stochastic Vehicle Routing Problem (CDSVRP) is the most studied one. Considering the latter class, we obtain the following generalization.

*Definition 2 (capacitated dynamic and stochastic vehicle routing problem). *Suppose the setting of the capacitated VRP is to be given with , where is the set of vertices or customer locations known at time . If costs are fixed for all and demands are random variables for all with sampling space , then (1), (2), (3), (4), (5), and (6) are referred to as Capacitated Dynamic and Stochastic Vehicle Routing Problem.

Traditionally, dynamic and stochastic VRP are formulated as* Markov decision processes* [18–20] or as* stochastic programs* [21]. Both methodologies model the uncertain problem data as random variables that follow a known distribution. The goal is to optimize a risk measure (such as the expected value, the variance, or the conditional value-at-risk of some cost function), subject to the satisfaction of side constraints [3, 22]. The most widely applied and studied* stochastic program* models are two-stage programs [23]. In* two-stage stochastic programming*, the variables are partitioned into two sets [24]. The first-stage variables are decided before the realization of the uncertain parameters, while the second-stage or recourse variables are determined once the stochastic parameters are revealed [25]. However, there are many situations where one is faced with problems where decisions should be made sequentially at certain periods of time based on information available at each time period. Such* multistage stochastic programming* problems [1, 26] can be viewed as an extension of two-stage programming to a multistage setting [23]. In two-stage stochastic programming, one typically distinguishes between* chance constrained programming* (CCP) [27–29] and* Stochastic Programming with Recourse* (SPR) [30]. In chance constrained programming, one can guarantee that the probability of route failure is less than a prespecified threshold. On the other hand, SPR implies minimizing the routing plan costs together with the costs of the recourse policy. A recourse policy describes what actions to take in order to repair the solution after a failure. For the capacitated DSVRP, three recourse policies are commonly used: detour to depot [31–33], preventive restocking [21, 34, 35], and reoptimization [24, 36–39]. In detour to depot, the vehicle returns to depot to restock when capacity is attained or exceeded. The vehicle restarts servicing along the planned route to that customer where route failure had occurred. In preventive restocking, an en route replenishment can be performed before a route fails. It may be less costly to travel to the depot to restock from the current location than to wait for a route failure at a location further away from the depot. In reoptimization, after failure or after each customer is served and its demand becomes known, the portion of a route that has not been served is reoptimized. A decision is taken regarding which customer will be visited next, either as part of the regular routing or on the way to replenishment at the depot. As stated in [30], for other DSVRP formulations, the recourse policy does not involve routing decisions. Instead a penalty for late/early arrivals or the extra time cost of the driver can be part of the expected cost when time windows and/or stochastic service time are taken into consideration [12, 40, 41].

Several methods based on the formulation described above have been proposed to address the dynamic nature of routing problems. Dynamic methods can be divided into two categories: nonanticipative [42–44], which only react to updates in the problem data, and anticipative, which take into account knowledge on the dynamically revealed information to anticipate the future. Nonanticipative methods are designed for DDVRP. Conversely, anticipative methods often make better decisions by using stochastic information available in the form of probability distributions. Anticipative methods are further classified into one of two families:* stochastic modelling* [45–47] or* sampling *[17]. Ritzinger et al. [48] classify these two families in* preprocessed decisions* approaches and* online decisions* approaches, respectively. The authors argue that* preprocessed decisions* approaches consider all states (e.g., all possible stochastic input realizations) in advance and value each state according to its performance. Such approaches perform the evaluation of the states before the vehicle starts the tour and enables an accurate decision making based on these values during the plan execution phase. On the other hand,* online decisions* approaches calculate solutions either by applying online algorithms or, if computational time allows it, by recomputing the base sequence, at predefined states (e.g., an event arises).

Verweij et al. [7] classify sampling-based approaches in two main groups:* interior* and* exterior* sampling methods. In* interior*, sampling is performed inside a chosen algorithm with new samples generated in the process of interactions, like, for instance, in Multiple Scenario Approach (MSA) proposed by Bent and Van Hentenryck [6]. The method starts by initializing the pool of scenarios with realization of problem random variables based on the currently known information. If/when an event occurs, the MSA updates the scenario pool and thus optimizes each scenario to compensate for deviations from the plan, by solving the respective static and deterministic problem in order to determine the next action [15]. As new information is revealed, some scenarios might become obsolete and are removed from the pool, leaving space for new ones [17]. Event defines the time step and may, for example, be the disclosure of a real value of some input or a vehicle breakdown. A distinctive feature of sampling-based algorithms is that the next customer to visit is selected based on the whole scenario pool by means of a decision process [5]. The most common algorithms used to reach a decision are online expectation (Algorithm E) [27, 49, 50], consensus (Algorithm C) [17, 25, 49], and regret (Algorithm R) [27–29]. These algorithms use the same offline optimization algorithm [48]. Algorithm E [25] is a stochastic algorithm that optimizes expectation values. It consists in evaluating the cost of visiting each customer first by forcing its visit in all scenarios and performing a complete search [17]. Algorithm C was introduced in [49] and selects the customer appearing first with the highest frequency among scenarios. Last, Algorithm R [27] approximates Algorithm E and avoids the reoptimization of all scenarios. The advantage of sampling-based algorithm is its (relative) simplicity and flexibility on distributional assumptions, and its requirement to solve static and deterministic problems only. Therefore this approach has virtually been adapted to any problem [17]. On the contrary, in* exterior* sampling approach the true problem is approximated by Sample Average Approximation (SAA) problem [7]. In the SAA method, the expected value of the objective function is approximated by a sample average estimate obtained from a random sample. The resulting SAA problem is solved for different samples in order to obtain a set of candidate solutions, once the sample is generated, the SAA problem becomes a deterministic optimization and can be solved by an appropriate algorithm [51]. Then, these candidate solutions are tested on a larger sample and the best solution for that sample is chosen [7].

In this work, we formulate the dynamic and stochastic capacitated vehicle routing problem as a two-stage stochastic program with recourse, using a detour to depot as the corrective action. Based on this formulation we propose a robust solution approach. Such approach also tries to optimize the corresponding deterministic expected value cost, like in SAA method. However, our approach uses only one sample of scenario and permits a wider deviation in the cost for the scenarios in the sample, aiming to accommodate changes in the customers’ demands.

Figure 1 presents some papers classified according to how the dynamic VRP is modelled and what type of solution methods is used to deal with the problem.

#### 3. Problem Definition

In this paper, we concentrate on the capacitated dynamic and stochastic vehicle routing problem according to Definition 2. Our aim, however, is to compute a robust solution, which minimizes the real and not the planned costs. As this optimization problem is designed and used for the a priori planning only, it needs to be extended accordingly. To this end, we formulate the problem as a two-stage stochastic program with recourse, where the real costs are split into two stages:The first stage represents the planned cost, that is, the cost of the a priori routing plan calculated using the stochastic knowledge. Meanwhile, the second stage corresponds to the cost of corrective actions. It means the additional costs for performing detours to the depot. A vehicle needs to go to the depot to be refilled if its capacity is attained before planned time. Then, either the same vehicle or a new vehicle attends to the remaining customers. Unfortunately, we can evaluate (8) only a posteriori, that is, upon completion when all real demands are revealed, or via stochastic analysis. In both cases, the focus relies on analyzing the costs. Here, we will focus on a structural property, that is, for example, length and sequence within a routing plan and also number of routes. More precisely, we want the computed solution to retain its structure despite possible deviations from the plan induced by real information. To anticipate the costs and the spread of costs of the latter, we propose to utilize an -norm-like cost functional.

*Problem 3. *Suppose a set of vehicles with restricted capacity each and a fully connected graph , where is the set of vertices representing customer locations ( is the depot of vehicles) and is the set of arcs with and , are given. Costs are fixed for all and demands are random variables for all with sampling space . Moreover, let be a binary variable taking the value 1 if arc is used by vehicle and the value 0 otherwise. Given a set of scenarios,where is the nominal scenario and a measure of the second stage costs, we want to compute a set of closed subgraphs minimizingThe latter is called Robust Dynamic and Stochastic Capacitated Vehicle Routing Problem (RDSCVRP).

In comparison to (8), the additional term in (10) accounts for the spread of the solutions and can be interpreted as the steepness of the cost functional with respect to input changes. Using the parameter , we combine two objectives into a scalar one. If is chosen large, then the additional term favors routing plans, which do not induce higher costs if inputs change. Hence, despite input changes, the plan is still structurally optimal; that is, the number of routes as well as the routing sequences remain unchanged. The weight represents the parameter of choice for managers to modify the importance of the two aspects in the cost functional (10): optimality and robustness. Note that here we do not characterize a certain tolerable bound on the disturbances, which would lead to a worst case estimate. Instead, we let the optimization mechanism decide, which (modified) minimum is robust in a structural sense. For this reason, we will not state explicit bounds on tolerable disturbances, and if disturbances are too large, they will be handled by replanning or extra tours. Comparing undisturbed optimal solutions and for and , see Figure 2, we know that , and typically this inequality is strict; that is, the robust solution corresponds to increased total cost. Yet, we expect that the solution of (1) has to be modified to . Our aim is not to develop a systematic way of designing such that the corresponding solution improves the performance measures; that is, .

The computed solution will typically exhibit higher planned costs than the one of the capacitated vehicle routing problem in Definition 1. Upon implementation, however, our numerical results, compare Section 5, indicate that the second stage costs (8) will be lower. Thus, these two aspects, robustness and optimality, represent trade-offs for routing solutions and must be balanced in accordance with the goals of the company.

#### 4. Robust Solution Approach

For the problem described before we develop a robust solution approach. The proposed approach includes 4 stages:* distribution fitting*,* generation of scenarios*,* definition of a static and deterministic CVRP*, and* optimization*. In the* distribution fitting* stage we fit a probability distribution function (PDF) to customer demand data by using historical demand data. Thereafter, in the* generation of scenarios* stage we use this PDF to generate scenarios. Each scenario represents a potential state of the uncertain demand for every customer. For the scenario 0 (nominal scenario) it is assumed that all customers’ demands are equal to the expected value of the probability distribution (). The other scenarios are constructed by sampling the demand probability distribution using Monte Carlo simulation. Note that, instead of using the existing customer demand scenarios (historical data), we generate new scenarios. We choose this because, in some situations, using historical data as a scenario may be impractical. For example, a new company may not have enough data for generating a bigger number of scenarios.

In the third stage, a static and deterministic instance of the capacitated DSVRP is set by using equationThis equation is formulated using the robust cost function (10). Every customer demand () is calculated by a linear combination of the scenarios with the weight , which increased the deviation from the expected value (), allowing creating worse case instances. Hence, it is possible to decide how conservative a solutions can be. A numerical example with and is presented in Table 2. The instance set in this stage is then used in the optimization stage. Since a capacitated DSVRP is set, we can make use of the efficient well established heuristics in the literature to solve the robust problem. In the numerical example case, the instance is , , and .

In the fourth and last stage we solve the instance defined in the previous stage. For that we use three heuristics: Clarke Wright savings, 2-opt Local Search, and Simulated Annealing. Using Clarke Wright [52] savings parallel version, we generate an initial plan of routes. Then, we apply a 2-opt Local Search [53] to remove crossing of links in a route, while preserving the orientation of the routes, which reduces the travel times. Given the result of the improvement heuristic, we utilize Simulated Annealing (SA) [54] to further improve the result. We use a different mechanism for neighborhood generation in the SA, called 1-interchange mechanism. In this mechanism, instead of restricting the interchanges between two stations to a single route, a neighbor of a solution is generated by inserting/exchanging one station into/between different routes and . Thus, we have two different operations: and to extract a customer from a route and insert it in a route and to swap customers between their initial routes and . The result obtained after this optimization stage is a plan of routes. This plan of routes is robust concerning certain deviations in demands.

#### 5. Computational Results

##### 5.1. Benchmark Dataset

In the literature, some authors based their computational experiments on adaptations of the Solomon [55] instances for static routing, compare, for example, [6, 56, 57], and others developed their own benchmark dataset [58, 59]. Since no dynamic benchmark dataset for stochastic and dynamic CVRP with stochastic demands was available in the literature, we developed a set of test problems to evaluate the proposed solution approach. The code details as well as the datasets are available [60].

We generated five benchmark test problems . They consist of fully connected graphs with nodes. Considering that the graph is symmetric, a number of arcs was generated equal to . The instances exhibit only capacity restrictions. Following [36, 39, 61], we considered for all test problems the demand to be uniformly distributed for all customers. Since in our problem customer demands are known as stochastic variables, it is assumed that historical demand data is available. We adopted that each customer requests an amount of a specific good per day and that there exist demand data for all customers from the last 100 working days. Therefore, we generated 100 values of demand for each customer.

##### 5.2. Performance Measures

After developing the dynamic benchmark dataset, we applied the proposed solution approach to the dataset using a total of scenarios. We applied the robust solution approach for to every test problem and solved it to optimality, with the maximum CPU time set to one hour. It is important to highlight that we do not want either to define a set of values for or an upper bound on it. We want to analyze how solutions designed for different perform. For each value of , we computed a plan of routes minimizing (10) and therefore obtained six plans of routes, which represent different degrees of robustness. It is important to highlight that when we choose we are using the nominal solution of the corresponding deterministic model. To compare these solutions, we introduced five performance measures, which will be elaborated in detail below: reliability of a plan of routes , probability of route failure , extra cost of the robust plan, expected real cost of a plan of routes, and the difference between planned cost and expected real cost as well as its increment.

Note that the first stage of the proposed solution approach is to fit a probability distribution in the customer demand data. To render the approach realistic, we included the fitting for the dynamic benchmark dataset. For that, we assumed that we do not know the PDF used to generate the instances (). After the fitting, we obtained a PDF for all customer demand , which is similar to .

###### 5.2.1. Reliability of a Plan of Routes

The reliability of a plan of routes is defined as the probability that the plan of routes did not suffer a failure. In the context of our Problem 3, a failure occurred when the capacity of a vehicle is exceeded, that is,for at least one route . Thus, it needed to return to the depot in order to attend the remaining customers. Reliability was estimated by Monte Carlo simulation with trials using the probability distributions that model the demands of the customers (). Using (19), we could define the indicator functionThis allows us to approximate the probability of failure via

###### 5.2.2. Probability of Route Failure

The number of routes in the plan of routes, which suffered a failure, that is,was introduced to compare plans of routes that have same reliability. Again, we applied Monte Carlo simulation with trials and utilized the to calculate the amount of routes that suffered a failure in each routing plan; that is,

###### 5.2.3. Extra Cost of the Robust Plan of Routes

Extra cost of the robust plan of routes is defined as the additional cost we incur if we apply the robust solution approach from Problem 3 instead of solving the CVRP as defined in Definition 1. Hence, if is a minimizer for the CVRP according to Definition 1 and is a minimizer of Problem 3, then the extra costs are given byIt is also called the price of robustness [62] and corresponds to the cost payed to allow for certain deviations within the stochastic variables.

###### 5.2.4. Expected Real Cost of a Plan of Routes

A solution to the optimization problems from Definition 1 or Problem 3 corresponds to planned costs. However, as the problem is dynamic and the proposed solution is deterministic, we only know the real costs when all vehicles finish serving the customers on their routes, that is, when all the dynamic inputs are revealed. Similar to reliability and probability of route failure, we utilize Monte Carlo simulation and . Hence, these realizations allow us to deduct how many times a failure occurs, and therefore a recourse function needs to be applied, revealing the expected real costs according to (8). A failure occurs in the position when the capacity of a vehicle exceeded (19), and a recourse function is defined as a detour to the depot. Thus, the cost of the second stage (8) is the sum of detours to the depot; that is,

###### 5.2.5. Difference between Planned Cost and Expected Real Cost

To assess the solutions, we also computed the difference between the planned cost and the expected real cost:This difference shows how realistic the plans calculated by the robust solution approach are.

###### 5.2.6. Increment

This performance measure extends the previous one and shows the distance from the planned to the expected real cost:

##### 5.3. Results and Analysis

From our results given in Table 3 we observed that for TP1, TP2, and TP3 the probability of plan to fail is lower using a higher . For TP4, TP5, and TP6, however, the probability of routing plan to fail remained unchanged for all . This performance measure does not consider how many routes within the routing plan failed. For that, we evaluate the routing plans regarding performance measure* probability of route failure*. Thus, the routing plans with same probability of plan failure can also be compared. For instance, in TP5, the routing plan obtained using and have the same probability of plan failure. However, for , these failures occur on 40% of the routes; on the other hand for this amount decreases to 33%. A lower probability of failure or higher reliability of a routing plan comes associated with a price, as mentioned before, the* extra cost* (price of robustness). Under the price of robustness we accept a suboptimal solution (higher cost) in order to ensure that the solution is more robust, and it remains feasible and near optimal when the data changes [62]. Hence, for all test problems a growth in the causes an increase in the* extra cost*. This cost is no higher than 32%. Actually, for all test problems, the extra cost varied between 3% and 11%. Only for in Test Problems and 3 the extra cost was higher than this range.

For all test problems the* expected real cost* was higher than the planned cost. This indicates that detours to depot were applied in all routing plans of all test problems to meet the real demands. It also means that at the end (after second stage; cf. (10)) we have more routes than planned (in the first stage; cf. (10)). For instance, for TP1 and , the plan of routes is composed of 5 routes; see Figure 3. However, when we use this plan to attend to the same customers, but now assuming the real values for the demands, we have 6 routes; see Figure 4. Hence, one route has failed, and therefore more routes are required to attend to the same clients. For example, the customer 12 was included in the route (Figure 3); however, when the real demands are revealed the total demand of this route is higher than expected. Thus, a vehicle needs to attend to customer 12 in only one route (4). It can be observed that the expected real cost behaved differently for different test problems. For TP1, TP3, and TP6 the expected real cost decreased from to and increased from to . For TP4 such cost decreased from to . Any pattern in the behaviour could be noticed for TP2. The behaviour of the performance measure* difference between planned cost and expected real cost* () is similar to the expected real cost. For TP1, TP2, TP3, and TP6 the lowest occurs when . The* increment* also behaves like the expected real cost and . This performance measure presents how much percent of the expected cost the real cost represents. For instance, for TP6 and the real cost represents 1.32% of the expected cost; that is, after revealing the real demand values we had an increment of 0.32% in the expected cost. The increment is higher for TP6 and TP5 compared to TP1, TP2, TP3, and TP4. The latter is due to the higher probability of failure; that is, we require more routes to attend to a bigger number of customers, which induces more recourse functions when the real demands are revealed, which in turn increases the real cost. We can then infer that for almost all test problems the routing plan designed with is the most robust; that is, the routing plan handles better changes in the demands. Most of the solution calculated for needed less detours to depot to deal with the real values of the demands compared to the other solutions in each test problem. Since the solutions calculated for did not always present the best performance over all solutions, one may also conjecture that a higher degree of robustness may not pay off.

Comparing CPU time for the same instance, we see that increases on cause growth on CPU time. Yet, comparing CPU time for different instances, we detect that more customers represent higher CPU time. However, the maximum CPU time was not reached.

#### 6. Conclusion

In this paper we proposed a robust solution approach for the dynamic and stochastic CVRP, where demands are uncertain and dynamic based on sampling strategies. We formulate the problem as a two-stage stochastic program model with recourse. A detour to the depot was defined as corrective action. The two-stage model is a new model, in which the first stage minimizes the a priori routing plan cost whereas in the second stage minimizes the average of higher moments for the recourse cost calculated via a set of scenarios. Different from the other sampling-based methods for the DSCVRP, the proposed solution approach permits deciding between optimality and robustness and computes an a priori robust plan of routes, which allows for small changes in demands without changing solution structure and losing optimality. Using the robust approach, the capacitated dynamic and stochastic VRP is reduced to capacitated static and deterministic VRP, which allows using simple algorithms. The results show that the proposed approach provides significant improvements over the deterministic approach. It is evident that the proposed idea provides a robust plan of routes. That is, for some , the reliability increased and the probability of route failure, extra cost, and expected real cost decreased. The robust solutions are not associated with a high price of robustness; that is, for the extra costs are less than 32% of the optimal cost. Additionally, it is worth mentioning that the proposed solution approach provides the lowest expected real cost, that is, the real cost we must pay after a working day. We like to note that for some situations it is better to choose robustness over optimality, that is, it is better to apply the proposed robust solution approach over the deterministic approach, to be safe against a worse case realization of the uncertainty. Although the proposed approach comes out with advantages, it still has some limitations. First, we need to have historical data about the uncertain input to be able to fit a probability distribution. Second, we have to assume information about the probability distributions of the uncertain parameters; that is, the underlying demand probability distributions must be known. In the future, we will extend our approach to other types of uncertainties, such as stochastic and dynamic travel times. Moreover, we plan to identify different set screws such as the robustness parameter , which allows for a simplified decision support.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

The authors would like to acknowledge the National Council of Technological and Scientific Development (CNPq) for a Doctor’s Degree scholarship granted to the first author.