Polygon Problem is a puzzle-solving algorithm designed for rectangular and square puzzles. It leverages the relationship between Shapely and GeoPandas geometries to perform comparisons on different objects, and employs a multi-tree structure to efficiently store and evaluate graphs using breadth-first search. The custom interface is implemented using Matplotlib.
- Each Graph object comprises a unique map, a set of pieces, and a try point. Initially, a root Graph is created with the starting map and pieces.
- The algorithm systematically determines every permutation of each piece at the try point, generating a new Graph object with the removed portion of the graph and piece.
- This process continues until no new Graph objects are created.
![Screen Shot 2023-10-24 at 9 14 43 PM](https://private-user-images.githubusercontent.com/120991436/277847273-27729890-13d5-490d-af45-b2bd60be25db.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODExNjksIm5iZiI6MTcxOTY4MDg2OSwicGF0aCI6Ii8xMjA5OTE0MzYvMjc3ODQ3MjczLTI3NzI5ODkwLTEzZDUtNDkwZC1hZjQ1LWIyYmQ2MGJlMjVkYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQxNzA3NDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zYWU0YTlkNWZlZmZlY2UzM2Y5OTYyNmRkZTY2ZDZhMWJjMWI0MWNlYmFmZjIxYzEyYjFkMjNjYTA0ODYzZGM2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.O-j5BA8uPNCBSuObkBoj-8z1Y5lpeauTiXs7JQHH0oM)
![Screen Shot 2023-10-21 at 9 31 59 AM](https://private-user-images.githubusercontent.com/120991436/277847416-7bc25ca4-9300-46fa-a047-68a3d5d77e8e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODExNjksIm5iZiI6MTcxOTY4MDg2OSwicGF0aCI6Ii8xMjA5OTE0MzYvMjc3ODQ3NDE2LTdiYzI1Y2E0LTkzMDAtNDZmYS1hMDQ3LTY4YTNkNWQ3N2U4ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQxNzA3NDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNjBkODg5ZmIxMjNjOTMzNDhhNGYxNzNmMThlMWJmYTMyOGVmZTkyM2NlNjUwNTBlNmM1MGE1YWQyYTEyMWRlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.RPiSVwxRTfFWEG64zgfN8IRfdMQI15ViZtMHke9VJCM)
![Screen Shot 2023-10-24 at 9 37 50 PM](https://private-user-images.githubusercontent.com/120991436/277847536-a7b0ba0e-e2e0-4675-81f3-d0c190955813.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODExNjksIm5iZiI6MTcxOTY4MDg2OSwicGF0aCI6Ii8xMjA5OTE0MzYvMjc3ODQ3NTM2LWE3YjBiYTBlLWUyZTAtNDY3NS04MWYzLWQwYzE5MDk1NTgxMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQxNzA3NDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mOWM0OWY4NjdmMDk0YzY2OThiYzRiMzNkOGNmZDI3MGQ4ZTU1MGMyZTgwZTExM2NjZjExNDExNWJiYzZlMDAzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9._oWjUvvPDn3MxjGtf4by5yugwuDFTH6p9qh8gnYtHOg)
The algorithm's runtime may increase significantly with the addition of more pieces due to its brute-force nature. Implementing a divide and conquer method, introducing multi-threading, or exploring a breadth-first search approach would improve efficiency.
Occasionally, the Shapely .difference
method may return a MultiPolygon object as a result of a piece splitting a graph into two. Currently, this is an unavoidable error. One solution may be to solve each split graph separately and then reintegrate the pieces used into the original graph.