## 2 New Production Scheduling Methodology
### Optimization Algorithm  
As mentioned at the beginning of this section, the scheduling methodology includes the definition of parameters, criteria, and constraints and their use by one of the many available optimization algorithms. The novelty of the methodology proposed in this article is based on the redefinition of criteria and constraints so that, when creating the schedule, it is possible to use the available knowledge of the influence of employees and tools on the course of operations. This solution is universal and can be used in combination with most of the algorithms from the huge number of optimization algorithms developed. However, for the purposes of this research, the authors have built a laboratory environment that ensures that imperfections of an optimization algorithm used will not have an influence on the results of the application of analyzed methodologies. This is due to the fact that all existing algorithms that work in iterations, epochs, or generations and are influenced in any way by previous steps of the optimization carried out are exposed to the risk of getting stuck in a dead-end (a local optimum). In such a situation, we are never sure whether the obtained result is the best for the adopted constraints and criteria or whether it is a result of the optimization algorithm;s imperfections. The only way to avoid the risk of falling into the local optimum is to completely ignore schedules determined in previous iterations. Of course, the exception is the best schedule (in terms of the value of the criterion). The production schedule optimization problem is characterized by optimization constraintsand criteria--defined as nonlinear functions that have many local minima. In the case of the presented methodology, the nonlinearity of constraints and criteria results from the nonlinearity of their component functions (e.g., for the delivery time, the amount of a needed blank), the argument \(R\) of which is a combination of resources allocated to them. They are defined by rules (IF.. THEN type) and nonlinear dependencies. Additionally, the considered optimization problem has a large number of parameters, where only some of them are continuous (e.g., timescales for technological operations), and others are characterized by discrete values (e.g., identifiers of assigned employees and machines). Based on these facts and guided by the desire to create a research environment that will allow to unequivocally confirm the advantages of the new method, the authors proposed the use of an algorithm that prevents it from getting stuck in a local optimum. The original algorithm developed is based on the Monte-Carlo algorithm [38; 39; 40]. It is a brute-force algorithm that consists of repeatedly generating completely new solutions (in the analyzed case, schedules). By meeting the postulate of ignoring the results of previous iterations, it ensures complete safety against getting stuck at a local minimum. The resistance to getting stuck in a local minimum would allow finding the global minimum with an infinite number of iterations. Of course, it is impossible, but the authors assumed that a sufficiently long period of stagnation in decreasing the value of the criterion allows us to assume (with a fair degree of probability) that a global minimum has been found. Resistance to getting stuck in a local minimum avoids the latter cause of stagnation. The flowchart of the algorithm implemented is presented in Figure 3. The algorithm stochastically selects orders for scheduling from a set of orders. For the selected order, according to the recipe, it selects subsequent operations to be inserted. Importantly, after each inserted operation, the global insertion cycle returns to order selection, allowing for the parallelization of production (if the availability of resources allows it). The resources themselves are also selected at random according to the technological recipe of the operation.