Skip to content

CP-Unibo/mzn2feat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mzn2feat 1.2.1

The features extractor tool mzn2feat was mainly developed by Roberto Amadini (University of Bologna / Lab. Focus INRIA). Jacopo Mauro (University of Bologna / Lab. Focus INRIA) developed the compiler xcsp2mzn.

The tool allows to extract an extensive set of 95 features from a Constraint (Satisfaction/Optimization) Problem defined in possibly different modelling languages: MiniZinc, FlatZinc or XCSP. It is essentially a new version of mzn2feat-0.1 extractor described in [1][2], designed to be more portable, light, flexible, and independent from the particular machine on which it is run as well as from the specific global redefinitions of a given solver. This version of mzn2feat was used in [4][5][6].

CONTENTS

bin Contains the executables. mzn2feat is the features extractor, while fzn2feat can extract features from FlatZinc models only, and xcsp2mzn is the converter from XCSP to MiniZinc.

fzn2feat Contains the sources of the FlatZinc parser used to extract the features, generated by exploiting the fzn-parser of MiniZinc 1.6 and extended by integrating suitable C++ code.

mznlib Contains a .mzn file for each global constraint supported by MiniZinc. This allows to be solver-transparent by avoiding to decompose any global constraint when converting to FlatZinc.

test Contains some samples of different FlatZinc, MiniZinc (with and without a corresponding .dzn) and XCSP models on which is possible to test the tool.

xcsp2mzn Contains the sources of the XCSP converter to MiniZinc, developed by adapting x4g converter [3]. All the code is written in C++ by exploiting the libxml2 libraries.

PREREQUISITES

mzn2feat is tested on 64-bit machines running Ubuntu 12.04, and not yet fully portable on other platforms.

  • MiniZinc 1.6 or higher http://www.minizinc.org/

  • Flex library sudo apt-get install flex

  • Bison library sudo apt-get install bison

  • GNOME XML library (libxml2-dev) sudo apt-get install libxml++2.6-dev

INSTALLATION

The mzn2feat can be called via http post requests by using the Docker image of the portfolio solver sunnny-cp. Please see sunnny-cp for more details on the installation of the solver.

To install mzn2feat manually instead:

  1. Move into the mzn2feat folder and run the installer:

    mzn2feat$ bash install [--no-xcsp]

    Note that setting the option --no-xcsp avoids to install the xcsp2mzn converter (e.g., if you don't want / cannot install the XML libraries).

  2. Try it out! (for help, type mzn2feat --help)

mzn2feat - a features extractor for (not only) MiniZinc models.

Usage: mzn2feat [OPTIONS] -i

Options: -h, --help Print this message. -p, --print-id Print a comma-separated list of all the features identifiers. -P, --print-all Print all the features identifiers and a brief description for each identifier. -k, --keep Keep all the auxiliary models generated by mzn2feat. -i Input model. Supported formats: .xcsp, .mzn, .fzn -d <MODEL.dzn> Data model (only for a MiniZinc model in input). -o Output format. Supported formats: csv: comma-separated list of the features values dict: a python-like dictionary which associates to each identifier the corresponding value pp: a pretty print of features identifiers, values, and description. (Default format: csv) -r Redirect the output to FILE instead of printing to standard output.

TESTING

Once successfully installed the tool, it is possible to test the samples included in mzn2feat/test folder. One can do it manually, for instance:

  mzn2feat/test/mzn$ mzn2feat -i zebra.mzn -o pp

or, alternatively, is possible to run all the tests of the folder by running:

  mzn2feat/test$ bash run-tests [--no-xcsp]

where the option --no-xcsp avoids to test the XCSP instances in test/xcsp.

FURTHER INFORMATION

For any question or information, please contact us at:

amadini at cs.unibo.it

jmauro at cs.unibo.it

REFERENCES

[1] R. Amadini, M. Gabbrielli, and J. Mauro. Features for Building CSP Portfolio Solvers. CoRR, abs/1308.0227, abs/1308.0227, 2013.

[2] R. Amadini, M. Gabbrielli, and J. Mauro. An Enhanced Features Extractor for a Portfolio of Constraint Solvers. In SAC, 2014.

[3] M. Morara, J. Mauro, and M. Gabbrielli. Solving XCSP problems by using Gecode. In CILC, 2011.

[4] R. Amadini, and Peter J. Stuckey. Sequential Time Splitting and Bounds Communication for a Portfolio of Optimization Solvers. In CP, 2014.

[5] R. Amadini, M. Gabbrielli, and J. Mauro. SUNNY-CP: a Sequential CP Portfolio Solver. In SAC, 2015.

[6] R. Amadini, M. Gabbrielli, and J. Mauro. A Multicore Tool for Constraint Solving. In IJCAI, 2015.