Method and device for determining package combination scheme, electronic equipment and storage medium

By constructing a package combination scheme using the decision tree algorithm, the problems of low package utilization and resource waste caused by the greedy algorithm are solved, and the globally optimal package combination is achieved, thereby improving resource utilization efficiency.

CN116245452BActive Publication Date: 2026-01-20BEIJING JINGDONG QIANSHITECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211634638.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-19
Publication Date
2026-01-20
Estimated Expiration
2042-12-19

AI Technical Summary

Technical Problem

The existing greedy algorithm does not determine the globally optimal package combination scheme, resulting in low package utilization and resource waste.

Method used

The decision tree algorithm is used to construct package combination schemes. Each leaf node of the decision tree is traversed to determine the combination scheme with the fewest packages, including the item details in each package. The decision tree generation is optimized using preset constraints and pre-pruning strategies.

Benefits of technology

It improves package utilization, saves package resources, and achieves the globally optimal package combination solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116245452B_ABST
    Figure CN116245452B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to a kind of package combination scheme determination method, device, electronic equipment and storage medium, relate to warehousing logistics technical field, the method includes: obtaining multiple to-be-packaged goods on target order, and determine the package coefficient of each to-be-packaged goods;Based on the decision tree of the package combination scheme for the multiple to-be-packaged goods of preset constraint condition construction, each leaf node of the decision tree corresponds to each package combination scheme;Each leaf node corresponding to the package combination scheme of the decision tree is traversed, the package combination scheme of the least number of packages is determined, the target package combination scheme of the target order is determined, and the item details in each package in the target package combination scheme is output;That is, all package combination schemes for the multiple goods of a certain customer order are obtained by decision tree algorithm, so that the package combination scheme of the least number of packages is determined, the global optimal solution is obtained, the utilization rate of package is improved, and package resources are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of warehousing and logistics technology, and in particular to a method, apparatus, electronic device and storage medium for determining a package combination scheme. Background Technology

[0002] In warehousing and production, when a customer order contains multiple items, it can be split into multiple packages for shipment. Before splitting the packages, it is necessary to calculate the details of the items in each package.

[0003] In existing technologies, a greedy algorithm is typically used to calculate how many packages an order should be split into, and what items each package should contain. The specific process is as follows: First, the items are sorted by volume from largest to smallest. When building a package, the item with the largest volume is selected first. Then, the volume of each item is calculated in sequence. If the sum of the volumes does not exceed the maximum capacity of the package, it can be built into a package. If it exceeds the maximum capacity, the item is ignored, and the calculation is performed for the next item in order, until the package can no longer contain any more items and is set to a full state. The remaining items are then sorted by volume again, and the above logic is repeated until all items are used to build a package.

[0004] However, the package combination scheme determined by this greedy algorithm is only a relatively approximate optimal solution, not the globally optimal solution. In other words, the package combination scheme obtained by the existing technology is not the optimal result, which will lead to low utilization of each package and waste of package resources. Summary of the Invention

[0005] The embodiments of the present invention provide a method, apparatus, electronic device and storage medium for determining a package combination scheme, so as to solve the technical problem of low package utilization and waste of package resources caused by the non-optimal result of the package combination scheme obtained by the existing greedy algorithm.

[0006] In a first aspect, embodiments of the present invention provide a method for determining a package combination scheme, comprising: acquiring multiple items to be packaged on a target order, and determining a package coefficient for each item to be packaged, wherein the package coefficient is determined based on the attribute values ​​of the items to be packaged and the attribute values ​​of the packages; constructing a decision tree for package combination schemes for the multiple items to be packaged based on preset constraints, wherein each leaf node of the decision tree corresponds to each package combination scheme, each package combination scheme includes the number of packages and the item details in each package, and the preset constraints are that the cumulative value of the package coefficients of the items in each package does not exceed a preset threshold; traversing the package combination schemes corresponding to each leaf node of the decision tree, determining the package combination scheme with the fewest packages as the target package combination scheme for the target order, and outputting the item details in each package of the target package combination scheme.

[0007] As an embodiment of the present invention, the step of constructing a decision tree for package combination schemes for the plurality of items to be packaged based on preset constraints includes: for a first target item among the plurality of items to be packaged, if there is no package corresponding to the first target item, constructing a first package based on the first target item, and taking the first package containing the first target item as the root node of the decision tree; starting from the root node, iteratively executing the following steps until the remaining items to be packaged among the plurality of items to be packaged are empty, and obtaining the decision tree: obtaining the package combination scheme corresponding to the current node of the decision tree, wherein the package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the number of packages already constructed. The cumulative value of the packaging coefficient of the items in the package; for the second target item among the multiple items to be packaged, calculate the cumulative predicted value of the packaging coefficient of the items in each built package after the second target item is grouped into the corresponding built package based on the packaging coefficient of the second target item and the cumulative value of the packaging coefficient of the items in each built package; if the cumulative predicted value of the packaging coefficient of the items in the built package does not exceed a preset threshold, group the second target item into the corresponding built package, and determine the built package containing the second target item as the first child node corresponding to the current node; construct a second package based on the second target item, and take the second package containing the second target item as the second child node corresponding to the current node.

[0008] As an embodiment of the present invention, the method further includes: when the number of packages built corresponding to the current node is equal to or greater than the preset number of packages, and the remaining items to be packaged are not empty, determining the current node as a leaf node of the decision tree.

[0009] As an embodiment of the present invention, the preset number of packages is obtained by calculating the multiple items to be packaged based on a greedy algorithm.

[0010] As an embodiment of the present invention, after determining the packaging coefficient of each item to be packaged, the method further includes: sorting the plurality of items to be packaged in descending order of packaging coefficient to obtain a sequence of items to be packaged; wherein, the first target item is the item to be packaged located in the first sequence position in the sequence of items to be packaged, and the second target item is the item to be packaged located in the next sequence position.

[0011] As an embodiment of the present invention, after constructing a decision tree for the package combination scheme of the plurality of items to be packaged based on preset constraints, the method further includes: verifying the package combination scheme corresponding to each leaf node of the decision tree according to preset item verification conditions, and deleting the leaf nodes that fail the verification.

[0012] As an embodiment of the present invention, when n identical items among the plurality of items to be packaged constitute a package, the package coefficient corresponding to the item to be packaged is determined to be the reciprocal of n; or the least common multiple among the package coefficients of different items to be packaged on the target order is determined, and the package coefficient corresponding to the item to be packaged is multiplied according to the least common multiple.

[0013] Secondly, embodiments of the present invention provide a device for determining a package combination scheme, comprising: an acquisition module, configured to acquire multiple items to be packaged on a target order and determine a package coefficient for each item to be packaged, wherein the package coefficient is determined based on the attribute values ​​of the items to be packaged and the attribute values ​​of the packages; a decision module, configured to construct a decision tree for package combination schemes of the multiple items to be packaged based on preset constraints, wherein each leaf node of the decision tree corresponds to each package combination scheme, and each package combination scheme includes a number of packages and details of the items in each package, wherein the preset constraints are that the cumulative value of the package coefficients of the items in each package does not exceed a preset threshold; and a determination module, configured to traverse the package combination schemes corresponding to each leaf node of the decision tree, determine the package combination scheme with the fewest packages as the target package combination scheme for the target order, and output the details of the items in each package in the target package combination scheme.

[0014] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of the method for determining the package combination scheme as described in any one of the first aspects when executing the program stored in the memory.

[0015] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the method for determining the package combination scheme as described in any one of the first aspects.

[0016] One embodiment of the above invention has the following advantages or beneficial effects:

[0017] By using a decision tree algorithm, all possible package combinations for a customer's order of multiple items are obtained, thus determining the package combination with the fewest packages, obtaining the global optimal solution, improving package utilization and saving package resources. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A flowchart illustrating a method for determining a package combination scheme according to an embodiment of the present invention;

[0021] Figure 2 A flowchart illustrating another method for determining a package combination scheme provided in an embodiment of the present invention;

[0022] Figure 3 This is a schematic diagram of a single node decision process in a decision tree provided by an embodiment of the present invention;

[0023] Figure 4 A flowchart illustrating a method for determining a package combination scheme according to an embodiment of the present invention;

[0024] Figure 5 A schematic diagram of a decision tree provided in an embodiment of the present invention;

[0025] Figure 6 A schematic diagram of a device for determining a package combination scheme according to an embodiment of the present invention;

[0026] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] First, the terms used in this invention will be explained:

[0029] Greedy algorithms are algorithms that, when solving a problem, make the best or optimal (i.e., most advantageous) choice at each step in order to achieve the best or optimal result. The result obtained by the algorithm is not necessarily the optimal result (sometimes it is the optimal solution), but it is always a result that is relatively close to the optimal solution.

[0030] A decision tree is a tree-like structure consisting of a series of nodes, each representing a feature and a corresponding decision rule. A decision tree includes a root node, intermediate nodes, and leaf nodes. The root and intermediate nodes, also known as decision nodes, represent nodes in the decision tree where further decision-making is possible. Leaf nodes represent the decision conclusion reached in the decision tree, nodes where no further decision-making is needed.

[0031] Currently, in warehousing and production, there exists a production model where, when a customer order includes many items, and each item has multiple units, the order can be split into multiple parcels. Once a single parcel is produced, it can be shipped out immediately, without waiting for all parcels to be produced before shipping. This improves outbound efficiency. This production model is called parcel production. In this model, the contents of each parcel must be calculated before production begins.

[0032] In existing technologies, trial calculations are typically based on a greedy algorithm. This involves first sorting the items by volume from largest to smallest, prioritizing the largest item when building a package, and then calculating the volume of each item in sequence. If the sum of the volumes does not exceed the maximum package capacity, the package can be built. If it does exceed the maximum package capacity, the item is ignored, and the next item in order is used for trial calculation, until the package is full and no more items can be added. The remaining items are then sorted by volume again, and the above logic is repeated until all items are used to build a package.

[0033] For example, the product details of an order are distributed as follows: 1 item a, with a package size of 2 items / package; 3 items b, with a package size of 3 items / package; 2 items c, with a package size of 4 items / package. The steps for determining the package combination scheme based on the greedy algorithm are as follows:

[0034] 1) Assuming the package capacity is 1, the package coefficient of item a is 1 / 2, the package coefficient of item b is 1 / 3, and the package coefficient of item c is 1 / 4. For ease of calculation, the package coefficients are multiplied to 6 / 12, 4 / 12, and 3 / 12 respectively.

[0035] 2) Sort the goods by volume from largest to smallest as a, b, c;

[0036] 3) Take one item a and put it into package 1. The remaining capacity is 6 / 12. Then add one item b. The remaining capacity is 2 / 12. No more items can be added. Package 1 is full. There are 2 items b and 2 items c remaining.

[0037] 4) Take one item b and put it into package 2. The remaining capacity is 8 / 12. Then put in one more item b. The remaining capacity is 4 / 12. Then put in one more item c. The remaining capacity is 1 / 12. No more items can be put in. Package 2 is full. There is one item c left.

[0038] 5) Place the last item c in package 3.

[0039] As we can see, the package combination scheme obtained based on the greedy algorithm requires building 3 packages, but it is not actually the globally optimal solution. For example, if one item 'a' and two items 'c' are placed in package 1, and three items 'b' are placed in package 2, the optimal solution is to build 2 packages. In other words, the current package combination scheme obtained based on the greedy algorithm is only an approximate optimal solution, not the globally optimal solution.

[0040] To address the aforementioned technical problems, the technical concept of this invention is as follows: by using a decision tree algorithm to obtain all package combination schemes for multiple items in a customer's order, each package combination scheme includes the number of packages and the item details in each package, thereby determining the optimal package combination scheme with the fewest packages.

[0041] Figure 1 This is a flowchart illustrating a method for determining a package combination scheme according to an embodiment of the present invention. The executing entity is a package combination scheme determination device, or an electronic device equipped with a package combination scheme determination device. Figure 1 As shown, the method for determining the package combination scheme includes:

[0042] Step S101: Obtain multiple items to be packaged on the target order and determine the package coefficient for each item to be packaged, wherein the package coefficient is determined based on the attribute values ​​of the item to be packaged and the attribute values ​​of the package.

[0043] Specifically, the target order can be a single order from the same customer containing multiple items, or multiple orders from the same customer within a preset time period. Attributes can include volume, weight, length, etc. For example, if a package can hold a maximum of 2 items, its package coefficient is 1 / 2; if a package can support a maximum of 3 items, its package coefficient is 1 / 3. In this embodiment, the product details of the target order (what products are included, the quantity of each product, etc.) can be obtained, and the package coefficient for each product can be determined. Identical products have the same package coefficient.

[0044] In some embodiments, when n identical items among the plurality of items to be packaged constitute a package, the package coefficient corresponding to the item to be packaged is determined to be the reciprocal of n; or the least common multiple among the package coefficients of different items to be packaged on the target order is determined, and the package coefficient corresponding to the item to be packaged is multiplied according to the least common multiple.

[0045] Specifically, taking volume as an attribute as an example, the package capacity can be preset to 1, and the number of items per package is n, meaning that n identical items can be packaged into one package. In this case, the package coefficient corresponding to the item is 1 / n. Alternatively, for easier calculation later, the package capacity and package coefficient can be multiplied by the least common multiple of the denominators of the package coefficients of all items in the target order. For example, if the order contains item a (package coefficient 1 / 2), item b (package coefficient 1 / 3), and item c (package coefficient 1 / 4), and the least common multiple of the denominators of the package coefficients is 12, the package capacity can be multiplied to 12, and the package coefficients can be multiplied to 6, 4, and 3 respectively.

[0046] Step S102: Construct a decision tree for package combination schemes for the multiple items to be packaged based on preset constraints. Each leaf node of the decision tree corresponds to each package combination scheme. Each package combination scheme includes the number of packages and the item details in each package. The preset constraints are that the cumulative value of the package coefficient of each item in the package does not exceed a preset threshold.

[0047] Specifically, a decision tree can be generated for package combination schemes of all goods on the target order. Each leaf node of the generated decision tree corresponds to a package combination scheme. Each package combination scheme includes the number of packages and the details of the goods in each package. In the process of generating the decision tree, timely pruning can be performed on the decision tree according to preset constraints. The preset constraints are that the sum of the package coefficients of the items in each package cannot exceed a preset threshold. If the package coefficient is 1 / n, then the sum of the package coefficients of the items in each package cannot exceed 1 (i.e., the preset threshold is 1). If the package coefficient is multiplied according to the least common multiple, then the preset threshold is the least common multiple, that is, the sum of the package coefficients of the items in each package cannot exceed the least common multiple.

[0048] Step S103: Traverse the package combination schemes corresponding to each leaf node of the decision tree, determine the package combination scheme with the fewest packages, which is the target package combination scheme for the target order, and output the item details of each package in the target package combination scheme.

[0049] Specifically, the number of packages at each leaf node of the decision tree can be traversed, and the package combination scheme with the fewest packages can be determined as the optimal solution. The product details of each package can be output, so that warehouse staff can pack the items in each package according to the product details of each package.

[0050] The method for determining package combination schemes provided in the embodiments of the present invention involves obtaining multiple items to be packaged on a target order and determining the package coefficient for each item. The package coefficient is determined based on the attribute values ​​of the items and the packages. A decision tree for package combination schemes of the multiple items to be packaged is constructed based on preset constraints. Each leaf node of the decision tree corresponds to a package combination scheme, and each package combination scheme includes the number of packages and the item details within each package. The preset constraints stipulate that the cumulative value of the package coefficients for each item in each package does not exceed a preset threshold. The package combination schemes corresponding to each leaf node of the decision tree are traversed to determine the package combination scheme with the fewest packages, which is the target package combination scheme for the target order. The item details within each package in the target package combination scheme are then output. In other words, the embodiments of the present invention obtain all package combination schemes for multiple items on a customer order through a decision tree algorithm. Each package combination scheme includes the number of packages and the item details within each package, thereby determining the optimal package combination scheme with the fewest packages, improving package utilization, and saving package resources.

[0051] Based on the above embodiments, Figure 2 A flowchart illustrating another method for determining a package combination scheme provided in an embodiment of the present invention is shown below. Figure 2 As shown, the method for determining the package combination scheme includes:

[0052] Step S201: Obtain multiple items to be packaged on the target order, and determine the package coefficient of each item to be packaged, wherein the package coefficient is determined based on the attribute values ​​of the item to be packaged and the attribute values ​​of the package.

[0053] Step S202: For the first target item among the multiple items to be packaged, if there is no package corresponding to the first target item, construct a first package based on the first target item, and take the first package containing the first target item as the root node of the decision tree.

[0054] Starting from the root node, iteratively execute steps S203-S207.

[0055] Step S203: Obtain the package combination scheme corresponding to the current node of the decision tree. The package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the cumulative value of the package coefficient of each item in each constructed package.

[0056] Step S204: For the second target item among the multiple items to be packaged, calculate the predicted cumulative value of the package coefficient of the items in each constructed package after the second target item is grouped into the corresponding constructed package, based on the package coefficient of the second target item and the cumulative value of the package coefficient of each item in the constructed package.

[0057] Step S205: If the cumulative predicted value of the package coefficient of the items in the constructed package does not exceed a preset threshold, the second target item is grouped into the corresponding constructed package, and the constructed package containing the second target item is determined as the first child node corresponding to the current node.

[0058] Step S206: Construct a second package based on the second target item, and use the second package containing the second target item as the second child node corresponding to the current node.

[0059] Step S207: Determine that the remaining items to be packaged among the multiple items to be packaged are empty.

[0060] If not, then iteratively execute step S203; if yes, then execute step S208.

[0061] Step S208: Obtain the decision tree, where each leaf node of the decision tree corresponds to each package combination scheme.

[0062] Step S209: Traverse the package combination schemes corresponding to each leaf node of the decision tree, determine the package combination scheme with the fewest packages as the target package combination scheme for the target order, and output the item details of each package in the target package combination scheme.

[0063] The implementation of steps S201 and S209 in this embodiment is similar to that of steps S101 and S103 in the above embodiment, and will not be repeated here.

[0064] The difference from the above embodiments lies in that this embodiment further defines the specific implementation method of decision tree generation. In this embodiment, for the first target item among the plurality of items to be packaged, if there is no package corresponding to the first target item, a first package is constructed based on the first target item, and the first package containing the first target item is taken as the root node of the decision tree; starting from the root node, the following steps are iteratively executed until the remaining items to be packaged among the plurality of items to be packaged are empty, and a decision tree is obtained: obtaining the package combination scheme corresponding to the current node of the decision tree, wherein the package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the cumulative value of the package coefficient of each item in each constructed package; for the plurality of items to be packaged... The second target item in the package is grouped into the corresponding built package based on the package coefficient of the second target item and the cumulative package coefficient of each item in the built package. The cumulative predicted value of the package coefficient of each item in the built package is then calculated. If the cumulative predicted value of the package coefficient of each item in the built package does not exceed a preset threshold, the second target item is grouped into the corresponding built package, and the built package containing the second target item is determined as the first child node corresponding to the current node. A second package is constructed based on the second target item, and the second package containing the second target item is taken as the second child node corresponding to the current node.

[0065] Specifically, in the process of generating a decision tree, the root node of the decision tree is first generated through step S202. Then, by iteratively executing steps S203-S207, the nodes of each level of the decision tree are determined from top to bottom starting from the root node until the remaining items to be packaged among multiple items are empty, thus obtaining the decision tree.

[0066] In this embodiment, one item is selected from multiple items to be packaged, namely the first target item. A first package is constructed based on the first target item and is used as the root node of the decision tree. At this time, the package combination scheme corresponding to the root node includes the following information: the number of packages constructed is 1, the item details in the constructed package are 1 first target item, and the sum of the package coefficients of the items in the constructed package is the package coefficient of the first target item.

[0067] Starting from the root node, a decision is made to select one more item (the second target item) from the remaining items to be packaged. This decision determines which package the second target item should be placed in, and can be made in either an existing package or a new package. First, the capacity of each existing package is calculated. If the capacity of a branch of an existing package exceeds the capacity after adding the second target item, no child node is created, and the branch terminates. If the capacity does not exceed the capacity after adding the second target item, a corresponding first child node is generated. Since no new packages are added, the number of existing packages remains unchanged when determining the package combination scheme corresponding to the first child node. Only the item details and the sum of the package coefficients within the existing packages after adding the second target item need to be updated.

[0068] After determining the decisions corresponding to all constructed packages, a new package is constructed based on the second target item, generating the corresponding second child node. Because a new package has been constructed, when determining the package combination scheme corresponding to the second child node, the number of constructed packages is incremented by 1, and the item details and package coefficient summation in the new package need to be updated.

[0069] Select items one by one from the remaining items to be packaged and make the above decision until there are no remaining items. Obtain a decision tree and the package combination schemes corresponding to each leaf node of the decision tree, that is, all package combination schemes.

[0070] Figure 3 This is a schematic diagram of a single node decision process in a decision tree provided by an embodiment of the present invention, such as... Figure 3 As shown, for a specific node in the decision tree, this node includes information such as remaining goods (i.e., remaining items to be packaged), the number of packages already constructed, the item details in each constructed package, and the occupied capacity of each constructed package (i.e., the cumulative value of the package coefficient, where the package coefficient is determined based on the relationship between the product volume and the package capacity). For this node, the process first determines whether there are any remaining goods. If not, the decision tree has been constructed, and the node decision ends. If there are remaining goods, the process continues to determine whether there are any constructed packages. If there are no constructed packages, the goods are directly combined into a new package, and the node decision ends. If there are constructed packages, each constructed package is tested one by one to determine whether the accumulated value of the constructed packages exceeds the package capacity. If it does, no branch or child node is generated, and the next constructed package is tested directly. If it does not exceed the capacity, the goods are combined into the corresponding constructed package, identified as the corresponding child node, and the next constructed package is tested, until all constructed packages have been tested. After all constructed packages have been tested, a new decision is added, namely, combining the goods into a new package, generating the corresponding child node, and the node decision ends.

[0071] In some embodiments, after step S201, the method further includes: sorting the plurality of items to be packaged in descending order of their package coefficients to obtain a sequence of items to be packaged; wherein, the first target item is the item to be packaged located in the first sequence position in the sequence of items to be packaged, and the second target item is the item to be packaged located in the next sequence position.

[0072] Specifically, the goods can be sorted from largest to smallest according to their package size, and decisions can be made on the goods in the order of sorting. For example, the first-ranked goods (such as the largest in volume) can be selected for decision-making, and placed in the first package as the root node of the decision tree; then the next-ranked goods can be selected for decision-making, obtaining the second-level node of the decision tree (the child node of the root node); then the next-ranked goods can be selected for decision-making, obtaining the third-level node of the decision tree, and so on, thus obtaining the decision tree corresponding to the sorting of goods.

[0073] In some embodiments, the method further includes: determining the current node as a leaf node of the decision tree when the number of built packages corresponding to the current node is equal to or greater than a preset number of packages, and the set of remaining items to be packaged is not empty.

[0074] Specifically, a pre-pruning strategy can be implemented during the generation of the decision tree. When the number of packages already built by a node equals the preset number of packages, and there are still remaining items, continuing to make decisions will generate new packages. The generated child nodes will definitely not be the optimal solution, so the node can terminate as a leaf node and stop making decisions, preventing overfitting and limiting the depth of the decision tree. Optionally, the preset number of packages is calculated based on a greedy algorithm for the multiple items to be packaged. That is, when the number of packages already built equals the preset number of packages obtained based on the greedy algorithm, and there are still remaining items, the current node terminates as a leaf node.

[0075] In some embodiments, after step S210, the method further includes: verifying the package combination scheme corresponding to each leaf node of the decision tree according to preset item verification conditions, and deleting the leaf nodes that fail the verification.

[0076] Specifically, after generating the decision tree, a post-pruning strategy can be executed. In this embodiment, the package combination schemes corresponding to the leaf nodes can be validated according to preset item validation conditions, and leaf nodes that fail the validation can be deleted. For example, based on the mutual exclusion relationship of goods in each package (e.g., goods a and b cannot be placed in the same package) and the special attributes of the goods (e.g., fragile items can only be placed in the same package as fragile items, and items that are prone to cross-contamination can only be placed in the same package as items that are prone to cross-contamination), leaf nodes corresponding to package combination schemes that do not meet the conditions can be removed.

[0077] Based on the foregoing embodiments, for the first target item among the plurality of items to be packaged, in the absence of a package corresponding to the first target item, a first package is constructed based on the first target item, and the first package containing the first target item is taken as the root node of the decision tree; starting from the root node, the following steps are iteratively executed until the remaining items to be packaged among the plurality of items to be packaged are empty, thereby obtaining the decision tree: obtaining the package combination scheme corresponding to the current node of the decision tree, wherein the package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the cumulative value of the package coefficient of each item in each constructed package; for the second target item among the plurality of items to be packaged, the first package is calculated based on the package coefficient of the second target item and the cumulative value of the package coefficient of each item in each constructed package. After grouping two target items into their corresponding pre-built packages, the predicted package coefficients of the items within each pre-built package are accumulated. If the accumulated predicted package coefficients of the items within the pre-built packages do not exceed a preset threshold, the second target item is grouped into its corresponding pre-built package, and the pre-built package containing the second target item is determined as the first child node corresponding to the current node. A second package is constructed based on the second target item, and the second package containing the second target item is taken as the second child node corresponding to the current node, thus realizing the construction of the decision tree. Furthermore, by using a pre-pruning strategy to determine the current node as a leaf node of the decision tree when the number of pre-built packages corresponding to the current node is equal to or greater than a preset number of packages, and the set of remaining items to be packaged is not empty, overfitting of the decision tree is prevented, and the depth of the decision tree is limited.

[0078] To further understand the embodiments of the present invention, we will now describe the packaging of goods (1 item a, 3 items b, and 2 items a) from a target order as an example. Before proceeding, the parameters involved in this embodiment are determined as follows:

[0079] M(): The set of remaining goods;

[0080] N[(),(),...]: An array of the collections of goods in each constructed package;

[0081] X[…]: An array of the current occupied capacity of each constructed package;

[0082] Y: Number of packages already constructed;

[0083] T: The preset number of packages obtained based on a greedy algorithm.

[0084] Figure 4 A flowchart illustrating a method for determining a package combination scheme according to an embodiment of the present invention is shown below. Figure 4 As shown, it includes the following steps:

[0085] Step 1: Obtain the product details from the order and determine the package size for each product.

[0086] For example, an order includes 1 item a, 3 items b, and 2 items c. Their corresponding package coefficients are determined to be 1 / 2, 1 / 3, and 1 / 4, respectively, as shown in Table 1. For ease of calculation, based on the least common multiple of the denominators of the package coefficients for each item being 12, the package capacity is doubled to 12, and the package coefficients are doubled to 6, 4, and 3, respectively. The order is then split into one item per detail, as shown in Table 2.

[0087] Table 1

[0088] commodity Package coefficient Number of pieces a 1 / 2 1 b 1 / 3 3 c 1 / 4 2

[0089] Table 2

[0090]

[0091]

[0092] Step 2: Sort the remaining items in descending order of their parcel coefficient to obtain the remaining item set.

[0093] For example, sort each item in the order according to its package coefficient from largest to smallest to obtain the remaining set of items as: M(a1,b1,b2,b3,c1,c2).

[0094] Step 3: Obtain the preset number of packages calculated based on a greedy algorithm.

[0095] For example, the preset number of packages for this order is T=3, obtained based on a greedy algorithm.

[0096] Step 4: Generate a decision tree based on the decision tree algorithm, preset constraints, and pre-pruning strategies.

[0097] Figure 5 A schematic diagram of a decision tree provided in an embodiment of the present invention, combined with Figure 5 This step will be explained.

[0098] First, determine the root node. Since the goods cannot be split and must be placed in a specific package, take the first item a1 from the remaining goods set and place it in package 1 as the root node. Remove the remaining goods from the set, M(b1,b2,b3,c1,c2), and add it to the array N[(a1),...] of the first package. Recalculate the capacity of each package X[6,...]. Increment the number of packages already grouped by 1, i.e., Y=1. Figure 5 Node 1 in the decision tree shown.

[0099] Then, based on the root node, a decision is made on the first-order item b1 in M(b1,b2,b3,c1,c2), including two options: placing b1 into the already constructed package 1 or placing b1 into the newly added package 2. When b1 is placed into package 1, it is tested whether the preset constraint condition is met after b1 is placed into package 1, that is, whether the cumulative capacity of b1 placed into package 1 exceeds the package capacity. Since 4+6<12, the preset constraint condition is met, and the corresponding node 2 can be generated. Its corresponding parameters are: M(b2,b3,c1,c2), N[(a1,b1)], X(10), Y=1. When b1 is placed into the newly added package 2, the corresponding node 3 is generated. Its corresponding parameters are: M(b2,b3,c1,c2), N[(a1),(b1)], X(6,4), Y=2.

[0100] Then, based on nodes 2 and 3 respectively, a decision is made on the first-ranked commodity b2 in M(b2,b3,c1,c2).

[0101] Based on node 2, we test whether the cumulative capacity of package 1 exceeds the package capacity after b2 is placed into the already constructed package 1. Since 10+4>12, the preset constraint is not met, so no child node is generated. We then place b2 into the newly added package 2, generating the corresponding node 4 with the following parameters: M(b3,c1,c2), N[(a1,b1),(b2)], X(10,4), Y=2.

[0102] Based on node 3, calculate whether the cumulative capacity of package 1 exceeds the package capacity after b2 is placed into it. Since 6+4<12, node 5 is generated with the following parameters: M(b3,c1,c2), N[(a1,b2),(b1)], X(10,4), Y=2. Calculate whether the cumulative capacity of package 2 exceeds the package capacity after b2 is placed into it. Since 4+4<12, node 6 is generated with the following parameters: M(b3,c1,c2), N[(a1),(b1,b2)], X(6,8), Y=2. Place b2 into the newly added package 3 to generate the corresponding node 7 with the following parameters: M(b3,c1,c2), N[(a1),(b1),(b2)], Y=3.

[0103] Similarly, based on nodes 4, 5, 6, and 7, decisions are made on b3 in M(b3,c1,c2) ​​until M is empty.

[0104] It should be noted that during the generation of the decision tree, a pre-pruning strategy is also executed. When the number of packages Y already formed equals the number of packages T constructed based on the greedy algorithm, and there are still remaining items (M is not empty), the node terminates as a leaf node and no longer makes decisions. For example, node 7 has formed a package number Y = 3, and M(b3,c1,c2) ​​is not empty, so node 7 terminates as a leaf node. For example, when making a decision on b3 in the remaining goods M(b3,c1,c2) ​​based on node 6, we first perform a trial calculation on package 1, which satisfies the constraints, generating node 12 with parameters M(c1,c2), N[(a1,b3),(b1,b2)], X[10,8], Y=2; we then perform a trial calculation on package 2, which satisfies the constraints, generating node 13 with parameters M(c1,c2), N[(a1),(b1,b2,b3)], X[6,12], Y=2; and we add package 3, generating node 14 with parameters M(c1,c2), N[(a1),(b1,b2),(b3)], X[6,8,4], Y=3. At this point, the number of packages Y is equal to the number of packages T based on the greedy algorithm, and there are still remaining goods. Since its child nodes are definitely not the optimal solution, this node is a leaf node and we do not continue making decisions.

[0105] Step 5: Post-pruning

[0106] According to the post-pruning strategy, based on the mutual exclusion relationship of goods in each package (e.g., goods a and b cannot be placed in the same package) and the special attributes of the goods (e.g., fragile items can only be placed in the same package as fragile items, and items that are prone to cross-contamination can only be placed in the same package as items that are prone to cross-contamination), the leaf nodes corresponding to package combinations that do not meet the conditions are removed.

[0107] Step 6: Obtain the optimal solution

[0108] After removing leaf nodes that do not meet the conditions, sort the groups by the number of packages in ascending order, and select the combination with the smallest number of packages. This is the optimal solution. Return the details of each package, such as... Figure 5 As shown, the minimum number of packages obtained is 2. One package contains 1 item 2 and 2 items c, and the other package contains 3 items b.

[0109] In summary, this embodiment of the invention obtains all package combination schemes for multiple items on an order through a decision tree algorithm, which can determine the optimal package combination scheme with the fewest packages. Furthermore, by combining the decision tree algorithm with a greedy algorithm, when the number of packages already constructed in a decision node exceeds the number of packages constructed by the greedy algorithm, the node terminates as a leaf node and no longer continues to make decisions, thus preventing overfitting, limiting the depth of the decision tree, and finally obtaining all combination methods, obtaining the global optimal solution, and acquiring the minimum number of packages and the corresponding package details.

[0110] Figure 6This is a schematic diagram of a device for determining a package combination scheme according to an embodiment of the present invention, as shown below. Figure 6 As shown, the device includes:

[0111] The acquisition module 601 is used to acquire multiple items to be packaged on the target order and determine the package coefficient of each item to be packaged, wherein the package coefficient is determined based on the attribute values ​​of the items to be packaged and the attribute values ​​of the packages; the decision module 602 is used to construct a decision tree for package combination schemes for the multiple items to be packaged based on preset constraints, wherein each leaf node of the decision tree corresponds to each package combination scheme, and each package combination scheme includes the number of packages and the item details in each package, wherein the preset constraints are that the cumulative value of the package coefficient of each item in each package does not exceed a preset threshold; the determination module 603 is used to traverse the package combination schemes corresponding to each leaf node of the decision tree, determine the package combination scheme with the fewest packages as the target package combination scheme for the target order, and output the item details in each package in the target package combination scheme.

[0112] As an embodiment of the present invention, the decision module 602 is specifically used for: for a first target item among the plurality of items to be packaged, in the case that there is no package corresponding to the first target item, constructing a first package based on the first target item, and taking the first package containing the first target item as the root node of the decision tree; starting from the root node, iteratively executing the following steps until the remaining items to be packaged among the plurality of items to be packaged are empty, and obtaining a decision tree: obtaining the package combination scheme corresponding to the current node of the decision tree, wherein the package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the sum of the package coefficients of the items in each constructed package. Value; For the second target item among the multiple items to be packaged, calculate the predicted cumulative value of the package coefficient of each item in the constructed package after grouping the second target item into the corresponding constructed package based on the package coefficient of the second target item and the cumulative value of the package coefficient of each item in the constructed package; if the predicted cumulative value of the package coefficient of each item in the constructed package does not exceed a preset threshold, group the second target item into the corresponding constructed package, and determine the constructed package containing the second target item as the first child node corresponding to the current node; construct a second package based on the second target item, and take the second package containing the second target item as the second child node corresponding to the current node.

[0113] As an embodiment of the present invention, the decision module 602 is further configured to: determine the current node as a leaf node of the decision tree when the number of built packages corresponding to the current node is equal to or greater than the preset number of packages, and the set of remaining items to be packaged is not empty.

[0114] As an embodiment of the present invention, the preset number of packages is obtained by calculating the multiple items to be packaged based on a greedy algorithm.

[0115] As an embodiment of the present invention, the acquisition module 601 is further configured to: sort the plurality of items to be packaged in descending order of package coefficient to obtain a sequence of items to be packaged; wherein, the first target item is the item to be packaged located in the first sequence position in the sequence of items to be packaged, and the second target item is the item to be packaged located in the next sequence position.

[0116] As an embodiment of the present invention, the decision module 602 is further configured to: verify the package combination scheme corresponding to each leaf node of the decision tree according to the preset item verification conditions, and delete the leaf nodes that fail the verification.

[0117] As an embodiment of the present invention, the acquisition module 601 is specifically used to: determine that the package coefficient corresponding to the packaged item is the reciprocal of n when n identical items in the plurality of packages constitute a package; or determine the least common multiple among the package coefficients of different packages in the target order, and multiply the package coefficient corresponding to the packaged item according to the least common multiple.

[0118] The device for determining the package combination scheme provided in this embodiment of the invention has a similar implementation principle and technical effect to the above embodiments, and will not be described again here.

[0119] like Figure 7 As shown, this embodiment of the invention provides an electronic device, including a processor 701, a communication interface 702, a memory 703, and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other via the communication bus 704.

[0120] Memory 703 is used to store computer programs;

[0121] In one embodiment of the present invention, when the processor 701 executes the program stored in the memory 703, it implements the steps of the method for determining the package combination scheme provided in any of the foregoing method embodiments.

[0122] The electronic device provided in this embodiment of the invention has a similar implementation principle and technical effect to the above embodiments, and will not be described again here.

[0123] The aforementioned memory 703 can be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Memory 703 has storage space for program code used to perform any of the method steps described above. For example, the storage space for program code may include individual program codes for implementing the various steps in the methods described above. This program code can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, optical discs (CDs), memory cards, or floppy disks. Such computer program products are typically portable or fixed storage units. The storage unit may have storage segments or storage spaces arranged similarly to memory 703 in the aforementioned electronic device. The program code may be compressed, for example, in a suitable form. Typically, the storage unit includes programs for performing the method steps according to embodiments of the invention, i.e., code that can be read by a processor such as 701, which, when run by the electronic device, causes the electronic device to perform the various steps in the methods described above.

[0124] Embodiments of the present invention also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for determining the package combination scheme as described above.

[0125] The computer-readable storage medium may be included in the device / apparatus described in the above embodiments; or it may exist independently and not assembled into the device / apparatus. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of the present invention.

[0126] According to embodiments of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0127] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0128] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for determining a package combination scheme, characterized in that, include: The system retrieves multiple items to be packaged from a target order and determines the package coefficient for each item. The package coefficient is determined based on the attribute values ​​of the items and the package. A decision tree is constructed based on preset constraints to generate package combination schemes for the multiple items to be packaged. Each leaf node of the decision tree corresponds to a package combination scheme. Each package combination scheme includes the number of packages and the item details in each package. The preset constraints are that the cumulative value of the package coefficients for each item in each package does not exceed a preset threshold. Traverse the package combination schemes corresponding to each leaf node of the decision tree, determine the package combination scheme with the fewest packages, which is the target package combination scheme for the target order, and output the item details of each package in the target package combination scheme; The decision tree for constructing package combination schemes for the multiple items to be packaged based on preset constraints includes: For the first target item among the multiple items to be packaged, if there is no package corresponding to the first target item, a first package is constructed based on the first target item, and the first package containing the first target item is used as the root node of the decision tree; Starting from the root node, iteratively execute the following steps until all remaining items to be packaged are empty, thus obtaining a decision tree: Obtain the package combination scheme corresponding to the current node of the decision tree. The package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the cumulative value of the package coefficient of each item in each constructed package. For the second target item among the multiple items to be packaged, the predicted cumulative value of the package coefficient of each item in each constructed package is calculated based on the package coefficient of the second target item and the cumulative value of the package coefficient of each item in each constructed package. If the cumulative predicted value of the package coefficient of the items in the constructed package does not exceed a preset threshold, the second target item is grouped into the corresponding constructed package, and the constructed package containing the second target item is determined as the first child node corresponding to the current node. A second package is constructed based on the second target item, and the second package containing the second target item is taken as the second child node corresponding to the current node.

2. The method according to claim 1, characterized in that, The method further includes: If the number of packages already constructed corresponding to the current node is equal to or greater than the preset number of packages, and the remaining items to be packaged are not empty, then the current node is determined to be a leaf node of the decision tree.

3. The method according to claim 2, characterized in that, The preset number of packages is calculated based on a greedy algorithm for the multiple items to be packaged.

4. The method according to any one of claims 1-3, characterized in that, After determining the parcel coefficient for each item to be parceled, the process also includes: Sort the multiple items to be packaged in descending order of their package coefficients to obtain a sequence of items to be packaged; Wherein, the first target item is the item to be packaged located in the first sequence position in the sequence of items to be packaged, and the second target item is the item to be packaged located in the next sequence position.

5. The method according to any one of claims 1-3, characterized in that, After constructing a decision tree for package combination schemes of the multiple items to be packaged based on preset constraints, the method further includes: The package combination scheme corresponding to each leaf node of the decision tree is verified according to the preset item verification conditions, and the leaf nodes that fail the verification are deleted.

6. The method according to any one of claims 1-3, characterized in that, When n identical items from the plurality of items to be packaged constitute a single package. The parcel coefficient corresponding to the item to be parceled is determined to be the reciprocal of n; or Determine the least common multiple among the parcel coefficients of different items to be parceled on the target order, and multiply the parcel coefficients corresponding to the items to be parceled according to the least common multiple.

7. A device for determining a package combination scheme, characterized in that, include: The acquisition module is used to acquire multiple items to be packaged on the target order and determine the package coefficient of each item to be packaged, wherein the package coefficient is determined based on the attribute values ​​of the item to be packaged and the attribute values ​​of the package. The decision module is used to construct a decision tree for package combination schemes for the multiple items to be packaged based on preset constraints. Each leaf node of the decision tree corresponds to each package combination scheme. Each package combination scheme includes the number of packages and the item details in each package. The preset constraints are that the cumulative value of the package coefficient of each item in the package does not exceed a preset threshold. The determination module is used to traverse the package combination schemes corresponding to each leaf node of the decision tree, determine the package combination scheme with the fewest packages, which is the target package combination scheme for the target order, and output the item details of each package in the target package combination scheme. The decision-making module is specifically used for: For the first target item among the multiple items to be packaged, if there is no package corresponding to the first target item, a first package is constructed based on the first target item, and the first package containing the first target item is used as the root node of the decision tree; Starting from the root node, iteratively execute the following steps until all remaining items to be packaged are empty, thus obtaining a decision tree: Obtain the package combination scheme corresponding to the current node of the decision tree. The package combination scheme corresponding to the current node includes the number of packages already constructed, the item details in each constructed package, and the cumulative value of the package coefficient of each item in each constructed package. For the second target item among the multiple items to be packaged, the predicted cumulative value of the package coefficient of each item in each constructed package is calculated based on the package coefficient of the second target item and the cumulative value of the package coefficient of each item in each constructed package. If the cumulative predicted value of the package coefficient of the items in the constructed package does not exceed a preset threshold, the second target item is grouped into the corresponding constructed package, and the constructed package containing the second target item is determined as the first child node corresponding to the current node. A second package is constructed based on the second target item, and the second package containing the second target item is taken as the second child node corresponding to the current node.

8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method for determining the package combination scheme as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for determining the package combination scheme as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Tray assembly method and application thereof

    CN110077772A

  • Object data processing method and device, computer equipment and storage medium

    CN112580902A