This section introduces the steps for building two evolutionary-based approaches for tackling MTCP, considering different moving and cutting speeds: a genetic algorithm (GA) and a biased random-key genetic algorithm (BRKGA).
3.1. A GA-Based Approach
As mentioned previously, the MTCP with different moving and cutting speeds can be seen as a generalization of the CPD problem [
5,
15]. The input data for the MTCP problem is a packing layout, i.e., a set of non-overlapping polygons, which are defined as a set of two-dimensional points and edges, as illustrated in
Figure 3. It also includes, in our approach, the moving (
) and cutting speeds (
), which are numerical parameters that vary according to the machinery and the raw material. Let
be the distance between the points
A and
B using a metric that respects the triangle inequality. This study adopted the Chebyshev metric (see
Figure 4) since it abstracts aspects that are ignored: deceleration, acceleration, and effects from the cutting process, such as surface bending. The solution for the MTCP problem is a sequence of actions (being either moving or cutting) for the cutting head device.
The first step is to build an equivalent undirected graph
containing the union of all the polygons’ vertices and edges in the layout (see
Figure 3). We applied the same strategy suggested by Silva et al. [
15].
Figure 5 illustrates two possible paths in which cutting moves are represented as black edges, and simple moves are shown in red. The nodes and edges of the resultant graph portray the polygon points in surface space and the lines resulting from the meeting of two faces, respectively. In the final step, the solution is associated with a sequence of (cut or move) instructions processed by the cutting machine until the separation of the entire layout of pieces is finished.
In addition, this section presents a packing approach that uses a traditional genetic algorithm (GA) to tackle practical instances that exact models cannot address in a reasonable time. GAs are computational algorithms based on the principle of natural selection and survival through the fittest individuals in a similar way to the evolutionary processes in nature [
37]. GA-based methods are among the prevalent approaches to cutting and packing problems [
38,
39] and cutting path problems [
16,
40].
The GA starts by generating a random group of individuals, which are represented by chromosomes or typically binary arrays. These structures are evaluated using a fitness function that measures the candidate solution’s quality. A small percentage of the individuals with the highest fitness is copied into the next generation (elitism). The selection operator then chooses two individuals of the current generation to be combined with probability
(crossover rate). Similarly, the mutation operator is applied to the offspring with probability
(mutation rate) [
41]. After the new population is generated, the stop condition (e.g., number of generations or genetic convergence) of the algorithm is tested. If it is not satisfied, the process is repeated.
In the proposed GA implementation, each individual is encoded by a chromosome represented by a vector
, where
n corresponds to the number of edges that must be cut from the input layout. The
n’s first positions represent the cutting order of each edge, and the remaining elements have binary values (0 or 1) expressing the direction of the process.
Figure 6a illustrates an input layout. We emphasize that the entire cutting process tends to start from the original system of each device (Source) and return with the movement head at the end (Regress). In this work, we considered the point (0,0), because the machine where we applied the tests follows the same idea. Note that in
Figure 6b, the coding process for each individual describes that the input layout has four edges and, therefore, the individuals’ representation vector contains eight positions.
Moreover, the order () and direction () determine the plan of the complete cut. Therefore, when treating each element of the representation vector, we applied an offset assuming the shortest distance (Chebyshev) possible for cases in which the target node of one edge i does not match the origin node of the next . We assumed that 0 represents “left-to-right” or “bottom-to-up,” in other words, for edge (), we considered the initial point to visit u and the final point v, and 1 depicts the directions back.
The initial population was generated by shuffling a list of each cutting edge, while the rest of the positions with values 0s or 1s were drawn randomly under equal probabilities. The fitness of each individual was calculated by adding the time needed to cut, i.e., the time to cut the required edges (
) and the motion of the head from the origin to the initial node of the layout and back from the head to the end of the complete cut (
). It was necessary to consider the speed
(cutting) and the other times
(without cutting) to calculate the value of
.
Figure 7 illustrates the (
i,
)-step of the fitness function. Note that (
i) typifies each position of
, and the two squares represent the required cut edges (
n), in other words, the input layout.
Figure 7a illustrates the
i-step to compute the fitness value for each individual. The
is (
x,
y) edge and its position in the second part of the chromosome (
) contained value 0. The movement occured from node
x to
y (direction represented by 0), and, in this case, the edge (
x,
y) belonged to the set of required cutting edges. Thereby, to compute the time,
was divided by the Chebyshev distance for (
x,
y) to
(cut speed). The next stage, (
-step), supposed that the
was the edge (
z,
w) and that its direction position (
) had value 1—see
Figure 7b. In this condition, to account for the time
, we needed to add the displacement time of the cutting device head from node
y to
z; for this, we applied the displacement speed (1) with the cutting time of the edge (
z,
w), and we used the cutting speed (2). Therefore, Equation (
1) formalizes the fitness function.
The method for individual selection applied was
q-Tournament [
42]. In this procedure, a group of
q individuals was randomly selected with population replacement. This group became part of a dispute in which the winner was determined according to the best fitness. The crossover operator, in general, recombines aspects of chromosomes and benefits the search for the solution space, directing the evolution process. The method applied to the proposed GA was partially matched crossover (PMX) [
43]. The goal is to generate two children by combining pairs of values in a given range of the two parents and exchanging these indexes’ values. This strategy was applied only to the
n’s first elements of the vector.
On the other hand, the remaining positions of the representation were recombined through the two-point crossover. This adaptation facilitates the manipulation of each part of the applied model’s scopes, sequencing edges, and direction choices, respectively. The mutation operator was verified to ensure an expansive scan of the state space and to contain the premature convergence (optimal locations) of the GA. Similar to the idea conceived for the crossover, we applied the Shuffle Indexes method to the first part of the chromosome and the flip bit mutation strategy for the directions portion.
Finally, we detailed all values for GA parameters like population size, crossover and mutation rate, stop criteria, and others in the results
Section 4.
3.2. A BRKGA-Based Approach
Genetic algorithms with random keys (RKGA) were introduced by [
44] to deal with combinatorial optimization problems involving representation adapted to sequencing. In an RKGA, each chromosome is represented as a vector of real numbers in the range
, where
n is the problem’s dimension. A decoder receives a chromosome and maps it into a feasible problem solution. Resende [
45] proposed the Biased Random-Key Genetic Algorithm (BRKGA), in which the individuals are selected in the recombination process, and it also contains the highlighted function of the probability of inheriting information from the parents (
).
This study used the BRKGA due to its tolerance to several optimization problems, assuming that two elements of its framework must be represented [
46]: a compatible decoder, featured in this section, and a representative fitness function, trying to minimize Equation (
1), for this problem.
Figure 8 illustrates the BRKGA heuristic and its parameters: the size of the population (
P), the proportion of the population in the elite (
Pe), and the number of new random individuals that will be included in the new population (
Pm).
An important characteristic of BRKGA is the parameterized uniform crossover [
47]. In this crossover type, one of the parents is extracted from the elite group, while the second parent is extracted from the non-elite set. This enables the BRKGA heuristic to mitigate a premature genetic convergence. On the other hand, it requires the calibration of the
parameter that can affect the overall performance. This peculiar parameter of the BRKGA ensures that the child individual inherits more characteristics of an elite parent. One parent is always selected (with replacement) from the elite solutions group, and the probability that the child inherits the key of the elite parent >0.5. According to Resende [
45], this is a differentiating factor in favor of faster convergence when compared to RKGA [
44].
Each gene in the chromosome representation for individuals in the BRKGA contains a real value in the range [0.1). For example,
Figure 9 illustrates how random keys represent alleles for each chromosome. In our proposed strategy, the value of each gene
was used by the decoder to determine the order and the cuts and movements’ directions. Therefore, the decoder operated as follows: first, the initial
n genes for each chromosome are sorted upwards, corresponding to the cut order. Then, for each of the remaining genes (
), the following function is used to determine the cuts’ direction.
Figure 9 presents the encoding process from random keys to process an individual. Note that this process depends on problem specifications. For this reason, we illustrated this process separately from
Figure 8. The input module saves the SVG file (layout) information like the edges for a cut. The dimension of the array depends on such a value. It is noteworthy that the part of the vector representing the directions does not participate in the keys’ ordering, being decoded only by the function
f(chrom). In this way, sorting random keys (ascending order of keys) results in the sequencing of edges visits. After that, the decoder presents a solution containing a sequence of movements for the input layout and the fitness function defined by Equation (
1), which can calculate the time required for each individual.
In this context, we use
Section 4 to present our GA and BRKGA approaches’ parameters and the cutting (
) and moving speeds (
), inherent in MTCP, for all computational tests applied.