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:
- You must have at least
python 3.8
. You can get this python version throughpyenv
. See more here -> https://github.com/pyenv/pyenv#installation - You should have installed
pipenv
. Instructions here -> https://pipenv.readthedocs.io/en/latest/#install-pipenv-today - You should have a
Linux/Mac
machine. Windows is not supported and we are not thinking in it. - Optionally, an user with sudo permissions
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
- Fork the repository on GitHub.
- Set up your development setup
$> pip install -e .
$> pipenv install --dev
- Run the tests to confirm they all pass on your system.
$> pipenv run pytest
- Make your change and run the entire test suite again and confirm that all tests pass including the ones you just added.
- 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
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.1.0.tar.gz
(19.4 kB
view details)
Built Distribution
File details
Details for the file tomato-cooker-0.1.0.tar.gz
.
File metadata
- Download URL: tomato-cooker-0.1.0.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f2cbda82b129f2a8a636b5a143dd01249837941177ab941ce8c84fe45823a6b |
|
MD5 | 7cd6c472b13c39882b824f6c32c7605d |
|
BLAKE2b-256 | 7c986c533671d64814a789bbbcc95e3a04240d79b76d4d2b8346a31a7e6d6f36 |
File details
Details for the file tomato_cooker-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tomato_cooker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93ecca9c2d638d78a71eef6c53096bfc884cef03b6f22e6274841c161c2a1680 |
|
MD5 | 227d1a0b7d62e8c1fed2f2dc2dd1d50f |
|
BLAKE2b-256 | 565ff4a83d8799fc26f77b97b8ae069bbed5904765d8d8572300d3d014094ec9 |