跳转到主要内容

Minizinc问题求解器

项目描述

PyPI CI Coverage Status

cooked-tomato

为Som Energia的电话注意力转换的日程表调度器

历史

此项目是2022年3月11日举行的Som Energia内部Hackathon的结果,主题为MiniZinc,目标是重新实现基于剪枝回溯的先前解决方案。

先决条件

在开始之前,请确保您已满足以下要求

  • 您必须至少有python 3.8。您可以通过pyenv获取此Python版本。更多信息请参见这里 -> https://github.com/pyenv/pyenv#installation
  • 您应该有一个Linux/Mac机器。Windows不受支持,我们也没有考虑它。

安装

pip install cooked-tomato

使用

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)

贡献

  1. 在GitHub上复制仓库。
  2. 设置您的开发环境
$> pip install -e .[dev,tests]
  1. 运行测试以确认它们在您的系统上全部通过。
$> pytest
  1. 进行更改并再次运行整个测试套件,并确认所有测试通过,包括您刚刚添加的测试。
  2. 向我们创建一个GitHub Pull Request到主仓库的master分支。GitHub Pull Requests是此项目的预期代码协作方法。

更改

更改历史

许可协议

此项目使用以下许可证: GNU AFFERO通用公共许可证.

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪个,请了解更多关于安装包的信息。

源代码分发

tomato-cooker-0.4.0.tar.gz (25.7 kB 查看哈希值)

上传时间 源代码

构建分发

tomato_cooker-0.4.0-py3-none-any.whl (23.9 kB 查看哈希值)

上传时间 Python 3