Genetic algorithm-based commodity allocation method and device, and storage medium
Through the product distribution method based on genetic algorithm, the product distribution plan is converted into binary encoding, the initial distribution plan library is built, and the genetic algorithm is optimized, which solves the problem of difficulty in meeting multiple constraints at the same time in the existing technology, and realizes a more competitive product distribution plan.
Patent Information
- Application Number
- CN202411510805.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-10-28
AI Technical Summary
The existing product distribution scheme based on genetic algorithms is difficult to meet the constraints of multiple dimensions at the same time, resulting in poor optimization results.
By determining the product data to be configured in the system, the quantity of target configurations, the product feature distribution and weight parameters, the product distribution scheme is converted into a binary coded product combination, and an initial delivery scheme library is built, the evaluation criteria is defined, and the genetic algorithm is optimized, and the solution with the highest fitness is finally selected as the optimal solution.
It effectively solves the problem of how to filter out products that meet multiple characteristic constraints and are more competitive to deliver to the store, and improves the optimization effect of product distribution.
Smart Images

Figure CN119515271A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer science and technology, and in particular to a commodity distribution method, device and storage medium based on genetic algorithm. Background Art
[0002] Warehouses have different distribution logic for each product to meet regular market demand. In related technologies, stores usually consider the optimal market demand as a constraint to select a distribution plan, but a single feature can only meet the sales volume of the current constraint, but cannot meet the needs of delivering more competitive products to the store. Therefore, when the distribution of product features is complex, insufficient consideration of multiple constraints leads to the inability to screen out more competitive products in the distribution plan. Summary of the invention
[0003] The main purpose of this application is to provide a commodity distribution method based on genetic algorithm, aiming to solve the technical problem that the existing commodity distribution scheme based on genetic algorithm is difficult to simultaneously meet the constraints of multiple dimensions and has poor optimization effect.
[0004] To achieve the above-mentioned purpose, the present application proposes a commodity distribution method based on a genetic algorithm, and the commodity distribution method based on a genetic algorithm includes: determining the commodity data to be configured in the system, the target configuration quantity, the commodity feature distribution, and the corresponding weight parameters; converting the commodity configuration plan into a binary-coded commodity combination, and constructing an initial distribution plan library; defining evaluation criteria, and evaluating the fitness of each plan according to the commodity feature distribution and weight parameters; performing genetic algorithm optimization, and selecting the plan with the highest fitness from the final distribution plan library as the optimal solution. In one embodiment, the steps of converting the commodity distribution plan into a binary-coded commodity combination and constructing an initial distribution plan library, each plan representing a possible distribution strategy, include:
[0005] Based on a preset coding rule, the commodity distribution plan is encoded into the commodity combination in binary;
[0006] Based on the binary sequence corresponding to the commodity combination, the initial distribution solution library is constructed.
[0007] In one embodiment, the step of encoding the commodity allocation plan into the binary commodity combination based on a preset encoding rule includes:
[0008] Based on the preset coding rules, determine the quantity of goods corresponding to the goods distribution plan;
[0009] Based on the commodity categories existing in the commodity quantity, the binary sequence is determined to be the commodity combination.
[0010] In one embodiment, the step of constructing the initial distribution solution library based on the binary sequence corresponding to the commodity combination includes:
[0011] Based on the distribution plan library corresponding to the product combination, determine the quantity of products corresponding to the distribution plan library;
[0012] Based on the quantity of goods and preset rules, the commodity combination is adjusted to construct the initial distribution solution library.
[0013] In one embodiment, the step of defining the evaluation criteria for the distribution plan and evaluating the initial distribution plan according to the commodity feature distribution and the weight parameter includes:
[0014] Based on the characteristic distribution of the commodities, determining the initial similarity of the distribution plan;
[0015] If the initial similarity is not less than the preset threshold, the product feature similarity is multiplied by the corresponding weight parameter to obtain the total fitness corresponding to the product distribution plan.
[0016] In one embodiment, the step of taking the initial cargo distribution solution library as input and generating the first cargo distribution solution library through selection, crossover and mutation operations includes:
[0017] Selecting two cargo distribution plans from the initial cargo distribution plan library based on the fitness of the cargo distribution plan;
[0018] The two distribution plans are crossover and mutation operations are performed to determine a first distribution plan library.
[0019] In one embodiment, after the step of performing crossover and mutation operations on the two distribution plans to determine the first distribution plan library, the step further includes:
[0020] The crossover and mutation operations are performed on at least two of the allocation plans in the first allocation plan library based on a preset iteration condition to determine a target allocation plan library.
[0021] In one embodiment, the step of selecting the cargo distribution plan with the highest fitness from the target cargo distribution plan library as the target cargo distribution plan includes:
[0022] Calculating the fitness of the target distribution plan based on the similarity of the commodity feature distribution in the target distribution plan library;
[0023] The target distribution plan is determined based on the fitness ranking order.
[0024] In addition, to achieve the above-mentioned purpose, the present application also proposes a commodity distribution device based on a genetic algorithm, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the commodity distribution method based on a genetic algorithm as described above.
[0025] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the commodity allocation method based on genetic algorithm as described above are implemented.
[0026] The commodity distribution method, device and storage medium based on genetic algorithm proposed in the present application determine at least two initial distribution plans based on preset product dimensions, and the product dimensions include: determining the commodity data to be configured in the system, the configuration quantity of the target, the commodity feature distribution and the weight parameter; converting the commodity distribution plan into a binary-coded commodity combination, and constructing an initial distribution plan library, each initial distribution plan represents a possible distribution strategy; defining the evaluation criteria of the distribution plan, and evaluating the initial distribution plan according to the commodity feature distribution and the weight parameter; using the initial distribution plan library as input, and generating a first distribution plan library through selection, crossover and mutation operations; repeating step S4 until the termination condition is met, such as reaching the maximum number of iterations or finding a target distribution plan library that meets the preset fitness threshold; selecting the distribution plan with the highest fitness from the target distribution plan library as the optimal solution. Based on the commodity distribution method based on genetic algorithm in the present application, the problem of how to screen out products that meet the constraints of multiple features and are more competitive and distribute them to stores is effectively solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flow chart of the first embodiment of the method for allocating goods based on genetic algorithm provided in this application;
[0028] Figure 2 A flow chart of the second embodiment of the commodity distribution method based on genetic algorithm provided in this application;
[0029] Figure 3 A flow chart of the third embodiment of the method for allocating goods based on genetic algorithm of the present application;
[0030] Figure 4 A flow chart of a fourth embodiment of a method for allocating goods based on a genetic algorithm according to the present invention;
[0031] Figure 5 A flowchart diagram of a fifth embodiment of a method for allocating goods based on a genetic algorithm of the present application is provided;
[0032] Figure 6 Schematic diagram of the device structure of the hardware operating environment involved in the commodity allocation method based on genetic algorithm in the embodiment of the present application. DETAILED DESCRIPTION
[0033] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0034] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0035] The main solution of the embodiment of the present application is: determine the commodity data to be configured in the system, the configuration quantity of the target, the commodity feature distribution and the weight parameter; convert the commodity distribution plan into a binary-coded commodity combination, and construct an initial distribution plan library, each of which represents a possible distribution strategy; define the evaluation criteria of the distribution plan, and evaluate the initial distribution plan according to the commodity feature distribution and the weight parameter; use the initial distribution plan library as input, and generate a first distribution plan library through selection, crossover and mutation operations; repeat the crossover and mutation operations to iterate until the termination condition is met, such as reaching the maximum number of iterations or finding the target distribution plan library that meets the preset fitness threshold; select the distribution plan with the highest fitness from the target distribution plan library as the optimal solution. The warehouse has different distribution logic for each product to meet the conventional market demand. In the related art, the store usually considers the optimal market demand as a constraint condition to select the distribution plan, and a single feature can only meet the sales volume of the current constraint condition, but cannot meet the delivery of more competitive products to the store. Therefore, in the case of complex distribution of commodity features, insufficient consideration of multiple constraints leads to the inability to screen out more competitive products in the distribution plan.
[0036] This application uses a commodity distribution method based on a genetic algorithm to solve the problem of inefficiency in manually summarizing data and adjusting distribution plans.
[0037] It should be noted that the execution subject of this embodiment can be a commodity distribution system, which is also a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, etc. The following takes the commodity distribution system as an example to illustrate this embodiment and the following embodiments.
[0038] Based on this, the first embodiment of the present application provides a commodity distribution method based on a genetic algorithm, referring to Figure 1 , Figure 1 This is a flow chart of Example 1 of the commodity distribution method based on genetic algorithm of the present application.
[0039] In this embodiment, the commodity distribution method based on genetic algorithm includes steps S1 to S6:
[0040] Step S1, determine the commodity data to be configured in the system, the configuration quantity of the target, the commodity feature distribution and the weight parameters.
[0041] It should be noted that the commodity data to be configured refers to the detailed information of the commodities considered in the distribution process, such as commodity ID, name, description, category, price, etc. The target configuration quantity refers to the total number or target of commodity combinations that need to be achieved in the distribution process. Commodity characteristics refer to the various attributes or characteristics of commodities, and the distribution of these characteristics among all commodities, which can be series, shape, material, style, price, etc., and the distribution of commodity characteristics indicates the frequency and diversity of different characteristics in the commodity set. The weight parameter is a numerical value assigned to each feature, which is used to indicate the relative importance in the decision-making of the distribution plan.
[0042] As an optional implementation, necessary product information is extracted from the enterprise's database, the product information is cleaned and verified, the current inventory level and historical sales data are extracted to determine the target configuration quantity, and the weight parameters of the initial products are determined for different product attributes.
[0043] For example, a company wants to obtain the number of goods to be configured in the system, so it obtains product information including name, description, price, inventory quantity, size, color, etc. from the database of the ERP system, determines historical sales data and current inventory levels after cleaning and verification, and then organizes the data into a unified format for analysis to determine the target configuration quantity. At the same time, the initial weight parameters are determined for different attributes of the goods, which can be size, color, style, etc.
[0044] S2: Convert the product allocation plan into a binary-coded product combination and build an initial allocation plan library, each of which represents a possible allocation strategy.
[0045] It should be noted that the binary code refers to the binary coding rules, which only have "0" and "1". The binary coding order can be from left to right or from right to left. This product distribution system does not limit the binary coding order. The initial distribution plan library merges the product combinations generated by the binary code, and each combination represents a distribution plan.
[0046] As an optional implementation, converting the product allocation plan into a binary-coded product combination involves representing each product as a binary number, where "1" means that the product is selected for allocation and "0" means that it is not selected. This process first requires determining the total number of products and then assigning a binary bit to each product. Next, each product is selected or not selected according to the allocation strategy, thereby forming a series of binary codes, each of which represents a unique allocation plan. All allocation plans are collected to construct an initial allocation plan library.
[0047] For example, a bookstore has 10 different books available for distribution, and the bookstore needs to configure books for a new store. In the binary encoding process, each book is assigned a number from 1 to 10, and then the bookstore decides which books need to be distributed based on factors such as the popularity of the book and seasonal demand. For example, if the bookstore decides to distribute books with numbers 1, 3, 5, and 7, the binary encoding of this distribution plan will be "1010101000", where each number corresponds to a book, 1 means selected, and 0 means unselected. At the same time, the bookstore can set an initial distribution plan library containing 100 different distribution plans. These distribution plans may be based on different selection criteria, such as the category, author, price range, or expected customer group of the book. For example, the first plan in the plan library may be "1010101000", representing the distribution of books with numbers 1, 3, 5, and 7; while the second plan may be "1111011100", representing the distribution of books with numbers 1, 2, 3, 4, 6, 7, and 8. This initial distribution plan library provides bookstores with a variety of distribution plans to choose from.
[0048] S3: defining evaluation criteria for the distribution plan, and evaluating the initial distribution plan according to the commodity feature distribution and the weight parameter.
[0049] It should be noted that the commodity feature distribution and weight parameters are derived from information such as commodity diversity, inventory turnover, customer satisfaction, and profit maximization. Therefore, the initial distribution plan can be evaluated in combination with the evaluation criteria under these parameters.
[0050] As an optional implementation, the distribution of product features in each solution is analyzed by product feature distribution and weight parameters, and the score of each solution is calculated according to preset weight parameters, so as to evaluate the feasibility of each solution based on the distribution of product features and weight parameters.
[0051] For example, when evaluating a distribution plan, three characteristics of the product are taken into account: function, brand awareness and price range, and weights are assigned to each characteristic based on market research: function accounts for 40%, brand awareness accounts for 30%, and price range accounts for 30%. Therefore, when evaluating a distribution plan containing 10 different car models, the total score of the plan is calculated based on the distribution of each car model in the plan on these three characteristics and then based on the weights.
[0052] S4: Taking the initial distribution plan library as input, generating a first distribution plan library through selection, crossover and mutation operations.
[0053] As an optional implementation, after determining the initial cargo distribution plan library, operations such as selection, crossover and mutation can be selectively performed on the initial cargo distribution plans whose fitness does not meet the preset threshold.
[0054] S5: Repeat step S4 until a termination condition is met, such as reaching a maximum number of iterations or finding a target distribution solution library that meets a preset fitness threshold.
[0055] S6: Selecting the distribution plan with the highest fitness from the target distribution plan library as the optimal solution.
[0056] It should be noted that crossover refers to a part of the genetic algorithm that simulates the biological reproduction process, which is achieved by exchanging certain parts of the parent plan, with the aim of generating new combinations that may include better distribution strategies. Mutation refers to randomly changing certain parts of the selected distribution plan, introducing new genetic diversity, which helps the algorithm to jump out of the local optimal solution and explore a wider solution space. The termination condition is the maximum number of iterations or the iterative algorithm reaching the target solution. Fitness is an indicator used to measure the quality of the distribution plan. The higher the fitness, the more the distribution plan can meet the target demand.
[0057] As an optional implementation, an initial distribution plan library is used as input, and the first generation distribution plan library is generated through the three core operations of the genetic algorithm: selection, crossover and mutation. The genetic algorithm is repeatedly executed until a predefined termination condition is found, which can be reaching the maximum number of iterations or finding a distribution plan that meets a preset fitness threshold. When the iteration stops, the distribution plan with the highest fitness is selected from the final distribution plan library as the optimal solution.
[0058] Exemplarily, after generating 100 binary solutions for a jewelry store, the fitness of each solution is calculated, and the 20 solutions with the highest fitness are selected as iterations of the genetic algorithm. Some parts between two solutions are exchanged through the single-point crossover method to generate a new solution. At the same time, a mutation operation is performed on a single solution to introduce new genetic diversity to generate a first-generation allocation solution library. If the first-generation allocation solution library does not meet the preset termination condition, it may be iterated 100 times, and then the genetic algorithm iteration is continued on the first-generation allocation solution library until the preset number of iterations of 100 is met to obtain the target allocation solution. At this time, there may be multiple target allocation solutions, so the fitness of the target allocation solution is calculated, and the allocation solution with the highest fitness is output as the optimal solution.
[0059] In this embodiment, by collecting and analyzing the detailed information of the goods to be allocated, the allocation plan is converted into binary code, an initial plan library is constructed, and then the evaluation criteria are defined, and the fitness of the initial plan is evaluated using the product characteristics and weight parameters. Then, through the selection, crossover and mutation operations of the genetic algorithm, the first generation of allocation plan library is generated from the initial plan library, and the plan library is continuously iterated and optimized until the maximum number of iterations is reached or a plan that meets the preset fitness threshold is found. Finally, the plan with the highest fitness is selected from the target plan library as the optimal solution. This plan can best meet market demand and business goals and represents the best allocation strategy. The whole process simulates the process of natural selection, and the best allocation plan is evolved through iteration.
[0060] Based on the first embodiment, the second embodiment of the present application proposes a commodity distribution method based on a genetic algorithm, referring to Figure 2 , Figure 2 This is a flow chart of Embodiment 2 of the commodity distribution method based on genetic algorithm of the present application, step S2 includes steps A21-A22:
[0061] Step A21, based on a preset coding rule, encode the commodity distribution plan into the binary commodity combination.
[0062] It should be noted that in this embodiment, the preset coding rule is that "1" usually indicates that a certain product is selected for distribution, while "0" indicates that the product is not selected. Each position of each bit in the binary sequence corresponds to a specific product or category.
[0063] Optionally, step A21 includes steps B21-B22:
[0064] Step B21, based on the preset coding rule, determine the quantity of goods corresponding to the goods distribution plan.
[0065] Step B22: determining the binary sequence as the commodity combination based on the commodity categories existing in the commodity quantity.
[0066] As an optional implementation, the number of "1"s representing selected commodities is counted. Each "1" represents a selected commodity item, and the number of commodities in the distribution plan can be obtained. The category distribution of commodities can be further analyzed to determine the specific commodity combination represented by the binary sequence.
[0067] For example, a bookstore uses binary coding rules to manage its merchandise allocation plan. There are four different book categories: comics, science and technology, history and art. The corresponding coding rules will assign a unique binary bit to each category of books, from left to right: comics (1st bit), science and technology (2nd bit), history (3rd bit), art (4th bit). It is feasible that there is a binary code of the allocation plan of "1010", which means that books in the comics and history categories are selected, while books in the science and technology and art categories are not selected, indicating that the allocation plan of the goods can be associated according to the binary code.
[0068] Step A22: construct the initial distribution solution library based on the binary sequence corresponding to the commodity combination.
[0069] It should be noted that the binary sequence is a character sequence obtained by binary encoding, representing an associated distribution plan.
[0070] Optionally, step A22 includes steps B23-B24:
[0071] Step B23, based on the distribution plan library corresponding to the commodity combination, determine the quantity of commodities corresponding to the distribution plan library.
[0072] Step B24, based on the quantity of the goods and the preset rules, adjust the product combination and build the initial distribution plan library.
[0073] As an optional implementation method, each distribution plan in the plan library is parsed, and a product combination of length N is generated for each plan based on the optional number of products, where N is the total number of optional products; for each product combination, 0 or 1 is assigned to each product based on empirical rules or historical data analysis, where 1 indicates that the product is selected and 0 indicates that it is not selected; the adjustment probability is introduced to increase the diversity of the distribution plan library, that is, in the process of generating product combinations, the values of some products are changed from 0 to 1, or from 1 to 0 with a certain probability, thereby constructing an initial distribution plan library.
[0074] In this embodiment, the commodity distribution plan is encoded into a binary commodity combination, that is, the specific commodity selection is converted into a format that can be efficiently processed by a computer, so that it can be managed and optimized through an automated method; an initial distribution plan library is constructed based on the binary sequences corresponding to these commodity combinations, and a group of diverse potential distribution plans are generated, so that feasible distribution plans can be uniformly processed.
[0075] Based on any of the above embodiments, the third embodiment of the present application proposes a commodity distribution method based on a genetic algorithm, referring to Figure 3 , Figure 3 This is a flow chart of Embodiment 3 of the commodity distribution method based on genetic algorithm of the present application, step S3 includes steps A31-A32:
[0076] Step A31, based on the feature distribution of the commodities, determining the initial similarity of the distribution plan.
[0077] It should be noted that the initial similarity is a preliminary evaluation of the distribution plan. The distribution plan is given a preliminary similarity score based on the degree of match between the distribution of product characteristics and the preset goals or market demand.
[0078] As an optional implementation, the frequency distribution of each feature in the distribution plan is calculated and a similarity score is performed on the target distribution.
[0079] As another optional implementation, the distribution plan is compared with a group of known distribution plans with high similarity through cluster analysis.
[0080] For example, a clothing store needs to adjust its merchandise distribution plan. First, it collects data on popular colors in the current season and finds that blue and green are the most popular colors. Then, the retailer checks the distribution of blue and green clothing in its distribution plan. If 60% of the clothing in the distribution plan is blue or green, and the target market demand is 70%, the retailer can calculate an initial similarity score, such as 0.86 (i.e., 60 / 70). This score indicates that the current distribution plan has a certain degree of match with market demand, but there is still room for improvement.
[0081] Step A32: If the initial similarity is not less than the preset threshold, the product feature similarity is multiplied by the corresponding weight parameter to obtain the total fitness corresponding to the product distribution plan.
[0082] As an optional implementation, the total fitness of the product distribution plan can be obtained by weighted average sum. First, the similarity between the characteristics of each product in the distribution plan and the market demand or target characteristics is evaluated; then, according to the importance of each feature, corresponding weight parameters are assigned to them; then, the similarity of each product feature is multiplied by its corresponding weight parameter to obtain the weighted similarity of each feature; finally, the weighted similarities of all features are summed to obtain the total fitness of the distribution plan.
[0083] It is feasible to calculate the formula for the total fitness S:
[0084]
[0085] Among them, S represents the total fitness of the product distribution plan, Sd represents the similarity of the main dimension, T represents the preset threshold, Wi represents the weight parameter of the i-th feature, and Si represents the similarity of the i-th feature. That is, if the similarity Sd of the main feature is less than T, the total fitness is 0; if the similarity Sd of the main feature is greater than or equal to T, the total fitness S is the sum of the products of all feature similarities Si and their corresponding weights Wi.
[0086] For example, in an electronics store, the weight parameters of four key features are determined based on market research: brand awareness (30%), technological innovation (25%), user evaluation (30%), and price competitiveness (15%). One of the distribution plans includes a variety of electronic products. First, the similarity of these products in the four features is evaluated, which are: brand awareness 0.8, technological innovation 0.7, user evaluation 0.9, and price competitiveness 0.6. Since the initial similarity of the distribution plan is greater than the preset threshold, the total fitness is calculated. Then the similarity of each feature is multiplied by the corresponding weight to obtain the weighted similarity (0.80.3+0.70.25+0.90.3+0.60.15): brand awareness 0.24, technological innovation 0.175, user evaluation 0.27, and price competitiveness 0.09. Finally, these weighted similarities are added together to obtain the total fitness of the distribution plan of 0.775.
[0087] In this embodiment, the initial similarity is determined by comparing the distribution of product characteristics in the distribution plan with the distribution of market demand characteristics, thereby evaluating the initial adaptability of the distribution plan. If the initial similarity reaches or exceeds the preset threshold, it indicates that the distribution plan is sufficiently matched with the market in terms of basic characteristics. Subsequently, the total adaptability is calculated by multiplying the similarity of product characteristics with the corresponding weight parameters and summing them, which can comprehensively reflect the adaptability and importance of the distribution plan in terms of various key characteristics.
[0088] Based on any of the above embodiments, the fourth embodiment of the present application proposes a commodity distribution method based on a genetic algorithm, referring to Figure 4 , Figure 4 This is a flow chart of Embodiment 4 of the commodity distribution method based on genetic algorithm of the present application, wherein step S4 includes steps A41 to A42:
[0089] Step A41: selecting two distribution plans from the initial distribution plan library based on the fitness of the distribution plan.
[0090] Step A42, performing crossover and mutation operations on the two distribution plans to determine a first distribution plan library.
[0091] As an optional implementation, based on the fitness of known distribution plans, the two with the highest fitness are selected as distribution plans for crossover operation. An intersection point is selected in the binary codes of the two plans, and then the codes on both sides of the point are exchanged to generate two new offspring plans, which together with the remaining distribution plans constitute a new first distribution plan library.
[0092] For example, there are the following five distribution plans and their fitness scores: Plan 1 (fitness 92), Plan 2 (fitness 85), Plan 3 (fitness 95), Plan 4 (fitness 88) and Plan 5 (fitness 90). The two plans with the highest fitness are selected for crossover operation, that is, Plan 3 and Plan 1 are selected, and then Plan 3 and Plan 1 are crossovered. If the code corresponding to Plan 3 is "11101001100" and the code corresponding to Plan 1 is "10101011001", after the crossover operation is performed at the second and seventh positions, the codes of the two new offspring plans generated may be "10101011100" and "11101001001", and these plans are merged with the uncrossed distribution plans into the first distribution plan library.
[0093] As another optional implementation, according to the fitness of known distribution plans, a corresponding mutation priority is set for each plan, the mutation priority is normalized, a single distribution plan is selected for mutation operation according to probability, the coding part inside the plan is mutated, and a new offspring plan is obtained, which is put back to form the first distribution plan library.
[0094] It should be noted that the mutation probability of high fitness needs to be low, because high fitness distribution schemes usually mean that they have good gene combinations, which can bring high fitness in the current environment. For these distribution schemes, we usually hope that they can pass on excellent gene combinations to the next generation, so we tend to reduce the mutation probability of these distribution schemes to maintain these excellent gene characteristics. In this embodiment, a lower mutation priority is set for high fitness distribution schemes to reduce the mutation probability of high fitness distribution schemes.
[0095] Exemplarily, there are the following four distribution plans and their fitness scores: Plan 1 (fitness 10), Plan 2 (fitness 20), Plan 3 (fitness 30) and Plan 4 (fitness 40), and the corresponding mutation priorities are (4, 3, 2, 1,), among which mutations with larger priorities are given priority. These mutation priorities are normalized to obtain the corresponding mutation probabilities: Plan 1 (0.4), Plan 2 (0.3), Plan 3 (0.2) and Plan 4 (0.1). Then, the selected plans are mutated. If the code corresponding to Plan 3 is "101010101010", mutations occur at the third and eighth positions to generate a new offspring plan "100010111010", and the distribution plan that performs the mutation operation and the non-mutated distribution plan are merged into the first distribution plan library.
[0096] Optionally, after step A42, the method further includes step B41:
[0097] Step B41, performing the crossover and mutation operations on at least two of the allocation plans in the first allocation plan library based on a preset iteration condition to determine a target allocation plan library.
[0098] It should be noted that the preset iteration condition refers to the termination condition for jumping out of the genetic algorithm loop. In this embodiment, it can be the maximum number of iterations, or it can be jumping out of the loop when the preset threshold condition is met before the maximum number of iterations is reached, such as when the fitness reaches the target value. The target distribution solution library is composed of one or more distribution solutions that meet the preset iteration conditions.
[0099] As an optional implementation, a distribution plan with high fitness in the first distribution plan library is selected as the parent according to the fitness evaluation standard, and then two distribution plans are selected for crossover operation to generate new offspring plans, or a distribution plan is mutated. Then, the offspring plans of the crossover and mutation operations and the original remaining plans together constitute a new distribution plan library until the preset iteration conditions are met, such as reaching the maximum number of iterations, so as to determine that the distribution plans that meet the preset threshold constitute the target distribution plan library.
[0100] Exemplarily, the constructed first distribution plan library contains 10 different distribution plans, each of which corresponds to a binary code, representing a different combination of goods. At this time, the highest fitness in the distribution plan is 75, the preset maximum number of iterations is 20 times, and the fitness threshold is 90. At this time, the distribution plan has not reached the preset iteration condition, so the first distribution plan library continues to perform crossover and mutation operations. If there is at least one distribution plan with a fitness greater than 90 in the fifteenth iteration, the loop is jumped out and the target distribution plan library that meets the preset fitness threshold is output. If the preset fitness threshold is not met when the maximum number of iterations is reached, the second distribution plan library at the end of the iteration is used as input to iterate the crossover and mutation operations again until the target distribution plan library is output.
[0101] In this embodiment, two initial distribution plans with high fitness are selected for crossover and mutation operations, and iterated according to preset conditions to simulate the mechanism of natural selection and genetic variation. The overall fitness of the distribution plan is gradually improved through iterative evolution, and a distribution plan that is more adapted to market demand is generated, thereby determining the target distribution plan library.
[0102] Based on any of the above embodiments, the fifth embodiment of the present application proposes a commodity distribution method based on a genetic algorithm, referring to Figure 5 , Figure 5 This is a flow chart of Embodiment 4 of the commodity distribution method based on genetic algorithm of the present application, step S6 includes steps A61-A62:
[0103] Step A61, calculating the fitness of the target distribution plan based on the similarity of the commodity feature distribution in the target distribution plan library.
[0104] Step A62, determining the target distribution plan based on the fitness ranking order.
[0105] It should be noted that the fitness of the distribution plan is calculated to reflect the matching degree of the distribution plan to the distribution of product characteristics.
[0106] As an optional implementation, based on the commodity feature distribution of the target market or customer demand, the commodity feature distribution of each distribution plan in the target distribution plan library is analyzed, and then the similarity between the commodity feature distribution of each distribution plan and the target feature distribution is quantitatively calculated, which can be calculated by the cosine similarity formula. It should be noted that cosine similarity is a method for calculating the similarity of the angle between two non-zero vectors. Finally, based on the similarity calculation result and the preset weight parameters, the fitness of each distribution plan is calculated, and the order of arrangement is based on the calculated fitness, and the distribution plan with the highest fitness is selected as the target distribution plan output.
[0107] It is feasible. The similarity calculation formula is:
[0108]
[0109] Among them, W is the cosine similarity, T c is the target feature distribution vector, S c is the distribution vector of the distribution plan characteristics, T c ·S c is the dot product of two feature distribution vectors, ||T c || is the modulus of the target feature distribution vector, ||S c || is the modulus of the distribution vector of the distribution plan characteristics.
[0110] For example, in order to optimize the distribution plan, a clothing store first determines the target feature distribution as color (bright color 50%, neutral color 30%, dark color), style (casual 60%, formal 20%, sports 20%) through market research. Then, a distribution plan in the target distribution plan library is analyzed, and its product feature distribution is: color (bright color 40%, neutral color 40%, dark color 20%), style (casual 50%, formal 30%, sports 20%). Then, the cosine similarity formula is used to calculate the similarity between the color and style feature distribution of the distribution plan and the target feature distribution. The two color feature distribution vectors are: T c (0.5,0.3,0.2), S c (0.4, 0.4, 0.2), from this, it can be calculated that the cosine similarity of the color feature of the distribution plan is 0.9, and the cosine similarity of the style feature is 0.7. If the feature weights of the preset color and style are known to be 60% and 40% respectively. The total fitness of the distribution plan can be calculated as: (0.9*0.6)+(0.7*0.4)=0.84. After calculating the total fitness of all distribution plans, the distribution plan with the highest total fitness is selected as the target distribution plan.
[0111] In this embodiment, by quantifying the degree of match between each distribution plan and the target customer needs, the similarity between the product feature distribution in the distribution plan and the target feature distribution is calculated, and it is converted into a fitness score and sorted, so as to quickly identify the distribution plan that best meets the market demand and ensure that the selected distribution plan can maximize the satisfaction of market demand and expected requirements.
[0112] The present application provides a commodity distribution device based on a genetic algorithm, and the commodity distribution device based on a genetic algorithm includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the commodity distribution method based on the genetic algorithm in the above-mentioned embodiment one.
[0113] Reference below Figure 6 , which shows a schematic diagram of the structure of a commodity distribution device based on a genetic algorithm suitable for implementing the embodiment of the present application. The commodity distribution device based on a genetic algorithm in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The commodity distribution device based on genetic algorithm shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0114] like Figure 6 As shown, the commodity distribution equipment based on the genetic algorithm may include a processing device 1001 (e.g., a core processor, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the commodity distribution equipment based on the genetic algorithm are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the commodity distribution device based on the genetic algorithm to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a commodity distribution device based on the genetic algorithm with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0115] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0116] The commodity distribution equipment based on genetic algorithm provided by the present application adopts the commodity distribution method based on genetic algorithm in the above embodiment, which can solve the technical problem of commodity distribution based on genetic algorithm. Compared with the prior art, the beneficial effects of the commodity distribution equipment based on genetic algorithm provided by the present application are the same as the beneficial effects of the commodity distribution method based on genetic algorithm provided by the above embodiment, and the other technical features of the commodity distribution equipment based on genetic algorithm are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0117] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0118] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0119] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the commodity allocation method based on genetic algorithms in the above-mentioned embodiments.
[0120] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0121] The computer-readable storage medium may be included in the commodity distribution device based on the genetic algorithm; or it may exist independently without being assembled into the commodity distribution device based on the genetic algorithm.
[0122] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the commodity distribution device based on the genetic algorithm, the commodity distribution device based on the genetic algorithm: determines the commodity data to be configured in the system, the target configuration quantity, the commodity feature distribution and the corresponding weight parameters; converts the commodity configuration plan into a binary-coded commodity combination, and constructs an initialization distribution plan library; defines evaluation criteria, and evaluates the fitness of each plan based on the commodity feature distribution and weight parameters; performs genetic algorithm optimization, and selects the plan with the highest fitness from the final distribution plan library as the optimal solution.
[0123] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0124] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0125] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0126] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned commodity allocation method based on genetic algorithms, and can solve the technical problems of commodity allocation based on genetic algorithms. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the commodity allocation method based on genetic algorithms provided in the above-mentioned embodiments, and will not be elaborated here.
[0127] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A commodity distribution method based on genetic algorithm, characterized in that: The commodity distribution method based on genetic algorithm includes: S1: Determine the commodity data to be configured in the system, the target configuration quantity, commodity feature distribution and weight parameters; S2: Convert the product allocation plan into a binary-coded product combination and build an initial allocation plan library, where each initial allocation plan represents a possible allocation strategy; S3: defining an evaluation criterion for a distribution plan, and evaluating the initial distribution plan according to the commodity feature distribution and the weight parameter; S4: taking the initial cargo distribution plan library as input, generating a first cargo distribution plan library through selection, crossover and mutation operations; S5: Repeat step S4 until a termination condition is met, such as reaching a maximum number of iterations or finding a target distribution solution library that meets a preset fitness threshold; S6: Selecting the distribution plan with the highest fitness from the target distribution plan library as the optimal solution.
2. A commodity distribution method based on genetic algorithm as claimed in claim 1, characterized in that: The steps of converting the commodity distribution plan into a binary-coded commodity combination and constructing an initial distribution plan library, each plan representing a possible distribution strategy, include: Based on a preset coding rule, the commodity distribution plan is encoded into the commodity combination in binary; Based on the binary sequence corresponding to the commodity combination, the initial distribution solution library is constructed.
3. A commodity distribution method based on genetic algorithm as claimed in claim 2, characterized in that: The step of encoding the commodity distribution plan into the binary commodity combination based on the preset encoding rule includes: Based on the preset coding rules, determine the quantity of goods corresponding to the goods distribution plan; Based on the commodity categories existing in the commodity quantity, the binary sequence is determined to be the commodity combination.
4. A commodity distribution method based on genetic algorithm as claimed in claim 2, characterized in that: The step of constructing the initial distribution solution library based on the binary sequence corresponding to the commodity combination includes: Based on the distribution plan library corresponding to the product combination, determine the quantity of products corresponding to the distribution plan library; Based on the quantity of goods and preset rules, the commodity combination is adjusted to construct the initial distribution solution library.
5. A commodity distribution method based on genetic algorithm as claimed in claim 1, characterized in that: The step of defining the evaluation criteria for the distribution plan and evaluating the initial distribution plan according to the commodity feature distribution and the weight parameter comprises: Based on the characteristic distribution of the commodities, determining the initial similarity of the distribution plan; If the initial similarity is not less than the preset threshold, the product feature similarity is multiplied by the corresponding weight parameter to obtain the total fitness corresponding to the product distribution plan.
6. A commodity distribution method based on genetic algorithm as claimed in claim 1, characterized in that: The step of taking the initial cargo distribution solution library as input and generating the first cargo distribution solution library through selection, crossover and mutation operations comprises: Selecting two cargo distribution plans from the initial cargo distribution plan library based on the fitness of the cargo distribution plan; The two distribution plans are crossover and mutation operations are performed to determine a first distribution plan library.
7. A commodity distribution method based on genetic algorithm as claimed in claim 6, characterized in that: After the step of performing crossover and mutation operations on the two distribution plans to determine the first distribution plan library, the method further includes: The crossover and mutation operations are performed on at least two of the allocation plans in the first allocation plan library based on a preset iteration condition to determine a target allocation plan library.
8. A commodity distribution method based on genetic algorithm as claimed in claim 1, characterized in that: The step of selecting the cargo distribution plan with the highest fitness from the target cargo distribution plan library as the target cargo distribution plan includes: Calculating the fitness of the target distribution plan based on the similarity of the commodity feature distribution in the target distribution plan library; The target distribution plan is determined based on the fitness ranking order.
9. A commodity distribution device based on genetic algorithm, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the commodity allocation method based on a genetic algorithm as claimed in any one of claims 1 to 8.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the commodity distribution method based on a genetic algorithm as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Method for determining optimal replenishment quantity based on big data
CN110163546A
Commodity sales distribution prediction-based replenishment method and system, and electronic device
CN110335090A
Replenishment order generation method, device, equipment and storage medium
CN111080206A
Store replenishment method, device and apparatus
CN111815198A
Supply chain inventory optimization method and device, equipment and storage medium
CN114118503A
Cited By
Cable distribution method and device based on genetic algorithm
CN120124992A