A 3D Sphere Bin Packing Method Based on Improved Genetic Algorithm and Simulated Annealing Algorithm

By dividing the 3D sphere packing problem into two stages and using an improved genetic algorithm and simulated annealing algorithm to optimize the solution, the problem of low space utilization in the decomposition and display of 3D models by traditional algorithms is solved, and efficient and real-time model display effect is achieved.

CN113128683BActive Publication Date: 2026-08-04CHICHENG TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHICHENG TECH
Filing Date
2021-04-15
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Traditional model decomposition algorithms suffer from low space utilization and poor versatility when dealing with irregularly distributed 3D models with a large number of parts, resulting in poor model display effects and failing to meet real-time requirements.

Method used

The 3D sphere packing problem is divided into two stages: packing the sphere into an inscribed cube space and unfolding the cube-sphere layout. An improved genetic algorithm and a simulated annealing algorithm are used to handle these stages respectively. The solution process is optimized by position encoding and adaptive adjustment of the crossover rate and mutation rate.

Benefits of technology

It significantly improves solution efficiency and immediacy, realizes the correspondence between part position and initial position, enhances model display effect, and has strong versatility and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113128683B_ABST
    Figure CN113128683B_ABST
Patent Text Reader

Abstract

This invention relates to the field of 3D model display technology, and in particular to a 3D sphere binning method based on an improved genetic algorithm and a simulated annealing algorithm. The method includes a data preprocessing stage, a binning stage of the sphere inscribed in a cube space, and a "cube-sphere" unfolding stage. This invention divides the complete problem into two parts, which are solved using the improved genetic algorithm and the simulated annealing algorithm respectively. The two algorithms play their respective advantages in different stages, achieving high efficiency, high accuracy, and high versatility in solving the problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of three-dimensional model display technology, specifically to a three-dimensional sphere packing method based on an improved genetic algorithm and a simulated annealing algorithm. Background Technology

[0002] When rendering and displaying 3D models, it is sometimes necessary to decompose the model at a certain level to achieve a more complete display effect. Traditional model decomposition algorithms typically multiply the difference between the initial part and the center point position, adjusting the final position of the part after unfolding to achieve the desired decomposition display effect. However, this simple position processing method suffers from low space utilization and poor versatility when dealing with models with irregular distribution and a large number of parts. It often results in overlapping parts after decomposition, significantly affecting the model display effect and hindering the promotion of this type of 3D model display solution.

[0003] The bin packing problem is a classic discrete combinatorial optimization problem that aims to pack a given number of "bins" into a specified target container according to certain constraints. This is highly relevant to our problem of decomposing model parts and displaying their final positions. Therefore, the calculation of the final positions of each part after model decomposition will be transformed into a three-dimensional bin packing problem in spherical space for solution.

[0004] Solving the 3D bin packing problem is difficult due to the influence of controllable factors. Conventional enumeration algorithms require an immeasurable amount of time to obtain an exact solution, making them impractical. Therefore, heuristic algorithms are often used to approximate solutions for this type of problem. However, even with traditional heuristic algorithms such as genetic algorithms, the solution time required for model display on web pages still cannot meet the real-time requirements, making it impossible to provide timely feedback after a user clicks. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention aims to provide a three-dimensional sphere binning method based on an improved genetic algorithm and simulated annealing algorithm. The solution process for the binning problem in three-dimensional sphere space is divided into two parts: binning within a cube space inscribed in the sphere, and "cube-sphere" layout unfolding. For binning within a cube space inscribed in the sphere, an improved genetic algorithm module is used to process the position of the model parts in the cube space according to preset position encoding and other processing information, obtaining an intermediate solution. Next, the "cube-sphere" layout unfolding process is performed using a simulated annealing algorithm to unfold the intermediate solution in sphere space and adjust its position to achieve the final position information.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a three-dimensional sphere binning method based on an improved genetic algorithm and a simulated annealing algorithm, comprising a data preprocessing stage, a binning stage of inscribed cube space within the sphere, and a "cube-sphere" unfolding stage.

[0007] (1) The steps in the data preprocessing stage are as follows:

[0008] (1.1) Receive the model information to be decomposed;

[0009] (1.2) Design the encoding of the received model information;

[0010] (2) The steps for the packing stage of the inscribed cubic space within the sphere are as follows:

[0011] (2.1) Generate an initial solution based on the preprocessed information;

[0012] (2.2) Based on the fitness function, solve for the fitness function value of the first generation population in the current initial solution;

[0013] (2.3) Based on the current crossover rate and mutation rate, randomly select individuals that need to be crossovered and mutated and perform the operation to generate some new individuals;

[0014] (2.4) Based on the fitness function values ​​of each individual in the current generation, use the selection operator to select individuals that will enter the next generation of the population;

[0015] (2.5) Determine whether the offspring have evolved, and adjust the crossover rate and mutation rate accordingly;

[0016] (2.6) Perform a termination condition check. If the current evolution count counter reaches the preset value, it means that the solution has been completed and the operation ends. If the preset evolution count has not been reached, return to step (2.2) and repeat the following steps until termination.

[0017] (3) The steps of the “cube-sphere” unfolding stage are as follows:

[0018] (3.1) Initialize the parameters based on the intermediate solution obtained in step (2);

[0019] (3.2) Use the partitioning method to generate the initial solution of the simulated annealing algorithm;

[0020] (3.3) Proceed to the sampling process, generate a new solution that meets the constraints, and determine whether to accept the solution;

[0021] (3.4) Update the temperature and determine whether the termination condition is met. If it is met, end the solution and output the current solution as the optimal solution. Otherwise, return to step (3.3) to perform the sampling operation again.

[0022] Preferably, the model information to be decomposed in step (1) includes the initial position coordinates of the model to be decomposed and the center coordinates of the parent node's bounding box, as well as the center coordinates and radius of the target container sphere.

[0023] Preferably, in step (1.2), before designing the location coding, the constraints should first be determined based on the actual usage requirements;

[0024] Its specific location encoding method is as follows:

[0025] ① For each individual part, obtain a three-digit position code based on its original position;

[0026] ② Divide the model into N parts along the z-axis based on the number of parts to be decomposed;

[0027] ③ Starting from the maximum value of the z-axis coordinate, the first bit of the code for each model position in this group is 0, and so on, up to code N-1;

[0028] ④ After that, for any group, establish a coordinate system with the center point, and assign the remaining position codes according to its position in the quadrant, distinguishing between 1 and -1;

[0029] ⑤ After obtaining the position code for each part, arrange it into a data string p according to the loading order. p contains the contents of all objects to be packed. Each integer value pi in the data string represents the number of the corresponding object to be packed.

[0030] Preferably, step (2.1) is performed as follows:

[0031] ① Based on the hierarchical coding data in the position coding, that is, the first data, all the models to be packed are divided into n groups according to the hierarchy;

[0032] ② For each group of objects, further subdivide them into 4 quadrant groups based on the last two digits of the code, and arrange them in ascending order according to the size of the objects in each group to form a list of hierarchical blocks to be packed.

[0033] ③ The packaging containers are also divided into 4n sub-containers in the same way.

[0034] Preferably, in step (2.3), the crossover operation uses two-point crossover, randomly selecting two marker points k1 and k2 from two individuals, exchanging the distribution results of the marker points in the two individuals, and generating two new individuals; the mutation operation uses distinct mutation, randomly selecting two assigned part information from a single individual, and exchanging their positions under the condition of satisfying the constraints.

[0035] In step (2.4), the selection operation uses roulette wheel selection, which assigns each individual in the current population to a specified numerical interval segment. Based on the result obtained from the fitness function, the length of each individual segment is allocated proportionally. Subsequently, the operator generates random numbers within the interval. Based on the position of the random number, the population individual corresponding to that region is obtained. This individual is the selected target individual. Random numbers are generated in a loop until the number of population individuals extracted reaches the set requirement.

[0036] Preferably, the crossover rate and mutation rate controlling the crossover and mutation operations are adaptively adjusted according to step (2.5). The adjustment method is based on whether evolution has occurred in the offspring. If the maximum fitness function value in the new generation is greater than the maximum value in the previous generation, it indicates that evolution has occurred, and the crossover rate and mutation rate are increased. Let p represent the current crossover rate value and t represent the number of generations in the population that has not evolved up to the latest generation. The increase in crossover rate follows the function f(t) = (1-p)e (-1 / t) ;

[0037] Regarding the mutation rate, since the probability of mutation is usually less than the probability of crossover, the mutation rate increases according to the function f(t) / 5. Conversely, if no evolution occurs, the two probabilities decrease. Let d represent the previous generation's optimal fitness function value, then the crossover rate decreases according to the function f(t) = d. t ·p; Similarly, the function for decreasing the rate of variation is f(t) / 3.

[0038] Preferably, the parameters in step (3.1) include the set initial temperature T, the termination temperature Ts, and the number of samplings L.

[0039] Preferably, the specific method of step (3.2) is as follows: First, based on the shape characteristics of the cube and its circumscribed circle, the objects in the cube space to be processed are divided into six parts, and each part is unfolded in the direction of its corresponding remaining spherical space. At the same time, according to the volume of the spherical container and the volume of the inscribed cube, the remaining unplaced space volume in each direction is calculated; and the models in each part are arranged in ascending order according to their volume to obtain the corresponding object sequence T of that part.

[0040] Based on the extracted sequence, calculate whether the total volume of the extracted objects is less than or equal to the total volume of the extracted objects. If so, continue to extract the next object; otherwise, end the object extraction operation.

[0041] For the objects that have been removed, place them randomly in accordance with the constraints. Repeat the distribution operation on the six parts according to the above logic to obtain the initial solution.

[0042] Preferably, according to step (3.3), when entering the sampling process, the current temperature t, the optimal solution B and the current solution s are used as parameters, and the number of times the solution effect optimization does not occur is set to p = 0;

[0043] Then, based on the neighborhood selection operation, a new solution state s' is generated using the current solution as a basis, and the fitness function is used to evaluate the difference between the two. The fitness function value is the current space utilization value.

[0044] The neighborhood selection operation described above is as follows: First, the neighborhood is updated by setting the unfolding method; for the previously obtained solutions, any two object models in the same quadrant are randomly swapped, while the contents of different quadrants are not swapped, thus obtaining a new solution with constant directionality; second, the neighborhood is controlled by setting the placement direction.

[0045] Based on the sampling results, the decision is made on whether to accept the solution. If the difference in the fitness function is greater than 0, it means that a better solution has been obtained. The current best solution is then set as the new solution s' and the optimization counter p is set to zero.

[0046] Conversely, the decision to accept a new solution is based on a preset probability, which is determined by the fitness function difference and the current input temperature T.

[0047] If the probability is acceptable, then the current solution is accepted according to the above rules; if it is still not accepted, then the new solution is abandoned, and the number of samplings and the unoptimized counter p are updated.

[0048] Repeat the current sampling process until the preset maximum number of samplings L is reached.

[0049] Preferably, in step (3.4), the temperature update condition is the reference sampling acceptance number acc, and the update value is updated each time; the termination condition is whether the updated temperature reaches the end temperature. If it does, the solution is terminated and the current solution is output as the optimal solution. Otherwise, the process returns to step (3.3) to re-perform the sampling operation.

[0050] Compared with the prior art, the beneficial effects of the present invention are:

[0051] 1) By solving the 3D bin packing problem of spheres in segments, the functional advantages of the two algorithms in different fields are fully utilized, resulting in a significant improvement in solution efficiency and enhanced algorithm immediacy;

[0052] 2) A position coding design based on the original model part position was adopted, and the constraint conditions of the candidate solution in the solution process were determined based on this, realizing the correspondence between the part position after the solution and the initial position, which can achieve an intuitive display effect;

[0053] 3) This invention has strong versatility and scalability. Because it uses two randomized solution algorithms, genetic algorithm and simulated annealing algorithm, it can achieve good solution results without adjusting parameters when facing models of different specifications and types. In practical use, it can be used to solve various types of models. Attached Figure Description

[0054] Figure 1 This is a schematic diagram of the location encoding design of the present invention;

[0055] Figure 2 This is a flowchart of the process of using an improved genetic algorithm to solve the problem of spatial binning of a sphere inscribed in a cube in this invention;

[0056] Figure 3 This is a flowchart illustrating the use of simulated annealing algorithm to solve the "cube-sphere" expansion in this invention;

[0057] Figure 4 This is a flowchart of the sampling process of the present invention. Detailed Implementation

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

[0059] To improve the real-time performance of the solution algorithm, the process of solving the bin packing problem in 3D spherical space is first divided into two parts: bin packing in inscribed cube space within the sphere, and "cube-sphere" layout unfolding. For bin packing in inscribed cube space within the sphere, an improved genetic algorithm module is used to process the position of the model parts in cube space based on preset position encoding and other processing information, obtaining an intermediate solution. Next, the "cube-sphere" layout unfolding process is performed. The simulated annealing algorithm is used to unfold the intermediate solution in spherical space and adjust the positions to achieve the final position information solution.

[0060] The bin packing problem is a classic discrete combinatorial optimization problem. Such problems typically involve selecting the optimal solution from a finite or infinite number of alternatives based on some quantifiable criterion. These alternatives usually involve several interdependent control factors, so the final solution will largely depend on the specific composition of each choice.

[0061] In practical applications, the bin packing problem often requires satisfying certain constraints: the bins to be packed must be intact and not exceed the boundaries; the objects to be packed must be spatially distinguishable and not overlap; and other constraints are set based on practical needs. The bin packing problems mentioned in this article are all three-dimensional bin packing problems, which involve multiple dimensions and are the most complex to solve, but also have the widest range of practical applications. Conventional solution methods include enumeration methods and heuristic algorithms.

[0062] Heuristic algorithms differ from conventional mathematical methods. They are based on the direct representation of the target and existing experience, applying real-life problem-solving approaches to solving complex problems. This method does not mechanically use systematic, predetermined steps to filter for the target answer; instead, it establishes a selection mechanism based on gained experience, choosing results that have proven effective. Unlike other exhaustive search algorithms that filter through a large number of possibilities, this method significantly reduces the number of trials, greatly aiding in rapid problem-solving.

[0063] Genetic algorithms and simulated annealing algorithms are the two main algorithmic foundations used in this invention, and targeted improvements are made based on these to address the problems to be solved.

[0064] Genetic algorithms extract the process of survival of the fittest and natural selection from biological theory. They transform the problem to be solved into a "population" similar to that in biology through a preset encoding method, and introduce operations such as selection, crossover, and mutation in the field of genetics. Through evolutionary generations, the best "individual" is finally obtained, which is the final solution to be obtained.

[0065] The simulated annealing algorithm's solution process references the principles of solid annealing. In this process, the solid material is first heated. As the temperature increases, the molecular motion speed within the solid gradually accelerates, increasing its internal energy. Once the object reaches a preset temperature, it begins to cool down, causing the molecules inside to slow down and their arrangement to become more ordered. When the temperature returns to the equilibrium point, the internal energy will also decrease to the set minimum value.

[0066] Based on the above principles, the algorithm introduces the optimization process from a relatively high initial "temperature". As the "temperature" decreases, based on the characteristics of probability change, it randomly searches for possible local optimal solutions in a certain solution space according to preset constraints, and finally approaches an optimal state.

[0067] The bin packing problem: Given a fixed number of "bins" (or other sets of items), we want to find a way to pack them into one or more specified target containers while satisfying certain preset conditions, which are usually to maximize utilization.

[0068] Heuristic algorithms are algorithms constructed based on intuition or experience that provide a feasible solution to every instance of a combinatorial optimization problem within an acceptable cost (referring to computation time and space). The deviation of this feasible solution from the optimal solution is generally unpredictable. Common heuristic algorithms include ant colony optimization and simulated annealing.

[0069] Genetic algorithms are computational models that simulate the biological evolutionary process based on natural selection and genetic mechanisms, as described in Darwin's theory of evolution. They are methods for searching for optimal solutions by simulating natural evolution. These algorithms use mathematical methods and computer simulations to transform the problem-solving process into processes similar to the crossover and mutation of chromosomes and genes in biological evolution.

[0070] Simulated annealing algorithm: The principle of simulated annealing is similar to that of metal annealing: applying thermodynamics to statistics, each point in the search space is imagined as a molecule in the air; the energy of a molecule is its kinetic energy; and each point in the search space, like an air molecule, carries "energy" to represent its suitability for the proposition. The algorithm starts with an arbitrary point in the search space: at each step, a "neighbor" is selected, and then the probability of reaching the "neighbor" from the current position is calculated.

[0071] This invention provides a technical solution: a three-dimensional sphere binning method based on an improved genetic algorithm and a simulated annealing algorithm. The solution to the target problem mainly consists of two parts: data preprocessing to transform the model positions to be solved into information acceptable to both algorithms; and then sequentially completing the binning of the inscribed cube space within the sphere and the unfolding of the "cube-sphere" layout using the genetic algorithm and the simulated annealing algorithm, respectively. The method includes the following steps:

[0072] (1) Data preprocessing stage:

[0073] (1.1) Receive model information, including the initial position coordinates of the model to be decomposed and the center coordinates of the parent node's bounding box, as well as the center coordinates and radius of the target container sphere;

[0074] (1.2) Encoding Design for the Obtained Model Position Data. Before designing the position encoding, constraints must first be determined based on actual usage needs. Since this invention is mainly used for decomposing and displaying parts of a rendered 3D model, it is necessary to consider that the relative positions of the decomposed parts have a good correlation with their initial state to ensure the display effect. Based on this, the following position encoding method was designed:

[0075] In this encoding method, each individual part receives a three-digit position code based on its original position. For example... Figure 1Based on the number of parts to be decomposed in the model, divide it into N groups along the z-axis. Starting from the maximum value of the z-axis coordinate, the first bit of the model position code in this group is 0, and so on, up to code N-1. Then, for any group, establish a coordinate system with the center point, and assign the remaining position codes according to its position in the quadrant, using 1 and -1 as the distinguishing factors. Figure 1 Taking the right side as an example, each dot represents the position of one of the parts. The red dot is coded as [2,-1,1], and the orange dot is coded as [2,1,-1]. After obtaining the position code for each part, it is arranged into a data string p according to the loading order. p contains all the contents of the objects to be packed, and each integer value pi in the data string represents the number of the corresponding object to be packed.

[0076] (2) Packing stage of the inscribed cube space within the sphere (e.g.) Figure 2 ):

[0077] (2.1) Based on the preprocessed information, generate an initial solution; based on the hierarchical encoding data in the position encoding, i.e., the first digit, divide all models to be packed into n groups according to their hierarchy. For objects in each group, further subdivide them into 4 quadrant groups based on the last two digits of the encoding, and arrange them in ascending order according to the size of the objects to be packed, forming a list of hierarchical blocks to be packed. At the same time, the containers to be packed are also divided into 4n sub-containers according to the same pattern.

[0078] Taking the first sub-container as an example, from the corresponding first assembly of hierarchical blocks, select hierarchical block objects that are suitable for the current remaining layout space volume and shape, and fill them into the layout space. Simultaneously, the remaining layout space is separated into unfilled subspaces, called the remaining subspaces, and the number of objects to be packed is updated and recorded. After filling one hierarchical block, return to the hierarchical block sequence and continue searching for hierarchical blocks that can be packed into the remaining subspace, repeating the process of filling, separating the remaining subspaces, and recording the number of objects to be packed in the sequence. When the current hierarchical block object sequence has zero objects, according to the hierarchical arrangement, search for hierarchical blocks in other quadrants of the same hierarchical group to determine if there are any objects to be packed into the current remaining subspace. If so, they are added to the current quadrant's filling and removed from the original hierarchical sequence.

[0079] (2.2) Based on the fitness function, the fitness function value of the first generation population in the current initial solution is obtained. The fitness function used in this invention adopts the space utilization rate of the current result, that is, the total volume of the spatial model / the volume of the cubic container;

[0080] (2.3) Based on the current crossover and mutation rates, randomly select individuals that need to undergo crossover and mutation and perform the operations to generate some new individuals. The crossover operation uses two-point crossover, selecting two random marker points k1 and k2 from two individuals and exchanging the distribution of the marker points between the two individuals to generate two new individuals. The mutation operation uses distinct mutation, randomly selecting two assigned part information items from a single individual and exchanging their positions while satisfying the constraints.

[0081] (2.4) Based on the fitness function values ​​of each individual in the current generation, a selection operator is used to select individuals to enter the next generation of the population. The selection operation employs roulette wheel selection, assigning each individual in the current population a corresponding segment within a specified numerical interval. The length of each segment is allocated proportionally based on the fitness function value. Subsequently, the operator generates random numbers within the interval. Based on the position of this random number, the corresponding population individual is selected; this individual is the chosen target individual. Random numbers are generated repeatedly until the number of selected population individuals reaches the set requirement. Furthermore, roulette wheel selection has a significant probability of missing excellent solutions. Therefore, a mechanism for saving the best individuals is introduced. The top n individuals are retained and directly enter the next generation, while the remaining individuals are then selected.

[0082] (2.5) Determine whether the offspring have evolved, and adjust the crossover rate and mutation rate accordingly. To improve efficiency and minimize solution time while ensuring accuracy, this invention also adaptively adjusts the crossover rate and mutation rate to control the occurrence of crossover and mutation operations.

[0083] This adjustment is based on whether evolution has occurred in the offspring. If the maximum fitness function value in the new generation is greater than the maximum value in the previous generation, it indicates that evolution has occurred, and the crossover rate and mutation rate are increased. Let p represent the current crossover rate value, and t represent the number of generations in the population that has not evolved up to the latest generation. The increase in the crossover rate follows the function f(t) = (1-p)e (-1 / t) Regarding the mutation rate, since the probability of mutation is usually less than the probability of crossover, the mutation rate increases according to the function f(t) / 5. Conversely, if no evolution occurs, the two probabilities are reduced. Let d represent the previous generation's optimal fitness function value, then the crossover rate decreases as f(t) = d. t Similarly, the function for decreasing the rate of variation is f(t) / 3;

[0084] (2.6) Perform a termination condition check. If the current evolution count counter reaches the preset value, it means that the solution has been completed and the operation ends. If the preset evolution count has not been reached, return to step 22) and repeat the next steps until termination.

[0085] (3) The "cube-sphere" unfolding stage (e.g.) Figure 3 ):

[0086] (3.1) Receive the intermediate solution obtained in step 2) and use it to initialize the parameters. The parameters include the set initial temperature T, the termination temperature Ts, the number of samplings L, etc.;

[0087] (3.2) Generate the initial solution of the simulated annealing algorithm using the partitioning method; First, based on the shape characteristics of the cube and its circumscribed circle, the objects in the cubic space to be processed are divided into six parts. Each part is expanded towards its corresponding remaining spherical space. Simultaneously, the remaining unplaced space volume in each direction can be calculated based on the volume of the spherical container and the volume of the inscribed cube. The models in each part are then arranged in ascending order of volume to obtain the corresponding object sequence T. Taking any part sequence as an example, it is calculated whether the total volume of the currently extracted objects is less than or equal to the total volume of the extracted objects. If so, the next object is extracted; otherwise, the extraction operation ends. For the extracted objects, random placement that meets the constraints is performed. The above logic is repeated for the six parts distribution operation, and the initial solution is obtained after completion.

[0088] (3.3) Enter the sampling process, generate a new solution that meets the constraints, and determine whether to accept the solution. When entering the sampling process, the current temperature t, the optimal solution B, and the current solution s need to be used as parameters, and the number of times the solution effect optimization has not occurred p = 0 is set. Next, according to the neighborhood selection operation, a new solution state s' is generated based on the current solution, and the difference between the two is evaluated using the fitness function. The fitness function value is the current space utilization value. In this invention, the neighborhood selection operation principle is as follows: First, the expansion method is set to update the neighborhood. For the previously obtained solution, any two object models in the same quadrant are randomly swapped, and the contents of different quadrants are not swapped, thus obtaining a new solution with constant directionality. Second, the placement direction is set to control the neighborhood. Similar to the constraint on direction in the genetic algorithm, it is necessary to control that the moving model cannot change its orientation when the neighborhood solution is randomly generated.

[0089] Based on the sampling results, the process proceeds to determine whether to accept a solution. If the fitness function difference is greater than 0, it indicates a better solution has been found, and the current best solution is set as the new solution s', with the optimization counter p set to zero. Otherwise, a predetermined probability is used to decide whether to accept the new solution. This probability is determined by the fitness function difference and the current input temperature T, and its probability is... If the probability is acceptable, then the current solution is accepted according to the rules described above; otherwise, the new solution is discarded, and the sampling count and the unoptimized counter p are updated. The current sampling process is repeated until the preset maximum sampling count L is reached. See the flowchart for the sampling process. Figure 4 .

[0090] (3.4) Update the temperature and determine if the termination condition is met. The temperature update condition will refer to the number of sampling acceptances acc, and the update value T′ = e each time. -acc / (L+acc) •T. The termination condition is whether the updated temperature reaches the termination temperature. If it does, the solution is terminated and the current solution is output as the optimal solution. Otherwise, the process returns to step (3.3) to perform the sampling operation again.

[0091] Through this technical solution,

[0092] 1. By transforming the complete 3D bin packing problem of a sphere into two parts, namely bin packing in the space of an inscribed cube within a sphere and unfolding the "cube-sphere" layout, and using two different solution algorithms to solve the problem in stages, the solution efficiency is significantly improved and the time to obtain the optimal solution is shortened.

[0093] 2. In the binning problem within a sphere-inscribed cube, a positional encoding method was designed to control the correspondence between the part positions and the initial positions in the intermediate solutions obtained by the genetic algorithm, achieving excellent positional results and improving the presentation. Furthermore, adaptive changes to the crossover and mutation rates were used to purposefully adjust the number of individuals undergoing crossover and mutation in each generation, further improving the solution performance.

[0094] 3. In the "cube-sphere" layout unfolding step, the initial solution is generated through a segmentation method. This improved method effectively allows for further adjustments to intermediate solutions, facilitating subsequent sampling operations. Simultaneously, the neighborhood selection operation logic is improved, controlling the generation method of candidate solutions and enhancing efficiency.

[0095] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for packing three-dimensional spheres into bins based on an improved genetic algorithm and a simulated annealing algorithm, characterized in that: This includes the data preprocessing stage, the binning stage of the inscribed cube space within the sphere, and the "cube-sphere" unfolding stage. (1) The steps in the data preprocessing stage are as follows: (1.1) Receive the model information to be decomposed, including the initial position coordinates of the model to be decomposed and the center coordinates of the parent node's bounding box, the center coordinates and radius of the target container sphere; (1.2) Determine the constraints according to actual usage needs, and design the position encoding for the received model information; the position encoding design method is as follows: ① For each individual part, obtain a three-digit position code based on its original position; ② Divide the model into N parts along the z-axis based on the number of parts to be decomposed; ③ Starting from the maximum value of the z-axis coordinate, divide the model position into N groups along the z-axis. The first bit of each group is 0, and so on, until the code is assigned to N-1. ④ After that, for any group, establish a coordinate system with the center point, and assign the remaining position codes according to its position in the quadrant, distinguishing between 1 and -1; ⑤ After obtaining the position code of each part, arrange it into data string P according to the loading sequence, P contains all the contents of the objects to be packed, each integer value in the data string P i represents the number of the object to be packed; (2) The steps for the packing stage of the inscribed cubic space within the sphere are as follows: (2.1) Generate an initial solution based on the preprocessed information; the specific method is as follows: ① Based on the hierarchical coding data in the position coding, that is, the first data, all the models to be packed are divided into n groups according to the hierarchy; ② For each group of objects, further subdivide them into 4 quadrant groups based on the last two digits of the code, and arrange them in ascending order according to the size of the objects in each group to form a list of hierarchical blocks to be packed. ③ The packaging containers are also divided into 4n sub-containers in the same way; (2.2) Based on the fitness function, the space utilization rate of the current result is used, i.e., the total volume of the spatial model / the volume of the cubic container, to solve the fitness function value of the first generation population in the current initial solution; (2.3) Based on the current crossover rate and mutation rate, randomly select individuals that need to be crossovered and mutated and perform the operation to generate some new individuals; (2.4) Based on the fitness function values ​​of each individual in the current generation, use the selection operator to select individuals that will enter the next generation of the population; (2.5) Determine whether the offspring have evolved, and adjust the crossover rate and mutation rate accordingly; (2.6) Perform a termination condition check. If the current evolution count counter reaches the preset value, it means that the solution has been completed and the operation ends. If the preset evolution count has not been reached, return to step (2.2) and repeat the next steps until termination. (3) The steps of the "cube-sphere" unfolding stage are as follows: (3.1) Initialize the parameters based on the intermediate solution obtained in step (2); (3.2) Use the segmentation method to generate the initial solution of the simulated annealing algorithm; the specific method is as follows: First, based on the shape characteristics of the cube and its circumscribed circle, the objects in the cube space to be processed are divided into six parts, and each part is unfolded in the direction of its corresponding remaining spherical space. At the same time, according to the volume of the spherical container and the volume of the inscribed cube, the remaining unplaced space volume in each direction is obtained; and the models in each part are arranged in ascending order according to their volume to obtain the corresponding object sequence of that part. Based on the extracted sequence, calculate whether the total volume of the extracted objects is less than or equal to the volume of the remaining unplaced space in that direction. If so, continue extracting the next object; otherwise, end the object extraction operation. For the objects that have been removed, place them randomly in accordance with the constraints. Repeat the above logic for each of the six parts to obtain the initial solution. (3.3) Proceed to the sampling process, generate a new solution that meets the constraints, and determine whether to accept the solution; (3.4) Update the temperature and determine whether the termination condition is met. If it is met, end the solution and output the current solution as the optimal solution. Otherwise, return to step (3.3) to perform the sampling operation again.

2. The three-dimensional sphere packing method based on improved genetic algorithm and simulated annealing algorithm according to claim 1, characterized in that: In step (2.3), the crossover operation uses two-point crossover, randomly selecting two marker points k1 and k2 from two individuals, exchanging the distribution results of the marker points in the two individuals, and generating two new individuals; the mutation operation uses distinct mutation, randomly selecting two assigned part information from a single individual, and exchanging their positions under the condition of satisfying the constraints. In step (2.4), the selection operation uses roulette wheel selection, which assigns each individual in the current population to a specified numerical interval segment. Based on the result obtained from the fitness function, the length of each individual segment is allocated proportionally. Subsequently, the operator generates random numbers within the interval. Based on the position of the random number, the population individual corresponding to the position of the random number is obtained. This individual is the selected target individual. Random numbers are generated in a loop until the number of population individuals extracted reaches the set requirement.

3. The three-dimensional sphere packing method based on improved genetic algorithm and simulated annealing algorithm according to claim 2, characterized in that: According to step (2.5), the crossover rate and mutation rate controlling the crossover and mutation operations are adaptively adjusted. This adjustment is based on whether evolution has occurred in the offspring. If the maximum fitness function value in the new generation is greater than the maximum value in the previous generation, it indicates that evolution has occurred, and the crossover rate and mutation rate are increased. In populations where evolution has not occurred for several generations... At that time, let Pc represent the current cross rate value, then the increase in the cross rate follows a function. ; Regarding the mutation rate, since the probability of mutation is less than the probability of crossover, the mutation rate increases according to the following function: Conversely, if no evolution occurs, the two probabilities are reduced. Let d represent the previous generation's optimal fitness function value, then the crossover rate reduction function is: Similarly, the function for decreasing the rate of variation is: .

4. The three-dimensional sphere packing method based on improved genetic algorithm and simulated annealing algorithm according to claim 3, characterized in that: The parameters in step (3.1) include the initial temperature T, the termination temperature Ts, and the number of samplings L.

5. The three-dimensional sphere packing method based on improved genetic algorithm and simulated annealing algorithm according to claim 4, characterized in that: In step (3.3), when entering the sampling process, the current temperature Tc, the optimal solution B, and the current solution s are used as parameters, and the number of times the solution effect optimization has not occurred is set to q=0. Then, based on the neighborhood selection operation, a new solution state s' is generated using the current solution as a basis, and the fitness function is used to evaluate the difference between the two. The fitness function value is the current space utilization value. The neighborhood selection operation described above is as follows: First, the neighborhood is updated by setting the unfolding method; for the previously obtained solutions, any two object models in the same quadrant are randomly swapped, while the contents of different quadrants are not swapped, thus obtaining a new solution with constant directionality; second, the neighborhood is controlled by setting the placement direction. Based on the obtained sampling results, the decision is made on whether to accept the solution. If the difference in the fitness function is greater than 0, it means that a better solution has been obtained. In this case, the current best solution is set as the new solution s', and the number of optimizations q is set to zero. Conversely, the decision to accept a new solution is based on a preset probability, which is determined by the fitness function difference and the current input temperature Tc. ,in This represents the difference in fitness function between the current solution and the latest solution. If the probability is acceptable, then set the current optimal solution to the new solution s' and set the optimization counter q to zero; if it is still unacceptable, then abandon the new solution and update the number of samplings and the unoptimized counter q. Repeat the current sampling process until the preset maximum number of samplings L is reached.

6. The three-dimensional sphere packing method based on improved genetic algorithm and simulated annealing algorithm according to claim 5, characterized in that: In step (3.4), the temperature update condition is the reference sampling acceptance number acc, and the update value for each time. The termination condition is whether the updated temperature reaches the end temperature. If it does, the solution is terminated and the current solution is output as the optimal solution. Otherwise, the process returns to step (3.3) to perform the sampling operation again.