Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1 and fig. 2 simultaneously, fig. 1 is a schematic view of a scenario of a method for implementing intelligent cable allocation based on a genetic algorithm and a priority queue according to an embodiment of the present invention, and fig. 2 is a schematic flow chart of a method for implementing intelligent cable allocation based on a genetic algorithm and a priority queue according to an embodiment of the present invention. As shown in fig. 1, the method for implementing intelligent cable allocation based on genetic algorithm and priority queue according to the embodiment of the present invention is applied to a server 10, where the server 10 is communicatively connected with a user terminal 20.
As shown in fig. 2, the method includes the following steps S110 to S160.
S110, responding to the intelligent cable distribution instruction, and acquiring current order information corresponding to the intelligent cable distribution instruction.
In this embodiment, the technical scheme is described by using a server as an execution body. A user with the cable intelligent goods allocation requirement can establish communication connection with the server by using the user terminal, and after logging in the cable intelligent goods allocation realization system in the server, the user terminal can trigger to generate a cable intelligent goods allocation instruction and send the cable intelligent goods allocation instruction to the server, and simultaneously send current order information corresponding to the cable intelligent goods allocation instruction.
The current order information at least comprises information such as the specification model number, the required length, the segmentation requirement and the like of the required cable, and the current order information is noted that the segmentation requirement is the information such as the specific segmentation segment number, the segmentation length of each segmentation and the like if the segmentation requirement is specific, and the segmentation requirement is null if the segmentation requirement is not specific. When the server receives the current order information, the intelligent cable distribution processing process can be performed based on the intelligent cable distribution realizing system in the server, and a final cable distribution processing result is obtained.
And S120, if the cable segment demand information in the current order information is determined to be not null, determining search space parameters based on the cable segment demand information and the acquired cable inventory data.
In this embodiment, if it is determined that the cable segment demand information in the current order information is not null, it indicates that the current order has a segment demand, and then the search space parameter corresponding to the cable segment demand information may be determined by combining the cable inventory data acquired and stored in the server. The cable inventory data comprises a plurality of pieces of cable inventory sub-data, and each piece of cable inventory sub-data at least comprises information such as specification model numbers, cable lengths, manufacturing dates, warehouses and the like of cables.
In one embodiment, as shown in fig. 3, determining the search space parameter based on the cable segment requirement information and the acquired cable inventory data in step S120 includes:
S121, sorting all cable inventory sub-data in the cable inventory data according to the ascending order of the cable length to obtain sorted cable inventory data;
S122, acquiring the ith segmentation requirement sub-information in the cable segmentation requirement information, wherein the initial value of i is 1;
s123, determining an ith candidate cable inventory sub-data set corresponding to the ith segmentation requirement sub-information according to the sequenced cable inventory data, determining an ith segmentation requirement index range corresponding to the ith candidate cable inventory sub-data set, and correspondingly determining the available inventory quantity of the ith segmentation based on the ith segmentation requirement index range;
S124, if it is determined that i does not exceed N and the obtained i-1 th search space parameter does not exceed a preset search space parameter threshold, multiplying the i-1 th search space parameter by the i-1 th available segment inventory quantity to obtain the i-th search space parameter, adding 1 to the i to update the value of i, and returning to execute the step of obtaining the i-th segment demand sub-information in the cable segment demand information, wherein N is the total number of the segment demand sub-information included in the cable segment demand information, the i-1 th search space parameter is a result obtained by continuously multiplying the 1-th available segment inventory quantity to the i-1 th available segment inventory quantity, and the 0 th search space parameter is equal to 1;
S125, if it is determined that i exceeds N and the obtained i-1 th search space parameter does not exceed the preset search space parameter threshold, obtaining the Nth search space parameter and taking the Nth search space parameter as the search space parameter;
s126, if it is determined that i does not exceed N and the obtained i-1 th search space parameter exceeds the preset search space parameter threshold, increasing i by 1 to update the value of i, and returning to execute the step of obtaining the i-th segment demand sub-information in the cable segment demand information;
s127, if it is determined that i exceeds N and the acquired historical search space parameter exceeds the preset search space parameter threshold, taking the historical search space parameter as the search space parameter, wherein the historical search space parameter is the search space parameter which exceeds the preset search space parameter threshold for the first time.
In this embodiment, when a segment requirement exists in a cable purchasing object corresponding to the current order information, a plurality of candidate cable inventory sub-data meeting the requirement of the specification model and having a cable length greater than or equal to the shortest required segment length can be rapidly determined in the cable inventory data by taking the specification model and the required length of the specification model cable as search conditions.
For example, the cable stock data includes cable stock sub-data for the cables with the same specification and model, for example, the lengths of the cables corresponding to 7 pieces of cable stock sub-data included in the cable stock data are 100, 5, 200, 3, 500,1000 and 1 (each unit is m), and the cables are sorted according to the ascending order of the lengths of the cables, so as to obtain sorted cable stock data of 1,3, 5,100,200,500 and 1000. Taking the 1 st segment demand sub-information to the 4 th segment demand sub-information in the cable segment demand information as an example, the obtained 1 st segment demand sub-information corresponds to 2m, the 1 st candidate cable inventory sub-data set determined by the sorted cable inventory data and the 1 st segment demand sub-information is {3,5,100,200,500,1000}, the 1 st segment demand index range is [1,6] (determined by taking the index value of 1 in the sorted cable inventory data as 0 as a standard), and the 1 st available inventory number is 6. Similarly, referring to the above procedure, the 2 nd candidate cable inventory sub-data set {100,200,500,1000}, the 2 nd segment demand index range [3,6] and the 2 nd available inventory number is 4, the 3 rd candidate cable inventory sub-data set {100,200,500,1000}, the 3 rd segment demand index range [3,6] and the 3 rd available inventory number is 4, the 4 th candidate cable inventory sub-data set {500,1000}, the 4 th segment demand index range [5,6] and the 4 th available inventory number is 2 are obtained when the 2 nd segment demand sub-information corresponds to 50 m. For example, after the 4 th available inventory count is 2, the 3 rd search space parameter is determined to be 6x4x4=96 based on the 1 st available inventory count to the 3 rd available inventory count and by continuous multiplication, where the 3 rd search space parameter 96 may be multiplied by the 4 th available inventory count 2 to obtain the 4 th search space parameter 192 after the 3 rd search space parameter 96 is determined not to exceed the preset search space parameter threshold. For another example, after the number of available inventory of the 4 th segment is 2, the 3 rd search space parameter is determined to be 6x4x4=96 based on the number of available inventory of the 1 st segment to the number of available inventory of the 3 rd segment and multiplied continuously, at this time, after the 3 rd search space parameter 96 is determined to exceed the preset search space parameter threshold value, no new search space parameter is obtained at this time, and the next segment requirement sub-information in the cable segment requirement information is directly obtained and the corresponding segment requirement index range and the segment available inventory number are determined. Of course, the above examples are only for explaining the process of acquiring the search space parameter, and the cable stock sub-data in the cable stock data and the segment requirement sub-information included in the cable segment requirement information are not limited to the data in the above examples. It can be seen that the overall search amount of the current order information in the cable inventory data can be quickly determined in the above manner, so as to determine whether to determine the final target population and the corresponding priority queue for the current order information by using the genetic algorithm model.
And S130, if the search space parameter exceeds a preset search space parameter threshold, generating a current initial population corresponding to the current order information based on the cable segment demand information and a preset initial population generation strategy included in the current order information.
In this embodiment, if it is determined that the search space parameter exceeds the preset search space parameter threshold, it indicates that the overall search amount of the current order information in the cable inventory data is larger, and if it is further based on the conventional evaluation method, the amount of data processing and the time complexity required by the system are larger. In order to improve the data processing efficiency, a genetic algorithm model can be used for determining a final target population and a corresponding priority queue for the current order information. Specifically, a corresponding current initial population is generated based on the cable segment demand information and a preset initial population generation strategy included in the current order information. For example, still referring to the above example, after determining the 1 st candidate cable inventory sub-data set to the nth candidate cable inventory sub-data set for the cable segment requirement information and correspondingly determining the 1 st segment requirement index range to the nth segment requirement index range, one index value may be respectively selected from the 1 st segment requirement index range to the nth segment requirement index range to form a population individual, and then multiple population individuals may be generated again according to the initial population generation strategy to form the current initial population. It can be seen that, based on the above manner, the current initial population can be quickly generated based on the cable segment demand information included in the current order information.
In one embodiment, as shown in fig. 4, step S130 includes:
s131, obtaining a population size value corresponding to the initial population generation strategy;
S132, generating the current initial population based on the initial population generation strategy and the 1 st to nth segment demand index ranges corresponding to the cable segment demand information, wherein the total number of population individuals included in the current initial population is the same as the population size value, and when generating a population individual based on the initial population generation strategy, randomly selecting one index value from the 1 st to nth segment demand index ranges respectively and forming the population individual.
In this embodiment, still referring to the above example, after determining the 1 st segment demand index range of [1,6], the 2 nd segment demand index range of [3,6], the 3 rd segment demand index range of [3,6], the 4 th segment demand index range of [5,6], randomly selecting the index value 1 from the 1 st segment demand index range, randomly selecting the index value 4 from the 2 nd segment demand index range, randomly selecting the index value 5 from the 3 rd segment demand index range, randomly selecting the index value 6 from the 4 th segment demand index range, the population individuals may be composed of the 4 index values and be [1, 4, 5,6]. And (3) referring to the mode of generating one population individual, generating (population size value-1) population individuals again to form the current initial population. Therefore, the current initial population can be quickly determined based on the initial population generation strategy and the cable segment demand information.
And S140, determining a current priority queue corresponding to the current initial population based on a preset value evaluation strategy and the cable inventory data.
In this embodiment, when a value evaluation policy preset in the cable intelligent distribution implementation system is combined, each time a value evaluation value corresponding to one population individual in the current initial population is determined, whether repeated judgment exists in the current priority queue or not and comparison of the value evaluation value with each population individual stored in the current priority queue are performed, and then whether the current priority queue is added to the current priority queue or not is determined to update the current priority queue. Because the total capacity (i.e. the total number of preset queue elements) of the population individuals contained in the current priority queue is preset, after the current priority queue is initialized and established, population individuals which are not repeated mutually are firstly obtained from the current initial population based on the capacity storage fullness corresponding to the total number of preset queue elements, if the total number of preset queue elements is 10, at least the first 10 population individuals are firstly obtained from the current initial population, after the situation that the distribution schemes corresponding to the existing population individuals in the current priority queue are different is judged in sequence, and the value evaluation value of each population individual is calculated, the corresponding population individual is directly added into the current priority queue, after the 10 population individuals are stored in the current priority queue, whether the population individuals to be judged are repeatedly judged and the various population individuals stored in the current priority queue are compared with the value evaluation value of the current priority queue, and whether the population individuals to be judged are added into the current priority queue is determined to update the current priority queue. When the new population individuals do not have repetition in the current priority queue and the corresponding value evaluation value is smaller than the value evaluation value of the population individuals in the current priority queue, the new population individuals are needed to replace the population individuals with the maximum value evaluation value in the current priority queue, so that the current priority queue is updated in time. The value evaluation strategy is used for determining a value evaluation value corresponding to each population of individuals in the current initial population. When judging whether two population individuals respectively correspond to the same allocation scheme, for example, one population individual corresponds to [1, 4, 5,6], the other population individual corresponds to [1, 5, 4,6], the 2 nd segment demand sub-information and the 3 rd segment demand sub-information both correspond to 50m, the 2 nd segment demand sub-information corresponds to index value 4 of the first population individual and the 2 nd segment demand sub-information corresponds to index value 5 of the second population individual, the 3 rd segment demand sub-information corresponds to index value 5 of the first population individual and the 3 rd segment demand sub-information corresponds to index value 4 of the second population individual, and the allocation schemes corresponding to the two population individuals can be regarded as the same allocation scheme.
In one embodiment, as shown in fig. 5, step S140 includes:
s141, creating a current priority queue based on the corresponding initialization of the total number of the preset queue elements, wherein the number of the population individuals stored in the current priority queue created by the initialization is 0, and the upper limit number of the storable population individuals in the current priority queue is the total number of the preset queue elements;
S142, obtaining individuals in a jth population in the current initial population, wherein the initial value of j is 1;
s143, inputting a candidate cargo allocation scheme corresponding to the jth population individual into a value evaluation value calculation model corresponding to the value evaluation strategy to obtain a value evaluation value corresponding to the jth population individual;
s144, if it is determined that j does not exceed the total number of the preset queue elements and population individuals which are the same as the corresponding allocation scheme of the j-th population individuals do not exist in the current priority queue, increasing the j-th population individuals to the corresponding queue positions of the current priority queue based on the corresponding value evaluation values so as to update the current priority queue;
s145, if it is determined that j does not exceed the total number of the preset queue elements, and population individuals with the same allocation scheme as the jth population individuals exist in the current priority queue, executing a step of automatically increasing j by 1 to update the value of j;
S146, if it is determined that j exceeds the total number of the preset queue elements, the population individuals which are the same as the assignment scheme corresponding to the jth population individuals do not exist in the current priority queue, and if it is determined that the value evaluation value corresponding to the population individuals exists in the current priority queue and is greater than the value evaluation value corresponding to the jth population individuals, the population individuals with the largest value evaluation value in the current priority queue are removed from the current priority queue, and the jth population individuals are added to the current priority queue to update the current priority queue;
S147, if it is determined that j exceeds the total number of the preset queue elements and population individuals with the same distribution scheme as the j-th population individuals exist in the current priority queue, executing a step of automatically increasing j by 1 to update the value of j;
S148, automatically increasing j by 1 to update the value of j;
S149, if j is determined not to exceed P, returning to execute the step of acquiring the j-th population individuals in the current initial population, wherein P is a population size value corresponding to the initial population generation strategy;
S1410, if it is determined that the exceeding j exceeds P, the current priority queue is obtained.
In this embodiment, still referring to the above example, as the 1 st population individual in the current initial population, the corresponding candidate cable inventory sub-data is determined from the sorted cable inventory data in combination with the 4 index values included in the population individual, for example, the index value 1 corresponds to the candidate cable inventory sub-data sorted by the 2 nd bit in the sorted cable inventory data, the index value 4 corresponds to the candidate cable inventory sub-data sorted by the 5 th bit in the sorted cable inventory data, the index value 5 corresponds to the candidate cable inventory sub-data sorted by the 6 th bit in the sorted cable inventory data, and the index value 6 corresponds to the candidate cable inventory sub-data sorted by the 7 th bit in the sorted cable inventory data. After determining each candidate cable inventory sub-data of the 4 candidate cable inventory sub-data, the information such as the specification model number, the cable length, the manufacturing date and the warehouse where the cable is located, which are specifically included in each candidate cable inventory sub-data, can be specifically obtained. At this time, the following formula corresponding to the value evaluation strategy is obtained:
(1)
Wherein, in formula (1), F Quantity of warehouse represents a warehouse dimensional value evaluation value corresponding to a current population individual to be evaluated in the current initial population (for example, in step S141, the j-th population individual in the current initial population has been obtained, F Quantity of warehouse represents a warehouse dimensional value evaluation value of the j-th population individual), and at this time, F Quantity of warehouse ,α Quantity of warehouse may be determined by F Quantity of warehouse =α Quantity of warehouse x (number of warehouses-1) as a first preset weight coefficient with a value greater than 0, where the number of warehouses is the number of warehouses obtained by counting the warehouses corresponding to candidate cable inventory sub-data corresponding to each index value in the current population individual to be evaluated;
F Number of cables represents an evaluation value of the cable number dimension value corresponding to one population individual to be evaluated currently in the current initial population, and F Number of cables = α Number of cables is (cable number-1), α Number of cables is a second preset weight coefficient (which is greater than 0), the cable number is obtained by performing statistics after de-duplication of the total data number of candidate cable stock sub-data corresponding to each index value in the population individual to be evaluated currently, where if the 4 index values in the population individuals [1, 4, 5,6] are all different, the cable number=4, and if the cable number=3 is another population individual [1, 4,6 ].
F Date of manufacture represents a manufacturing date dimension value evaluation value corresponding to a current population individual to be evaluated in a current initial population, F Date of manufacture = -α Date of manufacture represents an average age of the libraries, alpha Date of manufacture is a third preset weight coefficient (which is larger than 0), the average age of the libraries is obtained by firstly obtaining candidate cable inventory sub-data corresponding to each index value in the current population individual to be evaluated after de-duplication (for example, at least two index values in the current population individual to be evaluated are the same, the same inventory cable is represented, at this time, de-duplication processing is only carried out by keeping candidate cable inventory sub-data corresponding to one index value), then average age of the candidate cable inventory sub-data in the candidate cable inventory sub-data set is calculated, for example, the candidate cable inventory sub-data corresponding to one index value in the current population individual to be evaluated is known, and the corresponding manufacturing date is also known, then one library age corresponding to the index value can be obtained by subtracting the manufacturing date from the current system date, the average age of the libraries can be obtained by referring to the average age of the population corresponding to each index value in the population individual;
F Length of represents a cable length dimension value evaluation value corresponding to a population individual to be evaluated currently in a current initial population, F Length of i= α Length of i* g(Li),F Length of =F Length of 1+F Length of 2+……+ F Length of N, represents that the value range of i is 1 to N (N represents the total number of index values included in a population individual), when determining a Length of i, firstly judging whether the index values in the population individual correspond to the same stock cable (namely, whether a plurality of index values in the population individual to be evaluated currently are equal to the same index value) or not, if the index values are equal to the same index value, combining the stock cables corresponding to the same index values to obtain a combined stock cable (F Length of i corresponding to the same index values is combined to be calculated), summing the required cable lengths corresponding to the same index values respectively, subtracting the cable lengths in candidate cable stock sub-data corresponding to the same index values to obtain a current length difference value, setting a Length of i corresponding to the combined stock cable to be a great positive value when judging that the current length difference is greater than 0, setting a Length of i corresponding to the combined stock cable to be a great positive value when judging that the current length difference is smaller than 0, and setting a preset length difference value to be equal to a great value to a preset value of a value of the rest value and setting a value to be equal to zero; when it is determined that the current length difference is less than 0 and the absolute value of the current length difference does not belong to the preset remaining cable zero line length interval, a Length of i is set to a small positive value), when the current length difference value is equal to 0, setting alpha Length of i corresponding to the combined stock cable as a preset weight coefficient with a negative value, wherein g (Li) =1; for the situation that each index value of the population individuals corresponds to different inventory cables, the acquisition process of alpha Length of i corresponding to each index value is similar to the process, and the duplicate removal process is omitted, when the length difference value is not 0, g (Li) is obtained by subtracting the length of a cable required corresponding to the ith index value in the current population individuals to be evaluated from the length of the cable in the candidate cable inventory sub-data corresponding to the ith index value all the time;
Fitness represents a value evaluation value corresponding to a current population individual to be evaluated in the current initial population, and after determining a value evaluation value corresponding to the population individual, such as a value evaluation value corresponding to a jth population individual, based on the above formula (1), it is determined whether a repeated judgment exists in the current priority queue and whether the value evaluation value is compared with the population individual currently having the largest value evaluation value in the current priority queue, and then whether the value evaluation value is added to the current priority queue to update the current priority queue. Therefore, in each iteration process, as long as new population individuals do not have repetition in the current priority queue and the corresponding value evaluation value is smaller than the corresponding value evaluation value of the population individuals with the maximum value evaluation value in the current priority queue, the corresponding population individuals in the current priority queue need to be replaced by the new population individuals, so that the current priority queue is updated in time. The method comprises the steps of evaluating each population individual from four sub-dimensions of a warehouse dimension, a cable quantity dimension, a manufacturing date dimension and a cable length dimension, and then calculating by combining a formula (1) to obtain a value evaluation value of each population individual. The smaller the value evaluation value of the population individuals is, the better the cable allocation scheme corresponding to the population individuals is, in particular, the smaller the value evaluation value of the warehouse dimension in the value evaluation value of the population individuals is, the more convenient the allocation scheduling is, the smaller the value evaluation value of the cable number dimension is, the same stock cable is used as preferentially as possible in the cable allocation scheme to facilitate the picking, the smaller the value evaluation value of the manufacturing date dimension is, the longer stock cable is used preferentially in the cable allocation scheme, the stock backlog of long stock is avoided, the smaller the value evaluation value of the cable length dimension is, the short stock is used preferentially in the cable allocation scheme to avoid the long order backlog, and meanwhile, the zero line is required to be avoided as much as possible.
In addition, in the present application, a data structure in the form of a priority queue is used to store population individuals meeting the conditions (one population individual corresponds to one cable distribution scheme), and the time complexity of the insertion and deletion operations is O (logKK 1), where KK1 is the number of elements in the queue. The time complexity of using the priority queue is O (MM 1logKK 2) and the time complexity of direct ordering is O (MM 1log MM 1) when looking for the largest or smallest KK2 elements in the list of length MM1 (e.g., MM1 equals nttotal in the above example), and the efficiency of adopting the data structure in the form of the priority queue is higher when KK2 is much smaller than MM 1. Wherein, KK1, KK2 and MM1 are all positive integers.
S150, carrying out iteration of a preset target round number on the current initial population based on a preset genetic algorithm model to obtain a current target population, determining a current priority queue corresponding to the current target population based on the value evaluation strategy and the cable inventory data in each iteration, obtaining preferred population individuals in all population individuals for all current iterated rounds after each iteration is finished, stopping iteration until the iteration of the preset target round number is finished, and obtaining the current priority queue as a current target priority queue.
The total number of the population individuals included in the current priority queue is the total number of the preset queue elements.
In this embodiment, after step S140 or steps S141-S1410 corresponding to the specific embodiment thereof are performed, it is considered that a current priority queue corresponding to the current initial population is determined in the first round of the whole iteration process (where the maximum total number of population individuals stored is the total number of the preset queue elements, the current priority queue has an initialized condition only in the first round of process, in the subsequent iteration process, the population individuals in the current priority queue are continuously updated based on a deduplication principle and a value evaluation value comparison principle), it cannot be directly used for determining current cable cargo allocation information, and further, it is required to iterate the current initial population by combining with a genetic algorithm model to obtain a current target population, and in the process of each round of iteration, population individuals included in the current priority queue are continuously updated based on a new round of current target population, and the update principle is that in the current priority queue, there is no individual with the same population as the new population individual, and it is determined that the current priority value evaluation value corresponding to the population individual is greater than the new population, and then the current individuals in the current priority queue are preferentially added to the current priority queue, and the current target population is not preferentially added to the current priority queue in the current iteration process.
In one embodiment, as shown in fig. 6, step S150 includes:
s151, acquiring a genetic operator of the genetic algorithm model and a K-1 current target population, and carrying out corresponding selection, crossing and mutation treatment on the K-1 current target population according to the genetic operator of the genetic algorithm model to obtain a K current target population, wherein the initial value of K is 1, and the 0 current target population is the current initial population;
S152, determining a Kth current priority queue corresponding to the Kth current target population based on a preset value evaluation strategy, a Kth-1 current priority queue and the cable inventory data, wherein the 0 th current priority queue is a current priority queue corresponding to the current initial population;
S153, increasing K by 1 to update the value of K;
S154, if the fact that K does not exceed DD is determined, returning to execute the genetic operator for acquiring the genetic algorithm model and the K-1 current target population, and carrying out corresponding selection, crossing and mutation treatment on the K-1 current target population according to the genetic operator of the genetic algorithm model to obtain the K current target population, wherein DD represents the preset target number;
S155, if the fact that K exceeds the preset target number is determined, acquiring a DD current priority queue and taking the DD current priority queue as the current target priority queue.
In this embodiment, the genetic algorithm model is adopted to iterate the preset target number of rounds on the current initial population, so that natural selection and genetic mechanism can be simulated, and the current target population with better fitness is iterated and evolved from the current initial population. In the current target population obtained by each iteration, not only the value evaluation value of the population individuals can be evaluated according to the value evaluation strategy, but also a new population can be generated through operations such as selection, intersection, mutation and the like.
When a kth current priority queue corresponding to the kth current target population is determined based on a preset value evaluation strategy, a kth-1 current priority queue and the cable inventory data, the same population individuals as a new population individual corresponding allocation scheme do not exist in the kth-1 current priority queue, and the value evaluation value corresponding to the population individuals in the kth-1 current priority queue is determined to be larger than the value evaluation value corresponding to the new population individual, new population individuals in the kth current target population are added into the kth-1 current priority queue, population individuals with the largest value evaluation value in the kth-1 current priority queue are removed from the current priority queue, and a final kth current priority queue is obtained after the completion of the kth round of iteration, so that the current priority queue is continuously updated in the process of generating the current target population through multiple rounds of iteration.
And S160, generating current cable distribution information corresponding to the current order information based on the current target priority queue.
In this embodiment, after the preset target round number iteration is performed on the current initial population based on the genetic algorithm model and the current target priority queue is determined, each population individual in the current target priority queue represents a cable allocation scheme, candidate cable inventory sub-data corresponding to each index value in each population individual is also known, and after each population individual included in the current target priority queue and candidate cable inventory sub-data corresponding to each population individual are obtained, the candidate cable inventory sub-data is displayed in a tabular manner, so that a plurality of current cable allocation information corresponding to the current order information can be formed. Therefore, based on the mode, the current cable distribution information convenient for visual display can be rapidly obtained.
In one embodiment, after step S110, the method further includes:
if the cable segment demand information in the current order information is determined to be empty, determining a first current target priority queue based on a corresponding ascending sequencing result of a difference value between the cable length of each candidate cable inventory sub-data in the cable inventory data and the cable required length in the current order information; the cable length of the candidate cable stock sub-data corresponding to the current order information in the cable stock data is larger than or equal to the cable required length in the current order information; if the cable length of the plurality of candidate cable stock sub-data is the same as the difference value of the cable required length in the current order information, sorting the cable length of the plurality of candidate cable stock sub-data according to the manufacturing date ascending sequence of the plurality of candidate cable stock sub-data in the first current target priority queue, if the difference value of the cable length of the candidate cable stock sub-data and the cable required length in the current order information belongs to a preset residual cable length interval and the number of the stored candidate cable stock sub-data in the first current target priority queue is the preset total number of queue elements, not adding the corresponding candidate cable stock sub-data into the first current target priority queue, and if the difference value of the cable length of the candidate cable stock sub-data and the cable required length in the current order information belongs to the preset residual cable length interval and the number of the stored candidate cable stock sub-data in the first current target priority queue does not exceed the preset total number of queue elements, adding the corresponding candidate cable stock sub-data into the first current target priority queue;
And generating current cable allocation information corresponding to the current order information based on the first current target priority queue.
In this embodiment, if it is determined that the cable segment requirement information in the current order information is empty, it indicates that the cable purchasing object corresponding to the current order information does not have a segment requirement, and at this time, the first current target priority queue is determined directly by combining the cable inventory data in the server. For example, taking a specification model and a required length of a cable with the specification model in the current order information as search conditions, obtaining a plurality of candidate cable inventory sub-data meeting the specification model requirement and having a cable length greater than or equal to the required length in the cable inventory data, subtracting the required length of the cable corresponding to the current order information from the cable length (i.e. the cable inventory length) of each candidate cable inventory sub-data in the cable inventory data, thereby determining the remaining cable length of each candidate cable inventory sub-data relative to the required length of the cable, sorting the candidate cable inventory sub-data in an ascending order according to the corresponding remaining cable length, selecting a corresponding number of candidate cable inventory sub-data from the sorting results by combining the total number of candidate cable inventory sub-data which can be accommodated by the current target priority queue, obtaining the first current target priority queue, and avoiding long order shortage, and combining the order of the plurality of candidate cable inventory sub-data with the order in which the remaining cable length obtained by subtracting the required length of the cable corresponding to the current order information is the cable length is the same, wherein the sorting of the candidate cable inventory sub-data is ordered earlier in the order of manufacturing date. It should be noted that if the remaining cable length obtained by subtracting the cable required length corresponding to the current order information from the cable length of the candidate cable stock sub-data belongs to a preset remaining cable length section (the preset remaining cable length section can be flexibly set according to the actual requirement of the user), the value of the remaining cable length is small but the remaining cable length is regarded as generating a zero line, and the candidate cable stock sub-data is directly arranged to the rear of the sorting result. And after the sorting is completed, obtaining a first current target priority sub-queue corresponding to the current order information.
Thereafter, the current cable shipment information corresponding to the current order information is generated based on the first current target priority queue, and reference may be made to a process of generating the current cable shipment information corresponding to the current order information based on the current target priority queue, which is not described herein. Therefore, based on the above mode, when the current order information does not include the cable segment demand information, the current cable distribution information can be obtained quickly by combining the cable required length and the cable inventory data in the current order information.
In one embodiment, after step S120, the method further includes:
If the search space parameter is determined not to exceed a preset search space parameter threshold, determining a second current target priority queue corresponding to the current order information based on the cable segment demand information, the value evaluation strategy and the cable inventory data included in the current order information;
And generating current cable allocation information corresponding to the current order information based on the second current target priority queue.
In this embodiment, if it is determined that the search space parameter does not exceed the preset search space parameter threshold, it indicates that the overall search amount of the current order information in the cable inventory data is not large, and when the value evaluation policy and the cable inventory data are combined to obtain the second current target priority queue corresponding to the cable segment demand information included in the current order information, the specific process is similar to the process of obtaining the current priority queue in step S140, except that it is not necessary to generate a current initial population based on the cable segment demand information initially, but a manner of traversing all individuals is adopted.
And then generating current cable allocation information corresponding to the current order information based on the second current target priority queue, reference may be made to a process of generating current cable allocation information corresponding to the current order information based on the current target priority queue, which will not be described herein. Therefore, based on the above manner, when the search space parameter does not exceed the preset search space parameter threshold, the current cable distribution information can be obtained quickly by combining the cable segmentation demand information, the value evaluation strategy and the cable inventory data included in the current order information.
Therefore, the embodiment of the method can effectively improve the output efficiency of the cable distribution scheme by determining and recommending the optimal distribution scheme in a mode of combining a genetic algorithm and a priority queue and maintaining the optimal distribution scheme set by using the priority queue.
Fig. 7 is a schematic block diagram of a cable intelligent cargo allocation implementing device based on a genetic algorithm and a priority queue according to an embodiment of the present invention. As shown in fig. 7, the present invention also provides a device 100 for implementing intelligent cable shipment based on genetic algorithm and priority queue, corresponding to the above method for implementing intelligent cable shipment based on genetic algorithm and priority queue. The genetic algorithm and priority queue based cable intelligent shipment implementation apparatus 100 includes means for performing the genetic algorithm and priority queue based cable intelligent shipment implementation method described above. Referring to fig. 7, the genetic algorithm and priority queue based cable intelligent cargo allocation implementing apparatus 100 includes a current order information acquiring unit 110, a search space parameter acquiring unit 120, a current initial population generating unit 130, a current priority queue acquiring unit 140, a genetic iteration unit 150, and a current cable cargo allocation information generating unit 160.
The current order information obtaining unit 110 is configured to obtain current order information corresponding to a cable intelligent distribution instruction in response to the cable intelligent distribution instruction.
The search space parameter obtaining unit 120 is configured to determine a search space parameter based on the cable segment demand information and the obtained cable inventory data if it is determined that the cable segment demand information in the current order information is not null.
The current initial population generation unit 130 is configured to generate a current initial population corresponding to the current order information based on the cable segment demand information and a preset initial population generation policy included in the current order information if it is determined that the search space parameter exceeds a preset search space parameter threshold.
The current priority queue obtaining unit 140 is configured to determine a current priority queue corresponding to the current initial population based on a preset value evaluation policy and the cable inventory data.
The genetic iteration unit 150 is configured to iterate the current initial population by a preset target round number based on a preset genetic algorithm model to obtain a current target population, determine a current priority queue corresponding to the current target population based on the value evaluation policy and the cable inventory data in each iteration, and obtain preferred population individuals in all population individuals for all current iterated rounds after each iteration is completed, until the iteration of the preset target round number is completed, and obtain the current priority queue as the current target priority queue.
A current cable shipment information generating unit 160, configured to generate current cable shipment information corresponding to the current order information based on the current target priority queue.
It should be noted that, as those skilled in the art can clearly understand, the specific implementation process of the cable intelligent distribution implementation device and each unit based on the genetic algorithm and the priority queue may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, the description is omitted here.
Therefore, the embodiment of the device determines and recommends the optimal distribution scheme by combining the genetic algorithm and the priority queue, and maintains the optimal distribution scheme set by using the priority queue, so that the output efficiency of the cable distribution scheme can be effectively improved.
The cable intelligent distribution realizing device based on the genetic algorithm and the priority queue can be realized in the form of a computer program, and the computer program can be run on a computer device as shown in fig. 8.
Referring to fig. 8, fig. 8 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer equipment integrates any one of the intelligent cable distribution realizing devices based on the genetic algorithm and the priority queue provided by the embodiment of the invention.
With reference to fig. 8, the computer device includes a processor 402, a memory, and a network interface 405, which are connected by a system bus 401, wherein the memory may include a storage medium 403 and an internal memory 404.
The storage medium 403 may store an operating system 4031 and a computer program 4032. The computer program 4032 includes program instructions that, when executed, cause the processor 402 to perform a method of implementing intelligent cable shipment based on genetic algorithms and priority queues.
The processor 402 is used to provide computing and control capabilities to support the operation of the overall computer device.
The internal memory 404 provides an environment for the execution of a computer program 4032 in the storage medium 403, which computer program 4032, when executed by the processor 402, causes the processor 402 to perform the genetic algorithm and priority queue based cable intelligent distribution implementation method described above.
The network interface 405 is used for network communication with other devices. It will be appreciated by those skilled in the art that the structure shown in FIG. 8 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
Wherein the processor 402 is configured to execute the computer program 4032 stored in the memory to implement the genetic algorithm and priority queue based cable intelligent distribution implementation method as described in any of the above examples.
It should be appreciated that in embodiments of the present invention, the Processor 402 may be a central processing unit (Central Processing Unit, CPU), the Processor 402 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program comprises program instructions, and the computer program can be stored in a storage medium, which is a computer readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a computer-readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program includes program instructions. The program instructions, when executed by a processor, cause the processor to perform the genetic algorithm and priority queue based cable intelligent shipment implementation method as described in any of the examples above.
The storage medium may be a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, or other various computer-readable storage media that can store program codes.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.