FlatZinc is a low-level modelling language for constraint problems. It is designed to be easily interfaceable to constraint solvers (like Gecode). For more information on FlatZinc, please refer to the MiniZinc pages of the G12 project.
We provide a parser that reads a FlatZinc model from a file, and returns a Gecode Space object that represents the model. We also provide a simple front-end, an executable program that reads a FlatZinc model and prints the solution (if any) on the standard output.
Downloading FlatZinc for Gecode
The current version of the FlatZinc interpreter for Gecode is 1.3. You can download the source archive:
The URL of Gecode/FlatZinc in our subversion repository is
https://svn.gecode.org/svn/interfaces/flatzinc/tags/release-1.3
Please check our download pages for more information on how to use our subversion repository.
Binary packages
The Windows installer package and the Mac OS package (see the Gecode download page) contain precompiled executable versions of the Gecode/FlatZinc interpreter.
Compiling and Installing FlatZinc for Gecode
You have to install Gecode 2.2.0 prior to compiling and installing the FlatZinc parser. Please follow the installation instructions on the Gecode web site. Also, make sure that pkg-config is available when configuring Gecode, so that the pkg-config files are generated and installed.
The prerequisites for compiling the FlatZinc parser are the same as for compiling the Gecode library.
Configuration
The FlatZinc parser uses GNU autoconf to acquire information about the system it is compiled on. Typically, you need to run configure in the toplevel source directory.
To setup Gecode for your particular system, you may need to add one or more of the following options to configure:
- When using the Microsoft Visual C++ compiler, add CC=cl CXX=cl to your invocation of configure
- To install the parser somewhere else than the default /usr/local, use the --prefix=[...] switch
- You can get a list of all supported configuration options by calling configure with the --help switch.
Compilation and Installation
Just invoke make to compile and link the FlatZinc parser. The command make install will install the library and the executable.
Running the parser
The executable is called fz. You can run it with the -help switch to get an overview of how to invoke it:
$ ./fz -help Usage: fz [options]Options for FlatZinc/Gecode: -help, --help, -? print this help message -solutions (unsigned int) default: 1 number of solutions (0 = all) -c-d (unsigned int) default: 8 recompution copy distance -a-d (unsigned int) default: 2 recompution adaption distance -fail (unsigned int) default: 0 failure cutoff (0 = none, solution mode) -time (unsigned int) default: 0 time (in ms) cutoff (0 = none, solution mode) -mode (solution, stat) default: solution how to execute example
