Code Monkey home page Code Monkey logo

visapi's Introduction

Monte Carlo Tree Search on Perfect Rectangle Packing Problem Instances

GitHub Logo

Dataset

The dataset of 1000 Guillotinable and 1000 Braam rectangle packing problems with 20 tiles can be found in problems.

Installation

pip3 install requirements.txt

To run experiments, you will need to have a PostgreSQL database running.

After installing the PostgreSQL database you can create one by logging into the psql shell and running:

postgres=# create role binpack_user;
CREATE ROLE
postgres=# create database binpack;
CREATE DATABASE
postgres=# grant all on database binpack to binpack_user;
GRANT
postgres=# alter role binpack_user with login;
postgres=# alter user binpack_user with password 'password';

Copy the file visapi/secrets.json.local to visapi/secrets.json:

cp visapi/secrets.json.template visaip/secrets.json

Then edit it with a secret key and the details to connect to the database:

The database values meanings are in order:
HOST, DATABASE_NAME, USER, PASSWORD, PORT

For the example provided, the contents of the file would be:

{
    "SECRET_KEY": "something_random",
    "DATABASE": ["localhost", "binpack", "binpack_user", "password", ""]
}

To create a database schema, you will need to run:

python3 manage.py migrate

All experiments results will be saved to the database, in the table affinity.

Access them using the django shell:

python3 manage.py shell_plus

And then:

Result.objects.all()

See Django ORM reference.

Or access them using postgresql shell:

select * from affinity;

All the problem results will be available in the database with all the metrics needed to finish them (number of tiles placed etc.), and their scores (success / failure).

Running experiments

MCTS algorithm

Run:

PYTHONPATH=engine/ python3 manage.py run_mcts

to see all the options for the runner.

Example:

Run dynamically generated problems:

PYTHONPATH=engine/ python3 manage.py run_mcts 20 11 11

From file:

PYTHONPATH=engine/ python3 manage.py run_mcts 20 11 11 --from_file

Neural Network algorithm

This algorithm performs only one tile placement. To get the final solution calls the NN predict multiple times.

To train the neural network you can use:

PYTHONPATH=engine/ python3 manage.py just_train                                                  

visapi's People

Contributors

igorpejic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

visapi's Issues

how to run this project

Hi, I'm working on bin packing, too, with the classic BR instances and heuristic tree search methods. Could you please tell me how to run this project? I hope to compare it with my algorithm. Thanks for your kindness!

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.