Abstract
Solving large-scale jigsaw puzzles is a computationally challenging task, categorized as NP-complete. While traditional computer vision solvers often struggle with local optima and scale limitations, recent advancements in evolutionary computation have pushed the boundaries of what is possible. This paper presents a novel Genetic Algorithm (GA) capable of reassembling square-tiled puzzles with over 22,000 pieces, a significant leap over previous state-of-the-art solvers that typically capped out at 3,000 pieces.
Introduction
The automated reconstruction of jigsaw puzzles has applications ranging from archaeology and forensics to biology. Unlike human solvers who utilize both shape and color, computational solvers for square-tiled puzzles rely solely on color information at the edges. The primary hurdle in these solvers is avoiding "local optima"—incorrect piece placements that appear locally correct but prevent a global solution. Most previous attempts utilized greedy strategies, which are highly sensitive to early errors. To address this, a Genetic Algorithm (GA) framework was developed to explore the solution space more robustly through evolutionary selection.
Methodology
Fitness and Dissimilarity
In this GA framework, each "chromosome" represents a potential arrangement of all puzzle pieces. The fitness of a solution is determined by a dissimilarity function, which calculates the sum of squared color differences (in the Lab* color space) along the abutting edges of all adjacent pieces. A lower dissimilarity score indicates a higher fitness, suggesting a more accurate reconstruction.
The Kernel-Growing Crossover Operator
The core innovation of this research is the kernel-growing crossover operator. Standard crossover methods often produce invalid solutions for puzzles (e.g., duplicate pieces). The proposed operator overcomes this by:
- Seed Selection: Starting with a single "seed" piece.
- Consensus Growth: Examining two "parent" solutions. If both parents agree on the relative position of a neighbor (e.g., Piece B is to the right of Piece A), the child solution adopts this relationship.
- Best-Buddy Matching: If parents disagree, the algorithm looks for "best buddies"—pieces that mutually identify each other as the best possible match based on edge dissimilarity.
Crucially, this method is position-independent. It identifies correctly assembled clusters regardless of their absolute (x, y) coordinates in the parent solutions, allowing them to "shift" and merge correctly in the offspring.
Experimental Results
The solver was tested on standard benchmarks (432 to 805 pieces) and new, massive datasets created to test the limits of the algorithm.
Unprecedented Scale and Accuracy
The algorithm successfully reconstructed a puzzle containing 22,834 pieces, more than doubling the size of any previously reported automated solution. On an 805-piece benchmark, the GA achieved a neighbor-comparison accuracy of 96.26%, significantly outperforming the previous state-of-the-art of 89.70%.
Efficiency
Despite the massive search space, the solver remains efficient. The 805-piece puzzles were solved in approximately 2 minutes, while the 22,834-piece puzzle required roughly 13 hours on a modern PC. Interestingly, the GA occasionally found solutions with lower dissimilarity scores than the original image, indicating that the mathematical model can find "better-than-perfect" alignments where colors bleed together more smoothly than in the original photograph.
Conclusion and Future Work
By prioritizing relative adjacency over absolute positioning, the kernel-growing GA effectively navigates the complexities of large-scale jigsaw puzzles. While the current model assumes known piece orientation and final dimensions, future work aims to adapt this framework for more complex scenarios, including puzzles with missing pieces, unknown orientations, and 3D reconstructions.
Summary updated