1 Introduction

Nowadays, one of the most important technological strategies to add value to a process or a set of processes is through the design and implementation of a digital twin. This strategy is applicable to any type of organization, manufacturing or service company. However, the investment required to design and develop it is highly dependent on the objectives for which it was created. As the authors mention in [4], in the field of business, for example in supply chains, the technological platforms for the implementation of digital twins in available supply chains are scarce and expensive. Most of them are based on Enterprise Resource Planning systems (ERP), see [15, 26, 30]. An ERP system is generally commercial software that collects the most important information from the various areas of the organization in databases. This cluster of information allows decision makers monitoring the performance of the company using a global and integrated vision of reality. Full integration of ERP systems on a digital twin platform is not yet available. However, there are initiatives that propose the use of specialized software in supply chain management, simulation, business intelligence and others to develop digital supply chain twins. Some examples can be seen in [13, 14, 18] and [25]. Recently, novel business initiatives have emerged. These proposals ensure digital twin solutions for supply chain, building management & manufacturing [24] and [1]. Nevertheless, the solutions proposed for the real-time optimization of the supply chain do not ensure the handling of large-scale problems such as the Vehicle Routing Problem (VRP) and Bin-Packing Problem (BPP) among others.

For this reason, this work proposes the development of a digital supply chain twin that integrates the VRP and BPP in a joint scheme. The use of a commercial technology platform such as anyLogistix (ALX) [1] and ad-hoc heuristic algorithms allow solving large problems in real time. A hypothetical case is developed to verify the performance of the proposed digital twin.

The manuscript is organized as follows. Section 2 illustrates the literature review. Section 3 introduces the 3D-BPP and GVRP mathematical models used. Section 4 presents the twining data-driven joint optimization, the heuristic algorithm used for the 3D-BPP solution as well as how to integrate it into the GVRP solution through ALX. Section 5 shows the case study environment. Section 6 discusses the paper results. Finally, Section 7 summarizes the conclusions.

2 Literature review

Within digital supply chain twins development, recently some authors have directed their efforts in the optimization and simulation function of a digital twin. Some examples can be found in [3, 14, 18, 29] and [31]. Two large-scale optimization problems are addressed in this study: BPP and VRP. About the classic packing problems we can see in [5] that the authors focus on the study of the Bin Packing Problem. Each item consumes an interval of time which depends a piece. The objective is to use the least number of bins but at the same time it is necessary to consider the capability. There are different algorithms and formulations that are being studied through tests.

In [21], the authors focus on single stage stochastic bin packing problem (SBPP), which is based on a given item list. The items sizes are represented by stochastically independent variables. The SBPP needs to determine the minimum number of unit capacity bins that are needed to pack all the items in the list. Such calculations are important for the server consolidation field, because in that field is where jobs are assigned so they can manage low costs and keep the energy consumption as low as possible. This study is only focused on normally distributed item sizes; however, it can function in any other kind of distribution. From a mathematical perspective the characteristics of this kind of items are a challenge, because they turn out to be nonlinear integer program. For that scenario, the scientists, derived lower and upper bounds and studied the worsts case scenarios. Finally, all different mathematical approaches are tested on computational experiments involving both, randomly and real-world instances.

Additionally, there is a different problem variant, popularly known as the 2D circle bin packing problem (2D-CBPP). This variant involves packing circles into multiple square bins as densely as possible, this with the objective of minimize the number of bins used as much as possible. In [11], this paper proposes an adaptive large neighborhood search algorithm, which uses their Greedy Algorithm. The Greedy solution helps normally in a local optimum trap, which enables multiple neighborhood searches that depend on a stochastic schedule to avoid local traps. This method is tested or benchmarked with computational results in heterogenous instances, in all cases the study’s method outperforms the computational results, which means that the number of bins used is reduced.

Other authors consider the 3D bin packing problem (3D-BPP) which normally sets orthogonally in packs of rectangular items with different dimensions into the minimum number of 3D rectangular bins. In [8], they proposed a method that ensures the minimization of bins used and maximization of safety of the logistic operations, thanks to the load-balancing objective along with the orientation and stability. This paper develops a new concept, that is called family unity, which encourages packing a family of products together while taking advantage of the load-balance in 3D-BPP by combining the orientation and stability. This is the first paper that proposes a multi-objective mixed integer programming model for the problem to determine the optimal number of bins used and the deviation of balance from the ideal barycenter while maximizing family unity ratio. Finally, they test this particular method in a real-life container problem and solved the issue at hand. In [22], the main focus is on a specific version of the temporal bin packing problem (TBPP) that occurs in a job-to-server scheduling. The TBPP is a representation of BPP but with an additional variable, time. It requires to find or determine the minimal number of bins used to accommodate a given list of items at any instant of time. In addition to the aforementioned goal, recent paper suggests including the number of fire-ups of the servers as an important factor in sustainable and energy-efficient operation. It has been shown that the parameter that is used to weight both of the goals influence directly to the applicability of heuristics, making the problem more difficult so only favorable choices can be handled correctly. Even in these specific scenarios the approaches that have been taken fail to compute an exact answer. For this reason, this paper suggests different approaches to reduce the number of variables or new processing techniques to strengthen the LP bound. Based on different numerical tests it is shown that the improved method got better performances than the old one.

Finally, some applications in delivery and storage can be find in [7]. In this paper they focus on the bin packing problem with conflicts and item fragmentation (BPPC-IF) which has applications in the delivery and storage of items that cannot be packed together. Given a list of variable size items the main goal is to minimize the number of bins used for its packing while not packing fragments of conflicting items into the same bin. They make an assumption of same size-preserving fragmentation, the total size of fragments of an item packed into the bins has to be equal to the item’s original size. It is proved that this method does not necessarily admit optimal solutions with a special structure. Lastly, a heuristic proposal is made, which sequentially packs items into the bins using the observation about the oversized items. Thorough a computational study, they could demonstrate the out performance of this method compared to the existing algorithms.

Talking about digital twins (DT), we find several works related to its development, for example in [28] the study mentions that Fifteen years ago was the first time that the concept of digital twins was introduced. Digital twins are an important and promising technology that can be implemented in many areas and different industries. The objective of this paper is to research the principal advantages of DT and how it can be applied in the different fields of the industry.

Reviewing the works that integrate optimization methods and storage strategies we can find what was done by [6]. The objective of this paper is to propose three lean manufacturing tools to improve the production of warehouses. The first one is called Unified Modeling Language.The function is to display the design of the warehouse logistics. The second tool is the Value Stream Mapping, it determines if an activity is useful and valuable. And the last one is a mathematical formulation of the philosophy of Genba Shikumi, the objective is to inspect the performance of the warehouse to find irregularities. The tools were applied in a real case and the analysis showed a profitability warehouse and an upgrade quality.

Another example is founded in [12]. This study proposed a method to have a better control of the production logistics. It is complicated to plan the production due to the variability. However, with the technology of the Internet of the things (IoT) it is possible to reduce the fluctuation with the real-time information. The method consists of a mathematical scheduling model with a time interval to reduce the cost. Then with the algorithm designed it is implemented levels of satisfaction.After that, a real case is carried out with a real- time manufacturing environment. Finally, to prove the viability of the method it is necessary to do many experiments. Regarding the use of support systems, in [32] the authors propose a tool using a Decision Support System (DSS) and digital twins for having a better management of the port resilience computation and updating due to the variability and control how it is going to impact, it also can predict how it is going to perform and have a better resilience evaluation for different operational obstacles.For applying this tool it is necessary to have an optimal computing environment.

Other applications of digital twins are related to factory design and process improvement.The importance of a good design is the productivity and the space-use. Digital Twins make possible to check different designs and evaluate which is the better one. In [10] optimization of the factory design using the technology of digital twins is presented. To show all the advantages of this tool it was used in a real factory. Other applications as production engineering and material products is the work consulted in [27].

In the studies analyzed and discussed above, several applications of digital twins in engineering are presented. However, there are few works that present the integration of optimization techniques for solving optimization problems in real calculation times.

In this study that we present, large-scale problems such as bin-packing are addressed. However, some authors address these problems from different approaches and without the use of schemes or platforms such as digital twins. For example, in [21] the authors solve the stochastic Bin Packing Problem (SBPP), the objective is to minimize the quantity of packaging necessary for all the products. SBPP is a nonlinear integer program which is a problem. The proposed solution consists of trying lower and upper bounds to find the one that doesn’t work perfectly. Also it is necessary to linearize and to do many experiments.

Multi-objective temporal bin packing problem is presented in [2]. The main objective of this paper is to propose an heuristic method based on the bin packing problem to reduce the operations cost and minimize the servers necessary to reach the target. The obstacle is the capacity given. The study is established on the problem of energy efficiency of virtual machines and cloud servers. The paper proposes an algorithm to submit the lower limit in the expected value and it is useful to measure the performance of the heuristic method.

Production scheduling is complicated to synchronize the industry of manufacturing due to the deranged setups. In [17] the authors propose an automobile standard part factory applying internet of things with 3 principal objectives. First, there are two dimensions for synchronization. The horizontal synchronization (HSynch) and the vertical synchronization (VSynch). Second one is the IoT-enabled synchronization using instantaneous information. The third one is the use of advanced planning and scheduling (APS) for carrying out the synchronization mechanisms. Machine learning based Digital Twin Framework for Production Optimization Petrochemical Industry is presented in [23]. This paper focuses on the implementation of innovative technologies and tools, such as machine learning, big data, internet of things (IoT) to create a digital twin that can be used in the petrochemical industry. In this field it is important to have a precise control of the production due to the lack of time. The digital twin construction is important to have a better management of the demanded production and also with the variability.

As can be seen in the literature, there are many works on how to approach packing problems. However, there are few studies that address the solution of packaging problems integrating them into vehicle routing and within a scheme of digital twins.

3 Large-scale optimization models

3.1 3D-bin packing problem (3D-BPP)

The bin packing problem in its three-dimensional version considers the orthogonal packing of n rectangular shaped items. All items have a known length, width and depth. In this study we are based on the model proposed by [19]. An unlimited number of containers is considered and the objective is to minimize the number of them. All containers have the same dimensions.

The bin packing problem (BPP) can be informally defined in a very simple way. We are given n items, each having an integer weight wj(j = 1, ... , n), and an unlimited number of identical bins i of integer capacity c. The objective is to pack all the items into the minimum number of bins so that the total weight packed in any bin does not exceed the capacity.(In a different but equivalent normalized definition, the weights are real numbers in [0, 1], and the capacity is 1.) We assume, with no loss of generality, that 0 < wj < c for all j.

$$ y_{i}=\left\{ \begin{array}{cc} 1& \text{if bin i is used in the solution;} (i=1, ... , u), \\ 0&\text{otherwise} \end{array} \right. $$
$$ x_{ij} = \left\{ \begin{array}{cc} 1 &\text {if an item {j} is packed into bin i:} (i = 1, ... , u; j = 1, ... , n),\\ 0& \text{otherwise} \end{array} \right. $$

We can model the BPP as a basic Integer Linear Program (ILP) of the form, see [20].

$$ min \sum\limits_{i=1}^{u} y_{i} $$
(1)
$$ s.t. \sum\limits_{j=1}^{n} w_{j} x_{ij} \leq cy_{i} (i=1, ... , u), $$
(2)
$$ \sum\limits_{i=1}^{u} x_{ij}=1 (j=1, ... , n), $$
(3)
$$ y_{i} \epsilon \left \{ 0,1 \right.\left.\right \} (i=1, ... , u), $$
(4)
$$ x_{ij} \epsilon \left \{ 0,1 \right.\left.\right \} (i=1, ... , u; j=1, ... , n) $$
(5)

Constraint (2) is the capacity limit of each bin, while constraint (3) guarantees that each item is packed in a bin. For the case of three dimensions, constraint (2) must be replaced for the following:

$$ \sum\limits_{j=1}^{n} w_{j} \leq W (i=1, ... , u), $$
(6)
$$ \sum\limits_{j=1}^{n} h_{j} \leq H (i=1, ... , u), $$
(7)
$$ {\sum}_{j=1}^{n} d_{j} \leq D (i=1, ... , u), $$
(8)

Where w,h,d are three dimensions correspond to the width, height and dept values.

3.2 The generalized vehicle routing problem (GVRP)

The Generalized Vehicle Routing Problem is a subclass of the classic network design problems and is an extension of the typical Vehicle Routing Problem. Therefore, it has been widely studied due to its NP-Complete nature. We use the GVRP proposed by [9] that uses binary variables \(x_{nm}^{v}\) and \({y_{n}^{v}}\). \(x_{nm}^{v}\) indicates whether mN is visited immediately after node nN by vehicle \(v\in {\nu } (x_{nm}^{v}=1)\), or not \((x_{nm}^{v}=0)\). \({y_{n}^{v}}\) indicates whether node nN is visited by vehicle \(v\in {\nu } ({y_{n}^{v}}=1)\), or not \(({y_{n}^{v}}=0)\). For each node nN the model contains the variable tn and ρn. If node nN is visited by a vehicle tn specifies the arrival time and ρn are without any meaning. The contribution of each vehicle v𝜖ν to the objective function

$$ \sum\limits_{o\epsilon \phi}y_{n(0,1)}^{v}p_{o}-\sum\limits_{(n,m)\epsilon A}x_{nm}^{v}c_{nm}^{v} $$

The first term models revenues, the second term models transportation costs.

$$ Max \sum\limits_{v\epsilon \nu}\left( \sum\limits_{o\epsilon \phi}y_{n(0,1)}^{v}p_{o}-\sum\limits_{(n,m)\epsilon A}x_{nm}^{v}c_{nm}^{v}\right) $$
(9)

subject to

$$ \sum\limits_{(n,m)\epsilon A}x_{nm}^{v}= \sum\limits_{(m,n)\epsilon A}x_{mn}^{v} ~for ~all~ v\epsilon \nu , n\epsilon N $$
(10)
$$ {Y_{n}^{v}}=\sum\limits_{(n,m)\epsilon A}x_{nm}^{v}~for~ all~ v\epsilon \nu , n\epsilon N $$
(11)
$$ \sum\limits_{v\epsilon \nu}{Y_{n}^{v}}\leq 1 ~for~ all~ n\epsilon N $$
(12)
$$ ~for ~all~ v\epsilon \nu, (n,m)\epsilon ~A ~with~ n\neq n_{(v,\lambda_{v})}: $$
$$ if x_{nm}^{v}=1 ~then~ t_{n}+d_{nm}^{v} \leq t_{m} $$
(13)
$$ t_{n}^{min}\leq t_{n}\leq t_{n}^{max} for~all~n\epsilon N $$
(14)
$$ t_{n_{(v,\mu )}}\leq t_{n}{_{(v,\mu +1)}}~for~all~v~\epsilon~\nu,1\leq \mu <\lambda_{v} $$
(15)
$$ t_{n_{(o,\mu )}}\leq t_{n}{_{(o,\mu +1)}} ~for ~all~o~\epsilon\O,1\leq \mu <\lambda_{o} $$
(16)
$$ y_{n{(v,\mu )}}^{v}= 1~for~all~v~\epsilon~\nu, 1\leq \mu \leq\lambda_{v} $$
(17)
$$ \sum\limits_{\mu =1}^{\lambda_{o}}y_{n{(o,\mu)}}^{v}=\lambda_{o}y_{n{(o,1)}}^{v}~for~ all~o~\epsilon~\O, v \epsilon \nu $$
(18)
$$ \rho_{n{(v,1)}}=r_{n{(v,1)}}~for~all~v~\epsilon~\nu $$
(19)
$$ for~all~v~\epsilon~\nu,(n,m)\epsilon~A~with~n~\neq~n_{(v,\lambda_{v})}: $$
$$ if~x_{nm}^{v}=1 ~then~\rho_{m}=\rho_{n}+r_{m} $$
(20)
$$ for~all~v\epsilon\nu, ~n~\epsilon N:~if~{y_{n}^{v}}=1~then~0\leq \rho_{n}\leq r^{v} $$
$$ y_{n_{(o,1)}}^{v}\leq\delta_{ov}~for ~all~o~\epsilon\O,v\epsilon\nu $$
(21)
$$ x_{nm}^{v}\in{\{ 0,1\}} ~for~ all~v\epsilon\nu,(n,m)\epsilon A, $$
(22)
$$ {y_{n}^{v}}\in{\{ 0,1\}} ~for ~all~v\epsilon\nu, ~n~\epsilon N $$
(23)

The objective function is represented by Eq. 9. Equation 10 represents the flow conservation constraints which impose that each vehicle which reaches a node nN also departs from the node. Constraints (11) and (12) impose that each node is visited at most once.Inequality (13) imposes that each node which is not the starting point of a tour is reached no earlier than the preceding node to the mode.Inequality (14) impose that each arrival time within the time windows of the node.Constraints (15) and (16) are the precedence constraints imposed on the sequence in which nodes associated to vehicles and orders are visited. Equation 17 imposes that all nodes which must be visited by a vehicle are visited by this vehicle. Equation 18 represents the grouping constraint which imposes that, if the first node of an order is visited by some vehicle, all other nodes belonging to the order are visited by the same vehicle. Constraints (19) to (20) are the capacity constraint which impose that the load at each node equals the load at the node and that at each node the load is below the capacity of the vehicle and non negative. Inequality (21) represents the compatibility constraint which imposes that the orders are only assigned to vehicles capable of serving the order. Finally, constraints (22) and (23) impose the values of \(x_{nm}^{v}\) and \({y_{n}^{v}}\) are binary.

4 Twining data-driven joint optimization

In this study we propose the digitization of the solution of two large-scale problems. We use a free and open source tool (R-studio) and enterprise-ready professional software for data science teams. We also developed an interface to exchange information between 3D-BPP and GVRP using a supply chain design and simulation tool (Anylogistix).In other words, we propose a digital twin prototype to aggregate data of the physical orders of a shipping service system to optimize packing and vehicular routing to customers.

The methodology proceeds as follows:

  1. 1.

    Using the R-studio software, items with random dimensions are generated for their width (wj), height (hj) and depth (dj).

  2. 2.

    The items are ordered based on their volume and without increasing the height, this criterion helps to reduce the computational complexity in general terms.

  3. 3.

    Layer by layer the items are packed in the container (bin).

  4. 4.

    Later the heuristic algorithm (S-DBLF), see [16], optimizes the packaging. The pseudocode is shown in Fig.1.

  5. 5.

    Once the accommodation indicated by the stop criteria has been obtained, see Figs. 2 and 3, a plain text file is printed that will serve as input parameters for the specialized supply chain design (ALX) software. For reference see Table 1.

    Table 1 Output file example
  6. 6.

    Customer locations, demand and lead time are entered into the ALX software. Likewise, the vehicle fleet suggested by the number of bins obtained in the optimization process is also entered through the developed interface.

  7. 7.

    All the data and parameters necessary to optimize the production, inventory and distribution process are loaded directly into the logistics software. In this module you can enter the supply and inventory policies that you want to test, see Figs. 45 and 6.

  8. 8.

    Finally, after solving the GVRP by using the CPLEX optimizer, the vehicle routing is calculated. The proposed routes satisfy all constraints and are also carried out at minimum cost.

  9. 9.

    The results are presented in Microsoft’s Power BI.

Fig. 1
figure 1

Pseudo-code for the S-DBLF packing method

Fig. 2
figure 2

Packing algorithm results (a)

Fig. 3
figure 3

Packing algorithm results (b)

Fig. 4
figure 4

Discrete event diagram of the production level (supplier) simulation

Fig. 5
figure 5

Discrete event diagram of a Distribution Center Simulation

Fig. 6
figure 6

Customer simulation

5 Case study environment

This study is based on the hypothetical case of an automotive parts manufacturing center in Mexico. The supply chain is made up of two manufacturers, two warehouses for finished parts and customers scattered throughout the country, see Table 6. We consider customer demand data of Table 3, as well as the production and storage capacities of the facilities in the supply chain under study. Purchase orders made by customers generate orders that must be satisfied by the manufacturing and warehousing centers. At this stage of the supply chain the 3D-BPP is resolved. The order information is provided by a shipping service system.

5.1 File entry model for 3D-BPP

The file input model is a plain text file, no informative texts have been included in the file. The objects to be packed are considered as rectangular or cuboid parallels, the dimensions of the objects are handled with semi-radii, which are the half of each side for each direction or axis of the object. The first row refers to the dimensions of the container w = 160, l = 160, d = 320. The second line refers to the number of types of objects (not the list of objects to pack). The next 9 lines describe each of the 9 types of objects. See Table 2.

Table 2 File entry

5.2 Output file for 3D-BPP

The output file is a simple or plain text file separated by commas, the file is created as a table where in each line the type of object is specified followed by the coordinates of the center of the object, separated by a comma, see Table 1.

5.3 Input data for the GVRP

To begin the optimization of the supply chain it is necessary to take into account the geographic locations of the clients as well as their product demand. The data used is shown in Tables 3 and 4.

Table 3 Customer demand
Table 4 Customer and facility locations

Subsequently, Table 5 showh the 3D-BPP solution that gives us the number of vehicles that have to be occupied to satisfy the orders. In this part it is necessary to consider the characteristics of the vehicles as well as the specification of their capacity and average speed, see Table 6.

Table 5 Fleet size
Table 6 Vehicle type

6 Results

The entire process described above is calculated and stored in the cloud to create the necessary reports. These indicators and tables are available in real time to anyone involved in the decision-making process in the supply chain.

Figures 78910 and 11 show snapshots of the vehicle routing obtained by specialized supply chain software.

Fig. 7
figure 7

Vehicle routing 1

Fig. 8
figure 8

Vehicle routing 2

Fig. 9
figure 9

Vehicle routing 3

Fig. 10
figure 10

Vehicle routing 4

Fig. 11
figure 11

Vehicle routing 5

Figures 12 and 13 show the lead times of the two inventory policies tested in this case study:

  • RQ-Policy

  • Stock Security-Policy

As can be seen in Fig. 12, the RQ policy provides better results and decreases the average lead time to customers.

Fig. 12
figure 12

Lead time RQ-policy

Fig. 13
figure 13

Lead time stock security-policy

Finally the data dashboards are developed in a business intelligence tool, see Fig.14. Specific results for logistics KPIs, warehousing, product flow and warehouse operation are shown in the Tables 78,9 and 10.

Fig. 14
figure 14

Analytics-Power BI interface

Table 7 Key performance indicators RQ-policy
Table 8 Site state after network optimization
Table 9 Storage by product
Table 10 Production flows

7 Conclusions

Nowadays, many industries are evolving for the adoption of technology based on digital twins.This technology will allow in the future to obtain a digital mirror of any thing or process in the physical world.The present study was motivated by the need to solve large-scale problems in near-real times that arise in the supply chain operation. The 3D-BPP and GVRP are solved combining mathematical programming methods with a genetic algorithm and specialized supply chain software. A digital twin supply chain prototype is presented that solves large mathematical problems with classical optimization techniques. The results obtained encourage the development of modules that complement the tool. As future work, the incorporation of artificial intelligence tools to manage predictions and improve the resilience of the supply chain can be considered.