-
Notifications
You must be signed in to change notification settings - Fork 3
/
flatzinc.html
181 lines (153 loc) · 6.51 KB
/
flatzinc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
layout: default
title: GECODE flatzinc
headline: FlatZinc
---
{% assign GECODESTAMP = site.data.versions["gecodestamp"] %}
{% assign GECODECLEARDATE = site.data.versions["gecodecleardate"] %}
{% assign GECODEFLATZINCVERSION = site.data.versions["gecodeflatzincversion"] %}
<p>
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
<a href="http://www.minizinc.org/">
the MiniZinc pages of the G12 project.
</a>
</p>
<p>
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.
</p>
<h2>FlatZinc for Gecode</h2>
<p>
Starting with Gecode version 3.2.0, the FlatZinc interpreter for Gecode
is part of the standard Gecode distribution.
Please check our <a href="download.html">download pages</a> for more
information on how to get a copy of Gecode. Source packages as well
as binary packages are available.
</p>
<p>
The FlatZinc interpreter that ships with Gecode version {{ GECODESTAMP }}
supports the FlatZinc language and MiniZinc global constraint definitions
of MiniZinc version {{ GECODEFLATZINCVERSION }}.
</p>
<h2>Running the parser</h2>
<p>
The executable is called fzn-gecode. You can run it with the -help switch to get
an overview of how to invoke it:
</p>
<pre>
$ fzn-gecode -help
Gecode FlatZinc interpreter
- Supported FlatZinc version: {{ GECODEFLATZINCVERSION }}
Gecode configuration information:
- Version: {{ GECODESTAMP }}
- Variable types: BoolVar IntVar SetVar FloatVar
- Trigonometric and transcendental float constraints: enabled
- Thread support: enabled (8 processing units)
- Gist support: enabled
Options for Gecode/FlatZinc:
-help, --help, -?
print this help message
-n (unsigned int) default: 1
number of solutions (0 = all)
-p (double) default: 1
number of threads (0 = #processing units)
-c-d (unsigned int) default: 8
recomputation commit distance
-a-d (unsigned int) default: 2
recomputation adaption distance
-a (optional: false, 0, true, 1) default: false
return all solutions (equal to -solutions 0)
--free (optional: false, 0, true, 1) default: false
no need to follow search-specification
-decay (double) default: 1
decay factor
-node (unsigned int) default: 0
node cutoff (0 = none, solution mode)
-fail (unsigned int) default: 0
failure cutoff (0 = none, solution mode)
-time (unsigned int) default: 0
time (in ms) cutoff (0 = none, solution mode)
-interrupt (optional: false, 0, true, 1) default: true
whether to catch Ctrl-C (true) or not (false)
-r (int) default: 0
random seed
-restart (none, constant, linear, luby, geometric) default: none
restart sequence type
-restart-base (double) default: 1.5
base for geometric restart sequence
-restart-scale (unsigned int) default: 250
scale factor for restart sequence
-mode (solution, stat, gist) default: solution
how to execute script
-s (optional: false, 0, true, 1) default: false
emit statistics
-o (string) default: NONE
file to send output to
</pre>
<h2>Global constraint definitions for MiniZinc</h2>
<p>
The MiniZinc-to-FlatZinc converter provided by the G12 project can produce
specialized FlatZinc that is targeted at a certain solver. Gecode/FlatZinc
provides suitable definitions of global constraints in the directory
<tt>mznlib</tt>. This directory is located in the Gecode directory
installed in your program files folder (if you use the Windows binary
package), in <tt>/usr/local/share/gecode</tt> if you use the Mac OS
binary package, or in <prefix>/share/gecode if you installed
Gecode from the sources.
</p>
<p>
In order to make the MiniZinc-to-FlatZinc converter aware of these global
constraint definitions, you can either
</p>
<ul>
<li> copy the <tt>mznlib</tt> directory into the <tt>lib/minizinc</tt>
directory of your MiniZinc installation, rename it to <tt>gecode</tt>, and
use the <tt>-G gecode</tt> flag of <tt>mzn2fzn</tt>;</li>
<li> or use the <tt>-I</tt> flag of <tt>mzn2fzn</tt> with the complete
path to the <tt>mznlib</tt> directory;</li>
<li> or use the <tt>mzn-gecode</tt> script, which will invoke
<tt>mzn2fzn</tt> with the correct library paths and directly pass the
resulting FlatZinc on to the Gecode FlatZinc interpreter.</li>
</ul>
<h2>FlatZinc parser skeleton</h2>
<p>
We also provide the source code of the Gecode FlatZinc parser, stripped of
all Gecode-specific code. You can use it as a starting point for your own
FlatZinc interpreter.
</p>
<p>
The source code archive (compatible with FlatZinc 1.5) is available here:
</p>
<ul>
<li><a href="download/flatzinc_skeleton-1.3.zip">flatzinc_skeleton-1.3.zip</a></li>
</ul>
<p>
The archive contains a README file that explains how to adapt and compile
the code. If you have any questions, please contact <a
href="mailto:[email protected]">[email protected]</a>.
</p>
<h2>MiniZinc with Search Combinators</h2>
<p>
We have extended the Gecode FlatZinc interpreter with support for
<em>Search Combinators</em>, a new, powerful modeling language for search
heuristics. Search Combinators are explained in detail in
<a href="paper.html?id=SchrijversEtAl:CoRR:2012">this paper</a>.
</p>
<p>
You can download an archive with the source code and pre-built binaries
for Windows, Mac OS, and Linux. The archive contains a README and some
examples to get you started.
</p>
<ul>
<li><a href="download/searchcombinators-0.9.3.zip">searchcombinators-0.9.3.zip</a></li>
<li><a href="download/searchcombinators-0.9.3.tgz">searchcombinators-0.9.3.tgz</a></li>
</ul>
<p>
If you have any questions, please contact <a
href="mailto:Guido Tack <[email protected]>">Guido Tack <[email protected]></a>.
</p>
<?php gecode_footer(); ?>