*3.1. Implementation*

The presented case studies were formally described with a mathematical description as defined in Section 2 and implemented with the linear programming modelling environment PuLP [27]. PuLP is an open source high-level modelling library that allows mathematical programs to be described in the Python computer programming language. PuLP provides an interface to many mixed-integer linear programming solvers such as CPLEX, Gurobi, CBC, GLPK. Gurobi solver [28] was used in our case. The solver can offer more algorithms to solve continuous or mixed-integer models. As we are dealing with an integer linear programming problem, we used the dual simplex method.

The problem was solved using a PC with 3.4 GHz and 8 GB RAM.

#### *3.2. Elementary Case Studies*

Let us first overview the simplified example introduced in Section 2.5 that illustrates the realistic environment. We must make three products from five available raw materials, which are supplied with two purchase orders. In the generalized BPP formulation, this means that we have two bin groups with five bins:


Every product is composed of more intermediates. In the generalized BPP formulation, the products are represented with item groups and intermediates with items:


• *F<sup>I</sup>* 3∈ {*<sup>I</sup>*6, *I*7, *<sup>I</sup>*8}.

Details about available purchase (bins) and work (items) orders are summarized in Tables 1 and 2, respectively. We assume here that the processing time needed to cut the raw material is taken into account within *aj*.



**Table 2.** Work orders—Items.


The problem was formulated as an integer optimization problem as described in Section 2 and can be solved without delays, as a solution exists that provides intermediate materials before the time is due. Therefore, we are minimizing the leftover only (Equation (3)). The solver finds an optimal solution, which is graphically presented in Figure 5. The figure shows which intermediates (items) are allocated to a specific purchase order (bin). Next to the bin/item label, time information *aj*/*di* are given in round parentheses. Bins that belongs to one bin group are framed together. Items from one group are designated with the same color and we can see that the items from item groups *FI*1 and *FI*2 are assigned to bins from group *FB*1 , while items from *FI*3 are assigned to bin *B*4 from *FB*2 . Here white rectangles represent the leftovers. Bins *B*1, *B*2 and *B*4 still have 12, 2 and 8 units of unused space, i.e., the cumulative leftover is *z*2 = 22, while bins *B*3 and *B*5 are not used in a resulting plan.

**Figure 5.** Solution to a simple problem.

In practice, it often happens that one or more raw material deliveries are delayed, or the product would need to be finished earlier. That type of situation could be illustrated when considering a problem where raw material modelled with bin *B*2 is late for 30 time units (*<sup>a</sup>*2 = 40; all other conditions remain the same). In this case, we cannot achieve a feasible solution using Equation (3). Therefore, an optimization function where delays are allowed but penalized must be used. The multiple criterion function with soft constraints is used to optimize leftover and due date violation (Equation (6)). As for the given problem where tardiness and leftover are equally important, we set the weighting factors as *w*1 = 1 and *w*2 = 1. Figure 6 shows the resulting schedule where three raw materials (bins) are used and each of them produces some leftover (*B*1 = 12, *B*2 = 2 and *B*4 = 8). We can see that item *I*5 is planned to be made of bin *B*2, which is late for 20 time units (see red designation in Figure 6). The resulting objective function is *z*3 = 42. Cumulative leftover is the same as in the previous example; however items *I*1 and *I*3 are scheduled vice versa in order to minimize total tardiness.

**Figure 6.** Solution to a simple problem where *B*2 is late.

To ensure that the optimization problem works well for large size instances the mathematical formulation of the problem was validated on larger use case problems. Synthetical datasets of four different complexities were generated (UC1–UC4), where in each use cases all the bins are available before item's due date and for each use case at least one optimal solution, where no leftover is produced. Items and bins for each use case were generated based on optimal solution, where approximately 3/4 bin groups were used, where in each bin group one bin is left empty. The complexities of the use cases are as follows:


Figure 7 illustrates how the optimizer converges to optimal solution. For ease of comparison, the leftover is given in percentage of total items capacity. We can see that we achieve solutions with less than 5% of leftovers in a few seconds even for more complex problems that are present in the considered industrial environment. Such a result is incomparably better than can be achieved with the current planning practice. Let us add that such a plan is flawless (no mistakes and no overlapping activities), with fewer leftover and can be continuously upgraded in case of unexpected changes (e.g., new orders).

**Figure 7.** Validation on synthetical datasets (UC1–UC4).

#### *3.3. Case Study of a Steel-Processing Production Process*

The method is demonstrated on a data set from a real case study and illustrates a common situation in the observed production company. Typically, the production planner must deal with up to 150 intermediates that have to be produced from up to 50 raw materials. In this study, a problem where

150 intermediates (defined with 12 work orders, i.e., item groups) have to be produced from 100 raw materials grouped in 7 bin groups is used to validate our modelling and problem solving capabilities.

The problem was modelled and solved with the same procedure as described in the simple case study (criterion function from Equation (3)). As the problem is NP-hard, it is not possible to achieve the optimal solution in a short time. In our case, it took 593 s to achieve a close to optimal solution. The graph on the left of Figure 8 illustrates how the optimizer converges to an optimal solution. We do not achieve a better solution even if the optimization is run for a much longer time (24 h). The final solution produces 4923 of leftover when 22 bins are used. The solution and resulting plan are presented in Figure 9.

**Figure 8.** Convergence of criterion functions for the case study with no delays (**left**) and with delays (**right**).

We also analyzed a problem in which two purchase orders are late. In this case, we need to use the criterion function with soft constraints (Equation (6)) to optimize leftover and due date delays simultaneously. The following weighting factor values are considered in this experiment: *w*1 = 1 and *w*2 = 1/36. With the given settings, we ge<sup>t</sup> a solution (*<sup>z</sup>*3 = 24, 777.45) in which 25 bins are used and the cumulative leftover is 4238. In the resulting solution, more items are late. Their cumulative tardiness is 665,012 s, i.e., approximately 7.5 days. In this case, the optimization process took more time (26,518 s). The graph on the right in Figure 8 illustrates how the solution converges in this case. However, a close to optimal solution can be achieved in approx. 100 s.

In the case that minimization of the leftover is more important, we would choose other weighting factors (*<sup>w</sup>*1 = 1 and *w*2 = 1). In this case, 26 bins are used with a higher leftover of 11,200, but with a lower total tardiness (551,237 s), which means more than one day shorter than in the previous case. In this case, optimization took approximately 157 s.

Figure 10 illustrates the lateness of the work orders for all three studied cases, i.e., positive and negative difference between the completion time and the due date. We can see that none of the work orders are late in the case when purchase orders are available on time (upper data). In the case when two purchase orders are late, we can see that this will cause some work orders to also be late. However, there will be less delays in the case when the tardiness weighting factor is set to *w*2 = 1.

**Figure 10.** Lateness of input materials.

### **4. Discussion**

General-purpose IT solutions can solve several problems at hand. But often, production specifics require development of special tailor-made solutions. In this paper, we considered a problem from manufacturing in which stock material must be cut to provide a reliable material requirements plan. This plan must satisfy the needs of capacity and must be available by the work order's due date. Besides this, the plan must also consider the fact that a group of work orders must be produced from the same batch of raw material. In this way, the manufacturer can systematically compensate for some undesirable variations in raw material quality. In the current day to day practice, the plan is managed manually, and it is very difficult to maintain the plan up-to-date, even in smaller dimensions. The decisions of the operator are time consuming and prone to errors. This results in situations in which the operator must constantly make plan corrections.

In this paper, we propose using an extended bin-packing problem formulation to systematically solve the material planning. A basic BPP formulation is extended to include constraints such as variable bin and item sizes, time limitations, and the fact that only a group of bins can be used to produce one group of items.

The suggested solution offers a tool for supporting the production planner with his/her decisions. With it, he/she can determine how to efficiently cut the raw material to satisfy the planned work orders. Depending on the situation, the planner can choose between various model formulations. He/she can optimize the leftover, tardiness, or both.

We demonstrated that the proposed solution can solve a problem of realistic dimensions quickly enough to be used in an industrial application. However, in real applications, case-specific requirements would first need to be analyzed to most appropriately set the importance of leftovers and/or tardiness. In this way, the time for producing a feasible material requirements plan is reduced. The operator is relieved and can be focused on other tasks. Also, the need for corrections is decisively reduced. To summarize, variations in raw material quality no longer cause a problem when implementing our solution. We propose to use a rigorous and accessible MILP solution approach, i.e., Gurobi optimization solver, which satisfies the requirements of the problem considered in this

paper. To extend the use of the proposed method to more complex problems approximation algorithms should be applied (e.g., [3,12,21]).

To summarize, variations in raw material properties no longer cause a problem when implementing our solution, since end products are made from the same material and, consequently, the products' quality is improved. Moreover, raw material batches are used more rationally, which leads to decrease the needed of storage place and unused batch leftovers.

**Author Contributions:** Conceptualization, methodology, software and validation, D.G. and M.G.; writing–original draft preparation, D.G.; writing–review and editing, M.G. All authors have read and agreed to the published version of the manuscript.

**Funding:** The work was supported by the INEVITABLE project which has received funding from the European Union's Horizon 2020 research and innovation program under gran<sup>t</sup> agreemen<sup>t</sup> No 869815. The support of the Slovenian Research Agency (P2-0001) is also acknowledged.

**Conflicts of Interest:** The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.
