A factory inspection task allocation and route planning method
Patent Information
- Application Number
- CN202310762197.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-06-26
AI Technical Summary
但对于工厂中各建筑物、各楼层的设备需以周、月、季度等时间周期分配的巡检任务及同一设备的两次巡检需要有一定时间间隔的要求,现有无论是通过人员巡检还是通过机器人进行智能巡检,其均难以将所有设备的巡检任务进行合理的安排,使其满足时间间隔要求
Smart Images

Figure CN116859915B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of task allocation and route planning technology, and in particular to a method for allocating and planning factory inspection tasks. Background Technology
[0002] To maintain the normal operation of factory equipment, regular inspections are necessary to promptly identify any abnormalities. While robots are currently used for regular intelligent inspections to improve efficiency and effectively reduce labor costs, existing methods struggle to rationally schedule inspections of all equipment in different buildings and floors on a weekly, monthly, or quarterly basis, and to ensure sufficient time intervals between inspections of the same equipment. Both manual and robotic intelligent inspections cannot adequately meet these time interval requirements. Furthermore, after task allocation, it is impossible to plan inspection routes effectively to further improve efficiency and reduce manpower and material costs, resulting in additional resource waste.
[0003] Therefore, in the existing factory equipment inspection process, there are technical difficulties such as the inability to reasonably allocate inspection tasks and plan inspection routes, which increases inspection costs and fails to meet the needs of factory inspection. Summary of the Invention
[0004] This invention aims to provide a method for allocating factory inspection tasks and planning routes to solve the aforementioned technical problems. It uses a greedy algorithm to allocate inspection tasks and a genetic algorithm to plan inspection routes, thereby making the allocation of inspection tasks reasonable and optimizing the inspection tasks, effectively reducing inspection costs and meeting the needs of factory inspection.
[0005] To address the aforementioned technical problems, this invention provides a method for factory inspection task allocation and route planning, comprising the following steps:
[0006] Obtain factory inspection tasks, and allocate them according to equipment inspection cycles based on a greedy algorithm to obtain task allocation results;
[0007] Based on the task allocation results, calculate the distance between the inspection equipment required for each task;
[0008] Based on the task allocation results and the distance between the inspection equipment required for each task, the inspection route is planned for each task using a genetic algorithm to minimize the total inspection distance and optimize the inspection time for each task.
[0009] In the above scheme, a greedy algorithm is used to allocate inspection tasks, and a genetic algorithm is used to plan inspection routes, so as to make the allocation of inspection tasks reasonable and optimize the inspection tasks, effectively reducing inspection costs and meeting the needs of factory inspection.
[0010] Furthermore, the process of acquiring factory inspection tasks involves allocating these tasks according to the equipment inspection cycle using a greedy algorithm, resulting in the following task allocation results:
[0011] Obtain factory inspection tasks, including the name of all equipment, inspection cycle, number of cycle inspections, inspection interval, and inspection time;
[0012] Based on the greedy algorithm, a task table V = [(Name, M, GT, T)] is created to represent the equipment corresponding to the factory inspection tasks that meet the inspection cycle. Name represents the name, M represents the number of inspections in the cycle, GT represents the inspection interval, and T represents the inspection time. Each equipment must satisfy M + M * GT ≤ Q, where Q represents the minimum number of days in the inspection cycle.
[0013] For any inspection cycle, the factory inspection tasks are sorted in order of inspection time from V to V. Each row of data in the sorted task table V, i.e., the inspection task of each device, is traversed through the allocation scheme to obtain the range matrix A that can be allocated to each device for each task. Based on the range matrix A, the allocation scheme for each device is obtained to minimize the time of the allocated tasks. Based on the range matrix A, the inspection date of the allocation scheme, the total time of the allocated tasks within the inspection date, and the device name of the allocated tasks are obtained to obtain the task allocation result for that inspection cycle.
[0014] The inspection cycle includes weekly, monthly, quarterly, and annual cycles.
[0015] Furthermore, the calculation of the distance between the inspection devices required for each task based on the task allocation results is specifically as follows:
[0016] For any task, based on its task allocation result, obtain the name of the equipment for the corresponding assigned task within the inspection date, and determine the equipment to be inspected under that task;
[0017] Obtain device coordinates and determine the shortest path between devices based on the device coordinates; obtain the coordinates of turning points and plane terminal turning points on the shortest path.
[0018] The distance between devices is calculated based on the device coordinates, inflection point coordinates, and plane terminal inflection point coordinates.
[0019] Furthermore, based on the task allocation results and the distance between the inspection equipment required for each task, the genetic algorithm is used to plan the inspection route for each task to minimize the total inspection distance and optimize the inspection time for each task. Specifically:
[0020] Based on the task allocation results and the distance between the inspection equipment required for each task, a path planning model is constructed based on preset constraints.
[0021] Based on the distance between the equipment to be inspected for each task, a path planning model is solved using a genetic algorithm to obtain the planned inspection route for each task, so as to minimize the total inspection distance and optimize the inspection time for each task.
[0022] Furthermore, the step of constructing a path planning model based on the task allocation results and preset constraints specifically includes:
[0023] For any task, based on its task allocation results, obtain the name of the equipment assigned to the corresponding task within the inspection date, determine the equipment to be inspected under the task, obtain the coordinates of the equipment to be inspected in this task, and determine the building, floor and inspection time of the equipment.
[0024] For any given inspection date, assume the working time on that date is h; for each building to be inspected, determine the equipment that needs to be inspected on that date, and calculate the total working time t for that building. 总 The assignment just satisfies t 总 ≥K·(h-t') and t 总 K inspection units of <(K+1)·(h-t') inspect the building; where t' represents the round-trip time of the inspection unit from the starting point to the building;
[0025] For any inspection date, a planning table is constructed based on the determined K, the floor and building where the equipment to be inspected is located, and the inspection time.
[0026] A path planning model is constructed based on the planning table and preset constraints.
[0027] Furthermore, in the process of constructing the path planning model based on the planning table and preset constraints, the specific steps are as follows:
[0028] With the objective function of minimizing the total time F spent on the road during inspections, a path planning model is constructed, specifically expressed as follows:
[0029]
[0030] In the formula, N represents the number of tasks to be inspected, which is obtained from the planning table; i represents task i, j represents task j, and i and j equal to 0 indicate the starting point; k represents inspection unit k; c ijThis represents the time required to travel from task i to task j, where i ≠ j; x ijk This is a state variable. Its value is 1 when the inspection unit k moves from task i to task j, and 0 otherwise.
[0031] The above model must satisfy the following preset constraints, including:
[0032] The number of inspection units is constrained, meaning that the number of inspection units starting from the starting point does not exceed K:
[0033]
[0034] The start and end position constraints of the inspection unit indicate that each inspection unit starts from the starting point and eventually returns to the starting point:
[0035]
[0036] Task order inspection constraint means that each task is completed by exactly one inspection unit:
[0037]
[0038]
[0039] The flow conservation constraint means that the inspection unit must leave after completing a certain task:
[0040]
[0041] The time window constraint means that the departure and return times of each inspection unit must fall within a specified time window:
[0042]
[0043] In the formula: This indicates the departure time of inspection unit k. t represents the required return time for inspection unit k. ij This indicates the time it takes for the inspection unit to move from the equipment located at task i to the equipment located at task j; f i This represents the inspection time required for the inspection unit to complete task i, i.e., the dwell time.
[0044] Motion time constraint refers to the time constraint for the inspection unit to reach task j from task i:
[0045]
[0046] In the formula: s i This indicates the time when the inspection unit reaches the equipment where task i is located, where s0 = 0;
[0047] Integerization constraints are used to limit x.ijk Only 0 or 1 can be selected:
[0048] x ijk ∈{0,1} i,j∈{1,2,...,N},k∈{1,2,...,K} (9)
[0049] Furthermore, based on the distance between the inspection equipment required for each task, a path planning model is solved using a genetic algorithm to obtain the planned inspection route for each task, so as to minimize the total inspection distance and optimize the inspection time for each task. Specifically:
[0050] For the constructed path planning model, its feasible solution corresponds to the combination of all inspected equipment and inspection paths; the form of its feasible solution is encoded into genotype string structure data in the genetic space based on a genetic algorithm, resulting in several chromosomes;
[0051] An initial population is generated randomly based on several chromosomes, and the fitness of each chromosome in the initial population is calculated.
[0052] Based on the fitness of each chromosome, the population is subjected to genetic operations such as selection, crossover, and variation to obtain a new generation of population;
[0053] Calculate the fitness of each chromosome in the new generation population and sort the chromosomes according to their fitness to prepare for the genetic operations of the next generation.
[0054] The system makes a judgment based on a preset termination evolution rule. If the condition is met, the next generation of inheritance is stopped; otherwise, the next generation of inheritance is executed.
[0055] After stopping the next generation of genetics, the chromosome with the best performance is selected for decoding. The optimal solution of the path planning model is obtained based on the distance between the inspection equipment required for each task, so as to minimize the total inspection distance and optimize the inspection time for each task.
[0056] Furthermore, the feasible solution is encoded into genotype string structure data in the genetic space based on a genetic algorithm, resulting in several chromosomes, specifically:
[0057] The equipment to be inspected is like a gene in a chromosome.
[0058] Initialize a new path as a chromosome, and insert genes into the current chromosome in sequence. If the insertion of a gene causes the chromosome to exceed the preset length or not meet the preset constraints, then initialize a new path and insert genes again.
[0059] Finally, all the devices inspected along the inspection path are sequentially encoded into several chromosomes to ensure that each device is inspected and inspected only once.
[0060] Furthermore, based on the fitness of each chromosome, the population is subjected to genetic operations of selection, crossover, and variation to obtain a new generation population, specifically as follows:
[0061] The roulette wheel selection operator is applied to the population, and some superior chromosomes are selected to be passed on to the next generation based on the fitness of each chromosome.
[0062] The crossover operator is applied to the population to exchange some genes between selected pairs of chromosomes with a certain probability, thus generating new chromosomes.
[0063] The mutation operator is applied to the population, and for the selected chromosome, its genes are changed with a certain probability, resulting in a new chromosome.
[0064] Furthermore, the step of applying the mutation operator to the population and changing the genes of the selected chromosomes with a certain probability to generate new chromosomes specifically involves: applying the inversion mutation operator to the population and changing the genes of the selected chromosomes with a certain probability to generate new chromosomes. Attached Figure Description
[0065] Figure 1 This is a schematic flowchart of a factory inspection task allocation and route planning method according to an embodiment of the present invention;
[0066] Figure 2 This is a schematic diagram illustrating the calculation of the location and distance of equipment to be inspected, provided in an embodiment of the present invention.
[0067] Figure 3 This is a flowchart of the basic steps of a genetic algorithm provided in an embodiment of the present invention;
[0068] Figure 4 A schematic diagram of a roulette wheel provided in an embodiment of the present invention;
[0069] Figure 5 This is a schematic diagram of an inversion variation operation provided in an embodiment of the present invention. Detailed Implementation
[0070] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0071] Please see Figure 1 This embodiment provides a method for factory inspection task allocation and route planning, including the following steps:
[0072] Obtain factory inspection tasks, and allocate them according to equipment inspection cycles based on a greedy algorithm to obtain task allocation results;
[0073] Based on the task allocation results, calculate the distance between the inspection equipment required for each task;
[0074] Based on the task allocation results and the distance between the inspection equipment required for each task, the inspection route is planned for each task using a genetic algorithm to minimize the total inspection distance and optimize the inspection time for each task.
[0075] In this embodiment, a greedy algorithm is used to allocate inspection tasks, and a genetic algorithm is used to plan inspection routes, so as to make the allocation of inspection tasks reasonable and optimize the inspection tasks, effectively reducing inspection costs and meeting the needs of factory inspection.
[0076] Furthermore, the process of acquiring factory inspection tasks involves allocating these tasks according to the equipment inspection cycle using a greedy algorithm, resulting in the following task allocation results:
[0077] Obtain factory inspection tasks, including the name of all equipment, inspection cycle, number of cycle inspections, inspection interval, and inspection time;
[0078] Based on the greedy algorithm, a task table V = [(Name, M, GT, T)] is created to represent the equipment corresponding to the factory inspection tasks that meet the inspection cycle. Name represents the name, M represents the number of inspections in the cycle, GT represents the inspection interval, and T represents the inspection time. Each equipment must satisfy M + M * GT ≤ Q, where Q represents the minimum number of days in the inspection cycle.
[0079] For any inspection cycle of factory inspection tasks, the task table V is sorted according to the inspection cost in ascending order. Each row of data in the sorted task table V, i.e., the inspection task of each device, is traversed through the allocation scheme to obtain the range matrix A of the tasks that can be allocated to each device for each time. Based on the range matrix A, the allocation scheme for each device is obtained to minimize the time of the allocated tasks. Based on the range matrix A, the inspection date of the allocation scheme, the total duration of the allocated tasks within the inspection date, and the device name of the allocated tasks are obtained to obtain the task allocation result for that inspection cycle. The inspection cycle includes weeks, months, quarters, and years.
[0080] It's important to note that Q represents the minimum number of days in the inspection cycle. Taking a week as an example, if a device needs to be inspected twice a week, with a minimum interval of one day between inspections, then M = 2, Q = 7, and GT = 1. This task can be inspected on Monday-Wednesday, Monday-Thursday, Monday-Friday, Monday-Saturday, or Tuesday-Thursday, etc. However, it's crucial to avoid using Monday and Sunday, as the interval between Sunday and the following Monday is less than one day, thus failing to meet the minimum interval requirement. The minimum cycle length Q for weekly tasks is constant at 7, but for monthly tasks, the value will vary depending on the number of days in each month, as will for quarterly and yearly tasks.
[0081] In this embodiment, the inspection tasks for all equipment on all floors need to be uniformly allocated according to weekly, monthly, quarterly, and annual cycles. Since the inspection intervals for each type of equipment are different, the tasks need to be allocated according to the inspection cycle. Since a year contains 52 weeks, 12 months, and 4 quarters, the tasks can be allocated based on the number of tasks in the order of weeks, months, quarters, and years to avoid duplicate task allocation.
[0082] In this embodiment, for weekly tasks, the weekly inspection tasks are divided into tasks from Monday to Sunday. The inspection tasks for each day are determined by obtaining the weekly task list. For a device that needs to be inspected, it needs to be inspected at different times and intervals. There are multiple allocation schemes for allocating its tasks to the 7 days of the week. This embodiment can traverse all allocation schemes and select the scheme with the least time spent on the allocated tasks.
[0083] For weekly task allocation, based on a greedy algorithm, a task table V = [(Name, M, GT, T)] is created to represent the equipment corresponding to the factory inspection tasks that need to be carried out on a weekly basis. Here, Name represents the name, M represents the number of inspections per cycle, GT represents the inspection interval, and T represents the inspection time. Each equipment must satisfy M + M * GT ≤ 7. The task table V is then sorted in descending order of inspection time.
[0084] For each row of data in the sorted task table V, i.e., the inspection task of each device, iterate through the allocation schemes: If a device needs to be inspected m times, with an interval of t days between each inspection, the number of days n that can be allocated can be calculated as follows:
[0085] n = 7 - [(number of times - 1) * interval + number of times] + 1
[0086] The number of days available for allocation in the first round is 1, 2, ..., n;
[0087] The number of days available for allocation in the second round is 1+(t+1), 2+(t+1), ..., n+(t+1);
[0088] The number of days that can be taken in the mth time is 1+(m-1)*(t+1),2+(m-1)*(t+1),...,n+(m-1)*(t+1).
[0089] This yields the range matrix A that can be allocated to each device for each task. The specific range matrix A is as follows:
[0090] A = S nm =
[0091]
[0092] Where A = S nm It is an (n×m) dimensional two-dimensional matrix, where the elements in the m-th column represent the range of days that can be taken for the m-th inspection task. The m inspection tasks are then extracted sequentially from the m columns, specifically:
[0093] After obtaining the matrix of possible number of days for all possible values, select one number from each of the m columns of this matrix. If the following two conditions are met:
[0094] Any two points satisfy: if x i >x j , then y i ≥y j , i=1,2,...,m, j=1,2,...,n, i≠j;
[0095] (the number drawn in the first round - 1) + (7 - the number drawn in the mth round) ≥ t.
[0096] Then the combination of these m numbers is a feasible allocation scheme. In the formula, xy represents the xy axis of the above two-dimensional matrix, and (xi, yi) represents the coordinates of a number. After traversing all feasible allocation schemes, the scheme with the shortest allocated task time is determined as the final allocation scheme, and the task allocation result with a week period is obtained.
[0097] Furthermore, after the weekly tasks are allocated, since the daily tasks will be different each month, it is necessary to allocate monthly tasks separately. There are many feasible solutions at this point, but iterating through all of them would result in high time and space complexity. Therefore, the following greedy algorithm can be used for monthly task allocation:
[0098] Create a task table V = [(Name,M,GT,T)] that satisfies the requirement of monthly factory inspection tasks for the corresponding equipment, where Name represents the name, M represents the number of periodic inspections, GT represents the inspection interval, and T represents the inspection time. Each equipment must satisfy M + M * GT ≤ the minimum number of days in the month. Sort the task table V in descending order of inspection time.
[0099] For each row of data in the sorted task table V, i.e., the inspection task of each device, iterate through the allocation schemes: If a device needs to be inspected m times, with an interval of t days between each inspection, the number of days n that can be allocated can be calculated as follows:
[0100] n = number of days in a month - [(number of times - 1) * interval + number of times] + 1,
[0101] The first available number of days is 1, 2, ..., n;
[0102] The number of days that can be taken the second time is 1+(t+1), 2+(t+1), ..., n+(t+1);
[0103] The number of days that can be taken in the mth time is 1+(m-1)*(t+1),2+(m-1)*(t+1),...,n+(m-1)*(t+1).
[0104] This yields the range matrix A that can be allocated to each device for each task. The specific range matrix A is as follows:
[0105] A = S nm =
[0106]
[0107] Where A = S nm It is an (n×m) dimensional two-dimensional matrix, where the elements in the m-th column represent the range of days that can be taken for the m-th inspection task. The m inspection tasks are then extracted sequentially from the m columns, specifically:
[0108] The first inspection task, i.e., the range of possible horizontal index i1 for the elements in the first column is (1, n), is to find a u such that S u1 The day with the fewest assigned tasks is chosen as the day for the first inspection task assignment. Calculate the sum of the elements in column m and S. u1 Find a v such that (S) u1 -1)+(mS vm ) = t.
[0109] The range of possible horizontal axis subscripts for the subsequent z-th inspection task is (iz-1, v, the subscript of the value selected for the (z-1)-th inspection task). The day with the fewest assigned tasks is selected from this range and used as the day for assigning the z-th inspection task. This yields the final allocation scheme with the minimum assigned task time, resulting in a monthly task allocation result.
[0110] Similarly, after the weekly and monthly tasks are allocated, the tasks for each quarter and year are allocated separately, following the same monthly allocation method. The change needed is: M + M * GT ≤ the minimum number of days in the quarter or year.
[0111] The above embodiments can allocate inspection tasks for different periods such as weeks, months, quarters, and years, effectively solving the problem of unreasonable allocation of existing inspection tasks. The tasks obtained from task allocation serve as the basic unit for inspection path planning. Under any reasonable allocation conditions, this embodiment can optimize inspection tasks, effectively reduce inspection costs, and meet the needs of factory inspection.
[0112] Furthermore, the calculation of the distance between the inspection devices required for each task based on the task allocation results is specifically as follows:
[0113] For any task, based on its task allocation result, obtain the name of the equipment for the corresponding assigned task within the inspection date, and determine the equipment to be inspected under that task;
[0114] Obtain device coordinates and determine the shortest path between devices based on the device coordinates; obtain the coordinates of turning points and plane terminal turning points on the shortest path.
[0115] The distance between devices is calculated based on the device coordinates, inflection point coordinates, and plane terminal inflection point coordinates.
[0116] In this embodiment, unlike traditional planar distance calculations, the equipment to be inspected may not be on the same plane, i.e., not on the same floor. Therefore, distance calculation based on three-dimensional coordinates is required. See details below. Figure 2 .
[0117] Assuming devices A and B exist on different floors, and we need to calculate their distance, due to space constraints, there are N turning points between devices A and B, and each has a terminal turning point on its respective plane. We can establish a three-dimensional coordinate system (xyz) with a building as the midpoint. The distance between the two devices requires inputting the coordinates of the device, its turning points, and the terminal turning point on its plane. The distance between two points on the same plane (including turning points, terminal turning points, and the device itself) is calculated using coordinates and the Pythagorean theorem: The relationship between distance s and coordinates can be expressed as:
[0118] s 2 =(y1-y2) 2 +(x1-x2) 2
[0119] Then sum over all the turning points:
[0120]
[0121] This allows us to determine the actual three-dimensional distance between two devices. Based on this, we can calculate the distances between multiple devices on different planes.
[0122] It should be noted that the coordinates of the turning points, the coordinates of the plane's final turning point, and the coordinates of the device itself can be collected manually. Furthermore, the turning points have vector attributes (i.e., for three turning points a, b, and c, a->c means a can be reached from point c in a straight line, and vice versa; a<>b means that turning points a and b cannot be reached in a straight line). Therefore, the turning points in this embodiment can correspond to corners and turns in reality. Because there may be multiple feasible paths between two devices, and each path has multiple turning points, all turning points of multiple paths need to be entered. Theoretically, the more turning point coordinates, the better the results.
[0123] Furthermore, the turning points can be traversed repeatedly; that is, after a->c, one can still go back to a via c->a and then to other turning points. Therefore, the resulting path might be: a->c->d->z->d->f->c->e; the path may pass through turning points multiple times. These combinations of turning points are calculated by the program. Initially, a hash function can be used to randomly select turning points, and then the feasibility is determined using the turning point vector, thus obtaining a feasible path that passes through all devices. In this embodiment, a hash function can be used to obtain a certain number (currently set to (X / 3), where X is the number of devices) of feasible paths as the initial paths for the subsequent genetic algorithm. Then, the following genetic algorithm is used for evolution to finally obtain the optimal path.
[0124] Furthermore, after the tasks of the weekly, monthly, quarterly, and annual cycles are evenly distributed to each day, the tasks for the day have been determined, and the distances between the devices involved in all tasks have been analyzed. It is necessary to reasonably arrange the inspection routes of each inspection unit so that all tasks for the day can be completed within the working hours, the total distance traveled by the inspection unit is minimized, and the workload of each inspection unit is relatively even for the day. The inspection unit is a carrier that can perform inspection operations, such as an inspection robot or inspection personnel.
[0125] Furthermore, based on the task allocation results and the distance between the inspection equipment required for each task, the genetic algorithm is used to plan the inspection route for each task to minimize the total inspection distance and optimize the inspection time for each task. Specifically:
[0126] Based on the task allocation results and the distance between the inspection equipment required for each task, a path planning model is constructed based on preset constraints.
[0127] Based on the distance between the equipment to be inspected for each task, a path planning model is solved using a genetic algorithm to obtain the planned inspection route for each task, so as to minimize the total inspection distance and optimize the inspection time for each task.
[0128] Furthermore, the step of constructing a path planning model based on the task allocation results and preset constraints specifically includes:
[0129] For any task, based on its task allocation results, obtain the name of the equipment assigned to the corresponding task within the inspection date, determine the equipment to be inspected under the task, obtain the coordinates of the equipment to be inspected in this task, and determine the building, floor and inspection time of the equipment.
[0130] For any given inspection date, assume the working time on that date is h; for each building to be inspected, determine the equipment that needs to be inspected on that date, and calculate the total working time t for that building. 总 The assignment just satisfies t 总 ≥K·(h-t') and t 总 K inspection units of <(K+1)·(h-t') inspect the building; where t' represents the round-trip time of the inspection unit from the starting point to the building;
[0131] For any inspection date, a planning table is constructed based on the determined K, the floor and building where the equipment to be inspected is located, and the inspection time.
[0132] A path planning model is constructed based on the planning table and preset constraints.
[0133] The planning table constructed in this embodiment is used to determine the equipment and its location to be inspected on a given inspection date. This allows for the allocation of inspection tasks on a building-by-building basis, avoiding the need for inspection units to inspect across buildings and improving inspection efficiency. Furthermore, after allocating tasks to each building, the remaining tasks for each building can be divided into several different parts according to a given timeframe. Each part can be treated as a single task, further refining the tasks of a building into multiple smaller components, ensuring that each subsequent inspection unit receives a more comprehensive allocation of tasks.
[0134] Furthermore, in the process of constructing the path planning model based on the planning table and preset constraints, the specific steps are as follows:
[0135] With the objective function of minimizing the total time F spent on the road during inspections, a path planning model is constructed, specifically expressed as follows:
[0136]
[0137] In the formula, N represents the number of tasks to be inspected, which is obtained from the planning table; i represents task i, j represents task j, and i and j equal to 0 indicate the starting point; k represents inspection unit k; c ij This represents the time required to travel from task i to task j, where i ≠ j; x ijk This is a state variable. Its value is 1 when the inspection unit k moves from task i to task j, and 0 otherwise.
[0138] The above model must satisfy the following preset constraints, including:
[0139] The number of inspection units is constrained, meaning that the number of inspection units starting from the starting point does not exceed K. The parameter K in the model represents the total number of inspection units across all floors.
[0140]
[0141] The start and end position constraints of the inspection unit indicate that each inspection unit starts from the starting point and eventually returns to the starting point:
[0142]
[0143] Task order inspection constraint means that each task is completed by exactly one inspection unit:
[0144]
[0145]
[0146] The flow conservation constraint means that the inspection unit must leave after completing a certain task:
[0147]
[0148] The time window constraint means that the departure and return times of each inspection unit must fall within a specified time window:
[0149]
[0150] In the formula: This indicates the departure time of inspection unit k. t represents the required return time for inspection unit k. ij This indicates the time it takes for the inspection unit to move from the equipment located at task i to the equipment located at task j; f i This represents the inspection time required for the inspection unit to complete task i, i.e., the dwell time.
[0151] Motion time constraint refers to the time constraint for the inspection unit to reach task j from task i:
[0152]
[0153] In the formula: s i This indicates the time when the inspection unit reaches the equipment where task i is located, where s0 = 0;
[0154] Integerization constraints are used to limit x. ijk Only 0 or 1 can be selected:
[0155] x ijk ∈{0,1} i,j∈{1,2,...,N},k∈{1,2,...,K} (9).
[0156] Furthermore, the solution process using the genetic algorithm can be found in [reference needed]. Figure 3 The step involves using a genetic algorithm to solve a path planning model based on the distance between the inspection equipment required for each task, to obtain the planned inspection route for each task, so as to minimize the total inspection distance and optimize the inspection time for each task. Specifically:
[0157] For the constructed path planning model, its feasible solution corresponds to the combination of all inspected equipment and inspection paths; the form of its feasible solution is encoded into genotype string structure data in the genetic space based on a genetic algorithm, resulting in several chromosomes;
[0158] An initial population is generated randomly based on several chromosomes, and the fitness of each chromosome in the initial population is calculated.
[0159] Based on the fitness of each chromosome, the population is subjected to genetic operations such as selection, crossover, and variation to obtain a new generation of population;
[0160] Calculate the fitness of each chromosome in the new generation population and sort the chromosomes according to their fitness to prepare for the genetic operations of the next generation.
[0161] The system makes a judgment based on a preset termination evolution rule. If the condition is met, the next generation of inheritance is stopped; otherwise, the next generation of inheritance is executed.
[0162] After stopping the next generation of genetics, the chromosome with the best performance is selected for decoding. The optimal solution of the path planning model is obtained based on the distance between the inspection equipment required for each task, so as to minimize the total inspection distance and optimize the inspection time for each task.
[0163] It should be noted that this embodiment can use a predetermined number of generations as the rule to terminate the evolution. That is, it is determined whether the number of generations to be evolved is the required number of generations N. If it is, the evolution stops and the set of delivery paths corresponding to the chromosome with the best performance is selected as the optimal solution to the path planning problem. Otherwise, the evolution operation continues.
[0164] Furthermore, the feasible solution is encoded into genotype string structure data in the genetic space based on a genetic algorithm, resulting in several chromosomes, specifically:
[0165] The equipment to be inspected is like a gene in a chromosome.
[0166] Initialize a new path as a chromosome, and insert genes into the current chromosome in sequence. If the insertion of a gene causes the chromosome to exceed the preset length or not meet the preset constraints, then initialize a new path and insert genes again.
[0167] Finally, all the devices inspected along the inspection path are sequentially encoded into several chromosomes to ensure that each device is inspected and inspected only once.
[0168] It should be noted that traditional ordinal coding methods use a coding method that arranges both the device and the starting point. For example, the individual code (0532071690840) for 9 tasks inspected by 3 inspection units can be interpreted as follows: The first inspection unit starts from the starting point, passes through tasks 5, 3, and 2, and returns to the starting point, forming sub-path 1. The second inspection unit also starts from the starting point, passes through tasks 7, 1, 6, and 9, and returns to the starting point, forming sub-path 2. The third inspection unit starts from the starting point, passes through tasks 8 and 4, and returns to the starting point, forming sub-path 3. The corresponding 3 inspection path schemes are as follows (0 represents the starting point):
[0169] Sub-path 1: 0→5→3→2→0
[0170] Sub-path 2: 0→7→1→6→9→0
[0171] Sub-path 3: 0→8→4→0
[0172] The sub-paths described above are ordered; if points 7 and 1 in sub-path 2 are swapped, the function value will change. However, the sub-paths themselves are unordered; if sub-path 1 and sub-path 2 are swapped, the objective function value will not change. The above encoding method has a fixed number of tasks, meaning all individuals have the same number of tasks. Although distribution center 0, as a separator between different paths, easily distinguishes them, it can generate a large number of invalid solutions in subsequent crossover operations. Furthermore, this encoding method may significantly reduce the search space of the genetic algorithm. This embodiment avoids these disadvantages.
[0173] In this embodiment, the starting point 0, which serves as a path separator, is not added to the chromosome structure. Instead, all the devices accessed in the paths are directly encoded into a single chromosome. The three sub-paths above are encoded as (532716984). This intuitive chromosome encoding method based on direct device arrangement ensures that each device is accessed and accessed only once, which greatly simplifies the handling of model constraints.
[0174] For this encoding method, the subsequent decoding operation is the inverse process of the encoding operation, that is, "the process of mapping the chromosome's encoding vector to a feasible solution that satisfies all constraints". The decoding operation in this paper adopts a process similar to path construction.
[0175] In the above embodiments, the population size affects the final result of genetic optimization and the execution efficiency of the genetic algorithm. When the population size is too small, the optimization performance of the genetic algorithm is generally poor. Using a larger population size can reduce the chance of the genetic algorithm getting trapped in local optima, but a larger population comes at the cost of time and space complexity. For solutions with relatively short chromosome lengths, a population size between 20 and 200 is suitable. However, for large-scale computations, the population size can be appropriately increased according to the chromosome length to facilitate obtaining a better solution space. In this embodiment, the initial population can be generated randomly. Since the chromosome uses integer encoding, i.e., each individual (denoted as a permutation of natural numbers from 1 to n) is represented by i, popsize individuals are randomly generated as the initial population during initialization, where n is the number of client nodes and popsize is the population size.
[0176] In the above embodiments, the fitness of each individual can be calculated using a fitness function. The fitness function is non-negative, always greater than or equal to 0, and a larger value is better. However, the objective function may have positive or negative values, and sometimes it takes the maximum value and sometimes the minimum value. Therefore, it is necessary to appropriately exchange between the objective function and the fitness function.
[0177] In genetic algorithms, a higher fitness level indicates better performance. The path planning proposed in this embodiment is a minimization combinatorial optimization problem, aiming to minimize the total inspection cost, i.e., minimizing the objective function value. Therefore, the objective function needs to be transformed into a fitness function. The algorithm in this embodiment uses the following transformation method to convert the objective function into a fitness function:
[0178]
[0179] In the above formula, z i f represents the objective function value corresponding to the i-th chromosome in the population, reflecting the total inspection cost corresponding to the i-th chromosome; i Let be the fitness of the i-th chromosome, whose value determines the probability that the chromosome will produce offspring.
[0180] Furthermore, based on the fitness of each chromosome, the population is subjected to genetic operations of selection, crossover, and variation to obtain a new generation population, specifically as follows:
[0181] The roulette wheel selection operator is applied to the population, and some superior chromosomes are selected to be passed on to the next generation based on the fitness of each chromosome.
[0182] The crossover operator is applied to the population to exchange some genes between selected pairs of chromosomes with a certain probability, thus generating new chromosomes.
[0183] The mutation operator is applied to the population, and for the selected chromosome, its genes are changed with a certain probability, resulting in a new chromosome.
[0184] In this embodiment, the individual with the highest fitness is first selected and retained, and the remaining M-1 individuals are selected using a roulette wheel selection operator. See also... Figure 4 The roulette wheel is divided into sectors of varying sizes. The probability of the pointer landing on a sector is proportional to the central angle of that sector; the larger the central angle, the greater the probability of landing on that sector; the smaller the central angle, the less likely the pointer is to land on that sector. In a genetic algorithm, the entire population is divided into individuals. The proportion of each individual's fitness to the total fitness of all individuals (i.e., relative fitness) varies. This proportion divides the entire roulette wheel and determines the probability of each individual being inherited by the next generation. Suppose a chromosome i has a fitness of f. i The population size is M, and the specific execution process is as follows:
[0185] Calculate fitness f for each chromosome i ;
[0186] Calculate the sum of the fitness of M chromosomes in the population.
[0187] Calculate the probability of each chromosome i being selected.
[0188] Calculate the cumulative probability for each chromosome i
[0189] Using a simulated betting platform, random numbers between [0, 1] are generated to determine the number of times each chromosome is selected, and finally, some superior chromosomes are determined to be inherited by the next generation.
[0190] In this embodiment, a PMX-like crossover operator is used to operate on the population. Unlike traditional crossover operators, it does not directly exchange the crossover segments of chromosomes. Instead, it first adds the crossover segment before the first gene of the other chromosome, and then removes genes in the original individuals that are identical to the crossover segment genes one by one, thereby obtaining the crossovered individuals. Specifically, it can be represented as follows:
[0191] Step 1: Randomly select an intersection region among the parent individuals. For example, the two parent individuals and the selected intersection region are: A = "256|8437|19", B = "359|4178|26", where "||" represents the intersection region;
[0192] Step 2: Add B's mating region to the front of A, and A's mating region to the front of B, resulting in two intermediate individuals: A′ = "4178|256843719", B′ = "8437|359417826";
[0193] Step 3: In A′ and B′, delete the genes that are the same as those in the crossover region sequentially after the crossover region to obtain the final two individuals: A1 = "417825639" and B1 = "843759126".
[0194] Furthermore, the step of applying the mutation operator to the population and changing the genes of the selected chromosomes with a certain probability to generate new chromosomes specifically involves: applying the inversion mutation operator to the population and changing the genes of the selected chromosomes with a certain probability to generate new chromosomes.
[0195] In this embodiment, the inversion mutation operator is used for mutation operations. Specifically, two mutation points on a chromosome are randomly selected, and the mutated regions are inverted to obtain new individuals. Inversion mutation can effectively adjust individuals in the population during evolution, preventing premature convergence and improving the global optimization of genetic operations. The inversion mutation operation process can be as follows:
[0196] Randomly generate an individual temp = "92587310461" and two mutation points, such as 2 and 3, i.e., temp′ = "9|25873|10461", where "||" represents the mutation region;
[0197] The mutated gene is inserted into its original position in reverse order to obtain a new individual temp1 = "9|37852|10461". The operation process is illustrated below. Figure 5 As shown.
[0198] This embodiment provides a factory inspection task allocation and route planning method that can solve the problem of task allocation with periodicity and time interval requirements, as well as the optimal path problem in three-dimensional space. The method uses a greedy algorithm to allocate inspection tasks and a genetic algorithm to plan inspection routes, so as to make the allocation of inspection tasks reasonable and the inspection tasks optimized, effectively reducing inspection costs and meeting the needs of factory inspection.
[0199] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for allocating factory inspection tasks and planning routes, characterized in that, Includes the following steps: Obtain factory inspection tasks, including the name of all equipment, inspection cycle, number of cycle inspections, inspection interval, and inspection time; Based on a greedy algorithm, a task table is created to correspond to the equipment for factory inspection tasks that satisfy the inspection cycle. ,in Indicates the name, Indicates the number of periodic inspections. Indicates the inspection interval. This indicates the inspection time, and each piece of equipment must meet the following requirements. ,in Indicates the minimum number of days in the inspection cycle; For any given inspection cycle, the factory inspection tasks are listed in the task list. Sort the tasks according to the time taken for each inspection and create a task list. For each row of data, i.e. the inspection task of each device, the allocation scheme is iterated to obtain the range matrix of each device's task that can be allocated for each time. Based on the range matrix Obtain the allocatable scheme for each device to minimize the time consumed by the assigned tasks; based on the range matrix. Obtain the inspection dates of the allocable schemes, the total duration of the tasks assigned within the inspection dates, and the names of the devices assigned to the tasks, and obtain the task allocation results for this inspection cycle; The inspection cycle includes weekly, monthly, quarterly, and annual cycles; For any task, based on its task allocation result, obtain the name of the equipment for the corresponding assigned task within the inspection date, and determine the equipment to be inspected under that task; Obtain device coordinates and determine the shortest path between devices based on the device coordinates; obtain the coordinates of turning points and plane terminal turning points on the shortest path. Calculate the distance between devices based on device coordinates, inflection point coordinates, and plane terminal inflection point coordinates; Based on the task allocation results and the distance between the inspection equipment required for each task, the inspection route is planned for each task using a genetic algorithm to minimize the total inspection distance and optimize the inspection time for each task.
2. The factory inspection task allocation and route planning method according to claim 1, characterized in that, Based on the task allocation results and the distance between the inspection equipment required for each task, a genetic algorithm is used to plan the inspection route for each task to minimize the total inspection distance and optimize the inspection time. Specifically: Based on the task allocation results and the distance between the inspection equipment required for each task, a path planning model is constructed based on preset constraints. Based on the distance between the equipment to be inspected for each task, a path planning model is solved using a genetic algorithm to obtain the planned inspection route for each task, so as to minimize the total inspection distance and optimize the inspection time for each task.
3. The factory inspection task allocation and route planning method according to claim 2, characterized in that, The specific steps for constructing a path planning model based on task allocation results and preset constraints are as follows: For any task, based on its task allocation results, obtain the name of the equipment assigned to the corresponding task within the inspection date, determine the equipment to be inspected under the task, obtain the coordinates of the equipment to be inspected in this task, and determine the building, floor and inspection time of the equipment. For any inspection date, assume the working hours on that date are... For buildings requiring inspection, determine the equipment that needs to be inspected on the specified inspection date, and calculate the total working time for that building. The assignment just meets the requirements. and of Several inspection units conducted inspections of the building; among them... This indicates the round-trip time from the starting point to the building for the inspection unit; For any inspection date, based on the determined A planning table is constructed, including the building and floor where the equipment to be inspected is located and the inspection time. A path planning model is constructed based on the planning table and preset constraints.
4. The factory inspection task allocation and route planning method according to claim 3, characterized in that, In the process of constructing a path planning model based on the planning table and preset constraints, the specific steps are as follows: The total time spent on the road during inspections Minimize the objective function to construct a path planning model, specifically as follows: (1) In the formula, This indicates the number of tasks that need to be inspected, which is obtained from the planning table; Indicates task , Indicates task , , A value of 0 indicates the starting point; Indicates inspection unit ; Indicates from the task To the mission The time required is ; It is a state variable, when the inspection unit From the task To the mission When the value is 1, its value is 0 otherwise. The above model must satisfy the following preset constraints, including: The number of inspection units is constrained, meaning that the number of inspection units starting from the starting point does not exceed [a certain limit]. : (2) The start and end position constraints of the inspection unit indicate that each inspection unit starts from the starting point and eventually returns to the starting point: i =0, k ∈{1,2,..., K} (3) Task order inspection constraint means that each task is completed by exactly one inspection unit: i ∈{1,2,..., N} (4) i ∈{1,2,..., N} (5) The flow conservation constraint means that the inspection unit must leave after completing a certain task: p ∈{1,2,..., N}, k ∈{1,2,..., K} (6) The time window constraint means that the departure and return times of each inspection unit must fall within a specified time window: k ∈{1,2,..., K} (7) In the formula: Indicates inspection unit Departure time Indicates inspection unit Request a return time Indicates that the inspection unit starts from the task i The equipment moves to the task j The time of the device in use; This indicates that the inspection unit has completed its task. i The required inspection time, i.e. the dwell time; Motion time constraint, indicating the time constraint of the inspection unit from the task i Achieve the mission j Time constraints: j ∈{1,2,..., N} (8) In the formula: This indicates that the inspection unit has completed its task. i The time of the device in use, where s0=0; Integerization constraints are used to limit Only 0 or 1 can be selected: i , j ∈{1,2,..., N}, k ∈{1,2,..., K} (9)。 5. The factory inspection task allocation and route planning method according to claim 4, characterized in that, The process involves using a genetic algorithm to solve a path planning model based on the distance between the equipment to be inspected in each task, thereby obtaining the planned inspection route for each task to minimize the total inspection distance and optimize the inspection time. Specifically: For the constructed path planning model, its feasible solution corresponds to the combination of all inspected equipment and inspection paths; the form of its feasible solution is encoded into genotype string structure data in the genetic space based on a genetic algorithm, resulting in several chromosomes; An initial population is generated randomly based on several chromosomes, and the fitness of each chromosome in the initial population is calculated. Based on the fitness of each chromosome, the population is subjected to genetic operations such as selection, crossover, and variation to obtain a new generation of population; Calculate the fitness of each chromosome in the new generation population and sort the chromosomes according to their fitness to prepare for the genetic operations of the next generation. The system makes a judgment based on a preset termination evolution rule. If the condition is met, the next generation of inheritance is stopped; otherwise, the next generation of inheritance is executed. After stopping the next generation of genetics, the chromosome with the best performance is selected for decoding. The optimal solution of the path planning model is obtained based on the distance between the inspection equipment required for each task, so as to minimize the total inspection distance and optimize the inspection time for each task.
6. The factory inspection task allocation and route planning method according to claim 5, characterized in that, The feasible solution is encoded into genotype string structure data in the genetic space based on a genetic algorithm, resulting in several chromosomes, specifically: The equipment to be inspected is like a gene in a chromosome. Initialize a new path as a chromosome, and insert genes into the current chromosome in sequence. If the insertion of a gene causes the chromosome to exceed the preset length or not meet the preset constraints, then initialize a new path and insert genes again. Finally, all the devices inspected along the inspection path are sequentially encoded into several chromosomes to ensure that each device is inspected and inspected only once.
7. The factory inspection task allocation and route planning method according to claim 5, characterized in that, The process involves genetic operations such as selection, crossover, and mutation on the population based on the fitness of each chromosome to obtain a new generation population. The roulette wheel selection operator is applied to the population, and some superior chromosomes are selected to be passed on to the next generation based on the fitness of each chromosome. The crossover operator is applied to the population to exchange some genes between selected pairs of chromosomes with a certain probability, thus generating new chromosomes. The mutation operator is applied to the population, and for the selected chromosome, its genes are changed with a certain probability, resulting in a new chromosome.
8. The factory inspection task allocation and route planning method according to claim 7, characterized in that, The process of applying the mutation operator to the population, altering the genes of selected chromosomes with a certain probability to generate new chromosomes, specifically involves: The inversion mutation operator is applied to the population to change the genes of the selected chromosome with a certain probability, thus generating a new chromosome.
Citation Information
Patent Citations
A TSP problem path planning method
CN109948865A
Greedy K-mean self-organizing neural network multi-robot path planning method
CN113281993A