All Projects â†’ nemanja-m â†’ Gaps

nemanja-m / Gaps

Licence: mit
A Genetic Algorithm-Based Solver for Jigsaw Puzzles 🌀

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Gaps

tetris-ai
A Tetris AI written in JavaScript that uses a genetic algorithm
Stars: ✭ 22 (-95.36%)
Mutual labels:  genetic-algorithm
Seating Chart
Optimizing a Wedding Reception Seating Chart Using a Genetic Algorithm
Stars: ✭ 25 (-94.73%)
Mutual labels:  genetic-algorithm
Artificial Intelligence
Awesome Artificial Intelligence Projects
Stars: ✭ 330 (-30.38%)
Mutual labels:  genetic-algorithm
GeneticAlgorithmForFeatureSelection
Search the best feature subset for you classification mode
Stars: ✭ 82 (-82.7%)
Mutual labels:  genetic-algorithm
recmap
Draw your own Rectangular Statistical Cartogram - CRAN package
Stars: ✭ 18 (-96.2%)
Mutual labels:  genetic-algorithm
NEATEST
NEATEST: Evolving Neural Networks Through Augmenting Topologies with Evolution Strategy Training
Stars: ✭ 13 (-97.26%)
Mutual labels:  genetic-algorithm
Job-Shop-Scheduling-Genetic-Algorithm
Job Shop Scheduling Solver using Genetic Algorithyms
Stars: ✭ 48 (-89.87%)
Mutual labels:  genetic-algorithm
Ecosim
An interactive ecosystem and evolution simulator written in C and OpenGL, for GNU/Linux.
Stars: ✭ 382 (-19.41%)
Mutual labels:  genetic-algorithm
Training-Snake-Game-With-Genetic-Algorithm
training snake game using neural network and genetic algorithm
Stars: ✭ 28 (-94.09%)
Mutual labels:  genetic-algorithm
Iamdinosaur
🦄 An Artificial Inteligence to teach Google's Dinosaur to jump cactus
Stars: ✭ 2,767 (+483.76%)
Mutual labels:  genetic-algorithm
async-genetic
A blazing fast parameters optimiser by genetic algorithm
Stars: ✭ 18 (-96.2%)
Mutual labels:  genetic-algorithm
bio ik
MoveIt kinematics_base plugin based on particle optimization & GA
Stars: ✭ 104 (-78.06%)
Mutual labels:  genetic-algorithm
genetic-algorithm-matlab
A very simple Genetic Algorithm implementation for matlab, easy to use, easy to modify runs fast.
Stars: ✭ 18 (-96.2%)
Mutual labels:  genetic-algorithm
shorelark
Simulation of life & evolution
Stars: ✭ 109 (-77%)
Mutual labels:  genetic-algorithm
Car Simulator
Autonomous car simulator (based on JavaScript & WebGL) implemented by fuzzy control system, genetic algorithm and particle swarm optimization.
Stars: ✭ 335 (-29.32%)
Mutual labels:  genetic-algorithm
ai-n-queens
Solving and GUI demonstration of traditional N-Queens Problem using Hill Climbing, Simulated Annealing, Local Beam Search, and Genetic Algorithm.
Stars: ✭ 30 (-93.67%)
Mutual labels:  genetic-algorithm
Hippocrates
No longer maintained, actually usable implementation of NEAT
Stars: ✭ 59 (-87.55%)
Mutual labels:  genetic-algorithm
Geneticalgorithmpython
Source code of PyGAD, a Python 3 library for building the genetic algorithm and training machine learning algorithms (Keras & PyTorch).
Stars: ✭ 435 (-8.23%)
Mutual labels:  genetic-algorithm
Ml From Scratch
Python implementations of some of the fundamental Machine Learning models and algorithms from scratch.
Stars: ✭ 20,624 (+4251.05%)
Mutual labels:  genetic-algorithm
fundamental
Software to look for interrelationships between constants and find formulas for number sequences
Stars: ✭ 14 (-97.05%)
Mutual labels:  genetic-algorithm

Genetic Algorithm based solver for jigsaw puzzles with piece size auto-detection.

Build Status

demo

Installation

Clone repo:

$ git clone https://github.com/nemanja-m/gaps.git
$ cd gaps

Install requirements:

$ pip install -r requirements.txt
$ sudo apt-get install python-tk

Install project in editable mode:

$ pip install -e .

Creating puzzles from images

To create puzzle from image use create_puzzle script.

i.e.

$ create_puzzle images/pillars.jpg --size=48 --destination=puzzle.jpg

[SUCCESS] Puzzle created with 420 pieces

will create puzzle with 420 pieces from images/pillars.jpg where each piece is 48x48 pixels.

original             puzzle

Run create_puzzle --help for detailed help.

NOTE Created puzzle dimensions may be smaller then original image depending on given puzzle piece size. Maximum possible rectangle is cropped from original image.

Solving puzzles

In order to solve puzzles, use gaps script.

i.e.

$ gaps --image=puzzle.jpg --generations=20 --population=600

This will start genetic algorithm with initial population of 600 and 20 generations.

Following options are provided:

Option Description
--image Path to puzzle
--size Puzzle piece size in pixels
--generations Number of generations for genetic algorithm
--population Number of individuals in population
--verbose Show best solution after each generation
--save Save puzzle solution as image

Run gaps --help for detailed help.

Size detection

If you don't explicitly provide --size argument to gaps, piece size will be detected automatically.

However, you can always provide gaps with --size argument explicitly:

$ gaps --image=puzzle.jpg --generations=20 --population=600 --size=48

NOTE Size detection feature works for the most images but there are some edge cases where size detection fails and detects incorrect piece size. In that case you can explicitly set piece size.

Termination condition

The termination condition of a Genetic Algorithm is important in determining when a GA run will end. It has been observed that initially, the GA progresses very fast with better solutions coming in every few iterations, but this tends to saturate in the later stages where the improvements are very small.

gaps will terminate:

  • when there has been no improvement in the population for X iterations, or
  • when it reachs an absolute number of generations

License

This project as available as open source under the terms of the MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].