[gecode-users] FlatZinc parser
tack at ps.uni-sb.de
Thu Nov 6 08:03:07 CET 2008
Morten Boysen wrote:
> 1) How do I as simple as possible create a FlatZincGecode instance
> a FlatZinc file? No propagation should occur or anything. The
> should just simply be added to the FlatZincGecode instance along with
> the constraints. This FlatZincGecode instance will then work as the
> initial model.
Look at main.cc. It uses the (probably not very intuitively named)
function solve from the flatzinc.hh header:
FlatZincGecode* fg = FlatZinc::solve(filename, p);
> 2) Is there a way to get the original name of a variable in the
> FlatZincGecode instance and vice versa (I took a look at the Registry
> class and it looked like it might have something to do with it, but
> I am
> not sure).
The names are currently only represented indirectly as strings in the
FZPrinter, since they are only needed for output. If you need the
names more explicitly, you'll have to transfer the intvarTable,
boolvarTable, and setvarTable from the FParseParm object (usually
called pp in the parser) to the FlatZincGecode object. The tables map
names to the indices in the *VarArrays in FlatZincGecode. In
flazinc.yxx, there's a function initfg that creates all the
variables. In that function, you could create additional mappings in
FlatZincGecode for the names.
> 3) What is the easiest way to read the entire domain of an integer
> variable (not just the currently valid values, but also all the
> ones). This includes cases where the domain is not a range?
That information is not maintained (as the solver never needs it
anywhere). The closest you can get is the domain specification from
the FlatZinc, which might already be smaller than the domain in the
original MiniZinc. Again, you'd have to memorize that somewhere in
FlatZincGecode, this should be possible in the newIntVar, newBoolVar,
> 4) Is there a way to read only the values of variables that has
> and the values that have no support?
Inconsistent values are removed from the domains. The only way to do
this would be to store the original domain, and compute the difference
(which you can do using our iterators).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2436 bytes
Desc: not available
More information about the gecode-users