Medical waste collection and transportation route optimization method and device
By combining genetic algorithms and simulated annealing algorithms, the medical garbage collection and transportation routes are optimized, and the problems of low efficiency and high computational volume in the existing technology are solved, and efficient calculation and accuracy of the medical garbage collection and transportation routes are achieved.
Patent Information
- Application Number
- CN202411090973.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-26
AI Technical Summary
The existing calculation methods for medical waste collection and transportation routes are inefficient and have large calculation volume, making it difficult to quickly calculate the optimal route for medical waste collection and transportation.
Using a combination of genetic algorithm and simulated annealing algorithm, the distance matrix is calculated by obtaining the latitude and longitude coordinates of medical waste disposal plants and medical institutions, performing individual coding, selection, crossover and mutating operations, optimizing the collection route, avoiding repeated calculations, and combining simulation Annealing algorithm solves the optimal route.
This greatly improves the calculation efficiency of the optimal route, reduces the calculation amount, ensures the accuracy of the optimal transportation route, and avoids the unreliability of the calculation results of a single algorithm.
Smart Images

Figure CN119027016A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of route planning, and in particular to a method and device for optimizing medical waste collection and transportation routes. Background Art
[0002] Medical waste refers to waste materials generated during the medical process, which are characterized by strong pollution, complex sources and a wide variety. Medical waste can be divided into five categories: infectious medical waste, pathological medical waste, pharmaceutical medical waste, chemical medical waste and radiation medical waste. These wastes come from various departments of the hospital, such as operating rooms, medical waste treatment rooms, outpatient treatment rooms, etc. Medical waste contains a large number of pathogenic microorganisms and chemicals. Pathogenic microorganisms may cause the spread of infectious diseases. Improper disposal of medical waste will pollute the environment and affect public health safety. Medical waste must be stored separately and cannot be mixed with other domestic waste. Special disposal units must collect it regularly.
[0003] Regarding the collection and transportation of medical waste, since small hospitals, small clinics and other medical institutions produce less waste per day, usually ranging from a few kilograms to dozens of kilograms, and according to relevant regulations, medical waste must be cleared every two days, an empty medical waste collection and transportation vehicle needs to go to multiple medical institutions to collect medical waste before the collection and transportation vehicle is full and then transported to the disposal plant. The locations of medical institutions are randomly distributed in the plane space, and the distribution in space is relatively chaotic. There are many transportation routes. How to choose the shortest collection and transportation route is a major problem. If the shortest transportation route is calculated by exhaustive method, it will take a huge amount of time and computing resources. Therefore, how to quickly calculate the optimal route for medical waste collection and transportation and reduce the amount of calculation is a technical problem that technicians in this field need to solve urgently. Summary of the invention
[0004] The present invention provides a method and device for optimizing medical waste collection and transportation routes, which are used to solve the technical problems of low efficiency and large calculation amount in the existing medical waste collection and transportation route calculation method.
[0005] In view of this, the first aspect of the present invention provides a method for optimizing medical waste collection and transportation routes, comprising:
[0006] S1. Obtain the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set. The collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant;
[0007] S2. Calculate the distance between each collection and transportation point according to the longitude and latitude coordinates of each collection and transportation point to form a distance matrix;
[0008] S3, using the collection and transportation points as genes, encoding the genes, using the collection and transportation routes as individuals, and initializing the population;
[0009] S4. According to the distance matrix, the fitness function is used to calculate the fitness of each individual;
[0010] S5. Select and crossover individuals according to their fitness.
[0011] S6. Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals.
[0012] S7. For each individual, swap two gene positions;
[0013] S8. Determine whether the number of iterations reaches the set value. If so, output the current optimal individual and the optimal total distance corresponding to the optimal individual. If not, add 1 to the number of iterations and return to step S4.
[0014] Optionally, step S2 specifically includes:
[0015] The longitude and latitude coordinates of each collection and transportation point are converted into radians, and the distance between two collection and transportation points is calculated using the haversine distance formula to form a distance matrix;
[0016] The formula for the haversine distance is:
[0017]
[0018] Where Dis(i,j) is the distance between collection and transportation point i and collection and transportation point j, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude of the collection point i, Rad(x j ) is the arc of longitude of the collection point j, Rad(y j ) is the latitude of the collection point j in radians, and R is the radius of the earth.
[0019] Optionally, the fitness function is:
[0020]
[0021]
[0022] Among them, fit(a) is the fitness of the a-th collection and transportation route, D ωa is the total distance of the ath collection and transportation route, and N is the total number of collection and transportation points.
[0023] Optionally, in step S3, the gene is encoded using integer permutation encoding.
[0024] Optionally, after step S2, the following steps are further included:
[0025] S3B, initializing the parameters of the simulated annealing algorithm, including the initial temperature, the termination temperature, the cooling coefficient, the random arrangement initial solution, the initial distance of the collection and transportation route, and the maximum number of iterations;
[0026] S4B, generate new solutions based on temperature perturbations;
[0027] S5B, calculate the difference between the new solution and the randomly arranged initial solution;
[0028] S6B, determine whether the difference is less than or equal to 0, if so, accept the new solution as the current solution, otherwise, determine whether to accept the new solution as the current solution according to the Metropolis acceptance criterion;
[0029] S7B, determine whether the current temperature has been reduced to the lowest set temperature and the number of iterations has reached the maximum number of iterations. If so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution. Otherwise, return to step S4B;
[0030] S8B, compare the optimal individual and the optimal total distance corresponding to the optimal individual outputted in step S8 with the optimal solution and the total distance corresponding to the optimal solution outputted in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route.
[0031] A second aspect of the present invention provides a medical waste collection and transportation route optimization device, comprising a processor, the processor being configured to perform the following steps:
[0032] S1. Obtain the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set. The collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant;
[0033] S2. Calculate the distance between each collection and transportation point according to the longitude and latitude coordinates of each collection and transportation point to form a distance matrix;
[0034] S3, using the collection and transportation points as genes, encoding the genes, using the collection and transportation routes as individuals, and initializing the population;
[0035] S4. According to the distance matrix, the fitness function is used to calculate the fitness of each individual;
[0036] S5. Select and crossover individuals according to their fitness.
[0037] S6. Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals.
[0038] S7. For each individual, swap two gene positions;
[0039] S8. Determine whether the number of iterations reaches the set value. If so, output the current optimal individual and the optimal total distance corresponding to the optimal individual. If not, add 1 to the number of iterations and return to step S4.
[0040] Optionally, step S2 specifically includes:
[0041] The longitude and latitude coordinates of each collection and transportation point are converted into radians, and the distance between two collection and transportation points is calculated using the haversine distance formula to form a distance matrix;
[0042] The formula for the haversine distance is:
[0043]
[0044] Where Dis(i,j) is the distance between collection and transportation point i and collection and transportation point j, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude of the collection point i, Rad(x j ) is the arc of longitude of the collection point j, Rad(y j ) is the latitude of the collection point j in radians, and R is the radius of the earth.
[0045] Optionally, the fitness function is:
[0046]
[0047]
[0048] Among them, fit(a) is the fitness of the a-th collection and transportation route, D ωa is the total distance of the ath collection and transportation route, and N is the total number of collection and transportation points.
[0049] Optionally, in step S3, the gene is encoded using integer permutation encoding.
[0050] Optionally, after step S2, the following steps are further included:
[0051] S3B, initializing the parameters of the simulated annealing algorithm, including the initial temperature, the termination temperature, the cooling coefficient, the random arrangement initial solution, the initial distance of the collection and transportation route, and the maximum number of iterations;
[0052] S4B, generate new solutions based on temperature perturbations;
[0053] S5B, calculate the difference between the new solution and the randomly arranged initial solution;
[0054] S6B, determine whether the difference is less than or equal to 0, if so, accept the new solution as the current solution, otherwise, determine whether to accept the new solution as the current solution according to the Metropolis acceptance criterion;
[0055] S7B, determine whether the current temperature has been reduced to the lowest set temperature and the number of iterations has reached the maximum number of iterations. If so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution. Otherwise, return to step S4B;
[0056] S8B, compare the optimal individual and the optimal total distance corresponding to the optimal individual outputted in step S8 with the optimal solution and the total distance corresponding to the optimal solution outputted in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route.
[0057] It can be seen from the above technical solutions that the medical waste collection and transportation route optimization method provided by the present invention has the following advantages:
[0058] The medical waste collection and transportation route optimization method provided by the present invention obtains the optimal solution of the transportation route of the medical waste collection and transportation vehicle through genetic algorithm optimization according to the coordinates and pairwise distances of medical institutions within the preset range of the medical waste disposal plant. When optimizing the collection and transportation route, in addition to selection and crossover operations, repeated gene detection operations are also performed before performing mutation operations of gene position exchange, thereby avoiding repeated calculation of collection and transportation points. Compared with the exhaustive method, the calculation efficiency of the optimal route is greatly improved, the calculation amount is also reduced, and the technical problems of low efficiency and large calculation amount of the existing medical waste collection and transportation route calculation method are solved.
[0059] At the same time, the medical waste collection and transportation route optimization method provided by the present invention not only adopts a genetic algorithm to solve the optimal collection and transportation route, but also adopts a simulated annealing algorithm to solve the optimal collection and transportation route. Finally, the output results of the two are compared to obtain the optimal collection and transportation route, thereby avoiding the problem of unreliable results of calculating the optimal collection and transportation route by a single algorithm, and further ensuring the accuracy of the optimal collection and transportation route. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0061] Figure 1 A schematic diagram of a process flow of a medical waste collection and transportation route optimization method provided in the present invention;
[0062] Figure 2 A distribution map of medical institutions in region A provided in the present invention;
[0063] Figure 3 For Figure 2 Driver experience roadmap;
[0064] Figure 4 A schematic diagram of a gene sequence before the crossover operation provided in the present invention;
[0065] Figure 5 A schematic diagram of a gene sequence after the crossover operation provided in the present invention;
[0066] Figure 6 A schematic diagram of the results of duplicate gene replacement provided in the present invention;
[0067] Figure 7 A schematic diagram of the variation operation provided in the present invention;
[0068] Figure 8 It is an optimal collection and transportation route trajectory diagram of the medical waste collection and transportation route optimization method provided in the present invention;
[0069] Fig. 9 Another schematic flow chart of a method for optimizing medical waste collection and transportation routes provided in the present invention. DETAILED DESCRIPTION
[0070] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0071] For easier understanding, see Figure 1 The present invention provides an embodiment of a method for optimizing a medical waste collection and transportation route, comprising:
[0072] Step S1, obtaining the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set, the collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant.
[0073] It should be noted that, in the present invention, the longitude and latitude coordinates of each collection and transportation point are first picked up on the map to form a collection and transportation point coordinate set, where longitude is represented by x and latitude is represented by y. Figure 2 As shown, there are 59 collection and transportation points, including 1 medical waste disposal plant that sends out collection and transportation vehicles and medical institutions within the preset range of the medical waste disposal plant.
[0074] The distribution of medical institutions in area A is chaotic, and there are countless transportation routes. How to choose the shortest transportation route has become a major problem for drivers. If the shortest transportation route is calculated by exhaustive method, there are 59 transportation routes to be calculated. Figure 3 As shown in Figure 1, when the driver goes to the next collection point, he tends to choose the nearest point. When he falls into the local optimal route problem, he often cannot reach the global optimal point, which leads to a longer total collection distance. The total collection route distance is 292 kilometers. Figure 3 It can be seen that some routes intersect and overlap, and these routes are driven repeatedly, resulting in the total transportation distance not being the shortest.
[0075] Step S2: Calculate the distance between any two collection and transportation points based on the longitude and latitude coordinates of each collection and transportation point to form a distance matrix.
[0076] It should be noted that the longitude and latitude coordinates of each collection point are converted into radians using the following conversion formula:
[0077]
[0078]
[0079] Among them, x i is the longitude coordinate of the collection point i, y i is the latitude coordinate of the collection point i, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude in radians of the collection point i.
[0080] According to the longitude and latitude coordinates, the distance between two collection and transportation points is calculated using the haversine distance formula to form a distance matrix. The haversine distance formula is:
[0081]
[0082] Where Dis(i,j) is the distance between collection and transportation point i and collection and transportation point j, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude of the collection point i, Rad(x j ) is the arc of longitude of the collection point j, Rad(y j ) is the latitude of the collection point j in radians, and R is the radius of the earth.
[0083] Step S3: Encode the genes using the collection and transportation points as genes, and initialize the population using the collection and transportation routes as individuals.
[0084] It should be noted that in the problem of optimizing the routes for collecting and transporting medical waste, the set of routes composed of permutations and combinations of the collection and transport points is called a population, each collection and transport route in the population is called an individual, and each collection and transport point is called a gene. The candidate solutions to the problem are represented by chromosomes to achieve the mapping process from the solution space to the coding space. The genetic algorithm does not directly process the decision variables in the solution space, but converts them into chromosomes composed of genes in a certain structure. In the present invention, integer permutation coding is used to serialize the collection and transport points, and then the serial numbers of the collection and transport points are permuted and combined, which can easily realize operations such as gene crossover and mutation.
[0085] Initialize the population: Generate an initial population (encoding set) that represents the potential solution set of the problem. The population size is mainly set based on the following considerations: From the perspective of population diversity, the larger the population, the better, to avoid falling into the local optimum; from the perspective of computational efficiency, the larger the population size, the more computational effort will be. The size of the population should be determined based on the actual problem. There are usually two ways to generate the initial population: one is to generate it completely randomly; the other is to set a set of conditions that must be met based on prior knowledge, and then generate the initial sample based on these conditions. Figure 2 Taking the distribution of medical institutions as an example, the initial population size is set to 200, the order of 59 collection and transportation points (also called genes) is randomly arranged, and 200 initial collection and transportation routes are randomly selected. Each collection and transportation route is a chromosome. The chromosome encoding is shown in the following route: 1 chromosome (also called individual or collection and transportation route), starting from point 1 and returning to point 1, represents the visit order of the collection and transportation points. After the population is initialized, 200 collection and transportation routes (200 individuals) are randomly selected, which is [ω1,ω2,......,ω 200 ], each individual is composed of 59 genes arranged in a different order, that is, ω1=(gen1, gen2,......,gen 59 ), as shown in the following route:
[0086] 1—>42—>37—>16—>36—>17—>29—>21—>23—>14—>50—>45—>38—>56—>4—>32—>40—>47—>28—>19—>10—>11—>39—>24—>43—>46—>30—>12—>6—>27—>53—>33—>9—>5—>58—>44—>49—>59—>18—>3—>26—>20—>8—>2—>15—>54—>55—>52—>57—>13—>31—>22—>7—>41—>25—>35—>34—>48—>51—>1.
[0087] Set the number of iterations to 200-600, the crossover probability to 0.9, and the mutation probability to 0.05.
[0088] Step S4: Calculate the fitness of each individual using the fitness function according to the distance matrix.
[0089] It should be noted that the fitness function is used to calculate the fitness of each individual. In the problem of optimizing the collection and transportation routes, the shorter the distance between individuals (single collection and transportation routes), the better the individual is, the greater the fitness is, and the greater the probability of being selected. The formula for calculating fitness is:
[0090]
[0091]
[0092] Among them, fit(a) is the fitness of the a-th collection and transportation route, D ωa is the total distance of the ath collection and transportation route, and N is the total number of collection and transportation points.
[0093] Step S5: Select and crossover individuals according to their fitness.
[0094] It should be noted that unreasonable individuals are eliminated according to the principle of survival of the fittest based on the individual fitness. The random traversal sampling selection method is adopted, and the steps of the selection operation are as follows:
[0095] Step 1: Calculate the pointer spacing P = fit(a) / N;
[0096] Step 2: Randomly generate a starting point pointer position Start = [a random number between 0-P];
[0097] Step 3: Calculate the position of each pointer Pointers = [Start + i*P], where i = [0, 1....N-1];
[0098] Step 4: Select N individuals according to the positions of each pointer.
[0099] The steps of the crossover operation are as follows:
[0100] Randomly select two chromosomes as parent chromosomes, and randomly select the start and end positions of the crossover gene (the selected positions of the two chromosomes are the same), such as Figure 4 Then the positions of the two groups of genes are swapped, as shown in Figure 5 shown.
[0101] Step S6: Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals.
[0102] The duplicate gene detection establishes a mapping relationship (mapping table) based on the two groups of genes exchanged. Taking the 7-5-2 mapping relationship as an example, we can see Figure 5 In the result, there are two genes 7 in offspring 1. At this time, it is transformed into gene 2 through the mapping relationship, and so on until there is no conflict. Figure 5 After repeated gene replacement Figure 6 In the gene sequence shown, all conflicting genes will be mapped to ensure that the new pair of offspring genes formed are conflict-free. Repeated gene replacement ensures that the gene in each chromosome appears only once, and no duplicate genes will appear in a chromosome.
[0103] Step S7: For each individual, exchange two gene positions.
[0104] It should be noted that after step S6 is completed, a mutation operation is performed: a chromosome is randomly selected, two gene positions are randomly selected, and the genes at these two positions are exchanged, such as Figure 7 shown.
[0105] Step S8, determine whether the number of iterations reaches the set value, if so, output the current optimal individual and the optimal total distance corresponding to the optimal individual, if not, add 1 to the number of iterations and return to step S4.
[0106] It should be noted that it is determined whether the number of iterations reaches the set value. If so, the algorithm terminates and outputs the current optimal individual and the optimal total distance corresponding to the optimal individual. Otherwise, the number of iterations is increased by 1 and the algorithm returns to step S4. Figure 2 Taking the distribution of collection and transportation points as an example, after 600 calculations, the optimal collection and transportation route for the collection and transportation vehicle is as follows: Figure 8 As shown, it can be expressed as:
[0107] 1—>5—>2—>57—>56—>58—>59—>17—>10—>11—>54—>12—>53—>55—>16—>19—>18—>33—>35—>34—>27—>15—>14—>9—>8—>4—>3—>37—>29—>25—>38—>26—>7—>32—>20—>30—>31—>21—>23—>24—>28—>22—>40—>36—>39—>42—>45—>13—>52—>47—>46—>50—>51—>6—>41—>43—>44—>48—>49—>1.
[0108] The total distance of the shortest collection and transportation route is: 75.4 kilometers
[0109] During the optimization process, the total distance continued to decrease, from 292 kilometers to 75.4 kilometers, greatly saving the collection and transportation distance.
[0110] The medical waste collection and transportation route optimization method provided by the present invention obtains the optimal solution of the transportation route of the medical waste collection and transportation vehicle through genetic algorithm optimization according to the coordinates and pairwise distances of medical institutions within the preset range of the medical waste disposal plant. When optimizing the collection and transportation route, in addition to selection and crossover operations, repeated gene detection operations are also performed before performing mutation operations of gene position exchange, thereby avoiding repeated calculation of collection and transportation points. Compared with the exhaustive method, the calculation efficiency of the optimal route is greatly improved, the calculation amount is also reduced, and the technical problems of low efficiency and large calculation amount of the existing medical waste collection and transportation route calculation method are solved.
[0111] For easier understanding, see Figures 1 to 9 The present invention also provides another embodiment of a method for optimizing medical waste collection and transportation routes, comprising:
[0112] Step S1, obtaining the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set, the collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant;
[0113] Step S2, calculating the distance between two collection and transportation points according to the longitude and latitude coordinates of each collection and transportation point to form a distance matrix;
[0114] Step S3, using the collection and transportation points as genes, encoding the genes, and using the collection and transportation routes as individuals to initialize the population;
[0115] Step S4: Calculate the fitness of each individual using the fitness function according to the distance matrix;
[0116] Step S5: Select and crossover individuals according to their fitness.
[0117] Step S6: Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals.
[0118] Step S7: For each individual, exchange two gene positions;
[0119] Step S8, determine whether the number of iterations reaches the set value, if so, output the current optimal individual and the optimal total distance corresponding to the optimal individual, if not, add 1 to the number of iterations and return to step S4;
[0120] Step S3B, initializing the parameters of the simulated annealing algorithm, the parameters including the initial temperature, the end temperature, the cooling coefficient, the random arrangement initial solution, the initial distance of the collection and transportation route, and the maximum number of iterations;
[0121] Step S4B, generating a new solution according to the temperature disturbance;
[0122] Step S5B, calculating the difference between the new solution and the randomly arranged initial solution;
[0123] Step S6B, determine whether the difference is less than or equal to 0, if so, accept the new solution as the current solution, otherwise, determine whether to accept the new solution as the current solution according to the Metropolis acceptance criterion;
[0124] Step S7B, determine whether the current temperature has been reduced to the lowest set temperature and the number of iterations has reached the maximum number of iterations. If so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution. Otherwise, return to step S4B;
[0125] Step S8B, compare the optimal individual and the optimal total distance corresponding to the optimal individual outputted in step S8 with the optimal solution and the total distance corresponding to the optimal solution outputted in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route.
[0126] After step S2 is completed, on the basis of executing steps S3 to S8, steps S3B to S8B may also be executed. Steps S3B to S8B are the process of solving the optimal collection and transportation route using a simulated annealing algorithm. Specifically:
[0127] In step S3B, the initialization parameters include setting the initial temperature T0, the end temperature T f , cooling coefficient α, random arrangement initial solution ω=(ω1,ω2,……,ω N ), the initial distance f(ω) and the maximum number of iterations maxIter, where the initial distance f(ω) is calculated according to the objective function, which is:
[0128]
[0129] Where N is the total number of collection and transportation points, Dis(ω i ,ω i+1 ) is the collection pointω i and ω i+1 distance.
[0130] In step S4B, a new solution T is generated according to the temperature disturbance. i ', that is, T i '=α·T i , the temperature is reduced once according to the cooling coefficient α, and a new solution is generated. The method of generating a new solution is the two-transformation method. Select the sequence numbers u and v, and exchange the access order between u and v. If the solution before the exchange is ω i =(ω1,ω2,...,ω u ,...ω v , ..., ω N ), the exchanged path is the new path, that is:
[0131] ω' i =(ω1, ..., ω u-1 ,ω v ,ω v-1 , ..., ω u+1 ,ω u ,ω v+1 , ..., ω N )
[0132] At the same time, calculate the new solution distance f(ω' i ).
[0133] In step S5B, the difference Δf between the solution before transformation and the objective function after transformation is calculated:
[0134] Δf=f(ω' i )-f(ω i )
[0135] In step S6B, it is determined whether the difference Δf is ≤ 0. If so, the new solution is accepted as the current solution. Otherwise, it is determined whether to accept the new solution as the current solution according to the Metropolis acceptance criterion.
[0136] In step S7B, it is determined whether the current temperature T has dropped to the minimum set temperature T f , and the number of iterations has reached the maximum number of iterations maxIter, if so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution, otherwise, return to step S4B.
[0137] After the optimal solution and the total distance corresponding to the optimal solution are output in step S7B, step S8B is executed to compare the optimal individual and the optimal total distance corresponding to the optimal individual output in step S8 with the optimal solution and the total distance corresponding to the optimal solution output in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route, that is, the collection and transportation route with the shortest total distance is output as the final optimal collection and transportation route.
[0138] The medical waste collection and transportation route optimization method provided by the present invention not only adopts a genetic algorithm to solve the optimal collection and transportation route, but also adopts a simulated annealing algorithm to solve the optimal collection and transportation route. Finally, the output results of the two are compared to obtain the optimal collection and transportation route, thereby avoiding the problem of unreliable results of the optimal collection and transportation route calculated by a single algorithm, and further ensuring the accuracy of the optimal collection and transportation route.
[0139] The present invention also provides an embodiment of a medical waste collection and transportation route optimization device, the device comprising a processor, the processor is used to perform the following steps:
[0140] S1. Obtain the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set. The collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant;
[0141] S2. Calculate the distance between each collection and transportation point according to the longitude and latitude coordinates of each collection and transportation point to form a distance matrix;
[0142] S3, using the collection and transportation points as genes, encoding the genes, using the collection and transportation routes as individuals, and initializing the population;
[0143] S4. According to the distance matrix, the fitness function is used to calculate the fitness of each individual;
[0144] S5. Select and crossover individuals according to their fitness.
[0145] S6. Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals.
[0146] S7. For each individual, swap two gene positions;
[0147] S8. Determine whether the number of iterations reaches the set value. If so, output the current optimal individual and the optimal total distance corresponding to the optimal individual. If not, add 1 to the number of iterations and return to step S4.
[0148] Step S2 specifically includes:
[0149] The longitude and latitude coordinates of each collection and transportation point are converted into radians, and the distance between two collection and transportation points is calculated using the haversine distance formula to form a distance matrix;
[0150] The formula for the haversine distance is:
[0151]
[0152] Where Dis(i,j) is the distance between collection and transportation point i and collection and transportation point j, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude of the collection point i, Rad(x j ) is the arc of longitude of the collection point j, Rad(y j ) is the latitude of the collection point j in radians, and R is the radius of the earth.
[0153] The fitness function is:
[0154]
[0155]
[0156] Among them, fit(a) is the fitness of the a-th collection and transportation route, D ωa is the total distance of the ath collection and transportation route, and N is the total number of collection and transportation points.
[0157] In step S3, the gene is encoded using integer permutation encoding.
[0158] After step S2, the following steps are also included:
[0159] S3B, initializing the parameters of the simulated annealing algorithm, including the initial temperature, the termination temperature, the cooling coefficient, the random arrangement initial solution, the initial distance of the collection and transportation route, and the maximum number of iterations;
[0160] S4B, generate new solutions based on temperature perturbations;
[0161] S5B, calculate the difference between the new solution and the randomly arranged initial solution;
[0162] S6B, determine whether the difference is less than or equal to 0, if so, accept the new solution as the current solution, otherwise, determine whether to accept the new solution as the current solution according to the Metropolis acceptance criterion;
[0163] S7B, determine whether the current temperature has been reduced to the lowest set temperature and the number of iterations has reached the maximum number of iterations. If so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution. Otherwise, return to step S4B;
[0164] S8B, compare the optimal individual and the optimal total distance corresponding to the optimal individual outputted in step S8 with the optimal solution and the total distance corresponding to the optimal solution outputted in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route.
[0165] The medical waste collection and transportation route optimization device provided in the present invention is used to execute the medical waste collection and transportation route optimization method provided in the present invention. Its principle and technical effects are the same as those of the medical waste collection and transportation route optimization method provided in the present invention, and will not be repeated here.
[0166] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for optimizing medical waste collection and transportation routes, characterized in that: include: S1. Obtain the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set. The collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant; S2. Calculate the distance between each collection and transportation point according to the longitude and latitude coordinates of each collection and transportation point to form a distance matrix; S3, using the collection and transportation points as genes, encoding the genes, using the collection and transportation routes as individuals, and initializing the population; S4. According to the distance matrix, the fitness function is used to calculate the fitness of each individual; S5. Select and crossover individuals according to their fitness. S6. Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals. S7. For each individual, swap two gene positions; S8. Determine whether the number of iterations reaches the set value. If so, output the current optimal individual and the optimal total distance corresponding to the optimal individual. If not, add 1 to the number of iterations and return to step S4.
2. The method for optimizing medical waste collection and transportation routes according to claim 1, characterized in that: Step S2 specifically includes: The longitude and latitude coordinates of each collection and transportation point are converted into radians, and the distance between two collection and transportation points is calculated using the haversine distance formula to form a distance matrix; The formula for the haversine distance is: Where Dis(i,j) is the distance between collection and transportation point i and collection and transportation point j, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude of the collection point i, Rad(x j ) is the arc of longitude of the collection point j, Rad(y j ) is the latitude of the collection point j in radians, and R is the radius of the earth.
3. The method for optimizing medical waste collection and transportation routes according to claim 2, characterized in that: The fitness function is: Among them, fit(a) is the fitness of the a-th collection and transportation route, D ωa is the total distance of the ath collection and transportation route, and N is the total number of collection and transportation points.
4. The method for optimizing medical waste collection and transportation routes according to claim 1, characterized in that: In step S3, the gene is encoded using integer permutation encoding.
5. The method for optimizing medical waste collection and transportation routes according to any one of claims 1 to 4, characterized in that: After step S2, the following steps are also included: S3B, initializing the parameters of the simulated annealing algorithm, including the initial temperature, the termination temperature, the cooling coefficient, the random arrangement initial solution, the initial distance of the collection and transportation route, and the maximum number of iterations; S4B, generate new solutions based on temperature perturbations; S5B, calculate the difference between the new solution and the randomly arranged initial solution; S6B, determine whether the difference is less than or equal to 0, if so, accept the new solution as the current solution, otherwise, determine whether to accept the new solution as the current solution according to the Metropolis acceptance criterion; S7B, determine whether the current temperature has been reduced to the lowest set temperature and the number of iterations has reached the maximum number of iterations. If so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution. Otherwise, return to step S4B; S8B, compare the optimal individual and the optimal total distance corresponding to the optimal individual outputted in step S8 with the optimal solution and the total distance corresponding to the optimal solution outputted in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route.
6. A medical waste collection and transportation route optimization device, characterized in that: The device comprises a processor configured to perform the following steps: S1. Obtain the longitude and latitude coordinates of each collection and transportation point to form a collection and transportation point coordinate set. The collection and transportation points include the medical waste disposal plant that sends out the collection and transportation vehicle and the medical institutions within the preset range of the medical waste disposal plant; S2. Calculate the distance between each collection and transportation point according to the longitude and latitude coordinates of each collection and transportation point to form a distance matrix; S3, using the collection and transportation points as genes, encoding the genes, using the collection and transportation routes as individuals, and initializing the population; S4. According to the distance matrix, the fitness function is used to calculate the fitness of each individual; S5. Select and crossover individuals according to their fitness. S6. Perform duplicate gene detection on the individuals obtained after the crossover operation, and replace the duplicate genes according to the preset gene replacement rules until there are no duplicate genes in the individuals. S7. For each individual, swap two gene positions; S8. Determine whether the number of iterations reaches the set value. If so, output the current optimal individual and the optimal total distance corresponding to the optimal individual. If not, add 1 to the number of iterations and return to step S4.
7. The medical waste collection and transportation route optimization device according to claim 6 is characterized in that: Step S2 specifically includes: The longitude and latitude coordinates of each collection and transportation point are converted into radians, and the distance between two collection and transportation points is calculated using the haversine distance formula to form a distance matrix; The formula for the haversine distance is: Where Dis(i,j) is the distance between collection and transportation point i and collection and transportation point j, Rad(x i ) is the arc of longitude of the collection point i, Rad(y i ) is the latitude of the collection point i, Rad(x j ) is the arc of longitude of the collection point j, Rad(y j ) is the latitude of the collection point j in radians, and R is the radius of the earth.
8. The medical waste collection and transportation route optimization device according to claim 7 is characterized in that: The fitness function is: Among them, fit(a) is the fitness of the a-th collection and transportation route, D ωa is the total distance of the ath collection and transportation route, and N is the total number of collection and transportation points.
9. The medical waste collection and transportation route optimization device according to claim 6, characterized in that: In step S3, the gene is encoded using integer permutation encoding.
10. The medical waste collection and transportation route optimization device according to any one of claims 6 to 9, characterized in that: After step S2, the following steps are also included: S3B, initializing the parameters of the simulated annealing algorithm, including the initial temperature, the termination temperature, the cooling coefficient, the random arrangement initial solution, the initial distance of the collection and transportation route, and the maximum number of iterations; S4B, generate new solutions based on temperature perturbations; S5B, calculate the difference between the new solution and the randomly arranged initial solution; S6B, determine whether the difference is less than or equal to 0, if so, accept the new solution as the current solution, otherwise, determine whether to accept the new solution as the current solution according to the Metropolis acceptance criterion; S7B, determine whether the current temperature has been reduced to the lowest set temperature and the number of iterations has reached the maximum number of iterations. If so, directly output the current solution as the optimal solution and the total distance corresponding to the optimal solution. Otherwise, return to step S4B; S8B, compare the optimal individual and the optimal total distance corresponding to the optimal individual outputted in step S8 with the optimal solution and the total distance corresponding to the optimal solution outputted in step S7B to obtain the optimal collection and transportation route and the total distance corresponding to the optimal collection and transportation route.
