Gustavo Gutierrez wrote:
On Nov 23, 2007 5:04 PM, Guido Tack <[EMAIL PROTECTED]> 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?.
Yes, with the difference that you don't know the identity of variables that were put in by iterating 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.
In realistic examples, you probably need both. The logic is exactly the same as for copying: You copy the variables that make up your solution explicitly, so that they are available in the copy. All other variables are copied if needed (i.e., referenced by propagators or branchings) and discarded otherwise.
Cheers,
Guido
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users
