Skip to main content

Minizinc problem solver

Project description

PyPI CI Coverage Status

cooked-tomato

Timetable scheduler for phone attention turns in Som Energia

History

This project is the result of an internal Som Energia Hackathon held on 11-03-2022 about MiniZinc with the goal of reimplementing the previous solution based on a pruned backtracking.

Prerequisites

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

  • You must have at least python 3.8. You can get this python version through pyenv. See more here -> https://github.com/pyenv/pyenv#installation
  • You should have a Linux/Mac machine. Windows is not supported and we are not thinking in it.

Installation

pip install cooked-tomato

Usage

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

# define a problem
tomatic_problem_params = {
    "nPersons": 4,
    "nLines": 2,
    "nHours": 3,
    "nNingus": 1,
    "nDays": 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 .[dev,tests]
  1. Run the tests to confirm they all pass on your system.
$> 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.3.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

tomato_cooker-0.3.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tomato-cooker-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f28ff5c6c73fcd7382023c1a6fb254ec1eefc1e9c3b0bc156cc907e590d60994
MD5 62c8414487028c14bc4a8ac33501221c
BLAKE2b-256 e34cd673fa6e790578c3351e12258634cf3d6d203bc408572da723e0d7e7675a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tomato_cooker-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 106be90272ebee8288e2f41e7fa7a0fb4d0ccad3ba341ac2ad8b3e504320cd33
MD5 f5e40072ddc030fc97a755ba126c6a21
BLAKE2b-256 4dc4f4984a587bbc4c071782947c7d44fc75770b0b412e7334cfb80fb9ff17c3

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