[gecode-users] Gecode/FlatZinc 1.1 released
Guido Tack
tack at ps.uni-sb.de
Wed Feb 13 15:29:17 CET 2008
Raffaele Cipriano wrote:
> Dear Guido,
> I'have installed the "Flatzinc for Gecode 1.1" release, and it works.
> But perhaps I misunderstood something... I thought that the parser
> would have returned a
> gecode space in a c++ file
No, Gecode/FlatZinc is an interpreter for FlatZinc, not a compiler.
The advantage is that no additional step of compilation is needed -
the user does not have to have a C++ compiler installed.
> , for example I thought that executing
>
> $ fz myInstanceOfGolombRulers.fzn
>
> should have create a myInstanceOfGolombRulers.cc file
>
> to be compiled and executed...but it doesn't seem to work in this
> way...
>
> Is the gecode space only an internal translation?
> Is it directly executed by the fz command?
Yes, the fz command creates a new space, parses the input and creates
all variables and propagators, and then calls one of the search
engines. If you need more direct access to the space that results
from parsing, you can use Gecode/FlatZinc as a library. Have a look
at the file main.cc. The two lines
FZPrinter p;
FlatZincGecode* fg = FlatZinc::solve(contents, p);
Parse the string contents into a gecode space fg (FlatZincGecode
inherits from Gecoode::Space).
If you need a compiler that generates C++ from FlatZinc, you may want
to look at the new reflection capabilities (introduced in Gecode
2.0.0). They would let you take the FlatZincGecode object, iterate
over all its propagators and variables, and generate C++ code that
recreates an equivalent space.
Cheers,
Guido
More information about the gecode-users
mailing list