GithubHelp home page GithubHelp logo

aaronsnoswell / polyomino-solver Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 196 KB

Find multihedral tilings of patterns using Polyominoes

Python 15.26% MATLAB 84.74%
polyomino-solver recreational-mathematics optimization integer-programming

polyomino-solver's Introduction

polyomino-solver

Find all multihedral tilings of an arbitrary pattern using free Polyominoes.

Installation

git clone https://github.com/aaronsnoswell/polyomino-solver.git
cd polyomino-solver
pip install -e .

Requirements

Tested with Python 3.6 on Windows. Should support other OS' just fine though. Requires Matlab to be installed and accessible.

Usage

To tile the 2x3 rectangle with combinations of Polyominoes 1 and 9:

from polyomino_solver import multihedral_tile
sols = multihedral_tile([[1, 1, 1], [1, 1, 1]], polyomino_set=[1, 9])
for label, coloring in sols: print(label)

Gives the output;

[[1. 2. 3.]
 [4. 5. 6.]]
[[3. 3. 1.]
 [2. 3. 3.]]
[[1. 3. 3.]
 [3. 3. 2.]]

Keep in mind that the underlying solver optimization requires inverting a binary linear matrix system. As such, the time complexity is approximately cubic in the area of the target shape. To put this in perspective, using an Intel 8 Core i7-8650u laptop processor at 1.9GHz to solve the tiling of a shape with area 10 takes 5 minutes. Using the same laptop to solve a pattern with area 14 takes about a week.

Acknowledgements

This package is simply a thin convenience wrapper around the amazing Matlab Polyomino library provided free under GPL by John Burkardt at his website. Much thanks to him, and please see their paper describing the method at;

I have made minor modifications to the library, in particular I have enabled both H1 and H2 solution verification steps to screen out all invalid solutions. Please see this patch for details.

Also thanks to the following;

polyomino-solver's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.