Code mixing method, electronic device and storage medium based on sequence prediction dynamic programming
By using a sequence prediction dynamic programming mixing method, a site block diagram and difference array are constructed. Combined with a dynamic programming algorithm, the layout of materials on pallets is optimized, which solves the problems of versatility and performance of traditional palletizing strategies in handling diverse materials, and realizes efficient and automated material loading.
Patent Information
- Application Number
- CN202410897435.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-07-05
AI Technical Summary
Traditional material palletizing strategies struggle to balance versatility and algorithm performance, failing to effectively handle the stacking needs of various types and specifications of materials, resulting in low warehouse space utilization and insufficient security.
A mixing method based on sequence prediction and dynamic programming is adopted. By constructing a site block map and preprocessing the difference array, combined with the dynamic programming algorithm model, the optimal placement scheme of materials under different stacking heights is determined. The material size, rotation state and obstacle information are taken into account to optimize the material layout.
It improves space utilization, enhances loading efficiency and adaptability, adapts to various loading scenarios, reduces manual intervention, and increases the degree of automation.
Smart Images

Figure CN118446623B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of palletizing technology, and in particular to a code mixing method, electronic equipment and storage medium based on sequence prediction dynamic programming. Background Art
[0002] With the continuous development of the logistics industry and the increase in material handling needs, the multi-material palletizing (mixed-code) strategy has become a key link in supply chain management. In traditional logistics management, it is often encountered that a variety of materials of different types and specifications need to be stacked, stored and transported. The multi-material palletizing strategy is a solution to this complex situation.
[0003] With the rapid development of the manufacturing industry and the trend of product diversification, the warehousing and logistics industry is facing increasingly complex challenges. The traditional single material palletizing strategy can no longer meet the handling needs of diversified materials, because different types of materials have different sizes, weights and stacking characteristics. For example, a batch of goods may include boxes of different sizes, bagged materials, and even products of special shapes, which requires a flexible stacking solution to ensure the maximum utilization of warehouse space and the safe storage of materials.
[0004] When mixing, giving the upper layer more ample stacking space can create a better decision-making environment for future planning. If the search scoring strategy is used directly, it will be difficult to increase the space on the same layer as much as possible. Increasing the search depth will create a huge search space, and it is usually impossible to know the size of many incoming materials. The predefined stacking type is difficult to adapt to non-planar situations, and it is difficult to reconcile universality and algorithm performance. Summary of the invention
[0005] The embodiments of the present application provide a code mixing method, an electronic device and a storage medium based on sequence prediction dynamic programming, so as to at least solve the problem that the universality of the existing code mixing and palletizing schemes in the related art is difficult to reconcile with the algorithm performance.
[0006] In a first aspect, an embodiment of the present application provides a code mixing method based on sequence prediction dynamic programming, comprising:
[0007] Obtain information about materials to be loaded, pallet information, loaded pallet type information and mixed code parameters;
[0008] Constructing a site block diagram according to the loaded pallet type information and the mixed code parameters, wherein the site block diagram includes obstacle information of the site;
[0009] Taking the pallet information and the site block diagram as the first constraint condition, the material placement area is determined by a differential array preprocessing method;
[0010] Determine multiple stacking heights according to the information of the materials to be loaded, and calculate the optimal placement plan of the material placement area under different stacking heights through a pre-built dynamic programming algorithm model;
[0011] The optimal placement plans under all stacking heights are compared, and the optimal placement plan is selected as the final mixed-code placement plan according to the preset selection rules.
[0012] In one embodiment, the code mixing parameters include a height tolerance parameter; and constructing a site Block diagram according to the loaded pallet type information and the code mixing parameters includes:
[0013] Acquire a reference height, and determine a reference height range according to the high tolerance parameter and the reference height;
[0014] The reference height range is based on comparing the actual heights of all positions of the loaded stack type information to obtain obstacle information;
[0015] Determine the size of the pallet according to the pallet information, construct an initial map based on the pallet size, mark the locations in the initial map with obstacle types according to the obstacle information, and obtain the site block map;
[0016] Among them, the position smaller than the reference height range is marked as a hole obstacle area, and the position larger than the reference height range is marked as a cliff obstacle area.
[0017] In one embodiment, the constraints of the pallet information and the site block diagram include:
[0018] Obtaining a pallet size according to the pallet information, and limiting any position of the material to a range not exceeding the pallet size;
[0019] The cliff obstacle area and the hole obstacle area are determined according to the obstacle information of the site block map, and it is limited that any position of the material does not intersect with the cliff obstacle area and the corner point of the material does not intersect with the hole obstacle area.
[0020] In one embodiment, the plane of the pallet height is selected as a two-dimensional map with the size of the pallet as the boundary;
[0021] Creating two initial difference arrays with initial values of 0 according to the two-dimensional map, respectively representing the rows and columns of the two-dimensional map, and re-assigning the initial difference arrays according to the obstacle information of the site Block map;
[0022] and respectively perform prefix sum processing on the two initial difference arrays to obtain the two-dimensional difference array;
[0023] The two-dimensional difference array is traversed to determine whether an element in the two-dimensional difference array is a preset value. If so, it is determined that the position corresponding to the element in the two-dimensional map is an area where materials can be placed.
[0024] In one embodiment, the calculating the optimal placement scheme of the material placement area at different stacking heights by using a pre-built dynamic programming algorithm model further includes:
[0025] Create a dp array, whose size is limited according to the size of the tray, and all values in the dp array are initialized to 0;
[0026] Obtain the length and width of the material to be placed and the next table, and calculate the maximum number of materials dp[i, j] that can be placed in the range corresponding to the placement area in the dp array, adjust the area size (i, j), traverse the dp array, and update the value of dp[i, j] and the next table according to the state transition equation;
[0027] In the process of updating dp[i, j], the size of the transfer source area (i, j) of the current maximum material quantity is recorded to obtain the transfer path;
[0028] After the state transfer is completed, the maximum number of materials that can be placed on the entire pallet dp[PalletWidth, PalletHeight] and the optimal transfer path are obtained;
[0029] Starting from dp[PalletWidth, PalletHeight], backtracking is performed according to the optimal transfer path and the next table until dp[0, 0], and the optimal placement solution under the current palletizing height is obtained.
[0030] In one embodiment, the dynamic programming algorithm model includes a state transfer equation and a second constraint condition, wherein:
[0031] The state transfer equation is:
[0032] dp[i,j] = max(dp[i - w,j] + m(iw,0,w,j),dp[i - h,j] +m(ih,0,h,j),dp[i,j - w] +m(0,jw,i,w), dp[i,j - h] + m(0,jh,i,h))
[0033] Among them, dp[i, j] represents the maximum number of materials placed in the state transition area with length and width i and j, w and h represent the length and width of the material respectively, max() represents the maximum value; m() represents the predicted number of materials placed in the newly added area;
[0034] The second constraint condition includes: the gap between the materials is not less than a preset minimum interval.
[0035] In one embodiment, the next table creation and maintenance includes:
[0036] Create two next tables, next_row and next_col, whose size is the same as the dp array, to store the moving step of the next material placement in each area size [i, j];
[0037] Starting from the bottom of the next table, reversely traverse and calculate each position of each row of next_row to determine whether the current position is a droppable area; if so, reset step to 0, and set the value of the current position in next_row to the value of step; if not, add 1 to step, and set the value of the current position in next_row to the value of step;
[0038] Starting from the bottom of the next table, reversely traverse and calculate each position of each column of next_col to determine whether the current position is a droppable area; if so, reset step to 0, and set the value of the current position in next_row to the value of step; if not, add 1 to step, and set the value of the current position in next_row to the value of step;
[0039] After the traversal is completed, the next table for forward search is obtained according to the next_row and next_col.
[0040] In one embodiment, the optimal placement scheme is selected as the final mixed code placement scheme according to a preset selection rule, wherein the preset selection rule includes:
[0041] Compare the optimal placement plans for different stacking heights, and select the optimal placement plan with the lowest stacking height and at least one material as the final mixed-code placement plan; or,
[0042] Compare the optimal placement plans for different stacking heights, and select the optimal placement plan with the largest number of materials as the final mixed-code placement plan.
[0043] In a second aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the coding method described in the first aspect when executing the computer program.
[0044] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the coding method as described in the first aspect above.
[0045] The code mixing method based on sequence prediction dynamic programming, electronic device and storage medium provided in the embodiments of the present application have at least the following technical effects:
[0046] Obtain the information of materials to be loaded, pallet information, loaded stack type information and mixed code parameters; construct a site block diagram according to the loaded stack type information and mixed code parameters, and the site block diagram includes the obstacle information of the site; use the pallet information and site block diagram as constraints to determine the material placement area through the differential array preprocessing method; calculate the optimal placement plan of the material placement area under different transfer conditions according to multiple transfer conditions of the material information to be loaded through a pre-constructed dynamic programming algorithm model; compare the optimal placement plans under different transfer conditions, and select the optimal placement plan with the most materials as the final mixed code placement plan. Through the above scheme, the problem of the difficulty in coordinating the universality and algorithm performance of the existing palletizing scheme is solved through the dynamic programming algorithm, and the algorithm has significant technical effects in maximizing space utilization, improving loading efficiency, adaptability and scalability, etc., and can be effectively applied to various loading scenarios, and significantly improves more scenarios with the same sequence.
[0047] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0049] Figure 1 is a flow chart of a code mixing method based on sequence prediction dynamic programming according to an embodiment of the present application;
[0050] Figure 2 It is the effect diagram of the Block diagram in this application;
[0051] Figure 3 This is an optimization effect diagram of the code mixing method based on sequence prediction dynamic programming in this application;
[0052] Figure 4 It is a structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0054] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.
[0055] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0056] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0057] The design of a multi-material palletizing strategy needs to take into account the following aspects:
[0058] The first is the diversity of material properties. Different types of materials may have different sizes, weights, stacking restrictions and other characteristics. Therefore, it is necessary to design the stacking plan in a targeted manner to minimize space waste and ensure the stability and safety of the stacking.
[0059] The second is the flexibility of the stacking equipment. The use of a variety of material stacking strategies requires that the stacking equipment in the warehouse has a certain degree of flexibility to adapt to the stacking needs of different types of materials, such as height-adjustable shelves, automatic stacking robots, etc.
[0060] The third is the optimization of the stacking process. By optimizing the stacking process of materials, the operation efficiency of the warehouse and the processing speed of materials can be improved. For example, the stacking sequence of different types of materials can be reasonably arranged to reduce the number of material handling and adjustment times.
[0061] The fourth is safety and stability. When designing various material stacking strategies, the stability of the stacking structure and the safety risks in the material stacking process must be fully considered to ensure the safety and reliability of the material stacking operation.
[0062] Sequence Prediction Dynamic Programming is a method that combines sequence prediction and dynamic programming techniques to solve a series of prediction and optimization problems. Sequence Prediction (Sequence Prediction), sequence prediction is a technology that predicts future events or data points based on historical data. This application is used to predict the placement of materials to be loaded through existing material information. Dynamic Programming (Dynamic Programming): Dynamic programming is a method to solve complex problems by breaking them down into simpler sub-problems. It is often used to solve problems with overlapping sub-problems and optimal substructure characteristics. Dynamic programming avoids repeated calculations by storing the solutions to sub-problems (usually in a table), thereby improving efficiency.
[0063] Based on the above situation, the embodiments of the present application provide a code mixing method, an electronic device and a storage medium based on sequence prediction dynamic programming.
[0064] First, refer to Figure 1 The embodiment of the present application provides a code mixing method based on sequence prediction dynamic programming. The algorithm aims to optimize the layout of loaded materials through dynamic programming to maximize the use of pallet space. Its main goal is to determine the optimal placement plan by assuming that the future sequence is the same when the pallet size information, the information of the materials to be loaded and the information of the loaded materials are known. The specific steps are described as follows.
[0065] Step S1, obtaining information of materials to be loaded, pallet information, loaded pallet type information and mixed code parameters.
[0066] Among them, the loaded pallet type information represents the materials that have been actually stacked and can no longer be moved, and includes the material's location information and rotation information; the material information to be loaded refers to the materials to be loaded, and the information includes the length, width, height and material type; the pallet size is the size of the available space; the mixed code parameters include the minimum spacing between materials, height tolerance range, etc.
[0067] Step S2: constructing a site block diagram according to the loaded stack type information and the mixed code parameters, wherein the site block diagram includes site obstacle information.
[0068] Specifically, the code mixing parameters include a height tolerance parameter; and constructing a site Block diagram according to the loaded pallet type information and the code mixing parameters includes:
[0069] Obtaining a reference height (i.e., a palletizing height), and determining a reference height range according to the height tolerance parameter and the reference height;
[0070] The reference height range is based on comparing the actual heights of all positions of the loaded stack type information to obtain obstacle information;
[0071] Determine the size of the pallet according to the pallet information, construct an initial map based on the pallet size, mark the locations in the initial map with obstacle types according to the obstacle information, and obtain the site block map;
[0072] Among them, the position smaller than the reference height range is marked as a hole obstacle area, and the position larger than the reference height range is marked as a cliff obstacle area.
[0073] In another preferred embodiment, the initial map and the block map can be set as a two-dimensional array, usually corresponding to the size of the pallet, to indicate the occupancy status of each cell on the pallet. Create a two-dimensional array (i.e., the initial map) of the same size as the pallet, with all elements initialized to 0, indicating no obstacles. Traverse the information of all loaded materials, and mark the corresponding cells in the block map according to their position and size. The values of these cells can be set to 1 or other non-zero values to indicate that they are occupied.
[0074] Then identify obstacles, for example, a hole obstacle (assuming a value of 1): represents a hole below a certain height tolerance range, and materials cannot be placed in these locations; a cliff obstacle (for example, a value of 2): represents an obstacle above the height tolerance range, and materials cannot intersect with it. Update the corresponding cells in the block diagram based on the loaded materials and the identified obstacles. If the materials have special shapes or rotation states, these factors need to be considered in the block diagram to ensure that they do not exceed the actual occupancy range of the materials. At the same time, ensure that the markings in the block diagram accurately reflect the size of the materials and their position on the pallet. Reference Figure 2 , dark blue is the cliff obstacle area, white is the hollow obstacle area, and the black part represents the place where materials can be placed. The size of the pallet is not shown in the figure. In addition, this application uses 0 to represent no obstacle, 1 to represent hollow obstacles, and 2 to represent cliff obstacles. Hole obstacles represent holes below the height tolerance range, and cliff obstacles represent obstacles above the height tolerance range.
[0075] Preferably, if the material can be rotated, a block diagram needs to be generated for each possible rotation state; if a certain distance may need to be maintained between materials, this also needs to be reflected in the block diagram; and if the height of the material stack may be limited, this factor needs to be considered in the block diagram.
[0076] Block diagrams are used in dynamic programming algorithms to quickly determine whether materials can be placed in a specific location and how to place them to maximize space utilization. Block diagrams provide an intuitive way to view and understand the layout of materials on a pallet; and by viewing the block diagram, you can quickly determine whether a location is suitable for placing new materials. That is, the block diagram is generated to effectively represent and process space occupancy and obstacle information in the algorithm.
[0077] Step S3, using the pallet information and the site block diagram as the first constraint condition, determining the area where the material can be placed through a differential array preprocessing method.
[0078] Specifically, the first constraint condition includes the following:
[0079] The pallet size is obtained according to the pallet information, and any position of the material is limited to not exceed the range of the pallet size; the cliff obstacle area and the hole obstacle area are determined according to the obstacle information of the site block map, and it is limited that any position of the material does not intersect with the cliff obstacle area, and the corner point of the material does not intersect with the hole obstacle area.
[0080] In one embodiment, for determining the material placement area by the differential array preprocessing method, the following implementation method can be referred to. For example, with the size of the pallet as the boundary, the plane of the stacking height is selected as a two-dimensional map, wherein each cell represents a position in the pallet, and with the size of the pallet as the boundary, the plane of the stacking height is selected as a two-dimensional map; the initial values of all elements in the differential array are set to 0, respectively representing the rows and columns of the two-dimensional map, and the initial differential array is reassigned according to the obstacle information of the site Block map; and the two initial differential arrays are prefixed and processed respectively to obtain the two-dimensional differential array; the two-dimensional differential array is traversed to determine whether the elements in the two-dimensional differential array are preset values, and if so, it is determined that the position in the two-dimensional map corresponding to the element is the material placement area.
[0081] For example, for any position of the cliff obstacle (block[i, j] == 2), assuming that the lower right corner of the material position coincides with this point, mark the position of the upper left corner of the material (i-w+1, j-h+1) and the position of the lower right corner +1 (i+1, j+1) as 1 in the difference array, and then mark the position of the upper right corner of the material (i-w+1, j + 1) and the position of the lower left corner (i + 1, j-h+1) as -1. If the minimum interval is considered, the size of the material needs to be expanded accordingly. Perform prefix sum (for example, a[n] = a[n] + a[n - 1]) on the horizontal and vertical directions of the difference array to obtain the final placement space. At this time, the position of 0 in the array can be used to place the material; where w and h are the length and width of the material.
[0082] If the current position [i, j] is an empty obstacle area, after performing the prefix sum, the positions corresponding to the four corners of the material must be marked as values indicating that they cannot be placed; if the current position [i, j] is an obstacle-free area, the value is assigned to 0 and no reassignment is required.
[0083] Regarding the determination of the area where materials can be placed, this application determines the space where the current materials to be loaded can be placed based on the loaded materials information and the pallet size information. In addition, considering the different shapes and rotation states of the materials, it is necessary to maintain the type of materials that can be placed at each position and the rotation state (generally rotated 90 degrees). Then, through a two-dimensional differential array, all possible placement points are calculated, including both rotated and non-rotated cases. It should be noted that for hollow obstacles, only the corner points cannot be placed. For cliff obstacles, all points in the material cannot be placed. Constraints. If it is found that the current point cannot be placed, the array of the next placeable point is called the next array. It is also necessary to maintain the two rotation states, and the direction only needs to be the positive direction of x and y.
[0084] In a preferred embodiment, creating and maintaining a next table is generally used to optimize the search process, especially in search problems involving two-dimensional space (such as a map or grid). The next table is used to record the position to move to next when searching forward or backward from the current position during the forward search process. The following are the specific implementation steps.
[0085] Create two next tables, next_row and next_col, which are the same size as the tray, that is, the number of rows and columns. First, traverse backwards to calculate next_row, starting from the bottom (or top) of the grid, and traverse each row in reverse. For each position in each row, check whether it is a droppable space (that is, the value or state of the position meets the drop condition). If it is a droppable space, reset step to 0 and set next_row[i] to the value of step; if not, increase step by 1 and set next_row[i] to the value of step.
[0086] Then reverse the calculation of next_col, similar to the calculation of next_row, but this time reverse each column, for each position in each column, check whether it is a placeable space, if so, reset step and set next_col[i] to the value of step; if not, increase step and set next_col[i] to the value of step.
[0087] Finally, we get the next table used in the forward search. During the forward search, when we need to determine the next step, we can use the next_row and next_col tables to quickly skip the continuous non-placeable spaces, thereby improving the search efficiency. That is, through the above steps, we get the next tables in both directions, which can guide the next step in the search process.
[0088] Step S4, determining a plurality of stacking heights according to the information of the materials to be loaded, and calculating the optimal placement plan of the material placement area under different stacking heights through a pre-constructed dynamic programming algorithm model.
[0089] Specifically, create a dp array, the size of which is limited according to the size of the tray, and all values in the dp array are initialized to 0;
[0090] Obtain the length and width of the material to be placed and the next table, and calculate the maximum number of materials dp[i, j] that can be placed in the range corresponding to the placement area in the dp array, adjust the area size (i, j), traverse the dp array, and update the value of dp[i, j] and the next table according to the state transition equation;
[0091] In the process of updating dp[i, j], the size of the transfer source area (i, j) of the current maximum material quantity is recorded to obtain the transfer path;
[0092] After the state transfer is completed, the maximum number of materials that can be placed on the entire pallet dp[PalletWidth, PalletHeight] and the optimal transfer path are obtained;
[0093] Starting from dp[PalletWidth, PalletHeight], backtracking is performed according to the optimal transfer path and the next table until dp[0, 0], and the optimal placement solution under the current palletizing height is obtained.
[0094] In this embodiment, the dynamic programming algorithm model includes a state transfer equation and a second constraint condition, wherein:
[0095] The state transfer equation is:
[0096] dp[i,j] = max(dp[i - w,j] + m(iw,0,w,j),dp[i - h,j] +m(ih,0,h,j),dp[i,j - w] +m(0,jw,i,w), dp[i,j - h] + m(0,jh,i,h))
[0097] Among them, dp[i, j] represents the maximum number of materials placed in the state transition area with length and width i and j, w and h represent the length and width of the material respectively, and max() represents the maximum value; in the above formula, m() represents the predicted number of materials that can be placed in the newly added area. Specifically, m(iw, 0, w, j) represents the maximum number of materials that can be placed in the area with length and width w and j when the upper left corner coordinates are (iw, 0); m(ih, 0, h, j) represents the maximum number of materials that can be placed in the area with length and width h and j when the upper left corner coordinates are (ih, 0); m(0, jw, i, w) represents the maximum number of materials that can be placed in the area with length and width i and w when the upper left corner coordinates are (0, jw); m(0, jh, i, h) represents the maximum number of materials that can be placed in the area with length and width i and h when the upper left corner coordinates are (0, jh). That is, the area size (i, j) of the transfer source of the maximum number of materials is continuously selected through the above state transfer equation, and its position information and placement direction are recorded to obtain the transfer path.
[0098] The second constraint condition includes: the gap between the materials is not less than a preset minimum interval.
[0099] For example, when the stacking height is determined (the obstacles on the planes at different stacking heights are different), the optimal placement solution is determined by a dynamic programming algorithm. Specifically, dp[i, j] represents the maximum number of materials that can be placed in an area with length and width i and j. The stacking problem of this embodiment can be solved by dynamic programming, and the rotation state of the material needs to be considered.
[0100] Specifically, create a dp array of size PalletWidth + 1 times PalletHeight + 1, with all values initialized to 0. Based on the dimensions w and h of the items, calculate the maximum number of items that can be placed in any given area. During this time, use the next table to quickly find the maximum number of items that can be placed in a given remaining space.
[0101] Then the state transfer calculation is performed, traversing each possible region size (i, j) of the dp array. For each region, the value of dp[i, j] is updated according to the state transfer equation, including the following four placement schemes:
[0102] dp[i - w, j] + calculate the number of places that can be placed (i, j, w);
[0103] dp[i - h, j] calculates the number of places that can be placed (i, j, h);
[0104] dp[i, j - w] + calculate the number of places that can be placed (i, j, w);
[0105] dp[i, j - h] + calculate the number of places that can be placed (i, j, h);
[0106] Then the one with the largest result is selected as the transfer source for the next calculation. Here, the calculation of the number of available places (i, j, k) is a function that calculates the maximum number of materials that can be placed in different placement directions and different placement situations based on the current size of the area and the size k of the material (which can be w or h).
[0107] In the process of updating dp[i, j], the state transition of this embodiment records the source of the transfer that leads to the current maximum value, which can be achieved through an additional array or data structure. After the state transition is completed, dp[PalletWidth, PalletHeight] will contain the maximum number of materials that can be placed on the entire pallet. Starting from dp[PalletWidth, PalletHeight], backtracking according to the recorded path until dp[0, 0], the optimal placement solution is obtained, where PalletWidth and PalletHeight are the length and width of the pallet respectively.
[0108] And in the dynamic planning process, if the current material cannot be placed in the current area size, the size of the area is adjusted and re-planned; if it can be placed, the position and placement method (that is, in which direction the length and width of the material are) are recorded, and then the size of the next material can be obtained and planning can continue, thereby realizing rapid palletizing of mixed-code materials.
[0109] In this embodiment, the optimal state is obtained through dynamic programming. Using the dynamic programming algorithm, this embodiment can assume that all future materials are current materials and calculate the optimal state under the current strategy. The optimal placement plan is determined by considering the volume of each placeable space and the volume of the material to be loaded. In a state transfer calculation process, since the material sequence is assumed to be the same material, what is actually compared is how many can be put down. The maximum number that can be put under the specified strategy is obtained through dynamic programming. Dynamic programming can directly derive the maximum number of places that can be placed under the current strategy (i.e., the optimal), but does not determine the specific placement method. For this reason, this application can reverse the dynamic planning to derive a specific placement plan.
[0110] In the process of dynamic programming, the previous step of state transfer is recorded. After the algorithm is completed, one of the optimal state transfer paths can be inferred through the path. Then, based on the results of dynamic programming, the placement plan with the optimal volume ratio can be reversely derived. Ensure that each material is placed in the best position to maximize the use of pallet space.
[0111] Step S5, compare the optimal placement plans under all stacking heights, and select the optimal placement plan as the final mixed-code placement plan according to a preset selection rule. The preset rule includes: comparing the optimal placement plans of different stacking heights, selecting the optimal placement plan with the lowest stacking height and at least one material as the final mixed-code placement plan; or comparing the optimal placement plans of different stacking heights, selecting the optimal placement plan with the largest number of materials as the final mixed-code placement plan.
[0112] Specifically, the present application repeats the above steps for each layer of stacking height to obtain the optimal placement plan, and then calculates the optimal layout of each layer based on the height limit of the pallet and the information of the loaded materials. The optimal plan for each layer refers to the plan under different reference heights (stacking heights), and the optimal plan for the current layer is obtained. The algorithm can be performed for different heights, so that different stacking types will be obtained. This step can be performed according to different strategies. In some embodiments, a plan that can hold at least one material and has the lowest stacking height can be selected. This can make full use of space and provide utilization in the entire stacking type.
[0113] After each material is placed, the available space is updated and the available space and volume ratio of each location are recalculated for subsequent loading calculations. Figure 3 , Figure 3 The stacking effect diagram is obtained by adopting the mixed code based on sequence prediction dynamic programming provided by the present application.
[0114] In summary, the optimization method provided in the embodiment of the present application achieves the following effects through the relaxation algorithm proposed in the present application: the algorithm of the present invention adopts a dynamic programming model, which has a wide range of applications, low computational complexity, and high performance compared with the existing search scoring strategy. It not only has significant technical effects in maximizing space utilization, improving loading efficiency, adaptability, and scalability, but can also be effectively applied to various loading scenarios, and has significant improvements on scenarios with more sequences.
[0115] In another embodiment of the present application, the detailed process of the code mixing method provided by the present application is shown as follows.
[0116] Step 1: Input the information required by the algorithm, such as loaded pallet type information, material information to be loaded, pallet size, mixed code parameters, etc. Among them, the loaded pallet type information represents the materials that have been actually stacked and can no longer be moved, including the location information and rotation information of the materials. The material information to be loaded is the material to be loaded, including the length, width and height of the material. The pallet size is the size of the space that can be placed, the mixed code parameters include the minimum spacing of materials, the height tolerance range, etc.
[0117] In the implementation of this application, different stacking heights can produce different mixed-code placement results. The following algorithm explanation takes a single-layer solution as an example.
[0118] Step 2: Obtain a block diagram for subsequent algorithm use. The block diagram is an array representing the current spatial obstacles. 0 represents no obstacle, 1 represents a hole obstacle, and 2 represents a cliff obstacle. A hole obstacle represents a hole below the height tolerance range, and a cliff obstacle represents an obstacle above the height tolerance range.
[0119] Step 3: Preprocess the placement area through the differential array. The constraints are that the material must not exceed the pallet range, must not intersect with cliff obstacles, and the corner points must not intersect with hollow obstacles.
[0120] In order to improve the computing speed, the embodiment of the present application maintains a next table of materials (which stores the step length between two available placement positions), that is, when the current material is at the current position, if it can be placed, the value is the current position, if it cannot be placed, the value is the position where the next material can be placed. The purpose of maintaining this table is to reduce the subsequent calculation amount, and the next table can be calculated through the above-mentioned available placement area.
[0121] Step 4: Use the dynamic programming algorithm to calculate the optimal placement solution under the current transfer equation. The following is a detailed explanation of the algorithm, which is only for one rotation state.
[0122] In this embodiment, the dynamic programming state transfer equation is:
[0123] dp[i,j] = max(dp[i - w,j] + m(iw,0,w,j),dp[i - h,j] +m(ih,0,h,j),dp[i,j - w] +m(0,jw,i,w), dp[i,j - h] + m(0,jh,i,h))
[0124] Among them, dp[i, j] represents the maximum number of materials that can be placed in an area with length and width of i and j, w and h represent the length and width of the materials, and max() represents the maximum value.
[0125] In this embodiment, in order to ensure that the materials can be placed in the corresponding positions, the minimum interval and the constraints of the placement area need to be considered during dynamic programming. Therefore, the j / / w part in the transfer equation needs to be calculated by looping the next table to obtain the actual number of places that can be placed. At the same time, the path of each state transfer needs to be recorded during the state transfer process so that the optimal solution can be obtained by subsequent backtracking.
[0126] After the state transition area is adjusted, dp[tray width, tray length] is used as the optimal solution, and the optimal placement solution is obtained through the backtracking path of the recorded state transition table. The result is returned. At this point, the algorithm is completed and the optimal placement solution under the current conditions has been solved.
[0127] Step 5: For different heights, different optimal solutions can be obtained. The optimal solutions for different heights can be obtained by calling this algorithm multiple times. The optimal solutions for different heights can be compared and the best one can be selected. In this embodiment, the result with the lowest height and at least one material can be placed is considered as the optimal solution.
[0128] In summary, the code mixing method provided in the embodiment of the present application has the following effects:
[0129] Maximize space utilization: Through dynamic programming and reverse derivation of the optimal volume ratio placement plan, the algorithm can make the layout of loaded materials more compact, thereby maximizing the use of pallet space and improving space utilization;
[0130] Efficient loading strategy: By maintaining the available space and dynamically planning to obtain the optimal state, the algorithm can effectively determine the best loading plan for each layer, thereby improving loading efficiency;
[0131] Strong adaptability: The algorithm takes into account the different shapes and rotation states of materials, and can flexibly adapt to the loading requirements of various materials, with strong adaptability;
[0132] Good scalability: The algorithm can be applied to materials of various pallet sizes and shapes, and has good applicability and scalability;
[0133] Automated optimization: The algorithm automatically calculates the optimal loading plan, reducing the need for human intervention, improving the degree of automation in the loading process and reducing labor costs.
[0134] In a second aspect, an embodiment of the present application provides an electronic device, Figure 4 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 4 As shown, the electronic device may include a processor 11 and a memory 12 storing computer program instructions.
[0135] Specifically, the processor 11 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0136] Among them, the memory 12 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 12 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 12 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 12 may be inside or outside the data processing device. In a specific embodiment, the memory 12 is a non-volatile memory. In a specific embodiment, the memory 12 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0137] The memory 12 may be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program instructions executed by the processor 11 .
[0138] The processor 11 reads and executes computer program instructions stored in the memory 12 to implement any one of the code mixing methods based on sequence prediction dynamic programming in the above embodiments.
[0139] In one embodiment, the electronic device may further include a communication interface 13 and a bus 10. Figure 4 As shown, the processor 11, the memory 12, and the communication interface 13 are connected via a bus 10 and communicate with each other.
[0140] The communication interface 13 is used to realize the communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication port 13 can also realize data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage and image / data processing workstations.
[0141] The bus 10 includes hardware, software or both, and couples the components of the electronic device to each other. The bus 10 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 10 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 10 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0142] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a program stored thereon, and when the program is executed by a processor, the mixing method based on sequence prediction dynamic programming provided in the first aspect is implemented.
[0143] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0144] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the mixing method based on sequence prediction dynamic programming provided in the first aspect.
[0145] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0146] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A code mixing method based on sequence prediction dynamic programming, characterized in that: include: Obtain information about materials to be loaded, pallet information, loaded pallet type information and mixed code parameters; Constructing a site block diagram according to the loaded pallet type information and the mixed code parameters, wherein the site block diagram includes obstacle information of the site; Taking the pallet information and the site block diagram as the first constraint condition, the material placement area is determined by a differential array preprocessing method; Determine multiple stacking heights according to the information of the materials to be loaded, and calculate the optimal placement plan of the material placement area under different stacking heights through a pre-built dynamic programming algorithm model; Compare the optimal placement plans for all palletizing heights, and select the optimal placement plan as the final mixed-code placement plan according to the preset selection rules; Among them, the constraints based on pallet information and site block diagram include: Obtaining a pallet size according to the pallet information, and limiting any position of the material to not exceed a range of the pallet size; Determine the cliff obstacle area and the hole obstacle area according to the obstacle information of the site block map, and limit any position of the material not to intersect with the cliff obstacle area, and limit the corner point of the material not to intersect with the hole obstacle area; The method of determining the material placement area by using a differential array preprocessing method includes: Taking the size of the pallet as a boundary, a plane of the palletizing height is selected as a two-dimensional map; Creating two initial difference arrays with initial values of 0 according to the two-dimensional map, respectively representing the rows and columns of the two-dimensional map, and re-assigning the initial difference arrays according to the obstacle information of the site Block map; And respectively perform prefix sum processing on the two initial difference arrays to obtain a two-dimensional difference array; Traversing the two-dimensional difference array, determining whether an element in the two-dimensional difference array is a preset value, and if so, determining that the position corresponding to the element in the two-dimensional map is an area where materials can be placed; The method of calculating the optimal placement scheme of the material placement area at different stacking heights by using a pre-built dynamic programming algorithm model also includes: Create a dp array, whose size is limited according to the size of the tray, and all values in the dp array are initialized to 0; Get the length, width and next table of the material to be placed, and calculate the maximum number of materials dp[i, j] that can be placed in the range corresponding to the placeable area in the dp array, adjust the area size (i, j), traverse the dp array, and update the value of dp[i, j] and the next table according to the state transition equation; In the process of updating dp[i, j], the size of the transfer source area (i, j) of the current maximum material quantity is recorded to obtain the transfer path; After the state transfer is completed, the maximum number of materials that can be placed on the entire pallet dp[PalletWidth, PalletHeight] and the optimal transfer path are obtained; Starting from dp[PalletWidth, PalletHeight], backtracking is performed according to the optimal transfer path and the next table until dp[0, 0], to obtain the optimal placement solution under the current palletizing height; The next table is used to store the moving step length of the next material placement in each area size [i, j].
2. The code mixing method according to claim 1, characterized in that: The code mixing parameters include a height tolerance parameter; and constructing a site Block diagram according to the loaded pallet type information and the code mixing parameters includes: Acquire a reference height, and determine a reference height range according to the height tolerance parameter and the reference height; The reference height range is based on comparing the actual heights of all positions of the loaded stack type information to obtain obstacle information; Determine the size of the pallet according to the pallet information, construct an initial map based on the pallet size, mark the locations in the initial map with obstacle types according to the obstacle information, and obtain the site block map; Among them, the position smaller than the reference height range is marked as a hole obstacle area, and the position larger than the reference height range is marked as a cliff obstacle area.
3. The code mixing method according to claim 1, characterized in that: The dynamic programming algorithm model includes a state transfer equation and a second constraint condition, wherein: The state transfer equation is: dp[i,j] = max(dp[i - w,j] + m(iw,0,w,j),dp[i - h,j] +m(ih,0,h,j),dp[i,j- w] +m(0,jw,i,w), dp[i,j - h] + m(0,jh,i,h)) Among them, dp[i, j] represents the maximum number of materials placed in the state transition area with length and width i and j, w and h represent the length and width of the material respectively, max() represents the maximum value; m() represents the predicted number of materials placed in the newly added area; The second constraint condition includes: the gap between materials is not less than a preset minimum interval.
4. The code mixing method according to claim 1, characterized in that: The next table creation and maintenance includes: Create two next tables, next_row and next_col, whose size is the same as the dp array, to store the moving step step of the next material placement in each area size [i, j]; Starting from the bottom of the next table, reversely traverse and calculate each position of each row of next_row to determine whether the current position is a droppable area; if so, reset step to 0, and set the value of the current position in next_row to the value of step; if not, add 1 to step, and set the value of the current position in next_row to the value of step; Starting from the bottom of the next table, reversely traverse and calculate each position of each column of next_col to determine whether the current position is a droppable area; if so, reset step to 0, and set the value of the current position in next_row to the value of step; if not, add 1 to step, and set the value of the current position in next_row to the value of step; After the traversal is completed, the next table for forward search is obtained according to the next_row and next_col.
5. The code mixing method according to claim 1, characterized in that: The preset selection rules include: Compare the optimal placement plans for different stacking heights, and select the optimal placement plan with the lowest stacking height and at least one material as the final mixed-code placement plan; or, Compare the optimal placement plans for different stacking heights, and select the optimal placement plan with the largest number of materials as the final mixed-code placement plan.
6. An electronic device, characterized in that: The invention comprises a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the mixing method based on sequence prediction dynamic programming as claimed in any one of claims 1 to 5 is implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a mixing method based on sequence prediction dynamic programming as described in any one of claims 1 to 5 is implemented.
