The Use of Computer Simulation in the Management of Subcontractors and Outsourced Services

. The paper examines cooperation among production companies to fulfill orders beyond plant capacity by selecting subcontractors. The developed model focuses on planning the production process to minimize total production costs by deciding where to produce goods before they are actually produced. The concept utilized a 3D FlexSim simulation environment, specifically the built-in optimization module OptQuest, to address the problem. The paper covers the key steps in creating the simulation model and presents the simulation results.


Introduction
In the case of production companies whose processes depend on cooperation with external entities, it is important to take into account the scope of cooperation, starting from the management of raw materials, materials or semi-finished products, to the adoption of a production plan, the production itself, along with the registration of service, transport and storage costs. A cooperator's production plans should be included in the operational schedule of in-house production [1,2]. Cooperation in the production process is perceived by many production companies as an opportunity to more effectively adapt to the evolution of production systems [3][4][5]. The role of cooperation in the production of products is growing, especially in very dynamic markets with variable demand and a short product life cycle [6]. This is because for such markets it is sufficient to apply a deferred production strategy and to transfer the last stage of production from industrial enterprises to distribution companies. [7][8][9].
In the management of the production process, often a large part of the planning process concerns the selection of a subcontractor in terms of its efficiency and low cost, high quality and value of the delivered finished products, as well as safety. [10][11][12]. Therefore, it is important to establish a set of procedures/recommendations for pricing, selecting contractors, and measures to monitor and improve supplier relation. One should also not forget about the management processes of own means of production, their availability and own costs of process maintenance [13][14][15][16][17][18]. The development of modern computer technology and many fields of science, especially in the field of production engineering, made it possible to virtually simulate real production processes [19]. Due to the use of comprehensive IT solutions in the field of modeling and simulation of manufacturing processes, a significant economic benefit is achieved, especially in mass production [20]. Therefore, more and more IT solutions are appearing in the area of tracking, monitoring and visualizing the course of production processes in real time [21,22]. Many IT tools are at the disposal of managers today, incl. Technomatix Plant Simulation, Matlab/Simulink, Enterprise Dynamics, Arena, FlexSim, Vensim, Excel/Solver and others. The effectiveness of the production planning and scheduling processes, in particular at the stage of simulating virtual models of production systems, depends primarily on the mathematical models and optimization algorithms used [23]. In complex production systems, this efficiency is translated primarily into achieving a lower level of production costs, shorter production cycle times with a simultaneous high efficiency of data processing. [24]. It is also important that the digital model reacts quickly to changes [25].
Outsourcing tasks to external subcontractors is becoming increasingly common within enterprises due to the high level of specialization required for technological activities and the need to maintain high-quality standards [26][27][28].
Typical subcontracting involves technological tasks that either demand high qualifications and expensive machinery or impose a significant environmental burden, necessitating certified safeguards and purification systems [29]. Among the highly specialized activities in this regard, metal processing [30][31][32] coupled with surface treatment [33], including the application of DLC coatings [34][35][36], can be mentioned. Additionally, the production of high-pressure components [37,38] requires diagnostic control of structural connections [39,40] and certification.
In this manner, end manufacturers of machinery [41], equipment, or railway rolling stock [42] essentially serve as integrators, responsible for ensuring the sustained reliability and stable performance of the final products throughout their intended lifespan, irrespective of wear and tear [43].
Such an approach requires meticulous optimization of design and production processes, as well as monitoring them both internally and at subcontractors and service providers. Given the complexity of the processes and the numerous factors to consider, essential tools include dimensionality reduction methodologies [44] and design of experiments [45][46][47], including increasingly popular nonparametric approaches [48][49][50].

The Essence of Simulation and Optimization
Computer modeling and simulation is primarily used as a decision support method [51]. However, simulation techniques are most often used when analytical solutions are too difficult or timeconsuming [52,53]. Simulation modeling is useful in many fields of science. It is used to learn about a given process by replacing it with a simplified system that reflects its selected features. The modeling process is defined by the determination of the mathematical relationship between the output value y, and input value xl, x2, x3, …, xn. In the simplest version, it is the formula: y = f(xl, x2, x3, …, xn), where the variables: xl, x2, x3, …, xn, are input values, while y is the output value of the tested system.
There can be more than one input and output variable, it all depends on the complexity of the system / process. The simulation model can be compared to the so-called a black box that can have n input variables and m output variables [54].
Simulation will help in direct identification of cost reduction areas of efficiency improvement, it can also play an important role in risk analysis [46]. The simulation also indicates scenarios of the development of the situation based on the proposed actions [55]. For example, simulation will not be able to predict specific customer requirements for products and services, but it can be used to assess the impact of demand volatility on the ability to respond to this variability in a production system.
Optimizing a process by simulation means finding the best configuration of the input variables that match the best value [56]. Optimization usually consists of maximizing or minimizing a selected parameter [57]. After building each simulation model, it should be validated, i.e. its suitability for the given application assessed. If it turns out that the model correctly reflects reality, then only then can be proceeded to designing experiments and further data analysis [58,59].

Methodology -Case Study
The purpose of the paper is to discuss the model of cooperation from the perspective of a group of production companies for the purpose of comprehensive order fulfillment. The study took into account the problem of selecting subcontractors selected to fulfill an order exceeding the production capacity of the plant. The developed model focuses on planning the production process when the goods have not yet been produced. Therefore, at the time of deciding where to produce it, so that the total production costs are as low as possible. In this concept, a 3D FlexSim simulation environment was used to solve the problem -3D FlexSim with built-in optimization module OptQuest.
As part of the research analysis, the following problem was considered. The production plant must fulfill a production order for the production of 10,000 pcs. of products. The production resources available in the form of available machines are insufficient to fulfill this order, which is why the company wants to hire subcontractors. The x1 production system is owned by the company, while the subsequent systems marked as x2÷x10 are rented, hence the different costs of their use. Unit costs and capacities of individual production systems are summarized in Table 1. The implemented product production process can be presented in the FlexSim environment using the model shown in Fig. 1. In this model, standard objects from the program library were used, which were programmed in accordance with the task conditions. Intuitively, it can be assumed that the function of the production systems of individual plants should be performed by Processors. Process time for individual production systems is set according to their capacity. Source objects are usually generators of many flow elements. In this model, the source works in Arrival Sequence mode. In this particular case, the flow element will symbolize the number of items produced per unit of time. This is the variable that will be used in the optimization process, as well as the place where the optimizer will generate results from subsequent iterations. The OptQuest optimizer from OptTek built into the FlexSim platform will be used to solve the example problem. Its operation is based on neural networks and metaheuristic algorithms [35]. The objective function is defined as the cost of work of processors reflecting the work of individual plants. The cost is determined by the working time and efficiency of individual production systems. In order to calculate the cost of work for all processors in FlexSim, add the Financial Analysis chart to the Dashboard and specify the cost for all Processors. This parameter must be defined by adding it from the Toolbox library as a Performance Measure variable. Assign this objective function as Financial Analysis -Total for the previously defined Financial Analysis chart (Fig. 2).
The objective function in this task is minimized as the enterprise is interested in lowering the cost. In addition, the total time of task completion is also minimized. The system time from model operation is not listed as a ready-made function in the drop-down list. It is necessary to use the custom code in the optimizer tab for the Performance Measures variable. Enter the function in the code editing window [29]: /**Custom Code*/ treenode datanode = parnode(1); return time(); The optimizer needs 10 input parameters, which are the number of flow elements generated by each processor. This is the variable that will be used in the optimization process, as well as the place where the optimizer will generate results from subsequent iterations. This parameter must be defined by adding it from the Toolbox library. Then, in the Value column, select Integer as the type of input variables. The length of the sequence should be set according to the number of products according to the order, i.e. 0÷10000 (Fig. 3).
Boundary conditions and constraints related to the size of the production batch and the production capacity of individual plants should also be specified. Optimizer settings are shown in Figure 4.
The objective function in this task is minimized because the company is interested in reducing the cost. In addition, the total task completion time is also minimized. The optimizer will adjust the values of the flow elements for each Source until it finds the optimal value at which the production time and costs are the lowest.

Results Analysis
As a result of the optimizer's work, the best combination of allocation of production orders to individual plants was obtained, while minimizing costs and order execution time. The result of the optimizer's work for 100 iterations, along with the amount of costs and the duration of the production cycle, is shown in Fig. 5.  As the best sequence for addressing production orders, the optimizer proposed 8 solutions. In all solutions except 2, all production takes place in 3 plants. The detailed allocation of production orders along with the costs and lead time of a production order are presented in Table 2. Production time depends on many factors, including on the materials used, tools, machines, operator skills, etc. In the quoted calculations, the process time was described by the Uniform distribution function, which will randomly select any numbers from the specified range in accordance with Table 1. The uniform distribution strategy will include numbers with decimal places. Therefore, for the obtained optimal solution, five repetitions (replications) were made and confidence intervals of production costs (Fig. 6a) and execution times (Fig. 6b) were obtained for a single order batch consisting of 10,000 items of products. Graphical interpretation in the form of graphs is shown in Fig. 6.
The presented results were determined as a 95% confidence interval for the studied phenomenon. In practice, this means that there is a 95% probability that the unknown parameter of the population (in this case, the cost and production time will be in the designated numerical range. a) b)

Summary
The presented example shows how a discrete event simulation model can improve the planning of the production process. As can be seen in the presented example, looking for savings in the areas of process engineering allows for a real reduction in production costs, which a large part of companies is not aware of. This factor is of particular importance in the production process supported by external entities, as well as in the logistics sector, where transport, distribution and storage generate high costs. It should also be noted that in addition to costs, production time is also important. It is an indicator of the timely execution of the task, which is particularly important in the case of production in the so-called suction system, i.e. production to order. Such analysis is particularly important in situations where resources and people involved in a given process or operation are shared. Most importantly, however, the simulation shows the impact of plans and schedules on actual performance, and guides managers to choose optimal actions.