Multi-agricultural machinery task allocation method based on directional adaptive variation strategy
By introducing initialization rules and directional adaptive mutation strategies into the genetic algorithm, dynamically adjusting the variance rate, and combining the 2-opt local optimization mutation operator, the problem of blindness and weak local search capabilities in multi-machine task allocation is solved, and more efficient task allocation optimization is achieved.
Patent Information
- Application Number
- CN202510482538.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-07-18
AI Technical Summary
In the allocation of large-scale multi-machine tasks, the existing technology has problems such as genetic algorithm blindness in the early stage and weak local search capabilities in the later stage, making it difficult to efficiently allocate multiple agricultural machinery tasks.
A genetic algorithm based on a directional adaptive mutation strategy is adopted, and tasks with lower weights are assigned priority by introducing initialization rules, combining probability sorting and gene fragment weight accumulation in cross-operation, the variance rate is dynamically adjusted, and the 2-opt local optimization mutation operator is used for recombination, improving the algorithm's directional local convergence ability.
It improves the search efficiency of genetic algorithms in large-scale multi-machine task allocation, reduces blindness, enhances the local convergence capability in the later stage, and improves the optimization effect of task allocation.
Smart Images

Figure CN120338412A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent control technology, and particularly relates to a multi-agricultural machine task allocation method based on a directional adaptive mutation strategy. Background Art
[0002] In recent years, with the country's emphasis on the development of agriculture, agricultural production has gradually changed from the traditional mode to the intelligent mode. Smart farms are the future development trend of agriculture, and the cooperative operation of multiple agricultural machines is also one of the greatest characteristics of smart farms. In the field of multi-machine task allocation, various algorithms such as genetic algorithms, ant colony algorithms, particle swarm algorithms, simulated annealing algorithms, and various corresponding improved algorithms have been proposed, and how to solve the multi-machine task allocation problem through more efficient algorithms is also the current research focus. With the development of agriculture, smart farms have a greater demand for large-scale multi-agricultural machine task allocation. Therefore, how to design an efficient large-scale allocation algorithm for application in multi-agricultural machine task allocation is one of the key problems that smart farms need to solve. Summary of the Invention
[0003] In order to improve the problems existing in the genetic algorithm in the field of large-scale multi-machine task allocation, the present invention provides a multi-agricultural machine task allocation method based on a directional adaptive mutation strategy, which is used to allocate m work tasks to n agricultural machines. Taking the task allocation strategy as an individual, the optimal task allocation strategy is searched based on the genetic algorithm. The method is characterized in that, by using the genetic algorithm to search for the optimal task allocation strategy, after confirming the individuals that need to mutate, the mutation probability of each gene segment in the individual is adaptively updated, and the gene segments for performing the mutation operation are selected through the mutation probability. The mutation probability of a gene segment is the sum of the set basic mutation probability and the cumulative contribution of the gene segment.
[0004] Further, the priority is set for each work task according to the distance between the work task and the agricultural machine. The closer the distance, the higher the priority. Starting from the work task with the lowest priority, one work task is allocated to each agricultural machine in turn; after each agricultural machine has one work task, the other unallocated work tasks are randomly allocated to the agricultural machines. During the allocation process, the work tasks are preferentially allocated to the agricultural machines with fewer work tasks. The allocation process can adopt the roulette wheel method, and the more tasks an agricultural machine has, the smaller the probability of being selected.
[0005] Further, the fitness searched by the genetic algorithm is the reciprocal of the cost of completing all work tasks. The cost of completing all work tasks includes the travel distance, total energy consumption of all agricultural machines during the process of completing the work tasks, and the time required to complete all work tasks.
[0006] Further, each individual is composed of n gene segments. One work task corresponds to one gene, and the genes are arranged in the order of the agricultural machines executing the work tasks to obtain the gene segment corresponding to the agricultural machine.
[0007] Further, dynamically adjust the mutation intensity according to the iteration progress, that is, as the number of iterations increases, reduce the number of gene segments that need to perform mutation operations and reduce the perturbation amplitude of the mutation operations. After confirming the gene segments for which mutation operations are to be performed, randomly generate two mutation points within each segment, and arrange the genes between these two mutation points in reverse order of the pre-mutation sequence to complete the mutation.
[0008] Further, during the iteration of the genetic algorithm, after confirming the individuals that need to mutate, adaptively update the mutation probability of each gene segment within the individual, and select the gene segments for which mutation operations are to be performed through the mutation probability. The mutation probability of a gene segment is the sum of the set basic mutation probability and the cumulative contribution of the gene segment.
[0009] Further, after confirming the gene segments for which mutation operations are to be performed, randomly generate two mutation points within each segment, and arrange the genes between these two mutation points in reverse order of the pre-mutation sequence to complete the mutation.
[0010] Further, during the process of performing the crossover operation, first determine whether to perform the order crossover operation, and then determine whether to perform the mapping crossover operation.
[0011] Further, the mapping crossover operation includes the following steps:
[0012] Select a segment from the gene sequences of the first parent and the second parent respectively, and copy them to the corresponding positions of the gene sequences of the first offspring and the second parent respectively;
[0013] Remove the genes in the first parent that are the same as those in the second offspring and the genes in the second parent that are the same as those in the first offspring;
[0014] Copy the remaining segments of the first parent except the copied segment to the second offspring, and copy the remaining segments of the second parent except the copied segment to the first offspring;
[0015] Randomly assign the remaining genes in the selected gene segment of the first parent to the second offspring, and randomly assign the remaining genes in the selected gene segment of the second parent to the first offspring.
[0016] Further, the order crossover operation includes the following steps:
[0017] 100. Randomly generate a crossover order sequence {A1, A2, …, A n} and a retention point sequence {B1, B2, …, B n} for the gene segments of the parent for which the order crossover operation is to be performed, and let i = 1;
[0018] 101. Perform the i-th crossover operation to generate a random number within the range of [0, 1). If the random number is less than 0.5, select the A-th gene segment of the first parent; otherwise, select the A-th gene segment of the second parent. i The A-th i gene segments;
[0019] 102. Retain the genes at the first B positions of the original parent in the selected A-th i gene segments, and splice the inverted other genes with the retained genes to obtain the A-th i gene segment of the offspring; i gene segments;
[0020] 103. Remove the genes that the offspring already has from the parents. Determine whether i is equal to n. If so, proceed to step 104; otherwise, set i = i + 1 and return to step 101.
[0021] 104. Randomly insert the remaining genes of the parents into the offspring.
[0022] Compared with the prior art, the present invention has the following beneficial effects:
[0023] 1. The present invention is based on the genetic algorithm as a basic application in large-scale agricultural vehicle task allocation operations. By introducing rules in the initialization process of the genetic algorithm, each service center is used as the starting point of agricultural machinery and tasks with lower weights are preferentially allocated to it. Moreover, through the probability sorting in the crossover operation, the order crossover and mapping crossover that selectively retain the front segment of gene segments increase the population diversity, overcoming the blindness in the early stage of the genetic algorithm.
[0024] 2. The present invention further converges the search range in the later stage of the genetic algorithm. By cumulatively weighting the costs of each gene segment in each iteration, the mutation rate of each gene segment is dynamically adjusted according to the weight level. The finally mutated segments are selected by the mutation rate after normalization processing, and the high-weight segments are recombined through the 2-opt local optimization mutation operator, thus increasing the directional local convergence ability of the algorithm in the later stage and overcoming the problem of weak local search ability in the later stage of the genetic algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flowchart of a multi-agricultural machinery task allocation method based on a rule-based directional adaptive mutation strategy according to an embodiment of the present invention;
[0026] Figure 2 is a schematic diagram of task parameters according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of a mapping crossover operator according to an embodiment of the present invention;
[0028] Figure 4Schematic diagram of the order crossover operator in the embodiment of the present invention;
[0029] Figure 5 Schematic diagram of the directional 2-opt mutation operator in the embodiment of the present invention. Detailed implementation manners
[0030] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0031] The present invention provides a multi-agricultural-machine task allocation method based on a directional adaptive mutation strategy, which is used to allocate m work tasks to n agricultural machines. The task allocation strategy is used as an individual, and the optimal task allocation strategy is searched based on a genetic algorithm. After determining the individuals that need to mutate, the mutation probability of each gene segment in the individual is adaptively updated, and the gene segments for performing the mutation operation are selected through the mutation probability. The mutation probability of a gene segment is the sum of the set basic mutation probability and the cumulative contribution of the gene segment.
[0032] This embodiment proposes an optimal implementation manner. In this embodiment, each gene represents a task plot, and the work task of an agricultural machine is to perform agricultural management activities on this task plot. One task plot can only be allocated to one agricultural machine. Each gene segment represents the task plots allocated to an agricultural machine, and the arrangement order of the genes in the gene segment represents the sequence of work tasks performed by the agricultural machine. The purpose of the present invention is to reasonably allocate m work tasks to n agricultural machines, and the present invention searches for the optimal task allocation strategy through a genetic algorithm.
[0033] In this embodiment, all the agricultural machines in the service center start from the garage at the same time, and return to their respective garages after completing their respective allocated tasks. Among them, the set {a1, a2,..., a n} represents n operating agricultural machines, and the set {t1, t2,..., t m} represents m operating tasks. As an alternative implementation manner, the performance parameters of the i-th agricultural machine are expressed as a i = {v ti , v i , d i , w i , o ti , o i} (i = 1, 2,..., n), where v ti represents the average speed of the i-th agricultural machine during operation (unit: km / h), d irepresents the working width of the i-th agricultural machine (unit: meter m), w i represents the average working ability of the i-th agricultural machine (unit: m 2 / h), v i represents the average traveling speed of the i-th agricultural machine in the non-working state (unit: km / h), o ti represents the average fuel consumption per unit time of the i-th agricultural machine during operation (unit: L / h), o i represents the average fuel consumption per unit time of the i-th agricultural machine during non-working state traveling (unit: L / h); the parameters of the j-th task are represented as t j ={d tj ,l tj ,q j}(j = 1, 2, …, m), where d tj represents the width of the vertical working path of task t j , l tj represents the length of the parallel working path of task t j , q j represents the working area of task t j , as shown in Figure 2 .
[0034] The fitness of the genetic algorithm search can generally be set by those skilled in the art by minimizing the cost of agricultural machines, maximizing the utility of agricultural machines, etc. As an alternative implementation, the fitness of the genetic algorithm search in this embodiment is the reciprocal of the cost of completing all work tasks. In this embodiment, the cost of completing all work tasks includes the traveling distance, total energy consumption of all agricultural machines during the process of completing work tasks, and the time required to complete all work tasks. As a preferred implementation, the cost of completing all work tasks is calculated through the cost function of multi-machine collaboration, and this cost function is expressed as:
[0035]
[0036] where F is the cost function of multi-machine collaboration, and the reciprocal of this function value is used as the fitness value of the genetic algorithm of the present invention; α, β, γ ∈ [0, 1], respectively representing the weights of distance, energy consumption, and time; S i is the total distance of the i-th agricultural machine; O i is the total energy consumption of the i-th agricultural machine; T i is the time when the i-th agricultural machine completes all tasks and returns. Those skilled in the art can obtain the distance, energy consumption, and working time of each agricultural machine in any way in the prior art.
[0037] This embodiment provides a method for obtaining the total distance of an agricultural machine. In this obtaining method, the total distance of the agricultural machine is divided into four parts. The total distance of the i-th agricultural machine includes four parts, including: agricultural machine a iThe distance \(S(a, t)\) from the agricultural machinery center garage to the first task point \(t\) j , \(t\) i ); the distance \(S(a, t, t)\) of agricultural machinery \(a\) from its \(j\)-th task \(t\) j to the next task \(t\) i ; the distance \(S(a, t, t)\) of agricultural machinery \(a\) from its last task \(t\) j back to the agricultural machinery center garage; the total distance \(S(a, t)\) of agricultural machinery \(a\) operating within the task plot, where \(j, k, l, w\in\{1, 2, \ldots, m\}\); thus, the total distance \(S\) of the \(i\)-th agricultural machinery in this embodiment is expressed as: k i , \(t\) j , \(t\) k ); i l i , \(t\) l ); i i , \(t\) w ), where \(x(a, j)\), \(x(a, jk)\), \(x(a, l)\), \(x(a, w)\) are indicator functions, respectively expressed as: i
[0038]
[0039] i , \(j\)), \(x(a\) i , \(jk\)), \(x(a\) i , \(l\)), \(x(a\) i , \(w\)) are indicator functions, respectively expressed as:
[0040]
[0041] i
[0042]
[0043] i , \(j\)) is an indicator function, expressed as:
[0044]
[0045] i
[0046]
[0047] According to the positions of each task point and the garage, calculate the distance matrix. Take the position of the garage as the starting point, and the other m task points as the second to the (m + 1)-th points, so as to determine the following distance matrix:
[0048]
[0049] Among them, d i,j represents the travel distance between the (i - 1)-th task point and the (j - 1)-th task point.
[0050] After establishing the cost function, introduce the initialization rule. It is required that when the agricultural machinery leaves the garage, the task plot with the smallest initialization allocation weight is initialized, that is, the task closest to the agricultural machinery is preferentially assigned to the agricultural machinery. The remaining task plots are randomly assigned to the agricultural machinery, thereby giving an initialization allocation direction, reducing the search blindness of the genetic algorithm in the early stage of iteration, and improving the quality of the initial population.
[0051] Initialize through two-stage real number coding to obtain a population of N parent individuals, so as to perform subsequent crossover operations. To meet the population diversity and retain specific genes in the rule part, the crossover operator adopts a combination of order crossover and mapping crossover, which specifically includes the following steps:
[0052] First, generate a first random number Rc1 ∈ [0, 1). If Rc1 < Pc1, perform order crossover; if Rc1 ≥ P c1 , the individual remains unchanged;
[0053] Then, generate a second random number Rc2 ∈ [0, 1). If Rc1 < Pc2, perform mapping crossover; if Rc2 ≥ P c2 , the individual directly remains unchanged;
[0054] Repeat the crossover step until the number of generated offspring individuals reaches N. In this process, order crossover is used to retain the order of specific gene fragments, and mapping crossover is used to recombine some gene fragments to meet the diversity of the algorithm; among them, P c1 represents the probability threshold for performing order crossover, and P c2 represents the probability threshold for performing mapping crossover.
[0055] Before performing the mutation operation, introduce fragment gene weight accumulation. In each iteration, record the contribution of each gene fragment to the total cost, that is:
[0056]
[0057] Among them, is the contribution of the i-th gene fragment to the total cost in the t-th iteration; Denotes the cost of the i-th gene segment at the t-th iteration.
[0058] The present invention introduces a decay factor β1 to ensure that the total weight of genes does not accumulate excessively locally during each iteration, resulting in premature convergence. Then, the total weight of each segment at each iteration is calculated, i.e.:
[0059]
[0060] Where Denotes the total weight of the i-th gene segment at the t-th iteration.
[0061] According to the weight accumulation, high-weight gene segments that need to mutate are determined, and the mutation probability of gene segments is dynamically adjusted using the following formula:
[0062]
[0063] Where Denotes the mutation probability of the i-th gene segment at the t-th iteration; α1 is the decay factor; P m Is the basic mutation probability.
[0064] The mutation probabilities of each gene segment are normalized to obtain the mutation probabilities P Mutate(i) of each gene segment, and the roulette wheel strategy is executed to select the segments that finally need to mutate. For the mutated part, a 2-opt local optimization mutation operator is used.
[0065] The mutation intensity is dynamically adjusted according to the iteration progress. In the early stage, large-scale perturbations of multiple segments are generated, while in the later stage, local perturbations of fewer segments are performed. As an alternative implementation method, the number of gene segments that need to mutate at the it-th iteration is calculated using the following formula:
[0066]
[0067] Where R selected Denotes the number of gene segments that need to mutate at the it-th iteration; it represents the current iteration number; Max(it) represents the maximum iteration number; Is the ceiling function.
[0068] The mutation operation is repeatedly executed until the number of generated offspring individuals reaches N; gene segments with higher probability weights are selected through directional selection, and the high-weight genes are recombined after being processed by the local optimization mutation operator to obtain potentially better solutions.
[0069] During the execution of the genetic algorithm in this embodiment, in each iteration, the initialized population with the highest fitness and the population after crossover are directly retained respectively, and the population after mutation is incorporated into the final population to obtain the final population of this iteration. The fitness of the final population in this iteration is compared, and the individual with the highest fitness is recorded. After all the iteration times are completed, the individuals with the highest fitness obtained in each iteration are compared, and the individual with the highest fitness is selected as the optimal individual. As Figure 1 , it specifically includes the following steps:
[0070] S1. Establish a cost function, introduce initial rules to generate an initialized population, and set the iteration parameter it = 0;
[0071] S2. Set it = it + 1, and set the iteration parameter i = 0;
[0072] S3. Set i = i + 1, and judge whether the first random parameter Rc1 in the i-th iteration is less than the probability threshold P for performing order crossover c1 , if it is less, then execute the order crossover operator; otherwise, execute step S4;
[0073] S4. Judge whether the second random parameter Rc2 in the i-th iteration is less than the probability threshold P for performing mapping crossover c2 , if it is less, then execute the mapping crossover operator, otherwise retain the individual with the highest fitness as the i-th offspring individual;
[0074] S5. Judge whether the current individual quantity reaches the population quantity N. If not, return to step S3; otherwise, obtain the offspring population, and set j = 0;
[0075] S6. Set j = j + 1. For the j-th offspring individual, calculate the cumulative contribution of each gene segment of this individual, then calculate its weight according to the cumulative contribution, normalize the weight to obtain its mutation probability, and use roulette wheel to select R selected gene segments according to the mutation probability;
[0076] S7. Judge whether the mutation probability of the selected gene segment is greater than the set threshold. If it is greater, then execute the 2-opt mutation operator to perform mutation, otherwise do not mutate and directly obtain the j-th mutated offspring;
[0077] S8. Judge whether all individuals in the population N have performed mutation operations. If not, return to step S6; otherwise, judge whether the current iteration times exceed the maximum iteration times Max(it). If so, end the iteration and output the optimal individual, otherwise return to step S2.
[0078] Figure 2 is a schematic diagram of the task parameters in the embodiment of the present invention. The length l of each task plot i and width d iIt is known that agricultural machinery operates inside the plot in a roundabout manner.
[0079] Figure 3 This is a schematic diagram of the mapping crossover operator in an embodiment of the present invention. The first parent ( Figure 3 parent 1 in Figure 3 ) and the second parent ([parent 2 in
[0080] are selected for crossover through roulette wheel selection. Subsequently, two random sequences are generated to select a suitable segment from one of the two parents. In this embodiment, taking the example of allocating 15 tasks to three agricultural machines, each individual includes 3 gene segments, and the sum of genes in each gene segment of each individual is 15. The specific process of the mapping crossover operator is as follows: Figure 3 As shown in
[0081] , in the first parent, the first gene segment is the work task sequence to be executed by the first agricultural machine, expressed as {12, 9, 4, 14, 8}, the second gene segment is the work task sequence to be executed by the second agricultural machine, expressed as {1, 15, 5, 2}, and the third gene segment is the work task sequence to be executed by the third agricultural machine, expressed as {10, 3, 11, 6, 13, 7}; similarly, in the second parent, the first gene segment is the work task sequence to be executed by the first agricultural machine, expressed as {5, 12, 9, 1, 13, 15}, the second gene segment is the work task sequence to be executed by the second agricultural machine, expressed as {7, 3, 14, 4, 8}, and the third gene segment is the work task sequence to be executed by the third agricultural machine, expressed as {2, 11, 10, 6}; Figure 3 A random sequence is generated. This random sequence includes two elements, and each element respectively represents the gene segment selected from the first parent and the second parent to be retained in the offspring. In this embodiment, this random sequence is {1, 2}, which means that the first gene segment in the first parent is retained and copied to the position of the first gene segment in the first offspring ([offspring 1 in Figure 3 ); the second segment in the second parent is selected and retained and copied to the position of the second gene segment in the second offspring ([offspring 2 in
[0082] Then, the genes in the first parent that are the same as those in the second offspring are removed. After removal, the gene segments of the first parent are expressed as: {12, 9}, {1, 15, 5, 2}, {10, 11, 6, 13}, Figure 3 To represent the removed genes, the positions of the removed genes are left empty; similarly, the genes in the second parent that are the same as those in the first offspring are removed. After removal, the gene segments of the first parent are expressed as: {5, 1, 13, 15}, {7, 3}, {2, 11, 10, 6};
[0083] Then, copy the remaining segments of the first parent except the copied segment to the second offspring. That is, copy the 2nd and 3rd gene segments to the 2nd and 3rd gene segment positions of the second offspring. The gene segments of the obtained second offspring are represented as: {12, 9}, {7, 3, 14, 4, 8}, {10, 11, 6, 13}; Similarly, copy the remaining segments of the second parent except the copied segment to the first offspring. That is, copy the 1st and 3rd gene segments to the 1st and 3rd gene segment positions of the first offspring. The gene segments of the obtained first offspring are represented as: {12, 9, 4, 14, 8}, {7, 3}, {2, 11, 10, 6};
[0084] Finally, randomly assign the remaining genes to the first offspring and the second offspring. Among them, the genes missing in the first offspring of this embodiment are {1, 5, 13, 15}, and the genes missing in the second offspring are {1, 2, 5, 15}. When randomly inserting, it also follows the principle of preferentially inserting into the gene segment with fewer tasks, that is, the probability of inserting into the gene segment with fewer genes can be increased, and then the gene segment to be inserted is selected based on roulette selection. The position of the inserted gene is random. The gene segments of the first offspring obtained after random insertion are represented as: {5, 12, 9, 4, 14, 8}, {7, 3, 1, 13}, {15, 2, 11, 10, 6}, and the gene segments of the second offspring obtained after random insertion are represented as: {1, 12, 9, 15}, {5, 7, 3, 14, 4, 8}, {10, 11, 6, 13, 2}.
[0085] Figure 4 This is a schematic diagram of the order crossover operator in the embodiment of the present invention. Before performing the order crossover, randomly generate the crossover order and randomly retain the positions. Select the first parent ( Figure 4 parent 1 in it) and the second parent ( Figure 4 parent 2 in it) through roulette selection. Taking 3 agricultural machines and 15 task points as an example, randomly generate a crossover order sequence {A1, A2, …, A n}, the number of elements in this sequence is the same as the number of gene segments, and the sequence number of the element represents the execution order of the crossover, and the value of the element represents the serial number of the gene segment selected for the crossover. For example, A1 = 2 means that the first execution of the order crossover operator selects the second gene segment. Randomly generate a retention point sequence {B1, B2, …, B n}. In the present invention, the retention point refers to retaining the first B1 genes in the original parent. First, generate a random number sequence, the number of elements in this sequence is the same as the number of gene segments, and each element belongs to the interval (0, 1]. Determine whether to select the first parent or the second parent for the i-th execution of the order crossover operator according to the relationship between the i-th element and the set threshold. Confirm the selected gene segment according to the value of the i-th element A i in the crossover order sequence, and according to the i-th element B iThe value confirmation requires preserving the remaining gene order in the first B positions of the gene segment during the i-th execution of crossover. Taking 3 agricultural machines and 15 task points as an example, in this embodiment, the crossover order sequence is {2, 1, 3}, and the retention point sequence is {1, 2, 2}, which specifically includes the following parts: i Determine the gene positions to be retained. These positions are the positions of the gene points in the original parent. If the genes before this gene point are deleted during the crossover process, only the genes that have not been deleted before this position need to be retained;
[0086] In this embodiment, the original gene sequences of the first parent (parent 1 in
[0087] Figure 4 are: {12, 9, 4, 14, 8}, {1, 15, 5, 2}, {10, 3, 11, 6, 13, 7}; the original gene sequences of the second parent (parent 2 in Figure 4 Figure 4 are: {5, 12, 9, 1, 13, 15}, {7, 3, 14, 4, 8}, {2, 11, 10, 6};
[0088] According to the relationship between the generated third random number and the set threshold, determine whether to select the first parent or the second parent. For example, in this embodiment, the threshold is set to 0.5. When the generated third random number Rc3 < 0.5, select the first parent; otherwise, select the second parent. After selecting the parent, select the gene segment for the current execution of crossover according to the elements in the crossover order sequence. For example, if the first element of this sequence is 2, then select the second gene segment {1, 15, 5, 2}, copy the second gene segment of the first parent to the position of the second gene segment of the offspring, and determine the number of gene points to be retained according to the value of the first element in the retention point sequence. In this embodiment, only the first 1 gene of the original gene sequence of this gene segment is retained, that is, {1}, reverse the remaining genes {15, 5, 2} to get {2, 5, 15}, splice the retained gene and the reversed gene to get {1, 2, 5, 15}, and at the same time delete the genes repeated in the gene segment {1, 2, 5, 15} in the first parent and the second parent. After deletion, only the first gene segment and the third gene segment of the first parent contain genes, which are respectively represented as: {12, 9, 4, 14, 8}, {10, 3, 11, 6, 13, 7}; after deletion, each gene segment of the second parent is represented as {12, 9, 13}, {7, 3, 14, 4, 8}, {11, 10, 6}, Figure 4 Leave the positions of the deleted genes empty for easy understanding. At this time, only the second gene segment of the offspring has genes, which is represented as {1, 2, 5, 15};
[0089] Perform the second crossover in order. If the generated fourth random number Rc4 ≥ 0.5, select the second parent. The crossover order sequence is {2, 1, 3}, and the second element is 1, that is, select the first gene segment of the second parent. After deleting some genes in the first time, this gene segment is {12, 9, 13}. The retention point sequence is {1, 2, 2}, and the second element is 2, so retain the first two genes in the original sequence, that is, {5, 12}. However, since the gene {5} in the original sequence was deleted after the first crossover, only {12} is retained. The sequence after inverting the remaining genes {9, 13} is {13, 9}. The sequence obtained by splicing the retained gene and the inverted gene is still {12, 13, 9}. Take this sequence as the first gene segment of the offspring. At the same time, delete the genes in the first parent and the second parent that are repeated with the gene segment {12, 13, 9}. After deletion, only the first gene segment and the third gene segment of the first parent contain genes, which are respectively expressed as: {4, 14, 8}, {10, 3, 11, 6, 7}; after deletion, only the second gene segment and the third gene segment of the second parent contain genes, which are respectively expressed as {7, 3, 14, 4, 8}, {11, 10, 6}. At this time, only the first gene segment and the second gene segment of the offspring have genes, which are in turn: {12, 13, 9}, {1, 2, 5, 15};
[0090] Next, perform the third ordered crossover. If the generated fifth random number Rc5 < 0.5, select the third gene segment in the first parent to execute the ordered crossover operator, that is, select the third gene segment {10, 3, 11, 6, 7} of the first parent, retain the first 2 genes {10, 3}, invert the remaining genes to get {7, 6, 11}, and splice the retained genes and the inverted genes to get the sequence {10, 3, 7, 6, 11}. Take this gene segment as the third gene segment of the offspring. At this time, all 3 gene segments of the offspring have genes, which are in turn: {12, 13, 9}, {1, 2, 5, 15}, {10, 3, 7, 6, 11};
[0091] Randomly insert the remaining genes in the parents into the offspring. The remaining genes include {4, 8, 14}. During the random insertion process, it is also possible to follow the principle of preferentially inserting genes into gene segments with fewer tasks, that is, increase the probability of inserting genes into gene segments with fewer genes, and then select the gene segment to be inserted based on roulette selection. The position of the inserted gene is random. Finally, the gene segments of the obtained offspring are expressed as {12, 13, 4, 9}, {1, 2, 5, 15, 14}, {10, 3, 7, 8, 6, 11}.
[0092] Figure 5Schematic diagram of the directed 2-opt mutation operator according to an embodiment of the present invention. The directed 2-opt mutation operator determines the fragment to be mutated through the cumulative weight of gene fragments. At the same time, two random positions i and j are generated within this fragment, and the gene sequences at these two positions are inverted and then re-inserted into the original positions to complete the mutation operation. Specifically, as Figure 5 , for the gene fragments corresponding to three agricultural machines, if the gene fragment {10, 3, 11, 6, 13, 7} corresponding to agricultural machine 3 is selected for mutation, and the two randomly generated indices are i = 2 and j = 5, that is, the sequence corresponding to the second gene as the starting point and the fifth gene as the ending point is extracted. This sequence is represented as {3, 11, 6, 13}, and after inverting this sequence, we get {13, 6, 11, 3}. The inverted sequence is inserted into the corresponding position of the original gene fragment to obtain the mutated gene fragment, which is represented as {10, 13, 6, 11, 3, 7}.
[0093] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A multi - agricultural - machine task allocation method based on a directional adaptive mutation strategy, which is used to allocate m work tasks to n agricultural machines. Taking the task allocation strategy as an individual, the optimal task allocation strategy is searched based on a genetic algorithm. It is characterized in that, Using a genetic algorithm to search for the optimal task allocation strategy, after identifying the individuals that need to mutate, adaptively update the mutation probability of each gene segment within the individual. Select the gene segments to perform the mutation operation based on the mutation probability. The mutation probability of a gene segment is the sum of the set base mutation probability and the cumulative contribution of the gene segment.
2. The method according to claim 1, wherein When the genetic algorithm is initialized, set the priority for each work task according to the distance between the work task and the agricultural machinery. The closer the distance, the higher the priority. Starting from the work task with the lowest priority, assign a work task to each agricultural machinery in turn. After each agricultural machinery has a work task, randomly assign the other unassigned work tasks to the agricultural machinery. During the assignment process, give priority to assigning work tasks to the agricultural machinery with fewer work tasks.
3. The method according to claim 1, wherein The fitness value searched by the genetic algorithm is the reciprocal of the cost of completing all work tasks. The cost of completing all work tasks includes the travel distance, total energy consumption of all agricultural machinery during the process of completing the work tasks, and the time required to complete all work tasks.
4. The method according to claim 1, characterized in that Each individual consists of n gene segments. Correspond one work task to one gene, and arrange the genes in the order of the agricultural machinery executing the work tasks to obtain the gene segment corresponding to the agricultural machinery.
5. The method according to claim 1, characterized in that Dynamically adjust the mutation intensity according to the iteration progress, that is, as the number of iterations increases, reduce the number of gene segments that need to perform the mutation operation and reduce the perturbation amplitude of the mutation operation. After identifying the gene segments to perform the mutation operation, randomly generate two mutation points within each segment, and arrange the genes between these two mutation points in reverse order of the pre-mutation order to complete the mutation.
6. The method according to any one of claims 1 to 5, characterized in that, During the iteration of the genetic algorithm, retain the population with the higher fitness value from the current iteration's population and the population after its crossover operation, and merge this population with the population after the mutation operation of the current iteration's population as the output population of the current iteration.
7. The method according to claim 6, wherein During the execution of the crossover operation, first determine whether to perform the order crossover operation, and then determine whether to perform the mapping crossover operation.
8. The method according to claim 7, wherein The mapping crossover operation includes the following steps: Select a segment from the gene sequences of the first parent and the second parent respectively, and copy them to the corresponding positions of the gene sequences of the first offspring and the second offspring respectively. Remove the genes in the first parent that are the same as those in the second offspring, and the genes in the second parent that are the same as those in the first offspring. Copy the remaining segments of the first parent except the copied segment to the second offspring, and copy the remaining segments of the second parent except the copied segment to the first offspring. Randomly assign the remaining genes in the selected gene segment of the first parent to the second offspring, and randomly assign the remaining genes in the selected gene segment of the second parent to the first offspring.
9. The method according to claim 7, characterized in that, The order crossover operation includes the following steps:
100. Randomly generate a crossover order sequence {A1, A2, …, A n} and a retention point sequence {B1, B2, …, B n}, and let i = 1; 101. Perform the i-th execution of crossover, generate a random number within the interval [0, 1). If the random number is less than 0.5, select the A i gene segments of the first parent, otherwise select the A i gene segments of the second parent; 102. Retain the genes at the first B positions of the original male parent in the selected A gene fragments, invert the other genes, and splice them with the retained genes to obtain the A gene fragments of the offspring; i for the A i gene fragments, retain the genes at the first B positions of the original male parent, invert the other genes, and splice them with the retained genes to obtain the A i gene fragments of the offspring; 103. Remove the genes that the offspring already have in the parent. Determine whether i is equal to n. If so, go to step 104; otherwise, set i = i + 1 and return to step 101.
104. Randomly insert the remaining genes of the parent into the offspring.