minizinc

Access to all MiniZinc functionality directly from Python

https://github.com/minizinc/minizinc-python

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    4 of 13 committers (30.8%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.2%) to scientific vocabulary

Keywords

constraint-programming integer-programming linear-programming minizinc optimisation-problem python sat-solver

Keywords from Contributors

mesh interpretability sequences generic projection interactive optim hacking network-simulation
Last synced: 6 months ago · JSON representation

Repository

Access to all MiniZinc functionality directly from Python

Basic Info
  • Host: GitHub
  • Owner: MiniZinc
  • License: mpl-2.0
  • Language: Python
  • Default Branch: develop
  • Homepage: https://python.minizinc.dev
  • Size: 1000 KB
Statistics
  • Stars: 165
  • Watchers: 7
  • Forks: 27
  • Open Issues: 11
  • Releases: 18
Topics
constraint-programming integer-programming linear-programming minizinc optimisation-problem python sat-solver
Created over 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md


Logo

MiniZinc Python

The python package that allows you to access all of MiniZinc's functionalities directly from Python.
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

MiniZinc Python provides an interface from Python to the MiniZinc driver. The most important goal of this project are to allow easy access to MiniZinc using native Python structures. This will allow you to more easily make scripts to run MiniZinc, but will also allow the integration of MiniZinc models within bigger (Python) projects. This module also aims to expose an interface for meta-search. For problems that are hard to solve, meta-search can provide solutions to reach more or better solutions quickly.

Getting Started

To get a MiniZinc Python up and running follow these simple steps.

Installation

MiniZinc Python can be installed by running pip install minizinc. It requires MiniZinc 2.6+ and Python 3.8+ to be installed on the system. MiniZinc python expects the minizinc executable to be available on the executable path, the $PATH environmental variable, or in a default installation location.

For more information, please refer to the Documentation

Usage

Once all prerequisites and MiniZinc Python are installed, a minizinc module will be available in Python. The following Python code shows how to run a typical MiniZinc model.

```python import minizinc

Create a MiniZinc model

model = minizinc.Model() model.add_string(""" var -100..100: x; int: a; int: b; int: c; constraint a(xx) + b*x = c; solve satisfy; """)

Transform Model into a instance

gecode = minizinc.Solver.lookup("gecode") inst = minizinc.Instance(gecode, model) inst["a"] = 1 inst["b"] = 4 inst["c"] = 0

Solve the instance

result = inst.solve(all_solutions=True) for i in range(len(result)): print("x = {}".format(result[i, "x"])) ```

For more examples, please refer to the Documentation

Testing

MiniZinc Python uses uv to manage its dependencies. To install the development dependencies run uv sync --dev.

Although continuous integration will test any code, it can be convenient to run the tests locally. The following commands can be used to test the MiniZinc Python package.

  • We use PyTest to run a suite of unit tests. You can run these tests by executing: bash uv run pytest
  • We use Ruff to test against a range of Python style and performance guidelines. You can run the general linting using: bash uv run ruff check You can format the codebase to be compatible using: bash uv run ruff format (The continous integration will test that the code is correctly formatted using the --check flag.)
  • We use Mypy to check the type correctness of the codebase (for as far as possible). You can run the type checking using: bash uv run mypy .

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Mozilla Public License Version 2.0. See LICENSE for more information.

Contact

👤 Jip J. Dekker * Twitter: @DekkerOne * Github: Dekker1

🏛 MiniZinc * Website: https://www.minizinc.org/

Owner

  • Name: MiniZinc
  • Login: MiniZinc
  • Kind: organization
  • Location: Australia

MiniZinc is a free and open-source constraint modeling language

GitHub Events

Total
  • Create event: 15
  • Release event: 1
  • Issues event: 12
  • Watch event: 15
  • Delete event: 14
  • Issue comment event: 24
  • Push event: 29
  • Pull request event: 40
  • Fork event: 6
Last Year
  • Create event: 15
  • Release event: 1
  • Issues event: 12
  • Watch event: 15
  • Delete event: 14
  • Issue comment event: 24
  • Push event: 29
  • Pull request event: 40
  • Fork event: 6

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 514
  • Total Committers: 13
  • Avg Commits per committer: 39.538
  • Development Distribution Score (DDS): 0.158
Past Year
  • Commits: 24
  • Committers: 4
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Jip J. Dekker j****p@d****e 433
dependabot[bot] 4****] 62
Jason N a****n@c****g 5
Henk Bierlee b****k@g****m 3
ilansen i****n@g****m 2
Guido Tack g****k@m****u 2
Stefan Brüns s****s@r****e 1
Jason Nguyen j****n@m****u 1
Guilherme Soares g****0@g****m 1
Ofek Kirzner o****k@c****o 1
Marcel Nageler m****r@i****t 1
Justin Rawlings h****n@p****e 1
Hendrik Bierlee h****e@m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 42
  • Total pull requests: 163
  • Average time to close issues: 18 days
  • Average time to close pull requests: 15 days
  • Total issue authors: 35
  • Total pull request authors: 13
  • Average comments per issue: 2.38
  • Average comments per pull request: 0.36
  • Merged pull requests: 133
  • Bot issues: 0
  • Bot pull requests: 86
Past Year
  • Issues: 11
  • Pull requests: 31
  • Average time to close issues: 16 days
  • Average time to close pull requests: 6 days
  • Issue authors: 8
  • Pull request authors: 6
  • Average comments per issue: 1.45
  • Average comments per pull request: 0.23
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 17
Top Authors
Issue Authors
  • hadipourh (3)
  • jplauri (2)
  • jmjrawlings (2)
  • aklein3 (2)
  • tias (2)
  • informarte (2)
  • marcovc (1)
  • mrakgr (1)
  • viraj96 (1)
  • DavidPratten (1)
  • raphaelboudreault (1)
  • kristofferNorr (1)
  • deluxerootit (1)
  • dirkvbok (1)
  • Dekker1 (1)
Pull Request Authors
  • dependabot[bot] (138)
  • Dekker1 (60)
  • ilansen (6)
  • cyderize (3)
  • hbierlee (3)
  • EricGT (2)
  • vitor1001 (2)
  • lgtm-com[bot] (2)
  • StefanBruens (1)
  • fanosta (1)
  • adamgoldfeld (1)
  • jmjrawlings (1)
  • guilhas07 (1)
  • st0o0 (1)
Top Labels
Issue Labels
enhancement (5) bug (3) help wanted (1) wontfix (1)
Pull Request Labels
dependencies (138) python (108) github_actions (11) enhancement (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 14,540 last-month
  • Total docker downloads: 143
  • Total dependent packages: 8
  • Total dependent repositories: 38
  • Total versions: 22
  • Total maintainers: 2
pypi.org: minizinc

Access MiniZinc directly from Python

  • Versions: 22
  • Dependent Packages: 8
  • Dependent Repositories: 38
  • Downloads: 14,540 Last month
  • Docker Downloads: 143
Rankings
Dependent packages count: 1.2%
Dependent repos count: 2.4%
Downloads: 3.1%
Docker downloads count: 3.5%
Average: 4.2%
Stargazers count: 6.4%
Forks count: 8.7%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/python-package.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v2 composite
docs/requirements.txt pypi
  • sphinx *
  • sphinx_rtd_theme *
poetry.lock pypi
  • alabaster 0.7.13 develop
  • attrs 22.2.0 develop
  • babel 2.11.0 develop
  • backports-cached-property 1.0.2 develop
  • black 23.1.0 develop
  • cachecontrol 0.12.11 develop
  • cachy 0.3.0 develop
  • certifi 2022.12.7 develop
  • cffi 1.15.1 develop
  • charset-normalizer 3.0.1 develop
  • cleo 1.0.0a5 develop
  • click 8.1.3 develop
  • colorama 0.4.6 develop
  • crashtest 0.3.1 develop
  • cryptography 39.0.0 develop
  • distlib 0.3.6 develop
  • docutils 0.17.1 develop
  • dulwich 0.20.50 develop
  • exceptiongroup 1.1.0 develop
  • filelock 3.9.0 develop
  • html5lib 1.1 develop
  • idna 3.4 develop
  • imagesize 1.4.1 develop
  • importlib-metadata 4.13.0 develop
  • importlib-resources 5.10.2 develop
  • iniconfig 2.0.0 develop
  • isort 5.11.5 develop
  • jaraco-classes 3.2.3 develop
  • jeepney 0.8.0 develop
  • jinja2 3.1.2 develop
  • jsonschema 4.17.3 develop
  • keyring 23.13.1 develop
  • lockfile 0.12.2 develop
  • markupsafe 2.1.2 develop
  • more-itertools 9.0.0 develop
  • msgpack 1.0.4 develop
  • mypy 0.950 develop
  • mypy-extensions 1.0.0 develop
  • numpy 1.24.2 develop
  • packaging 23.0 develop
  • pathspec 0.11.0 develop
  • pexpect 4.8.0 develop
  • pkginfo 1.9.6 develop
  • pkgutil-resolve-name 1.3.10 develop
  • platformdirs 2.6.2 develop
  • pluggy 1.0.0 develop
  • poetry 1.2.2 develop
  • poetry-core 1.3.2 develop
  • poetry-plugin-export 1.2.0 develop
  • ptyprocess 0.7.0 develop
  • py 1.11.0 develop
  • pycparser 2.21 develop
  • pygments 2.14.0 develop
  • pylev 1.4.0 develop
  • pyrsistent 0.19.3 develop
  • pytest 7.2.1 develop
  • pytz 2022.7.1 develop
  • pywin32-ctypes 0.2.0 develop
  • requests 2.28.2 develop
  • requests-toolbelt 0.9.1 develop
  • ruff 0.0.126 develop
  • secretstorage 3.3.3 develop
  • shellingham 1.5.0.post1 develop
  • six 1.16.0 develop
  • snowballstemmer 2.2.0 develop
  • sphinx 4.5.0 develop
  • sphinx-rtd-theme 1.1.1 develop
  • sphinxcontrib-applehelp 1.0.2 develop
  • sphinxcontrib-devhelp 1.0.2 develop
  • sphinxcontrib-htmlhelp 2.0.0 develop
  • sphinxcontrib-jsmath 1.0.1 develop
  • sphinxcontrib-qthelp 1.0.3 develop
  • sphinxcontrib-serializinghtml 1.1.5 develop
  • tomli 2.0.1 develop
  • tomlkit 0.11.6 develop
  • tox 3.28.0 develop
  • tox-gh-actions 2.12.0 develop
  • tox-poetry-installer 0.10.0 develop
  • typed-ast 1.5.4 develop
  • types-dataclasses 0.6.6 develop
  • types-docutils 0.19.1.3 develop
  • types-setuptools 65.7.0.4 develop
  • typing-extensions 4.4.0 develop
  • urllib3 1.26.14 develop
  • virtualenv 20.18.0 develop
  • webencodings 0.5.1 develop
  • xattr 0.9.9 develop
  • zipp 3.12.1 develop
  • lark-parser 0.12.0
pyproject.toml pypi
  • lark-parser ^0.12.0
  • python ^3.7