2D Bin Packing with a Genetic Algorithm
This is a follow up to a previous notebook where I used a guillotine heuristic to solve a 2D bin packing problem. In my previous notebook, I sorted the parts by descending area before applying the guillotine heuristic. As I pointed out, this sorting choice can have a significant impact on packing performance. I've used genetic (evolutionary) optimization algorithms (GA) in other applications and thought they might be effective in solving the bin packing problems. GA overcomes the sorting dilemma by randomly trying many different orderings of the parts. Genetic Algorithms ¶ The basic ideas and steps in genetic optimization are: Create an intial population . Parts are randomly sampled from the original parts list (without replacement) then some are rotated based on chance. This is repeated until $N_{pop}$ parts lists have been created. This collection of ordered parts lists is called a population. Evaluate this poulation for fitness . Each parts list is provided to a ...