Three-dimensional encasement solving method based on gridding and full single-mode matrix acceleration
By performing gridding and discretization on the packing space, the three-dimensional packing problem is transformed into a fully single-mode matrix form, which solves the problems of low solution efficiency and limited scale in traditional methods and realizes an efficient three-dimensional packing solution.
Patent Information
- Application Number
- CN202510710629.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-09-19
AI Technical Summary
Existing technologies have low efficiency and limited scale in solving three-dimensional bin packing problems. Traditional MILP models are highly complex and computationally expensive, making them difficult to handle large-scale bin packing problems.
By performing gridding and discretization on the packing space, the problem is transformed into a full unimodular matrix form, a linear programming model is established, and the characteristics of the full unimodular matrix are utilized to directly solve the integer solution, avoiding the branch and bound step.
The solution speed has been significantly improved, and it can handle packing problems with more items and larger volumes. The model has excellent mathematical properties and the solution results are stable and reliable.
Smart Images

Figure CN120670705A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of three-dimensional bin packing, and in particular relates to a three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration. Background Art
[0002] The 3D Bin Packing Problem (3DBPP) involves packing a series of three-dimensional objects of varying sizes (usually small rectangular boxes) into one or more larger containers, requiring that the objects do not overlap and that space utilization be optimized as much as possible. This problem is widely encountered in fields such as logistics warehousing, container loading, and industrial packaging, and is a classic challenge in combinatorial optimization. 3DBPP is inherently NP-hard and extremely challenging to solve on large-scale instances. Traditional methods often use a mixed integer linear programming (MILP) model to model and solve the 3D bin packing problem, using commercial solvers to find the optimal binning solution.
[0003] The MILP modeling of traditional 3DBPP has many limitations. First, the model is large in scale and highly complex, mainly reflected in the need to introduce a large number of 0-1 decision variables and complex constraints. For example, for each pair of items that may conflict with each other, it is necessary to add mutually exclusive non-overlapping constraints, so that the number of constraints increases almost quadratically with the logarithm of the items. When the number of items increases, the scale of the MILP model expands rapidly, and the combination state space that the solution algorithm needs to traverse expands exponentially, resulting in huge computational overhead. Secondly, the constraint matrix of the traditional MILP model does not have the property of being fully single-mode. For example Figure 1 As shown in the figure, the constraint coefficient matrix structure of the classic 3DBPP model is disordered and is a non-fully unimodular matrix (non-TUM matrix diagram). This means that during the linear relaxation solution, non-integer fractional solutions will appear, which cannot directly correspond to an effective packing solution. Further search and solution must be carried out with the help of integer programming algorithms such as branch-and-bound. This solution process requires a large number of branch pruning operations, further slowing down the solution speed. Due to the limitations of the above factors, existing technologies can only solve 3DBPP at a very small scale, which limits the solution scale and makes it difficult to efficiently handle large-scale problems in practical applications. In many cases, heuristic algorithms have to be resorted to in exchange for acceptable solution time, but this sacrifices the optimality and strict guarantees of the solution.
[0004] In view of the defects of the existing technology in solving three-dimensional box packing, such as low efficiency and limited scale, the purpose of the present invention is to provide a new modeling and solving method. Summary of the Invention
[0005] To overcome the shortcomings of the existing technology, the present invention provides a three-dimensional bin packing solution method based on gridding and full unimodular matrix acceleration. By gridding and discretizing the bin packing space, the mathematical modeling of the problem is converted into a full unimodular matrix form, thereby converting the original MILP integer programming model into an equivalent linear programming (LP) model, greatly improving the solution speed and solving the problems in the existing technology.
[0006] One embodiment of the present invention provides a three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration, comprising the following steps:
[0007] S10, discretizing the three-dimensional continuous space of the container into uniform cubic grid units along the length, width, and height directions, wherein the size of the grid units is determined according to the size of the items to be packed;
[0008] S20. Define a Boolean variable X for each item i i,x,y,z , when the reference point of item i is located at the container grid coordinates (x, y, z), X i,x,y,z =1, otherwise 0; the value range of the reference point satisfies:
[0009] 0≤x≤Ll i ,0≤y≤W-wi,0≤z≤Hh i ;
[0010] Among them, L, W, H are the container dimensions, l i 、w i 、h i is the size of the item;
[0011] S30, establishing a constraint condition based on the Boolean variable, including:
[0012] Unique placement constraint: Each item can only be placed at a unique grid reference point, that is:
[0013]
[0014] No overlap constraint: Any two items do not overlap in the three-dimensional grid space, that is, for each grid cell (p, q, r), satisfy:
[0015]
[0016] Boundary constraints: The coordinates of the item's reference points must meet the container size constraints, namely:
[0017] 0≤x≤Ll i ,0≤y≤Ww i ,0≤z≤Hh i ;
[0018] S40, generating a full single-mode constraint matrix based on the Boolean variables and the constraint conditions to ensure that the relaxed solution of the linear programming is an integer solution;
[0019] S50. Taking maximizing the loading volume or minimizing the number of containers as the objective function, call a linear programming solver to solve the full single-mode constraint matrix, and output the grid coordinates and packing plan of the items; the objective function includes but is not limited to maximizing the loading volume, minimizing the number of containers, giving priority to loading high-value items, or minimizing space waste.
[0020] In one embodiment, in step S10, the size of the grid unit is determined as follows:
[0021] Extract the length, width, and height of all items and calculate the lowest common denominator of each dimension as the side length of the grid unit;
[0022] The container size and item size are both expressed as integers in grid units.
[0023] In one embodiment, in step S30, the mathematical expression without overlap constraint is implemented as follows:
[0024] Traverse all grid cells of the container and generate a set of item placement locations covering each cell;
[0025] A constraint is imposed on each cell that at most one item in the set is selected.
[0026] In one embodiment, in step S30, the constraint condition further includes a multi-container expansion constraint:
[0027] Define a Boolean variable S ij Indicates whether item i is loaded into the jth container;
[0028] Add constraint∑ j S ij =1, ensure that each item is placed in one and only one container;
[0029] Add container using logical constraint S ij ≤n j , where n j Indicates whether container j is enabled;
[0030] The objective function is to minimize the number of containers used min∑ j n j .
[0031] In one embodiment, the objective function in step S50 is selective optimization:
[0032] If high-value items need to be loaded first, the objective function is defined as:
[0033] max∑ i,x,y,z v i ·X i,x,y,z ;
[0034] Among them, v i is the value of item i;
[0035] To minimize space waste, the objective function is defined as:
[0036] max∑ i,x,y,z l i ,w i ,h i ·X i,x,y,z .
[0037] In one embodiment, in step S30, the constraint condition further includes an object orientation constraint:
[0038] Define the rotation variable l of the item in each dimension xi ,l yi ,w xi ,w yi ∈{0,1}, represents the orientation of the item in terms of length and width;
[0039] Add constraints xi +l yi = 1, ensuring that each dimension has only one possible rotation.
[0040] In one embodiment, in step S50:
[0041] The linear programming solver adopts the simplex method or the interior point method and utilizes the characteristics of all-unimodular matrices to directly solve the integer optimal solution without the need for a branch and bound step.
[0042] The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration provided in the above embodiment has the following beneficial effects:
[0043] 1. Significantly Improved Solution Speed: Utilizing a fully unimodular matrix, the original problem is transformed into a linear programming problem, avoiding exponential branching searches. The linear programming solver can obtain the optimal solution in polynomial time, significantly improving solution efficiency. Experiments show that, under identical hardware conditions, the proposed method solves complex bin packing cases more than an order of magnitude faster than traditional MILP methods.
[0044] 2. Capability of Larger-Scale Problems: Due to the reduced computational complexity, the proposed method can be extended to handle packing problems with larger numbers of items and larger volumes. While traditional MILP models are often limited to cases with dozens of items, the proposed method can achieve optimization results within an acceptable timeframe even for large-scale cases with hundreds of items, significantly expanding the applicability of three-dimensional packing problems. This opens up the possibility of solving large-scale loading optimization problems in practical industrial applications.
[0045] 3. Excellent mathematical properties of the model: The LP model constructed in this paper possesses excellent mathematical properties. The constraint matrix is fully unimodal, so that the vertices of the solution space are all integer points, ensuring that the solution process can obtain a discrete feasible solution without the need for special integer constraints. This not only eliminates the problems caused by fractional solutions, but also makes the solution more stable and reliable. At the same time, the linear structure of the model is easy to understand and implement, providing a foundation for further improvements (such as combining other linear relaxation techniques or introducing more practical constraints). BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0047] Figure 1 Schematic diagram of a traditional non-fully single-mode matrix;
[0048] Figure 2 A flowchart of a three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of a fully unimodal matrix in a three-dimensional bin packing solution method based on gridding and fully unimodal matrix acceleration provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0051] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture. If the specific posture changes, the directional indications will also change accordingly.
[0052] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features limited to "first" and "second" may explicitly or implicitly include at least one of such features. In addition, if "and / or" or "and / or" appears in the full text, its meaning includes three parallel solutions. Taking "A and / or B" as an example, it includes solution A, solution B, or solutions that satisfy both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is mutually contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0053] Reference Figure 2 、 Figure 3 One embodiment of the present invention provides a three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration, comprising the following steps:
[0054] S10, discretizing the three-dimensional continuous space of the container into uniform cubic grid units along the length, width, and height directions, wherein the size of the grid units is determined according to the size of the items to be packed;
[0055] S20. Define a Boolean variable X for each item i i,x,y,z , when the reference point of item i is located at the container grid coordinates (x, y, z), X i,x,y,z =1, otherwise 0; the value range of the reference point satisfies:
[0056] 0≤x≤Ll i ,0≤y≤Ww i ,0≤z≤Hh i ;
[0057] Among them, L, W, H are the container dimensions, l i 、w i 、h i is the size of the item;
[0058] S30, establishing a constraint condition based on the Boolean variable, including:
[0059] Unique placement constraint: Each item can only be placed at a unique grid reference point, that is:
[0060]
[0061] No overlap constraint: Any two items do not overlap in the three-dimensional grid space, that is, for each grid cell (p, q, r), satisfy:
[0062]
[0063] Boundary constraints: The coordinates of the item's reference points must meet the container size constraints, namely:
[0064] 0≤x≤Ll i ,0≤y≤Ww i ,0≤z≤Hh i ;
[0065] S40, generating a full single-mode constraint matrix based on the Boolean variables and the constraint conditions to ensure that the relaxed solution of the linear programming is an integer solution;
[0066] S50. Taking maximizing the loading volume or minimizing the number of containers as the objective function, call a linear programming solver to solve the full single-mode constraint matrix, and output the grid coordinates and packing plan of the items; the objective function includes but is not limited to maximizing the loading volume, minimizing the number of containers, giving priority to loading high-value items, or minimizing space waste.
[0067] As described in step S10 above, the three-dimensional continuous space of the container is discretized into uniform cubic grid cells along the length, width, and height directions. The grid cell size is dynamically determined based on the minimum size of the items to be packed or the common divisor of each dimension. For example, if the item dimensions are 20cm in length, 15cm in width, and 10cm in height, respectively, the grid cell side length can be set to 5cm (the lowest common divisor of each dimension). The container dimensions (e.g., 1m×0.8m×0.6m) are thus converted into 20×16×12 grid cells.
[0068] As described in step S20 above, define a Boolean variable X for each item i. i,x,y,z , when the reference point of item i is located at the container grid coordinates (x, y, z), X i,x,y,z =1, otherwise 0. The range of the reference point is precisely defined by the following formula:
[0069] 0≤x≤Ll i ,0≤y≤Ww i ,0≤z≤Hh i ;
[0070] If the item size is a 2×3×1 grid and the container size is a 10×8×6 grid, the reference point coordinate range is:
[0071] x∈[0,8],y∈[0,5],z∈[0,5];
[0072] As described in step S30 above, three types of constraints are established based on Boolean variables:
[0073] (1) Unique placement constraint:
[0074]
[0075] This ensures that items must and can only be placed in one location.
[0076] (2) No overlap constraint:
[0077] For each grid cell (o,q,r), constrain the item placement variables covering that cell to be at most 1:
[0078]
[0079] (3) Boundary constraints:
[0080] The coordinates of the reference point satisfy 0≤x≤Ll i ,0≤y≤Ww i ,0≤z≤Hh i ;
[0081] As described in step S40 above, a fully unimodular constraint matrix is generated based on the Boolean variables and constraints. Since the coefficient matrix corresponding to the unique placement, no overlap, and boundary constraints satisfies the fully unimodular condition (each column has at most one +1 and -1 non-zero element), its linear programming relaxation solution is automatically an integer solution.
[0082] As described in step S50 above, a linear programming solver (such as Gurobi) is called to drive the solution with the objective function, and the grid coordinates of the items and the packing plan are output.
[0083] For example, if the goal is to maximize the loading volume, the objective function is:
[0084] max∑ i,x,y,z (l i w i h i )·X i,x,y,z .
[0085] In this embodiment, it is assumed that a cross-border logistics company needs to load a batch of goods of different specifications into a container (size 12m×2.4m×2.6m), with the goal of maximizing the utilization rate of a single container and reducing cargo damage.
[0086] S10, spatial gridding:
[0087] Product size: A (0.8m × 0.6m × 0.5m), B (1.2m × 1m × 0.4m), C (0.5m × 0.5m × 0.5m);
[0088] Calculate the lowest common divisor of all dimensions of all products to be 0.1m, and the grid unit size is 0.1m;
[0089] The container grid size is 120×24×26.
[0090] S20, variable definition:
[0091] Benchmark variable X for product A A,x,y,z The range is x∈[0,112], y∈[0,18], z∈[0,21];
[0092] Benchmark variable X for product B B,x,y,z The range is x∈[0,108], y∈[0,14], z∈[0,22].
[0093] S30, Constraint Modeling:
[0094] Unique placement: Each item must be placed once and only once;
[0095] No overlap constraint: 0.1m each 3 A grid cell is only allowed to be covered by one product;
[0096] Boundary constraints: Ensure that the item is completely within the container.
[0097] S40, full single-mode matrix generation:
[0098] Generate a sparse matrix containing all variables and constraints, where the matrix elements are 0 / 1 coefficients.
[0099] S50, model solution:
[0100] The objective function is set to maximize the loading volume, and the Gurobi solver completes the packing planning of several items within a preset time.
[0101] In one embodiment, in step S10, the size of the grid unit is determined as follows:
[0102] Extract the length, width, and height of all items and calculate the lowest common denominator of each dimension as the side length of the grid unit;
[0103] The container size and item size are both expressed as integers in grid units.
[0104] In this embodiment, the grid cell size is determined by:
[0105] Extract item dimensions: Obtain the length, width, and height dimensions of all items to be packed. For example, if the item dimensions include 20cm×15cm×10cm and 30cm×25cm×15cm, each dimension will be processed independently.
[0106] Compute the lowest common denominator:
[0107] Long axis direction: extract the object length values 20 and 30, and calculate the lowest common divisor 10cm;
[0108] Width axis direction: extract the width values 15 and 25 of the object and calculate the lowest common divisor 5cm;
[0109] High axis direction: extract the object height values 10 and 15, and calculate the lowest common divisor 5cm;
[0110] The final size of the grid unit is: length × width × height = 10 cm × 5 cm × 5 cm (or further unified into 5 cm cubes to simplify calculations).
[0111] Size shaping:
[0112] The container size (e.g., 1m × 0.8m × 0.6m) is converted to the number of grid cells: 100cm / 5cm = 20 (length) × 80cm / 5cm = 16 (width) × 60cm / 5cm = 12 (height);
[0113] Item size conversion is synchronized: 20cm×15cm×10cm → 4 grids × 3 grids × 2 grids, 30cm×25cm×15cm → 6 grids × 5 grids × 3 grids.
[0114] This embodiment dynamically adjusts the grid size through the lowest common denominator, maintaining flexibility in item size while avoiding traditional standardization (e.g., a fixed 10cm grid that wastes space for small items). At the same time, it reduces the scale of variables, and integer sizes strictly discretize variable assignments, shifting the problem complexity from continuous space to combinatorial optimization. Furthermore, it improves solution accuracy by dividing the grid based on the common denominator, eliminating the voids or overflows caused by size adaptation errors in traditional methods. It is also compatible with irregular-shaped items. For example, the long-axis grid size is dynamically adjusted based on the longest item, avoiding forced alignment and loss of space utilization.
[0115] In one embodiment, in step S30, the mathematical expression without overlap constraint is implemented as follows:
[0116] Traverse all grid cells of the container and generate a set of item placement locations covering each cell;
[0117] A constraint is imposed on each cell that at most one item in the set is selected.
[0118] In this embodiment:
[0119] For traversing grid cells: from the starting grid cell (0,0,0) of the container to the ending grid cell (L-1,W-1,H-1), traverse each cell (p,q,r) in turn, where L,W,H are the number of grids in the length, width, and height directions of the container.
[0120] For generating a covering set: For each cell (p, q, r), generate a set C(p, q, r) of all possible item placement locations that cover the cell, specifically:
[0121] For item i, if its reference point is at (x, y, z), the grid range occupied by the item satisfies:
[0122] Coordinates satisfy x≤p<x+l i ,y≤q<yw i ,z≤r<zh i ;
[0123] Then X i,x,y,z ∈C(p,q,r).
[0124] To impose constraints:
[0125] For each unit (p,q,r), constrain at most one variable in its covering set C(p,q,r) to be 1;
[0126]
[0127] This embodiment generates constraints by traversing the grid cells. The number of constraints is only linear with the number of grid cells (O(LWH)), and the constraint matrix is highly structured. 2 ) is reduced to (O(LWH)), which is particularly suitable for large sets of items. Each constraint only involves the coverage variables of a single grid cell, and the constraint coefficient is 0 / 1, satisfying the sufficient condition of a fully unimodular matrix (each row has at most one +1 element), ensuring that the linear program solution is an integer.
[0128] In one embodiment, in step S30, the constraint condition further includes a multi-container expansion constraint:
[0129] Define a Boolean variable S ij Indicates whether item i is loaded into the jth container;
[0130] Add constraint∑ j S ij =1, ensure that each item is placed in one and only one container;
[0131] Add container using logical constraint S ij ≤n j , where n jIndicates whether container j is enabled;
[0132] The objective function is to minimize the number of containers used min∑ j n j .
[0133] In this embodiment, multi-container extension constraints are implemented in the following ways:
[0134] (1) Define container-associated variables:
[0135] Item-container binding variable: define Boolean variable S ij ∈{0,1}, indicating whether item i is placed in the jth container;
[0136] Container enable variables: define a Boolean variable n j ∈{0,1}, indicating whether container j is enabled.
[0137] (2) Add logical constraints:
[0138] Unique container assignment: Each item must fit into one and only one container:
[0139]
[0140] Container activation logic: If at least one item is loaded into the jth container, then n j =1, otherwise n j =0; achieved through the following constraints:
[0141]
[0142] (3) Objective function jump adjustment: minimize the total number of enabled containers:
[0143]
[0144] In traditional methods, multi-container expansion requires independent modeling for each container (such as duplicating single-container variables and constraints), which causes the model size to grow linearly with the number of containers. Auxiliary variables need to be introduced to handle the item allocation logic between containers, and the constraint complexity increases exponentially (such as item cross-container exclusive constraints). Compared with traditional methods, this embodiment uses a shared Boolean variable S ij With container-enabled logical n j , directly associate the relationship between items and containers; using the characteristics of the fully unimodular matrix, the multi-container constraints still maintain the linear programming solvability.
[0145] In this embodiment, it is assumed that a maximum of 5 containers (j=1, 2...5) are allowed to load 10 items:
[0146] Variable definition:
[0147] S ij Indicates whether item i is placed in the jth container, a total of 10×5=50 variables;
[0148] n j Indicates whether container j is enabled, a total of 5 variables;
[0149] Constraint Construction:
[0150] For each item i, constraint S i1 +S i2 +......+S i5 =1;
[0151] For each container j, constraint S 1j +S 2j +......+S 10j ≤10·n j ;
[0152] Solution:
[0153] If in the optimal solution, n1=n2=1, the remaining n j =0, it means that only 2 containers are needed to load all the items.
[0154] In one embodiment, the objective function in step S50 is selective optimization:
[0155] If high-value items need to be loaded first, the objective function is defined as:
[0156] max∑ i,x,y,z v i ·X i,x,y,z ;
[0157] Among them, v i is the value of item i;
[0158] To minimize space waste, the objective function is defined as:
[0159] max∑ i,x,y,z l i ,w i ,h i ·X i,x,y,z .
[0160] In this embodiment, the objective function is selectively optimized in the following manner:
[0161] (1) Value-first model:
[0162] Objective function definition: If high-value items need to be loaded first, set the objective function to maximize the total value of the loaded items:
[0163] max∑ i,x,y,z v i ·X i,x,y,z ;
[0164] Among them, v i is the unit value of item i (e.g. electronic products are set at unit price), X i,x,y,z Indicates whether the item is placed.
[0165] Constraint association: Value optimization needs to work together with unique placement constraints and non-overlap constraints to ensure that high-value items occupy valid space first.
[0166] (2) Space efficiency model
[0167] Objective function definition: To minimize space waste (i.e. maximize loading volume), set the objective function to maximize the total volume of loaded items:
[0168] max∑ i,x,y,z (l i w i ·h i )·X i,x,y,z .
[0169] Among them, l i ,w i ,h i is the size of the item, l i w i h i Indicates the volume of an item;
[0170] Volume weight correction: For special-shaped items (such as irregular packaging), the volume filling rate coefficient α can be introduced i ∈[0,1], adjust the objective function to:
[0171] max∑ i,x,y,z α i ·l i w i h i ·X i,x,y,z .
[0172] In traditional methods, the objective function is usually fixed to a single mode (such as maximizing volume or minimizing the number of containers), which cannot dynamically adapt to multi-objective requirements; hybrid optimization requires the introduction of multi-objective planning, which leads to a sharp increase in model complexity (such as Pareto front solution). Compared with traditional methods, this embodiment supports dynamic switching of objective functions through the stability of the full single-mode matrix without modifying the constraint structure; the value / volume weight is directly related to the Boolean variable X i,x,y,z Linear correlation ensures solution efficiency.
[0173] In one embodiment, in step S30, the constraint condition further includes an object orientation constraint:
[0174] Define the rotation variable l of the item in each dimension xi ,l yi ,w xi ,w yi ∈{0,1}, represents the orientation of the item in terms of length and width;
[0175] Add constraints xi +l yi = 1, ensuring that each dimension has only one possible rotation.
[0176] In this embodiment, the item orientation constraint is implemented in the following way:
[0177] (1) Define the rotation variable:
[0178] Long axis direction variable: l xi ,l yi ∈{0,1},l xi =1 means that the long axis of item i is aligned with the x direction of the container, l yi =1 means that the long axis of item i is aligned with the y direction of the container.
[0179] Width axis direction variable: w xi ,w yi ∈{0,1},w xi = 1 means that the width axis of item i is aligned with the x direction of the container, w yi = 1 means that the width axis of item i is aligned with the y direction of the container.
[0180] (2) Add logical constraints:
[0181] Unique orientation in one dimension: Only one rotation is allowed in the direction of the long axis and the width axis respectively:
[0182] l xi +l yi =1 (long axis constraint)
[0183] w xi +w yi =1 (width axis constraint)
[0184] Mutually exclusive in width direction: The long axis and the wide axis cannot be aligned in the same direction at the same time to avoid size conflicts:
[0185] l xi +w xi ≤1 (mutually exclusive constraint in the x direction)
[0186] l yi +w yi ≤1 (mutually exclusive constraint in the y direction)
[0187] (3) Dynamically adjust item size:
[0188] Update the size of the item in the grid based on the rotation variable:
[0189] Actual number of long axis grids = l xi ·l i +l yi w i
[0190] Actual width axis grid number = w xi w i +w yi ·l i
[0191] Among them, l xi ,w xi The number of grid cells of the original length and width of the item.
[0192] In traditional methods, object orientation is modeled by enumerating all possible rotations (e.g., six three-dimensional rotations), resulting in a surge in the number of variables (six sets of variables per object). Constraints must also address dimensional conflicts after rotation (e.g., boundary constraints after length and width swaps), exponentially increasing model complexity. Compared to traditional methods, this embodiment uses binary variables to define the length and width axis directions, requiring only four variables to cover all possible two-dimensional rotations. Logical constraints (mutual exclusivity) are combined with a fully unimodular matrix to ensure that the linear programming solution remains an integer.
[0193] In one embodiment, in step S50:
[0194] The linear programming solver adopts the simplex method or the interior point method,
[0195] l xi ,Use the fully unimodular matrix: property to directly solve the integer optimal solution without the ,branch and bound step.
[0196] In this embodiment, the linear programming solver is implemented in the following manner:
[0197] (1) Algorithm selection:
[0198] Simplex method: Applicable to sparse constraint matrices (e.g., most constraints after meshing are local coverage relations), and quickly converges to the optimal solution through vertex traversal;
[0199] Interior point method: Applicable to large-scale dense matrices (such as high-resolution grids or complex object orientation scenes), approximating the optimal solution through the central path.
[0200] (2) Utilization of all single-mode matrix characteristics:
[0201] The Totally Unimodular Matrix (TUM) constraint ensures that the determinants of all its non-singular submatrices are ±1 or 0;
[0202] The relaxed solution of linear programming automatically satisfies the integer property (i.e. X i,x,y,z ∈{0,1}), without the need for the branch and bound step in traditional mixed integer programming.
[0203] In traditional methods, mixed integer linear programming (MILP) must rely on branch-and-bound method to deal with integer constraints, and the computational complexity is exponential (O(2 n )), it is difficult to solve large-scale problems; branch and bound requires repeated cutting of the feasible region and generation of subtrees, which consumes huge memory and time (for example, solving 100 items requires several hours). Compared with the traditional method, this embodiment degenerates the problem into a pure linear programming (LP) through a single-module matrix, and reduces the complexity to the polynomial level (O(n 3 )); Directly call the LP solver to output integer solutions, skipping the branch and bound loop.
[0204] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made by using the contents of the present invention description and drawings under the inventive concept of the present invention, or direct / indirect application in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration, characterized in that: The steps include: S10, discretizing the three-dimensional continuous space of the container into uniform cubic grid units along the length, width, and height directions, wherein the size of the grid units is determined according to the size of the items to be packed; S20. Define a Boolean variable X for each item i i,x,y,z , when the reference point of item i is located at the container grid coordinates (x, y, z), X i,x,y,z =1, otherwise 0; the value range of the reference point satisfies: 0≤x≤L-l i ,0≤y≤W-w i ,0≤z≤H-h i ; Among them, L, W, H are the container dimensions, l i 、w i 、h i is the size of the item; S30, establishing a constraint condition based on the Boolean variable, including: Unique placement constraint: Each item can only be placed at a unique grid reference point, that is: No overlap constraint: Any two items do not overlap in the three-dimensional grid space, that is, for each grid cell (p, q, r), satisfy: Boundary constraints: The coordinates of the item's reference points must meet the container size constraints, namely: 0≤x≤L-l i ,0≤y≤W-w i ,0≤z≤H-h i ; S40, generating a full single-mode constraint matrix based on the Boolean variables and the constraint conditions to ensure that the relaxed solution of the linear programming is an integer solution; S50. Taking maximizing the loading volume or minimizing the number of containers as the objective function, call a linear programming solver to solve the full single-mode constraint matrix, and output the grid coordinates and packing plan of the items; the objective function includes but is not limited to maximizing the loading volume, minimizing the number of containers, giving priority to loading high-value items, or minimizing space waste.
2. The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration according to claim 1 is characterized in that: In step S10, the size of the grid unit is determined as follows: Extract the length, width, and height of all items and calculate the lowest common denominator of each dimension as the side length of the grid unit; The container size and item size are both expressed as integers in the number of grid units.
3. The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration according to claim 1 is characterized in that: In step S30, the mathematical expression without overlap constraint is implemented as follows: Traverse all grid cells of the container and generate a set of item placement locations covering each cell; A constraint is imposed on each cell that at most one item in the set is selected.
4. The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration according to claim 1, characterized in that: In step S30, the constraints also include multi-container expansion constraints: Define a Boolean variable S ij Indicates whether item i is loaded into the jth container; Add constraint∑ j S ij =1, ensure that each item is placed in one and only one container; Add container using logical constraint S ij ≤n j , where n j Indicates whether container j is enabled; The objective function is to minimize the number of containers used min∑ j n j .
5. The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration according to claim 1, characterized in that: The objective function in step S50 is selective optimization: If high-value items need to be loaded first, the objective function is defined as: max∑ i,x,y,z v i ·X i,x,y,z ; Among them, v i is the value of item i; To minimize space waste, the objective function is defined as: max∑ i,x,y,z l i ,w i ,h i ·X i,x,y,z 。 6. The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration according to claim 1, characterized in that: In step S30, the constraint conditions also include an object orientation constraint: Define the rotation variable l of the item in each dimension xi ,l yi ,w xi ,w yi ∈{0,1}, represents the orientation of the item in terms of length and width; Add constraints xi +l yi = 1, ensuring that each dimension has only one possible rotation.
7. The three-dimensional bin packing solution method based on gridding and full single-mode matrix acceleration according to claim 1 is characterized in that: In step S50: The linear programming solver adopts the simplex method or the interior point method and utilizes the characteristics of all-unimodular matrices to directly solve the integer optimal solution without the need for a branch and bound step.