Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MiniZinc/libminizinc
The MiniZinc compiler
https://github.com/MiniZinc/libminizinc
Last synced: 2 months ago
JSON representation
The MiniZinc compiler
- Host: GitHub
- URL: https://github.com/MiniZinc/libminizinc
- Owner: MiniZinc
- License: other
- Created: 2015-01-21T00:20:22.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T07:27:13.000Z (2 months ago)
- Last Synced: 2024-11-07T07:34:17.586Z (2 months ago)
- Language: C++
- Homepage: http://www.minizinc.org
- Size: 27.3 MB
- Stars: 513
- Watchers: 39
- Forks: 80
- Open Issues: 107
-
Metadata Files:
- Readme: README.md
- Changelog: changes.rst
- License: LICENSE.txt
- Citation: CITATION.cff
Awesome Lists containing this project
README
MiniZinc
A high-level constraint modelling language that allows you to easily
express and solve discrete optimisation problems.
Visit our website ยป
View Documentation
ยท
Report Bug
ยท
Request Feature
## Table of Contents
- [About the Project](#about-the-project)
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Usage](#usage)
- [Building](#building)
- [Prerequisites](#prerequisites)
- [Compilation](#compilation)
- [Testing](#testing)
- [License](#license)
- [Contact](#contact)## About The Project
MiniZinc is a free and open-source constraint modeling language.
You can use MiniZinc to model constraint satisfaction and optimisation problems
in a high-level, solver-independent way, taking advantage of a large library of
pre-defined constraints. Your model is then compiled into FlatZinc, a solver
input language that is understood by a wide range of solvers.MiniZinc is developed at Monash University in collaboration with Data61
Decision Sciences.## Getting Started
To get a MiniZinc up and running follow these simple steps.
### Installation
The recommended way to install _MiniZinc_ is by the use of the bundled binary
packages. These packages are available for machines running Linux, Mac, and
Windows.The latest release can be found on [the MiniZinc
website](http://www.minizinc.org/software.html).### Usage
Once the MiniZinc bundle is installed on your machine, you can start expressing
and solving discrete optimisation problems. The following code segment shows a
MiniZinc model for the well known n-queens problem.```minizinc
int: n = 8; % The number of queens.array [1..n] of var 1..n: q;
include "alldifferent.mzn";
constraint alldifferent(q);
constraint alldifferent(i in 1..n)(q[i] + i);
constraint alldifferent(i in 1..n)(q[i] - i);
```You have two easy options to solve this model:
- In the MiniZincIDE: Select your preferred solver and press the "Run" button.
- With the `minizinc` executable available on your path: run `minizinc --solver gecode nqueens.mzn`._For more example MiniZinc models and more information about working with
MiniZinc, please refer to our
[Documentation](https://www.minizinc.org/doc-latest/)_## Building
The following instructions will help you compile the MiniZinc compiler. Note
that this repository does not include the IDE, findMUS, or any solvers that are
part of the MiniZinc project. These can be found in the following repositories:- [MiniZincIDE](https://github.com/MiniZinc/MiniZincIDE)
- [Gecode](https://github.com/Gecode/gecode)
- [Chuffed](https://github.com/chuffed/chuffed)### Prerequisites
- [CMake](https://cmake.org/) (>=3.4)
- A recent C++ compiler - Compilation is tested with recent versions of Clang,
GCC, and Microsoft Visual C++.
- (optional) [Bison](https://www.gnu.org/software/bison/) (>=3.4) and
[Flex](https://github.com/westes/flex) (>=2.5) - To make changes to the
MiniZinc lexer or parser.
- (optional) [Gecode](https://www.gecode.org/) - To compile the internal Gecode
solver interface (included in the MiniZinc bundle)
- (optional) [Coin OR's CBC](https://www.coin-or.org/) - To compile the
internal CBC solver interface (included in the MiniZinc bundle)
- (optional) Proprietary solver headers
([CPLEX](https://www.ibm.com/analytics/cplex-optimizer),
[Gurobi](https://www.gurobi.com/), [SCIP](https://www.scipopt.org/),
[Xpress](https://www.fico.com/)) - To load these solvers at runtime (included
in the MiniZinc bundle)### Compilation
The MiniZinc compiler is compiled as a CMake project. CMake's [User Interaction
Guide](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html)
can provide you with a quick introduction to compiling CMake projects. The
following CMake variables can be used in the MiniZinc project to instruct the
compilation behaviour:| Variable | Default | Description |
| -------------------------------------------- | ------- | ----------------------------------------------------------- |
| CMAKE_BUILD_TYPE | Release | Build type of single-configuration generators. |
| CMAKE_INSTALL_PREFIX | | Install directory used by `--target install`. |
| CMAKE_POSITION_INDEPENDENT_CODE | TRUE | Whether to create a position-independent targets |
| ****\_ROOT | | Additional directory to look for **** |
| CMAKE*DISABLE_FIND_PACKAGE***** | FALSE | Disable compilation of ****'s solver interface |
| CPLEX_PLUGIN | TRUE | Load CPLEX at runtime (instead of static compilation) |Possible values for **** are `CPlex`, `Geas`, `Gecode`, and `OsiCBC`.
## Testing
The correctness of the MiniZinc compiler is tested using a
[PyTest](https://docs.pytest.org/en/stable/) test suite. Instruction on how to
run the test suite and how to add new tests can be found
[here](https://github.com/MiniZinc/libminizinc/tree/master/tests)## License
Distributed under the Mozilla Public License Version 2.0. See `LICENSE` for more information.
## Contact
๐ **MiniZinc Community**
- Website: [https://www.minizinc.org/](https://www.minizinc.org/)
- StackOverflow: [https://stackoverflow.com/questions/tagged/minizinc](https://stackoverflow.com/questions/tagged/minizinc)
- Google Groups: [https://groups.google.com/g/minizinc](https://groups.google.com/g/minizinc)๐ **Monash Optimisation Group**
- Website: [https://www.monash.edu/it/dsai/optimisation](https://www.monash.edu/it/dsai/optimisation)