Feature extractor for MiniZinc and XCSP models
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


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].

Version 1.2.x adds to version 1.1 the global constraints of MiniZinc 2.0 not 
implemented in MiniZinc 1.6. Environment variables no longer needed.


  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.


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

+ MiniZinc 1.6 or higher

+ 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

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 <MODEL>

    -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 
    -k, --keep
      Keep all the auxiliary models generated by mzn2feat.
    -i <MODEL>
      Input model. Supported formats: .xcsp, .mzn, .fzn
    -d <MODEL.dzn>
      Data model (only for a MiniZinc model in input).
    -o <FORMAT>
      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 <FILE>
      Redirect the output to FILE instead of printing to standard output.


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.


For any question or information, please contact us at:

  amadini at cs.unibo.it

  jmauro  at cs.unibo.it


  [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.