1 Introduction

Grocery retail businesses have been increasing sales through the online channel, a practice known as e-grocery. As a result, many studies tried to explain this change in consumer attitude. The perception of reduced physical effort, less time lost and a wider range of products are key factors that condition the appeal of the online channel (Harris et al. 2017; Sreeram et al. 2017). Consequently, correct management of these aspects will determine customer satisfaction with the new channel, which has been shown to have a net substitution effect over the traditional one (Gorczynski and Kooijman 2015; Suel et al. 2015).

When aiming to manage the switch between channels, retailers should bear in mind that the online food channel has characteristics that present a series of logistics complications compared to other sectors (Gallino and Moreno 2019). One of the main differences is the number of items per order (Nguyen et al. 2018). In addition to the complexity of order management, there are various product types requiring different temperatures for conservation (Saskia et al. 2016). Thus, products are sorted into three categories: dry, frozen and fresh. Fresh products are those that generate the greatest level of customer mistrust, as they are sensitive and not standard. Unlike the offline channel, online customers cannot see and touch perishable products (Boyer et al. 2004). At the same time, these complications also affect transport, as delivery times must be shorter to conserve product quality (Yang et al. 2016).

As a consequence of order complexity, in terms of the number of products and their characteristics, there is a significant increase in the cost of the main activities (Boyer and Hult 2005). Authors such as (Marchet et al. 2018) identified that picking and transport were the most relevant activities in the online food channel because, unlike the traditional channel, their costs have to be absorbed by the supermarkets. In this way, some studies identified that operational costs are a key factor in the profitability of the new channel (Holzapfel et al. 2016; Valle and Beasley 2020). Therefore, e-grocers should focus on improving delivery efficiency to reduce logistics costs and product quality loss (Darestani and Hemmati 2019; Vazquez-Noguerol et al. 2020).

Authors such as Hübner et al. (2016b) focused their research on analyzing the various picking locations that supermarkets with an online channel can adopt. These studies describe three main strategies: picking orders at separate fulfillment centers, in store or at central warehouses. Initially, the business model of a company influences its choice of fulfillment strategy. Consequently, those firms that are only present online, known as pure-players, prefer to pick orders at a warehouse to avoid aisle congestion. Another of the main advantages of picking the orders at separate fulfillment centers is that the configuration of logistics activities can be optimized when it comes to designing the warehouse (Eriksson et al. 2019). However, they require greater investment and their profitability is not so clear when the volume of online orders is low (Hübner et al. 2016b). For that reason, traditional supermarkets that decide to enter into the new channel opt to make the most of the synergies of multichannel and prepare orders in their stores to keep initial investment lower (Murphy, 2003). The greatest advantage of picking their orders in store is that it makes the most of means, as staff can make preparing online orders compatible with their working day in the offline channel. Even so, some inefficiencies tend to occur as store layouts are not designed for optimizing the routes of pickers and interaction with offline customers can lead to problems of congestions and stock-outs (Marchet et al. 2018). These drawbacks have led many e-grocers to opt to move their online order picking and distribution to central warehouses. Thus, on the one hand, there is an increase in efficiency and flexibility in the picking process and, on the other, there is greater control over logistics, which allows service quality to increase (Murphy, 2003). However, for this strategy to be viable, order volumes must ensure a return on investment because the costs of means and infrastructure for a warehouse are notably greater than those for stores.

Together with picking optimization, the other great challenge facing e-grocers is the profitability of transporting orders to the customers, which is known as the last-mile (Ishfaq et al. 2016). As Lim et al. (2018) state, it is important to manage transport correctly to meet customer expectations at the same time as maintaining a profit margin for deliveries. Basically, firms can offer three delivery modes: home delivery, delivery points and pick-up points. For greater profitability, e-grocers should encourage online clients to choose the option of picking up orders in collection points. However, as this option offers the lowest level of service, special importance must be attached to the design and comfort of the pick-up point (Hübner et al. 2016a; Jara et al. 2018). At the same time, pick-up point delivery and home delivery modalities increase service levels but reduce profitability. Therefore, when it comes to determining the most suitable business model, order volumes and preferences of the population must be taken into consideration (Hirogaki 2015; Wollenburg et al. 2018).

Most of the research of e-grocery is focused on developing statistical models and describing processes with the objective of finding best practices and efficient business models. However, these studies highlight a clear need for the development of mathematical models that allow e-grocers to organize their main logistics activities into an integrated structure (Dias et al. 2020). The literature review carried out shows that no studies have been developed to optimize e-fulfillment activities together in the warehouse preparation model. This study aims to present a mathematical model for planning picking and transport activities that minimizes associated costs. The proposed model determines both the time windows during which picking and transport should take place and the assignment of trucks to delivery routes. The allocation of online orders is performed taking into account the conservation requirement of each type of product and the availability of means. The model makes it possible to compare two logistics scenarios. First, workload leveling of available means and, second, minimization of the number of available means by increasing their workload. The proposed model has been tested out in a well-known supermarket chain that operates in the online channel to assess the capacity of the model to reduce and compare the e-fulfillment costs in both strategies. This planning tool achieved substantial savings by modifying the delivery services and advancing the order preparation guaranteeing the quality of service while reducing the e-fulfillment cost from joint picking and delivery point of view.

The publication is structured as follows: this introduction is followed by Sect. 2, in which a review of the existing literature on mathematical models in e-grocery is carried out. In Sect. 3, we present the model definition. The developed mathematical model is detailed in Sect. 4. Section 5 introduces a real case study regarding one of the biggest e-grocers providing theoretical and managerial implications. Finally, we include the unique contributions of the paper, limitations and further research agenda in Sect. 6.

2 Literature review

Among existing research publications on the online channel of the food sector, there has been growing interest in optimizing order preparation and transport tasks. These logistics activities are identified as one of the main bottlenecks of e-grocery (Chen et al. 2020). Intending to organize the contents of this section, there are two different sub-sections: the first is a review of studies on picking process optimization and the second shows how complex order distribution can be. This distinction is made to highlight the scarcity of mathematical models that deal with both processes jointly, which is in essence the objective of this study.

2.1 Order picking processes

Order picking is determined as being the process of collecting food products from storage in response to patron demands (Valle and Beasley 2020). This product handling activity is the one that requires the most labor and machinery, so its cost can be 55% of the total operating costs of a store or warehouse (Tompkins et al. 2010; Vazquez-Noguerol et al. 2021).

Within the framework of mathematical models of online order picking in central warehouses, Bozer and Kile (2008) develop a mixed integer-programming model based on the order-batching problem. The lower and upper limits of the problem of minimum order lots are identified in a collection area with ladder structure. One of the main limitations of the study is that it does not consider additional vertical trips that may be incurred due to the height of the shelves. In addition, to solve the problem, possible congestion in the warehouse aisles is not taken into account. This type of publication has been completed with studies that formulate mathematical models to improve efficiency when grouping orders (Scholz and Wäscher 2017). It must be highlighted that for efficient order picking in complex multi-block designs, more attention should be paid to the picker path problem that arises when dealing with the order batch problem. These activities are considered critical to the efficient operation of manual order picking systems.

In the same line of research, a study by Yadav and Saxena (2019) proposes different mathematical optimization models to complete the collection of food products in a minimum time. In addition to improving efficiency by reducing process times, it is possible to minimize the number of boxes required, which moderates the quantity of transports required. The authors do not seek to standardize the order picking process, but rather to provide a significant economic benefit to the company in the form of minimizing means. Although this model makes it possible to improve the overall efficiency of the picking process, the different types of products and the necessary storage conditions have not been identified. Nor have the times involved in preparing fresh products been differentiated compared to dry products.

A recent study by Valle and Beasley (2020) presents an integer-programming model that improves the problem of order batching for worker routing in the warehouse by grouping products. They adopt the most common order picking model where a picker pushes a trolley through different aisles to collect all the items for the orders assigned to a specific trolley. The exact algorithm manages to reduce the operating costs of the warehouse since these activities involve intensive problems in labor and capital. Using optimization to employ pickers efficiently can help make operations more profitable. However, in the studies focused on picking optimization, no consideration is given to the possibility of separating the products making up the order by their type. This little-studied option allows preparation of dry and frozen products to be advanced to improve the flexibility of the means required to prepare orders.

In general, studies based on the picking process in e-grocery are focused on the business strategy of online ordering at central warehouses. This process varies significantly if it is carried out from a store and so far no mathematical models have been developed aimed at optimizing the picking processes with a store-based model. Nevertheless, some publications established that the improvements related to picking processes are associated with some information tools (Faraoni et al. 2019; Piotrowicz and Cuthbertson 2014). This technology provides the fundamental pillars that allow beneficial impacts while also adding value to new processes (Loketkrawee and Bhatiasevi  2018). However, e-grocers with a store-based model must control the investments made in the latest technology, therefore some researchers developed Big Data tools from analytical models to manage and control online investments (Erdmann and Ponzoa 2020). Furthermore, some researchers consider that information tools have implications, affecting whether the online and offline channels complement each other (Fu et al. 2020; Suel et al. 2018).

2.2 Last-mile order shipping processes

In parallel with those studies on order picking processes, some research has looked into the realm of food product distribution for the online channel. This is due to the complications in the delivery process derived from product characteristics and tight deadlines (Allen et al. 2018). It should be noted that home delivery is regarded the worst last-mile alternative because an absent customer when the delivery arrives at their home means an increase in transportation costs and a possible loss of perishable food (Rai et al. 2019). Consequently, in the online channel logistics plays a key role to maintain the value of such products (Villalobos et al. 2019).

Reviewing the mathematical models published so far, it is worth noting the publication by Chen et al. (2020), which clarifies that articles about vehicle routing problems often do not address the implications of perishable food delivery. For that reason, they present research on a multi-compartment vehicle routing problem with time slots appearing for fresh food delivery. By solving the problem, researchers obtain a 37% improvement in the costs of fresh produce delivery, which shows that there is a lot of room for improvement. The main limitation identified is that the developed model considers homogeneous transports with equal capacities. In the search to ensure perishable product conservation, another alternative to avoid home delivery service waste is to provide anticipatory delivery of orders to improve the service of transportation. Rasini et al. (2020) formulate a stochastic programming model by using backward dynamic programming to study the anticipatory shipment to pick up points. The results of the numerical experiments suggest that anticipatory shipments can have substantial benefits both in terms of cost and delivery time. As a consequence, the benefits of anticipatory shipments rise with increasing collection-point capacity, but profits decrease if short delivery times are offered to the customer. Although the proposed model allows e-grocers to optimize shipping costs, the study did not incorporate different collection points. In addition, they did not incorporate the warehouse stock in the calculations when providing this new service.

Moreover, when optimizing transport activities, the relationship between both channels must be taken into account. There are several findings on the substitution between online purchases and physical sales because these two channels will accompany each other or end up being replaced (Dias et al. 2020; Suel et al. 2018). As a result, the presence of several distribution alternatives in multichannel retailing makes e-fulfillment process challenging. Paul et al. (2019) demonstrate that significant benefits can be achieved by sharing the forwarding capacity in a multichannel context. When consumers shop online and pick up at store their orders, stores are typically visited by a truck that supplies the collection points and by a transport that replenishes the inventory of the store. By developing a mixed-integer linear programming model, the aim of their study is to leverage any available capacity in the transport that replenishes store inventories by transferring online orders to these trucks. The main limitation identified in this article is that the constraints posed by perishable products are not defined. Each type of product requires different conservation conditions, which means trucks must have compartments with different temperatures and capacities.

In addition to considering the nature of products and possible improvements in travel, in recent years the tight shipping times have been creating a problem in the last-mile transport. As a result, practitioners innovated in many concepts, among which unmanned aerial vehicles (drones) and autonomous delivery robots that take charge of the delivery of orders stand out (Boysen et al. 2020). Furthermore, authors such as Liu et al. (2020) developed a multi-objective optimization model in which these alternatives are introduced to meet the expectations of customers. The aim of this mathematical model is to determine the optimal locations of the depots, optimize the number of orders delivered and the associated routes. This research contributes to the mastery of last-mile network design by modeling the environmental and economic cost of e-grocery distribution adopting mixed fleets. One of the gaps to be highlighted is that the researchers assume unlimited capacities in the deposits and define a homogeneous demand for orders.

So far, the mathematical models reviewed are focused on reducing costs. Authors such as Agatz et al. (2008) state that firms must seek a balance between service level and operational costs to ensure business profitability. Following that condition, their study presents a mathematical model based on the definition of the best time windows according to each region, calculating the delivery route costs. Despite this contribution, the model is limited by defining the same demand for all time windows.

In conclusion, the studies that focus on last-mile optimization do not consider the number of implications that the previous order preparation process implies. E-grocers must do joint management and planning of the order preparation and transport activities to ensure a good customer service. The review of existing literature on mathematical models aimed at e-grocery highlighted two large areas of study: picking activities and last-mile transport. However, there appears to be a clear lack of mathematical models that deal with both activities jointly (Chen et al. 2020).

The mathematical model for order planning developed in this publication arose because of the integration of picking and transport activities, taking into account the inherent complications of the online food channel. To do this, the work takes a business model based on order preparation and delivery from an exclusive online warehouse, which offers home delivery, click and drive (C&D) and click and collect (C&C) modalities. Among other novel aspects, it should be pointed out that each product type is managed in a different way. For picking, that means specialized means for each product type, and for transports, it means the definition of the capacity of the different temperature compartments. Furthermore, this study presents the possibility of comparing two different logistics scenarios: (i) workload leveling of the available means, or (ii) maximization of the occupation of means needed. With this differentiation, the proposed approach can be adapted to the reality of supermarket chains that operate in the online channel working with their own or external means. In the model that uses their own means, the main objective when it comes to minimizing costs is usually to balance the workload. Conversely, when supermarkets seek increased adaptability to demand, the main objective is usually associated with maximizing occupation to use the fewest means. Furthermore, both logistics scenarios allow the e-grocer to compare the operational costs they have depending on the business model and seek, for each of the cases, the lowest e-fulfillment cost.

3 Definition of the proposed approach

This section introduces a mathematical model that jointly optimizes picking and transport activities for an e-grocer that operates from a single warehouse dedicated to the online channel. The horizon for carrying out order fulfillment activities is defined by using a base period, which is called a time window. The model developed is designed to work with a rolling time horizon, which allows order planning to be updated as new customer orders arrive. During the study, the reference was a weekly planning horizon that is updated each day. However, the model offers the possibility for each firm to adapt the time horizon and the planning updates to whatever suits them best.

The proposed approach seeks to manage picking and transport activities efficiently and jointly in such a way that operational costs and product quality loss are reduced. To do so, the model determines the time windows in which order preparation must be carried out and allocates the available trucks to the delivery routes. Furthermore, to guarantee customer satisfaction, the obtained planning should meet a series of requirements: orders must be delivered in the time window chosen by the customer when the order was placed, the customer must receive the whole order on one visit and all the products must be prepared and transported under suitable conservation conditions. To maintain food product traceability, the items in an order are differentiated into three types: dry, fresh, or frozen. During order preparation, all products of one category are grouped in boxes, which will later be transported to the delivery point.

The model presented here considers the possibility of advancing preparation of both dry and frozen products, which are stored at a suitable temperature until being dispatched. Conversely, foods from the butcher, fishmonger, delicatessen, bakery or greengrocer sections (falling within the fresh foods category) must be prepared during the same time window as delivery. This is because perishable products are more sensitive and advancing their preparation could lead to quality problems (Mkansi et al. 2018).

The capacity to prepare orders at the warehouse in each time window will be different depending on the type of products. Thus, in one-time window, each of the three warehouse areas (fresh products, dry products and frozen products) can have a distinct capacity available. This is because the degree of specialization of the pickers, and therefore the cost, is different in each case. The fresh food category tends to require greater specialization in preparation. Likewise, pickers of frozen products are exposed to very low temperatures, which means they cannot work continuously. For those reasons, the costs associated with these two preparation areas tend to be higher than those for the dry products area. The capacity of a time window is usually defined according to the means assigned to each area. Because of the great variety of product shapes and sizes, the capacity of each preparation time window is defined in terms of the number of boxes, which are made up according to product groupings (Yousefi Nejad Attari et al. 2020).

In the search for efficient logistics, the online food sector tends to resort to multi-compartment vehicles (Ostermeier et al. 2018). Thus, to ensure food product traceability, trucks required for deliveries usually have separate insulated compartments at different temperatures, which allow products of all types to be carried (Chen and Shi 2019). Each compartment has a defined capacity, which is measured in the same way as for preparation areas, that is, by number of boxes. This study considers a fleet of heterogeneous trucks, whose capacity is defined according to the availability of trucks and drivers. In this way, there is a possibility to adjust the dimension of each truck to adapt them to peaks in demand or set at zero when the transports are not available. In terms of delivery service, the model contemplates three delivery modes: home delivery, picked up by car (C&D) and picked up at store (C&C). Regardless of which service the client chooses, orders are prepared in the warehouse and then assigned to delivery trucks. Because not all trucks or delivery services are the same, the costs associated with moving and delivering orders varies depending on the time and distance of the delivery (Ostermeier and Hübner 2018).

As for delivery route management, this is done by grouping customers into regions. The regions are considered to be far enough away from the warehouse and from each other so that a truck can go to only one region during each time window. This does not mean that only one truck can go to each region as several trucks can carry out the same types of route. As a consequence, all the orders assigned to a truck at one time must belong to the same region. In this way, a maximum route time is ensured, below which there is no risk of quality loss. At the same time, a physical store operates in each region and acts as a support for C&C or C&D order delivery. These stores are also collection points where dissatisfied customers can return products. For home delivery orders, an average radius distance is determined for each area from the store to the customers. Taking into account the variations that can exist in each region because of its geography and road network, the distance is corrected by means of the Wiggle Factor (Cooper 1983).

As a result, once orders are complete and prepared for delivery, they are assigned to the available trucks in the time window requested by the customer. As Fig. 1 shows, each of the trucks carries out a first run from the warehouse to the main physical store of each region. Once there, it leaves the C&C and C&D at customer service and then starts to deliver to homes. Once the orders have been met, it can go back to the store to deal with any returns occurring during the delivery or to leave orders that could not be dispatched. In this way, inverse logistics is considered by avoiding products being transported back to the warehouse, which would lead to the maximum time for guaranteed conservation being exceeded.

Fig. 1
figure 1

Route of transports in each time window

Bearing in mind that the capacity of available means at any time may not be sufficient to meet demand, both for picking activities and transport, the concept of slack has been included. Thus, the e-grocer will be able to identify which orders cannot be prepared or transported using the defined capacity in each time window. To solve this drawback, e-grocers can take measures in the time windows such as reallocate means, use overtime or hire more pickers or vehicles. Therefore, these slack measures are defined as a very high penalty cost that are only employed to highlight infeasibilities. In this way, if an initial calculation detects an infeasibility, the capacity can be adjusted and the model can be recalculated.

The mathematical model should allocate online orders by considering the different characteristics of the warehouse, the orders and the available vehicles. The input data for the developed model comes from the order characteristics and warehouse and vehicle features, collected in the database of the company. Our model allows the development of two main strategies depending on the preferences of the e-grocer and the nature of the means required for picking and transport activities. On the one hand, mainly for companies that work with their own resources the model allows the workload of means to be leveled. On the other hand, a transformation of the proposed approach has been developed to adapt to those companies with a strategy of minimizing the means for online order preparation and delivery. In this way, we are illustrating a mathematical model that solves the problem found to carry out the order scheduling for two well-differentiated e-fulfillment strategies. The weekly schedule allocates orders to the different time slots and vehicles to obtain the best optimal solution. That solution should indicate where each order ought to be prepared, and what the most appropriate picking time window is, to minimize the e-fulfillment costs.

4 Mathematical model formulation

This section describes the problem of allocating online orders for the supply chain optimization of an e-grocer. The proposed mathematical model allows users to adapt to two types of strategies. That is why, based on the problem setting described above, this section describes the problem settings to optimize the cost of picking and transport activities of both strategies. The first section presents a model for those e-grocers that work with their own means. E-grocers with this business model tend to level the workload of means to avoid imbalances in their occupation. Based on the model obtained, in the second section a series of modifications will be made to limit the quantity of accessible trucks and pickers to adjust the model to the case of companies that work with outsourced means.

4.1 Notation of the workload leveling scenario

The input data of the proposed approach are the orders i ∈ I = {1, …, I} requested by customers through the online channel. Each of the orders must be delivered in the time window j ∈ J = {1, …, J} selected by the customer. For this, the e-grocer has heterogeneous trucks k ∈ K = {1, …, K} that operate in different regions z ∈ Z = {1, …, Z} into which the delivery area offered is divided.

Each prepared order is made up of a certain number of boxes, each of which contains items of the same typology. For notation convenience, we use superscripts ‘D’, ‘FR’ and ‘FZ’ to represent the parameters and variables associated with dry, fresh, and frozen products, respectively. Note that NiD, NiFR, NiFZ represent the number of dry, fresh and frozen products boxes per order i. From these parameters, the data necessary for the definition of the formulation are defined as binary BiD = 1, BiFR = 1 and BiFZ = 1 if NiD, NiFR and NiFZ are greater than zero, respectively.

The capacity of each time window of the picking activity is expressed in number of boxes. This value must be determined based on the number of means available in each of the picking areas. As indicated in Fig. 2, the maximum picking capacity of dry products boxes is denoted as MPCj. Besides this, to obtain the order picking cost per box at each time window j, it is necessary to divide the cost of the means of each type of products by the capacity. This cost includes the collection of the products from the shelves, the packaging and their replacement. The sum of these three terms is defined as PCj.

Fig. 2
figure 2

Definition of order picking capacities and costs

Considering that the preparation of dry and frozen products can be advanced and, therefore, not all types of products of the same order have to be prepared in the same time window, the following decision binary variables are defined:

$${p}_{ij}^{D}= \left\{\begin{array}{l}1\quad {if\,dry\,products\,of\,order}\,i\,{are~prepared~at~time~window}~ j\\ 0\quad otherwise\end{array}\right.$$
$$ {p}_{ij}^{FR}= \left\{\begin{array}{l}1 \quad if\,fresh\,products\, of \,order\, i \,are\, prepared\, at\, time\, window\, j\\ 0\quad otherwise\end{array}\right.$$
$${p}_{ij}^{FZ}= \left\{\begin{array}{l}1\quad if\, frozen\, products\, of\, order\, i \,are\, prepared\, at\, time\, window\, j\\ 0\quad otherwise\end{array}\right.$$

Furthermore, with regard to transport activities, the characteristics of the online demand must be considered. Firstly, CCi parameter is created to take into account the delivery method of each order. This parameter takes the value of 1 if the delivery method is C&C or C&D, and takes the value 0 if the order is home delivery. Secondly, the delivery time window is expressed by BTWij, that is 1 if shipment i should be delivered at time window j, and 0 otherwise. Lastly, the parameter BRiz is 1 if i belongs to the region z. In addition, for the last-mile of orders it is necessary to determine for each of the regions: (i) a delivery distance Lz that represents the roundtrip kilometers from the warehouse to the central store in each region z, (ii) an average distance Rz within which home delivery orders are made and (iii) a Wiggle Factor WFz that allows this average distance to be adjusted more precisely in each region.

The capacity of each distribution time window is defined according to the available trucks. The capacity of the trucks is defined in number of boxes. This value must be determined based on the size of the compartments available for each type of products. MTCjk represents the maximum capacity of products boxes that can be delivered per each truck k at time window j. Last-mile costs are calculated from the kilometers traveled and the time spent on making deliveries. The traveling cost per kilometer of each truck k is KMCk, which is calculated based on the expenses generated by each truck such as fuel costs, salary of the driver and maintenance. Moreover, the cost of delivery an order is defined according to the time allocated to this activity, which is made up of: (i) a cost corresponding to the time spent handling the boxes that make up the orders and (ii) a fixed cost for the time that it elapses from when the merchandise is unloaded until the delivery is managed. Usually, C&C and C&D orders the delivery time is shorter than for home delivery, since several orders are managed at the same time and there is no interaction with the customer. Therefore, there is a variable loading and unloading cost per box for order handling BMCk and other fixed delivery charges. These delivery charges differ in HDCk for home deliveries and CCCk for those that are collected in store. A summary of the notation of transport costs is shown in Fig. 3.

Fig. 3
figure 3

Definition of transport capacities and last-mile costs

Subsequently, two new decision variables that assign the orders among the available trucks and determine a delivery region for each truck are defined:

$${x}_{ijk}= \left\{\begin{array}{l}1 \quad if\, the\, order\, i\, is \,delivered\, in\, the\, truck\, k\, at\, time\, window\, j\\ 0\quad otherwise\end{array}\right.$$
$${y}_{jkz}= \left\{\begin{array}{l}1\quad if\, the\, truck\, k\, delivers\, in\, region\, z\, at\, time\, window\, j \\ 0 \quad otherwise\end{array}\right.$$

As explained in the problem definition, a slack term is added to both picking and transport capacities. The units of these slacks will correspond to those of the capacity in each case, since they represent the additional capacity required. In the case of order picking, the parameters hpj are created to indicate the number of boxes. These boxes should be prepared in larger quantities in time window j, although this is not possible due to lack of capacity in that time window. Similarly, the capacity slack of the compartments of each truck k is denoted as htjk. Likewise, it should be taken into account that in the transport activity, infeasibilities may arise—in addition to if capacities are exceeded—if there are fewer trucks than delivery areas. For this case, the binary variable udij is defined, which takes the value 1 if it has not been possible to deliver order i at time window j, and 0 otherwise.

Finally, assuming that the e-grocer works with its own means and therefore is interested in balancing the workload occupation, the weekly leveling of picking and transport activities is defined. In the case of picking, the leveling is carried out according to the percentage of occupation of time windows, taking into account the relationship between the occupation of the means and the maximum capacity allowed. In this sense, only the leveling of dry and frozen products is considered, since fresh products have to be prepared in the same delivery time window and therefore the workload cannot be leveled. Since the cost of delivery does not only depend on the occupation of the trucks, to level the load of trucks, both the delivery distance and the number of deliveries made in the same region will be taken into account. On this wise, the expense generated by each truck is leveled, so drivers can receive a similar salary for their benefits. For each truck its payment function is denoted by TCFk. Considering the weekly rolling horizon with daily updating, in the case of transport leveling, it is necessary to know the expense already generated by each truck in the previous period. The definition of the PTCFk pre-payment function allows leveling the new week taking into account the costs of each truck in the previous period. When leveling the workload of means, it is very important to define the leveling accuracy. Each e-grocer can define the maximum allowable difference between the occupation of the picking time windows and the payment function of each truck. For this, MDO is defined, which expresses the maximum occupancy difference between the picking means that prepare the same type of products as a percentage. Intending to compare this maximum admissible difference with the occupation values of the means in the time horizon, a pair of variables is defined that take the maximum and minimum occupation values: hoD and loD for dry products, and hoFZ and loFZ for frozen products. Moreover, the e-grocer must define MDCF as the maximum monetary difference between the payments made to drivers for the kilometers traveled and the number of deliveries. Similarly, the pair of variables hct and lct are defined to compare this difference with the maximum and minimum values of the payment function. A summary table of the notation introduced can be consulted in Table 1.

Table 1 Scheme of the parameters considered in the model

The objective function of the proposed optimization approach presents the e-fulfillment costs to be minimized. The total cost is formed by five addends, representing the cost associated to the main activities: order picking processes and delivery. On the one hand, the first addend that illustrates the preparation cost is formed by three addends. Each of them corresponds to the preparation of one of the three types of products, since these costs usually are different. The resulting cost in the time horizon of the preparation of all the dry, fresh, and frozen product boxes is obtained by multiplying the number of boxes prepared in each time window by the unit cost of the corresponding time slot.

On the other hand, the next three addends refer to delivery activities. Although all of them could be grouped into one, they have been separated to simplify the explanation. Each sum corresponds to one of the differentiated distribution cost concepts: (i) cost according to the number of kilometers traveled, (ii) delivery charges and (iii) variable delivery costs. Firstly, the addend that defines the cost as a function of the kilometers traveled is divided into the sum of two terms. On the one hand, the cost associated with the distance traveled from the warehouse to the delivery regions. On the other hand, the cost of travel within each of the regions, corresponding to home delivery orders. For greater clarity when representing said cost, the number of C&C and C&D orders that a truck transports to an area in a given time window has been denoted as NCCjkz, and is calculated as: \({NCC}_{jkz}= \sum_{i\in I}{CC}_{i}\cdot {x}_{ijk}\cdot {BR}_{iz}\). Secondly, the next sum represents the fixed charges per delivery, which are different for home delivery orders and for those collected in the store. To calculate the total fixed cost, the number of orders for each modality is multiplied by its defined cost. Finally, the third term refers to the variable cost per delivery corresponding to the handling of the boxes that make up the orders. This cost is the result of multiplying the cost of handling one box by the occupation of the truck.

To achieve the defined workload leveling, the objective function includes the fifth addend representing the use of slacks. This logistical expression depends on the value of ‘M’, which is a sufficiently large number to prevent the model from using slacks if they are not strictly necessary (Williams 2013). The ‘M’ parameter always has the same meaning and its value is 1,000,000. In this way, the use of some slack will be easily identifiable and the necessary capacity and asset adjustments can be changed to make the problem feasible. Based on the notation introduced, the objective function of the workload leveling scenario is formulated as follows:

$$\begin{aligned}&Min\quad \sum_{i\in I}\sum_{j\in J}\left({PC}_{j}^{D}\cdot {p}_{ij}^{D}\cdot {N}_{i}^{D}+{PC}_{j}^{FR}\cdot {p}_{ij}^{FR}\cdot {N}_{i}^{FR}+ {PC}_{j}^{FZ}\cdot {p}_{ij}^{FZ}\cdot {N}_{i}^{FZ}\right)\\&\quad+\sum_{j\in J}\sum_{k\in K}\sum_{z\in Z}{KMC}_{k}\cdot \left[{y}_{jkz}\cdot {L}_{z}+ \sum_{i\in I}\left({x}_{ijk}-{NCC}_{jkz}\right)\cdot {R}_{z}\cdot {WF}_{z}\right]\\&\quad+\sum_{j\in J}\sum_{k\in K}\left[\sum_{i\in I}{x}_{ijk}\cdot {HDC}_{k}+ \sum_{z\in Z}{NCC}_{jkz}\cdot \left({CCC}_{k}-{HDC}_{k}\right)\right]\\&\quad+\sum_{j\in J}\sum_{k\in K}{BMC }_{k} \cdot \sum_{i\in I}{x}_{ijk}\cdot ({N}_{i}^{D}\\&\quad+{N}_{i}^{FR}+{N}_{i}^{FZ})+ \sum_{j\in J}\left[\left({hp}_{j}^{D}+{hp}_{j}^{FR}+{hp}_{j}^{FZ}\right)+\sum_{k\in K}\left({ht}_{jk}^{D}+{ht}_{jk}^{FR}+{ht}_{jk}^{FZ}\right)+\sum_{i\in I}{ud}_{ij}\right]\cdot M\end{aligned}$$
(1)

The formulated objective function is subject to constraints (2)–(26) ranked among four groups. The first set includes the constraints (2)–(7), which ensure that both time windows picking capacities and truck compartment capacities are not overcome. On the one hand, constraints (2)–(4) ensure that the number of boxes prepared of each type of products cannot exceed the maximum picking capacity for each time window plus the auxiliary slack variable. On the other hand, constraints (5)–(7) guarantee that the number of boxes delivered of each type of products in each truck at each time window must be less than the capacity of each compartment plus the auxiliary slack variable.

$$\sum_{i\in I}({p}_{ij}^{D}\cdot {N}_{i}^{D})\le {MPC}_{j}^{D}+{hp}_{j}^{D}\quad \forall j$$
(2)
$$\sum_{i\in I}({p}_{ij}^{FR}\cdot {N}_{i}^{FR})\le {MPC}_{j}^{FR}+{hp}_{j}^{FR}\quad \forall j$$
(3)
$$\sum_{i\in I}({p}_{ij}^{FZ}\cdot {N}_{i}^{FZ})\le {MPC}_{j}^{FZ}+{hp}_{j}^{FZ}\quad \forall j$$
(4)
$$\sum_{i\in I}{(x}_{ijk}\cdot {N}_{i}^{D})\le {MTC}_{jk}^{D}+{ht}_{jk}^{D}\quad \forall j,k$$
(5)
$$\sum_{i\in I}{(x}_{ijk}\cdot {N}_{i}^{FR})\le {MTC}_{jk}^{FR}+{ht}_{jk}^{FR}\quad \forall j,k$$
(6)
$$\sum_{i\in I}({x}_{ijk}\cdot {N}_{i}^{FZ})\le {MTC}_{jk}^{FZ}+{ht}_{jk}^{FZ}\quad \forall j,k$$
(7)

The second group of constraints corresponds to the order picking. Constraints (8)–(10) guarantee that all type of products of an order are prepared in a single time window. Constraints (11)–(13) ensure that the order is complete before its delivery. Considering conservation requirements, constraint (11) establishes that, if the order has fresh items the picking and the delivery of its products must be done in the same time window. In the case of dry and frozen products, constraints (12) and (13) establish that the preparation can be done in the same time window or in one of the above.

$$\sum_{j\in J}{p}_{ij}^{D} = {B}_{i}^{D}\quad \forall i$$
(8)
$$\sum_{j\in J}{p}_{ij}^{FR} = {B}_{i}^{FR}\quad \forall i$$
(9)
$$\sum_{j\in J}{p}_{ij}^{FZ} = {B}_{i}^{FZ}\quad \forall i$$
(10)
$$\sum_{j\in J}(j\cdot {p}_{ij}^{FR})=\sum_{j\in J}(j\cdot {BTW}_{ij})\quad \forall i/{B}_{i}^{FR}=11$$
(11)
$$\sum_{j\in J}(j\cdot {p}_{ij}^{D})=\sum_{j\in J}(j\cdot {BTW}_{ij})\quad \forall i$$
(12)
$$\sum_{j\in J}(j\cdot {p}_{ij}^{FZ})=\sum_{j\in J}(j\cdot {BTW}_{ij})\quad \forall i$$
(13)

The third group of constraints (14)–(17) corresponds to the activity of distribution of orders. Constraint (14) guarantees that all orders are delivered at the right time. Constraint (15) limits that each truck can only go to a single region at the same time slot. If the transport capacity for the same area is exceeded, the model allows more than one truck to be assigned for that region. Constraints (16) and (17) ensure that trucks with an assigned order visit the delivery region in the corresponding time window. Multiplying the equation by the M parameter ensures that the condition always remains true.

$$\sum_{k\in K}{x}_{ijk} ={BTW}_{ij}\quad \forall i,j$$
(14)
$$\sum_{z\in Z}{y}_{jkz} \le 1\quad \forall j,k$$
(15)
$$\sum_{i\in I}{x}_{ijk} \cdot {BR}_{iz} \le M \cdot {y}_{jkz}\quad \forall j,k,z$$
(16)
$$\sum_{i\in I}{x}_{ijk} \cdot {BR}_{iz} \ge {y}_{jkz}\quad \forall j,k,z$$
(17)

The fourth and last group of constraints (18)–(26) correspond to leveling, so they are only written when using the approach of this section. Constraints (18) and (19) calculate the dry box preparation occupancy of each time window, so the number of boxes prepared in each one is divided by their maximum capacity. The variables hoD and loD take, respectively, the maximum and minimum values of the calculated occupations. Complying with constraint (20), the difference between the two cannot exceed the maximum limit established. Similarly, constraints (21)–(23) have the same function, but for frozen products. Following the same reasoning, constraints (24)–(26) level the payment function of each truck. To simplify the notation of some constraints, the TCFk parameter has been defined which groups together the terms of transport expense for each truck. \({TCF}_{k}= \sum_{j\in J}\sum_{z\in Z}{KMC}_{k}\cdot \left[{y}_{jkz}\cdot {L}_{z}+ \sum_{i\in I}\left({x}_{ijk}-{NCC}_{jkz}\right)\cdot {R}_{z}\cdot {WF}_{z}\right]+\sum_{j\in J}\sum_{i\in I}{BMC }_{k}\cdot {x}_{ijk}\cdot ({N}_{i}^{D}+{N}_{i}^{FR}+{N}_{i}^{FZ}) + \sum_{j\in J}\left[\sum_{i\in I}{x}_{ijk}\cdot {HDC}_{k}+ \sum_{z\in Z}{NCC}_{jkz}\cdot ({CCC}_{k}-{HDC}_{k})\right]\). There are three addends for each truck: (i) cost for the number of kilometers traveled, (ii) fixed delivery costs per order and (iii) variable delivery costs.

$$\frac{\sum_{i\in I} {p}_{ij}^{D}\cdot {N}_{i}^{D}}{{MPC}_{j}^{D}} \le {ho}^{D}\quad \forall j$$
(18)
$$\frac{\sum_{i\in I} {p}_{ij}^{D}\cdot {N}_{i}^{D}}{{MPC}_{j}^{D}} \ge {lo}^{D}\quad \forall j$$
(19)
$${ho}^{D}-{lo}^{D}\le MDO$$
(20)
$$\frac{\sum_{i\in I} {p}_{ij}^{FZ}\cdot {N}_{i}^{FZ}}{{MPC}_{j}^{FZ}} \le {ho}^{FZ}\quad \forall j$$
(21)
$$\frac{\sum_{i\in I} {p}_{ij}^{FZ}\cdot {N}_{i}^{FZ}}{{MPC}_{j}^{FZ}} \ge {lo}^{FZ}\quad \forall j$$
(22)
$${ho}^{FZ}-{lo}^{FZ}\le MDO$$
(23)
$${TCF}_{k}+ {PTCF}_{k} \le hct\quad \forall k$$
(24)
$${TCF}_{k}+ {PTCF}_{k}\ge lct\quad \forall k$$
(25)
$$hct-lct \le \mathrm{MDCF}$$
(26)

4.2 Transformation into a model that optimizes the use of resources

In an attempt to obtain a flexible model capable of adapting to e-grocer preferences, this section presents a modification of the leveling mathematical model proposed in Sect. 4.1. Maintaining the main objective of optimizing the e-fulfillment costs, the transformation is based on replacing the workload leveling limitations presented in the original model with a series of parameters and constraints that allow minimizing the means required. This approach is aimed at those e-grocers that tend to outsource picking and delivery activities to third party logistics. In this case, the objective of companies is usually oriented to increase the occupation of means, which allows them to manage fewer pickers and transports internally. In addition, in the case of transport activity, this modification is presented as a more optimal option in the resource usage since orders are grouped into the fewest number of trucks possible.

Regarding general data, for the scenario of minimization of number of means, the cost approximation described in Sect. 4.1 is maintained since the workload leveling of the means is carried out in the constraints and does not affect the objective function. For this reason, in this new approach only the data, variables and constraints that are related to leveling should be eliminated, keeping the rest. However, due to the need to represent the availability of means, a new concept is added to the total cost. In outsourcing models, having outside personnel and trucks implies an additional cost, derived from the opportunity cost and the management of contracts. For this reason, the goal of this mathematical model is to complete the occupation of contracted means to use the least possible. For the notation and calculation of this availability cost, a series of additional parameters and variables are defined. In the case of transport, the TUCk parameter defines the cost per availability of each truck in the planning horizon considered, since it is assumed that the contracting of transports is carried out by periods. The variable that controls its use is denoted as tuk and takes values one if the truck k should be available and 0 otherwise. With regard to preparation, the TWUCj cost is defined for each time window required. The utilization of a time window implies that it must be available, so an availability cost is determined. To control the use of the means dedicated to the preparation of each type of product, the binary variables twujD, twujFR and twujFZ are defined, which take the values:

$${twu}_{j}^{D}= \left\{\begin{array}{l}1\quad if\,pickers\, of\, dry\, products\, should \,be\, available\, at\, time\, window\, j\\ 0 otherwise\end{array}\right.$$
$${twu}_{j}^{FR}= \left\{\begin{array}{l}1\quad if\, pickers\, of\, fresh\, products \,should \,be \,available\, at\, time\, window\, j\\ 0 otherwise\end{array}\right.$$
$${twu}_{j}^{FZ}= \left\{\begin{array}{l}1\quad if\, pickers\, of\, frozen\, products\, should\, be \,available\, at \,time \,window\, j\\ 0 otherwise\end{array}\right.$$

The objective function described for this new minimization approach retains the purpose of reducing e-fulfillment costs. For this reason, the definition of the costs of picking, transport, and penalties for the use of slacks will be maintained. In this new approach, leveling terms should be removed and two more addends must be included. On the one hand, one of the addends represents the cost of availability of the means of each time window. To calculate it, just multiply the availability cost of each time window by the binary variable that indicates whether or not that time window has been used. On the other hand, the last addition corresponds to the cost of availability of transport means. As in the case of picking, this cost is calculated by multiplying the availability cost by the binary variable that indicates whether or not the truck has been required in a given time horizon. Therefore, the notation of the objective function for the scenario of minimization of number of means is denoted as follows:

$$\begin{aligned}&Min \sum_{i\in I}\sum_{j\in J}\left({PC}_{j}^{D}\cdot {p}_{ij}^{D}\cdot {N}_{i}^{D}+{PC}_{j}^{FR}\cdot {p}_{ij}^{FR}\cdot {N}_{i}^{FR}+ {PC}_{j}^{FZ}\cdot {p}_{ij}^{FZ}\cdot {N}_{i}^{FZ}\right)\\ &+\sum_{j\in J}\sum_{k\in K}\sum_{z\in Z}{KMC}_{k}\cdot \left[{y}_{jkz}\cdot {L}_{z}+ \sum_{i\in I}\left({x}_{ijk}-{NCC}_{jkz}\right)\cdot {R}_{z}\cdot {WF}_{z}\right]\\ &+\sum_{j\in J}\sum_{k\in K}\left[\sum_{i\in I}{x}_{ijk}\cdot {HDC}_{k}+ \sum_{z\in Z}{NCC}_{jkz}\cdot \left({CCC}_{k}-{HDC}_{k}\right)\right]\\ &+\sum_{j\in J}\sum_{k\in K}{BMC }_{k} \cdot \sum_{i\in I}{x}_{ijk}\cdot ({N}_{i}^{D}+{N}_{i}^{FR}+{N}_{i}^{FZ}) \\ &+\sum_{j\in J}\left[\left({hp}_{j}^{D}+{hp}_{j}^{FR}+{hp}_{j}^{FZ}\right)+\sum_{k\in K}\left({ht}_{jk}^{D}+{ht}_{jk}^{FR}+{ht}_{jk}^{FZ}\right)+\sum_{i\in I}{ud}_{ij}\right]\cdot M \\ &+ \sum_{j\in J}{TWUC}_{j}\cdot ({twu}_{j}^{D}+{twu}_{j}^{FR}+{twu}_{j}^{FZ})+\sum_{k\in K}{tu}_{k}\cdot {TUC}_{k}\end{aligned}$$
(27)

Regarding the constraints of this scenario, it is necessary to remove the constraint group referring to workload leveling. In addition, a new group of constraints is added to limit external means. As a consequence, the group of constraints (18)–(26) presented in Sect. 4.1, is replaced by the group (28)–(31). The new constraints (28)–(30) guarantee that, if the means for the order picking of dry, fresh, or frozen products are needed at any time window, they must be available. Similarly, constraint (31) ensures the availability of trucks that are required at some point in the time horizon. These logical expressions depend on the value of M, which is a sufficiently large number so that the condition always remains true.

$$\sum_{i\in I}{p}_{ij}^{D}\le M\cdot {twu}_{j}^{D}\quad \forall j$$
(28)
$$\sum_{i\in I}{p}_{ij}^{FR}\le M\cdot {twu}_{j}^{FR}\quad \forall j$$
(29)
$$\sum_{i\in I}{p}_{ij}^{FZ}\le M\cdot {twu}_{j}^{FZ}\quad \forall j$$
(30)
$$\sum_{i\in I}\sum_{j\in J}\sum_{z\in Z}{x}_{ijk} \cdot {BR}_{iz}\le M \cdot {tu}_{k}\quad \forall k$$
(31)

As a summary, keeping most of the general data, variables and constraints described in Sect. 4.1, slight modifications allow us to adapt the model to two different logistic scenarios. In both scenarios, the main goal is to minimize the cost related to e-fulfillment activities. For the leveling scenario, the condition of leveling the workload of the means is also added. On the other hand, for the optimal resource usage scenario the model groups the workload in the most economical means, which is why it is considered more convenient in a subcontracting situation. Therefore, the model serves both as a planning tool for picking and transport activities and to offer the e-grocer a comparison of the costs incurred in each of the logistics scenarios.

5 Case study

The case study of this research raises the need to support online order planning in supermarket chains with a mathematical model that allows associated costs optimization. This section uses data from the pioneer in e-grocery in Spain to illustrate how the model can be applied to a real case. First, we describe the characteristics, the magnitude of the analyzed company and the input data used in the experiments. Section 2 presents the initial situation of the company applying a workload leveling scenario for the own means (pickers and trucks). The results show how the proposed mathematical model allows the occupation of means to be balanced. Based on the results obtained, Sect. 3 develops the optimization scenario to minimize the use of means. In this way, it is possible to carry out an analysis and a comparison of the costs and the distribution of the workload between both strategies to know the highlights of the model. Finally, in Sect. 5.4, two experimental studies of interest defined by the company and a computational study are carried out to empirically evaluate the validity of the model.

5.1 Study area

Considered within the scope of the study, the mathematical model for electronic compliance scheduling has been applied in the oldest supermarket chain in Spain. This e-grocer has a network of 320 supermarkets, in which more than 7000 people work. The firm selected in the study stands out for being the first supermarket chain to enter in the online business and for being the first company that allocated an area of 4000 square meters exclusively to online order preparation. Unlike many of the Spanish supermarket chains, this company has a strategic model for preparing and shipping orders from the warehouse and not from traditional stores. They had a multichannel model and traditional stores have been used by customers as pick-up points. The same stores serve as collection points for the reverse logistics. To develop the case study, input data was gathered from the firm database, which contains the information provided by customers when they place orders on the website. This database also contains the characteristics of the e-grocer in terms of features of the warehouse, the transports and the available means.

The company under study prepares and ships online orders from a single central warehouse. The average number of orders demanded is 111 online orders per day. To carry out order preparation and delivery, the firm works with six time slots, each of which lasts for two hours. For each time window, the firm has between four and seven pickers to gather each product type. The preparation capacity in a time window averages at 8 boxes for fresh products, 10 boxes for frozen products and 15 boxes for dry products. Regarding distribution means, the firm has a fleet of 12 heterogeneous trucks each with three compartments at different temperatures that can carry between 15–35 dry products boxes, 10–15 fresh products boxes and 10–15 frozen products boxes. For cost purposes, the hourly pay rate is €15 for dry pickers, €17.50 for frozen pickers and €20 for those who prepare fresh products. The price per kilometer is calculated according to the vehicle characteristics and is between €0.80 and €1.20 per kilometer. Handling and delivery costs run at an average of €15.00 per hour for each driver. Additional costs are €0.30 for order handling, €2.50 charges for home deliveries and €1.25 charges for pick-up point deliveries. To determine the location of deliveries, the firm has identified ten delivery regions within its metropolitan area. The specific input data entered to solve the scenarios can be consulted in the Zenodo repository with the https://zenodo.org/record/4677294#.YHV-zR8zbIU. To define the precision of the leveling it is necessary to detail the values of the different admissible maximums between preparation occupations and the driver payment function. The firm has established a 30% maximum difference between preparation time windows for dry and frozen products (MDO = 0.3) and €200 of maximum difference between the payment function received by each driver (MDCF = 200).

5.2 Results of the workload leveling scenario

The leveling data given above are the input elements used to implement the mathematical model. The firm under study works with a model based on leveling the workload of hired means, which is why this section assesses the cost of e-fulfillment obtained for the initial scenario. As a result, the value is known of binary variables that allow planning of picking and transport activities that meet customer delivery requirements and product conservation conditions. Thus, information is obtained regarding: the time window in which picking should take place of each product type; allocation of shipments to available trucks; and mapping of the transports to each delivery region at each time window. Furthermore, the model details the costs of e-fulfillment resulting from the initial leveling approach, which can be consulted in Table 2.

Table 2 Results for the workload leveling approach

From the results, the first point to observe is that transport costs account for 65% of e-fulfillment costs. It is worth noting that the average transport cost obtained for each order is €30.68. The size of this cost is to centralized order fulfillment leading to a substantial increase in delivery distances compared to preparation and distribution from a store. The remaining 35% of the total costs corresponds to picking costs, which has an average value of €16.12 per order. In this scenario for leveling means workload, it can be seen that all the picking time windows and available trucks are required.

5.3 Comparison of the results for workload leveling and minimization of the number of means

After obtaining the results for the initial situation of the firm based on workload leveling, the modifications described in Sect. 5.2 were made to adapt the model to the scenario of minimization of the number available means. The aim of this approach, like the leveling scenario, is to minimize overall cost. However, in this case maximization of the workload of the means is also sought to have as few pickers and trucks as possible. To compare both scenarios, the values were kept for equipment capacities and costs detailed in the above subsection. Thus, it is possible to analyze the incidence of leveling on total cost. In addition, for this approach, the firm has defined availability costs for the time windows and the trucks required in the time horizon. The cost of having preparation means available in a time window varied between €4.50 and €9, depending on the number of pickers. For transport, the availability cost of trucks and drivers varied between €15 and €45 per time window. The comparison of the results obtained in the simulation of the scenarios for leveling and minimization of the number of means can be seen in Fig. 4.

Fig. 4
figure 4

Components of e-fulfillment costs in both scenarios

When both scenarios were compared, an increase of 4.25% was obtained for the total cost of e-fulfillment for the minimization of number of means. However, it can be seen that this result is conditioned by the appearance of the concept of equipment availability costs. If the terms that are common to both scenarios are compared, a cost of €5,095 is obtained in the second scenario. This value is a 2% reduction in the cost compared to the initial situation of leveling. Considering that the profitability of the sector has often been questioned because of its heavy impact on logistics costs, the minimization approach offers an alternative, which could lead to a saving of €101 on the sample of orders selected. Because the sample corresponds to demand for the daily planning horizon, this saving could exceed €31,200 per year. However, for the second approach, transport continues to be the main cost of e-fulfillment. In this case, the average value is only reduced by 0.75% compared to the first scenario, which is an average cost of €30 per order. For preparation, this reduction comes to 4.16%, which means an average cost of €15 per order. It is worth mentioning that the economic differences between both scenarios are not the most important ones, as a comparison of the results also shows a noticeable variation in the level of usage of means and their capacities. Table 3 shows the level of occupation for the dry and frozen product time windows.

Table 3 Comparison of the occupation of the time windows in both scenarios

In this sense, the number of time windows required for dry and frozen product preparation drops from six to four, which is a 33% reduction. A decrease in usage is not possible in the case of the fresh products time windows because these items must be prepared and shipped in the same time slot. For workload leveling situation the dry product time windows, it can be seen that the occupation range varies between 47 and 77%, complying with the maximum difference of 30%. These results indicate that none of the time windows is used efficiently as, in the best case; almost 25% of capacity is unused. However, by using the approach of minimization of the number of means, full occupation is achieved of time windows 3 and 4, which reach 100% efficiency. Use of the first time window is conditioned by the fact that orders sent in it can only be prepared at that time. The priority for filling time windows is justified by their price, in such a way that the model seeks to increase occupation of those that have a lower unit cost for preparation. For that reason, it can be seen that the more expensive time windows are not r in the minimization approach and those are the ones with the lowest percentage of occupation in the workload leveling approach.

A similar situation can be seen for frozen products. Initially, by means of leveling, the efficiency range for occupation varied between 32 and 62%. Thus, there is clear underuse of the capacity of means, which reaches almost 70% in the worst case. On the other hand, with the minimization approach, occupation of time windows 1, 3 and 4 rises until full capacity and 100% efficiency are reached. As for dry products, use of time window 1 is unavoidable as some orders must be prepared and delivered at that time. For that reason, once the model completes the most economic time windows, it attempts to group most of the remaining preparation in just one window. Once the occupation of the first time window is completed, the rest of the frozen food boxes are assigned to time window 2, which has the same cost. In that way, it can be seen that time window 2 has 5% efficiency for occupation. To avoid such a low value, there are two measures the e-grocer could adopt: either increase the capacity of time window 1 so that it can take all the order preparation from time window 2, which can then be disregarded; or spread out the occupation of time windows 1 and 2 more equally as both have the same preparation cost.

Looking at transport, Table 4 contains the values obtained for the payment function in both scenarios. Because workload leveling considers the values of the previous payment function, the table shows two columns that correspond to workload means leveling. The first column shows the values given by the leveling model, including the previous payment function for each vehicle. For this reason, the second column for leveling shows the results of the payment function for the sample from the current horizon.

Table 4 Comparison of the transport payment function

The first aspect to notice in Table 4 is that, thanks to the scenario of minimization of the number of means, the number of trucks needed during the planning horizon drops 17% for the minimization approach. In addition, it can be seen that the payment function given by the leveling model is distributed in such a way that the difference between the maximum and minimum values is €200. These slight variations, which are within the set limit of €200, are what allow the workload to be distributed while at the same time minimizing the cost of the activity. However, by looking at the payment function corresponding to current orders, it can be seen that the difference increases to €323. This is due to the model trying to level the current period by considering the previous one to avoid always favoring or not favoring the same trucks. At the same time, for the approach of minimization of means, an increase is observed in the payment function in some transports. The most outstanding cases are trucks 3 and 9, with a cost increase of €118 and €113, respectively. The other variations stay within €50. Thanks to these adjustments, the workload was redistributed to avoid using trucks 4 and 8, which have the highest cost per kilometer.

As a conclusion, when the scenario of minimization of means is compared to the initial situation of the company, it has been demonstrated that there is a great deal of potential for improvement. In economic terms, it can be concluded that maximizing the equipment workload can lead to a saving of €31,200/year. The improvements are not only economic, however, because the usage of means is vastly increased. Thanks to the approach of minimization of the number of means, a 33% downsizing of pickers and a 17% decrease in necessary trucks were achieved. As a result, the final saving obtained in the variable costs described could be added to the fixed costs derived from using means owned by the company which could include repayment of machines and vehicles, the national insurance of workers, bonuses, etc. Therefore, the developed model is a tool for planning and calculating variable costs for e-fulfillment activities, which allows online supermarkets to optimize the use of means and run simulations to compare the costs of each approach.

5.4 Experiments

Once the case study results have been obtained, this section presents two scenarios defined by the firm, which analyze potential reductions in picking and transport expenses. The proposed approach is executed as a costs simulation tool in such a way that it can be employed as a support for decision-making. Because of the interest that e-grocers have in improving the profitability of order preparation and transport in their businesses, a quantitative study is first made of the savings that could be made by advancing the preparation of dry and frozen products. After that, the second section shows an analysis of how the transport cost varies when C&C or C&D are encouraged instead of home delivery. Moreover, at the end of this section, a computational experiment has been developed to demonstrate the behavior of the model, the resolution speed and some characteristics of the machine used to solve the case study.

5.4.1 Advancing the order picking processes

One of the main contributions of the mathematical programming model developed here has been its capacity to consider the possibility of advancing the preparation of some product categories. Both dry and frozen products can be prepared in any time window before delivery, as long as they are then stored at the correct temperature until dispatch. Conversely, as explained previously, the preparation of fresh products cannot be done any earlier as they are sensitive and perishable. The great advantage of being able to advance dry and frozen product preparation is that the firm can plan the use of its means more efficiently either by leveling or by maximizing occupation. Were this possibility not considered, then every orders would have to be prepared in its delivery time window because of the constraints imposed by fresh products. Planning of preparation means, therefore, would be limited to assigning complete order preparation to the corresponding time window. As a consequence, the cost of picking each order could be calculated as the number of boxes of each product type times their preparation cost in the time window that coincides with delivery. Figure 5 shows a comparison of the picking costs for both situations. Firstly, complete order preparation is carried out in the dispatch time window, and secondly, earlier dry and frozen product preparation is possible. This comparison has been made, as an example, with the scenario of minimization of number of means.

Fig. 5
figure 5

Variation of picking costs by advancing preparation

As the figure shows, advancing dry and frozen product preparation means a saving in the picking costs of almost 7%. If a daily demand for 111 orders maintained over time is considered, this saving is a total of €43/day for dry products and €85/day for frozen ones. Annually, the savings for both types come to €38,400. Therefore, in the search for optimization in e-fulfillment activities, the possibility of advancing the preparation of some products appears to be an interesting option for logistics costs reduction.

Regarding the decision variables, the use of time slots for both scenarios is maintained in terms of preparation. The six time windows are used because of the time slots chosen by the clients. Only the allocation of the preparation windows varies, where morning time windows have a higher occupancy than afternoon time slots. The transport decision variables are not modified because the experiment does not affect them, the orders being sent in the 12 available trucks.

5.4.2 Promoting collection services

The aim of this scenario is to analyze the influence on operational costs of customer preferences to the different delivery services. Home delivery offers a greater level of service and it is the mode most valued by customers even though it means the payment of an additional charge (Seitz et al. 2017). The firm defines this cost in an attempt to balance the delivery costs of managing the service. If the supermarket could increase the percentage of orders using C&C and C&D (through marketing campaigns, for instance) its delivery costs would be reduced. To carry out a quantitative analysis of the potential cost saving, the model is executed in three scenarios of the minimization approach increasing the number of orders to be collected. From a total of 111 online orders: (i) initial situation, 54 pickup orders, (ii) first scenario with 67 pickup orders and (iii) second scenario with 89 pickup orders. The results for each assumption are given in Fig. 6.

Fig. 6
figure 6

Transport costs according to the number of C&C and C&D orders

Both the delivery charges and the traveling costs decrease as the number of C&C or C&D orders increase. From the initial situation to the first assumption, with an increase of only pick-up 13 orders, a saving of €66 is made on the traveling costs and of €16 of the delivery charges. For the second assumption, increasing the pick-up orders by 35, this saving increases to €1800 for traveling costs and €44 for delivery charges compared to the initial situation. Together, the transport cost for the initial situation is reduced by 2.5% in the first assumption and 6.6% in the second. Maintaining these valued over time, the potential savings from this measure is almost €25,000/year assuming that 60% of orders could be C&C or C&D, and €67,000/year assuming that 80% of orders could be C&C or C&D.

Regarding the decision variables, in this scenario the variables related to preparation do not vary. The six preparation windows are used in all three scenarios. The transport decision variables do vary since many of the orders are no longer transported. Still, the decision variable for the number of vehicles used remains constant at twelve due to the shipping regions.

5.4.3 Computational study

The objective of this section is to test the performance and responsiveness of the model to possible growth in order demand. The linear programming model has been coded with the MPL (Mathematical Programming Language) system. The solver used has been Gurobi 8.1.1, which allows MILP (Mixed Integer Linear Programming) models to be solved using Branch & Bound algorithms. The computational experiments were run on a laptop with an Intel® Core ™ i5-5200U processor, 2.20 GHz and 4 GB of RAM.

Through the computational study, the scalability of the model is analyzed, evaluating its resolution capacity in the face of a sudden increase in demand. Starting from the sample provided by the company of 111 orders, an increase in demand has been simulated by replicating the data until obtaining volumes of 350, 500 and 700 orders. In all cases, the number of windows and available vehicles has been maintained. The capacities have been modified in proportion to the increase in demand. For each of the demand volumes, the time and the resolution gap are compared. Table 5 shows the results obtained.

Table 5 Results for computational study

Columns 1 and 2 establish the volume of demand and the approach used in each case. The following columns show the necessary calculation time and the gap obtained. The resource minimization approach has proven to be the fastest to calculate, taking less than 2 s for 111 orders. The calculation time for this approach grows as orders increase, but remains within reasonable values. For an assumption of demand for 700 orders per day, the calculation time does not reach 4 min. Since the one-hour calculation time limit is not reached, the gap of the minimization model is zero for all the cases studied. This means that the model returns the optimal solution in the indicated time. However, some variations are observed for the case of the leveling approach. In the initial situation, the resolution time is little more than a minute. For a demand volume of 350 orders, this value increases to 10 min and 35 s, for which there is a considerable increase in time. Both for the case of 500 and 700 orders, the time limit of one hour is reached. This does not mean that in that time the optimal solution has been found, but rather that as the gap indicates, there is a margin of 0.08% and 0.07% between the upper limit (the best feasible solution) and the lower limit (optimal solution with relaxed variables). Therefore, it is known that the optimal solution will lie between these two values, but the model has not been able to find it within the time limit. Therefore, it can be stated that the model is sensitive to leveling, since this approach requires more calculation time and, depending on the company's objectives, it will be a more or less interesting option.

6 Conclusion and outlook to future studies

Product conservation requirements and demanding delivery conditions in the online channel make the management of supermarket chain means a key aspect for ensuring business profitability. When the e-grocer picks online orders at separate fulfillment centers, order planning becomes difficult because a greater number of orders, means and delivery regions must be managed, compared to picking online orders in store. This article has addressed the problem of allocating and managing means for order preparation and transport at supermarket chains operating in the online channel. Although both problems are closely interconnected, most works have focused on the activities of picking or transporting orders separately. The intention of this article is to investigate whether it is possible to solve both problems in an integrated manner, guaranteeing product quality during preparation and delivery. Thus, the proposed approach does not only determine the cost resulting from carrying out e-fulfillment activities. The model also details the time windows in which each of the product types in an order should be prepared, and the assignment of delivery trucks and routes that allow online demand fulfillment to be satisfied.

By developing the case study, it has been shown that the improvements obtained by applying the model are not just monetary as there is also optimization of the workload and the number of means required for picking and transport tasks. The model is adaptable to different logistics strategies, making it possible to either level the workload or group it to lessen the quantity of trucks and pickers needed. The simulation of the scenario for minimizing the means required has achieved a 33% decrease of preparation time windows for preparation and a 17% diminution of transports, in contrast with the original condition of the enterprise.

Furthermore, application of the mathematical model has shown that around 65% of e-fulfillment costs for the order preparation model using a warehouse correspond to transport activities. Finally, the first experiment defined by the firm has determined that encouraging a 30% increase in C&D and C&C services leads to a 7% drop in the transport cost. Moreover, in the second experiment, it has been concluded that preparation costs can also be reduced if a system to advance orders is used. This alternative has scarcely been studied to date because of the difficulties presented by fresh products. However, the model of this study has determined that picking costs can be reduced by 7%.

The experimental results highlight the managerial implications of this work, as other e-grocers can use the model to improve organizational aspects to reach minimum costs. However, some theoretical implications have also been detected that are due to the lack of studies in joint management of picking and transport activities. This gap has been filled thanks to the linear programming model developed to optimize both activities by balancing the reduced profit margins with which e-grocers work. To those low margins must be added the demands for the market, which is clamoring for the same-day-delivery model. This service greatly hinders order planning and workload management of the means required, which is why they have not been taken into account in the development of the model but are recognized as the main limitation.

The mathematical model developed here for the strategy of order preparation and delivery from a warehouse could be used for other logistics alternatives, which is a reason why future lines of research could develop studies that compare online order preparation models using stores and warehouses. A study based of several firms with various strategic models would help respond to assumptions that transport costs increase and preparation costs decrease using warehouses. For this, our mathematical model could be tested with historical data provided by the company. Furthermore, the trend towards growth in the online channel is expected to continue into the future, which is why the incorporation of mathematical algorithms that help improve the solution speed of the model and increase its capacity to respond could be a promising approach. Finally, further research could focus on considering aspects to do with the customer to improve online order fulfillment. The allocation and management of online orders would be improved if e-grocers included customer comments, reasons for returns and preferences for time windows. Such attitudes go beyond mathematical algorithms, which is why the development of Big Data or Machine Learning tools tailored to these scenarios could be of particularly attractive for both researchers and practitioners.