-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflatzinc.html
More file actions
160 lines (139 loc) · 5.48 KB
/
Copy pathflatzinc.html
File metadata and controls
160 lines (139 loc) · 5.48 KB
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
---
layout: default
title: GECODE flatzinc
headline: FlatZinc
---
{% assign GECODESTAMP = site.data.versions["gecodestamp"] %}
<section class="page-section">
<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="https://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>
</section>
<section class="page-section">
<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' | relative_url }}">download pages</a> for more
information on how to get a copy of Gecode.
</p>
<p>
The FlatZinc interpreter that ships with Gecode version {{ GECODESTAMP }}
supports the FlatZinc language and the MiniZinc global constraint
definitions included in the source release.
</p>
</section>
<section class="page-section">
<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
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>
</section>
<section class="page-section">
<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
<code>mznlib</code>. This directory is located in the Gecode directory
installed under <prefix>/share/gecode.
</p>
<p>
In order to make the MiniZinc-to-FlatZinc converter aware of these global
constraint definitions, you can either
</p>
<ul class="simple-list">
<li>
Copy the <code>mznlib</code> directory into the <code>lib/minizinc</code>
directory of your MiniZinc installation, rename it to <code>gecode</code>, and
use the <code>-G gecode</code> flag of <code>mzn2fzn</code>;
</li>
<li>
Use the <code>-I</code> flag of <code>mzn2fzn</code> with the complete
path to the <code>mznlib</code> directory;
</li>
<li>
Use the <code>mzn-gecode</code> script, which will invoke
<code>mzn2fzn</code> with the correct library paths and directly pass the
resulting FlatZinc on to the Gecode FlatZinc interpreter.
</li>
</ul>
</section>
<section class="page-section">
<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 class="simple-list">
<li><a href="{{ '/download/flatzinc_skeleton-1.3.zip' | relative_url }}">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:tack@gecode.dev">tack@gecode.dev</a>.
</p>
</section>