Skip to main content

Minizinc problem solver

Project description

Som-MiniZinc

Hackathon held on 11-03-2022 about MiniZinc

This problem was previously solved at https://github.com/Som-Energia/somenergia-tomatic/blob/master/tomatic/backtracker.py. With this library we want to solve the same problem using minizinc language and also open the possibility to extend the resolution of other similar problems.

Prerequisites

Before you begin, ensure you have met the following requirements:

Installation

pip install git+https://github.com/Som-Energia/Som-Minizinc.git

Usage

import asyncio
from tomato_cooker.grill import GrillTomatoCooker
from tomato_cooker.models import TomaticProblem, tomatic

# define a problem
tomatic_problem_params = {
    "nPersones": 4,
    "nLinies": 2,
    "nSlots": 3,
    "nNingus": 1,
    "nDies": 5,
    "maxTorns": 2,
    "nTorns": [3, 3, 3, 3,],
    "indisponibilitats": [
        {1}, {1}, {2}, {1}, {1},
        {2}, {2}, {2}, {2}, {2},
        {3}, {3}, {2}, {3}, {3},
        {2}, {3}, {2}, {2}, {1},
    ]
}
tomatic_problem = TomaticProblem(**tomatic_problem_params)

# choose a list of minizinc solvers to user
solvers = ["chuffed", "coin-bc"]

# create an instance of the cooker
tomato_cooker = GrillTomatoCooker(tomatic.MODEL_DEFINITION_PATH, solvers)

# Now, we can solve the problem
solution = asyncio.run(tomato_cooker.cook(tomatic_problem))
print(solution)

Contribute

  1. Fork the repository on GitHub.
  2. Set up your development setup
$> pip install -e .
$> pipenv install --dev
  1. Run the tests to confirm they all pass on your system.
$> pipenv run pytest
  1. Make your change and run the entire test suite again and confirm that all tests pass including the ones you just added.
  2. Create us a GitHub Pull Request to the main repository’s master branch. GitHub Pull Requests are the expected method of code collaboration on this project.

Changes

Historic of changes.

License

This project uses the following license: GNU AFFERO GENERAL PUBLIC LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomato-cooker-0.0.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

tomato_cooker-0.0.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file tomato-cooker-0.0.1.tar.gz.

File metadata

  • Download URL: tomato-cooker-0.0.1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for tomato-cooker-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5857c7777f98850d3803eeb7a0c7cdabfa8532a9d0c1e58aec3556bb23354b2b
MD5 50bdb2a11899b3717351a79e6c0d2362
BLAKE2b-256 509401d973328c248bcad6fd3e0b7dff6ad58e17c0073aeb6a4f215678366abd

See more details on using hashes here.

File details

Details for the file tomato_cooker-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tomato_cooker-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9998f6a31dacf015b085c487e6ab91fb7859a786467ad4be844767c242a1b9f
MD5 0e11c3a28a7e0c2a40d9701891dc2b7b
BLAKE2b-256 9115ec72dd708e231d66047c3e7fc8b740159b99bd03be7979b6c417bc55eec9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page