On Nov 26, 2007, at 4:02 AM, Guido Tack wrote:
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 am having some problems with VarMaps. As you said there are two ways
to fill a VarMap: by using put and putArray methods and by iterating
on actor specifications. I tried the second but because of a design
decision in the past we cannot use it. In our design we have a class
GenericSpace which inherits from Gecode::Space. This class has an
attribute that contains a DynamicArray with all variables declared in
a computation space. This array contains VarBase pointers (VarImpBase
in the trunk version). To fill the VarMap i am using the following code:
void GenericSpace::merge(GenericSpace *src) {
Reflection::VarMap vm;
for (int i = 0; i < src->vars.getSize(); i++) {
std::stringstream s;
s << "src-" << i;
vm.put(src,src->vars.getVar(i),s.str().c_str());
}
printf("End merge operation\n");fflush(stdout);
}
getVar(i) returns a reference to the VarImpBase stored at position i
in the array. When building the following error appears:
/Users/ggutierrez/Work/gec/include/gecode/kernel/var-map.icc: In
member function ‘void Gecode::Reflection::VarMap::put(Gecode::Space*,
const Var&, const Gecode::Support::Symbol&) [with Var =
Gecode::VarImpBase]’:
/Users/ggutierrez/Work/mozart-gecode/mozart/platform/emulator/
GeSpace.cc:180: instantiated from here
/Users/ggutierrez/Work/gec/include/gecode/kernel/var-map.icc:177:
error: no type named ‘View’ in ‘class
Gecode::VarViewTraits<Gecode::VarImpBase>’
Note that vars does not contain integer constraint variables only it
also contains set vars, bool vars, etc. This is why we chose to use an
array of VarImpBase.
Any help on this is very welcome, thanks in advance.
Cheers,
_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users