[gecode-users] Views and serialization

Gustavo Gutierrez ggutierrez at cic.puj.edu.co
Mon Nov 26 05:34:05 CET 2007


On Nov 23, 2007 5:04 PM, Guido Tack <tack at ps.uni-sb.de> wrote:
> After iterating all the actors, vmp will contain all variables in
> source, and you can iterate them using a VarMapIter.  For each
> variable, you get a VarSpec that tells you what type the variable
> has.  Furthermore, you can use the spec you get to recreate the
> variable in target:

Does this mean that creating a VarMap is not only achieved by putting
the VarArray but also by iterating all the actors?.
I mean, for the queens problem for instance, the following two codes
do the same in which respects to filling a VarMap?

code 1:

  VarMap * exportVars(void) {
    VarMap *vmp = new VarMap();
    Support::Symbol symb("root",true);
    vmp->putArray(this,q,symb);
    return vmp;
  }


code 2:

VarMap * exportVars2(void) {
    VarMap *vmp = new VarMap();
    SpecIter si = actorSpecs(*vmp);
   while (si())
    ++si;
   return vmp;
  }

If that is true i find the second a more general approach, since it
automatically collects only variables related to constraints.

Cheers,
-- 
Gustavo Gutierrez




More information about the gecode-users mailing list