Filip Konvička wrote: > I looked a bit at your reflection HOWTO at > > http://www.gecode.org/gecode-doc-latest/PageReflection.html#SecReflAddSupport > > Well, it seems that it should be possible to add support for > FloatVars, > but still I'd welcome some comments/advices :-)
Sure! > One thing is that we don't have just generic propagators and > branchings, > we also have generic variables and views. All are templates :-) One > thing I did already was making the user explicitly instantiate some > classes using a pre-defined macro once they want to use FloatVars > with a > certain "domain type" (we need ViewVarImpTraits and VarViewTraits > specializations for the appropriate types). So I can probably use a > similar approach to register all kinds of reflection & > (un)serialization > stuff. Yes, right. What you'll mainly have to implement for variables is the function FloatVarImp<...>::spec. It will have to create a Reflection::VarSpec, whose first argument is the variable type identifier (vti), a symbol. You have to make sure that this vti is unique for each FloatVarImp instance. > Another thing is the reflection spec (Gecode::Reflection::ActorSpec). > There seems to be support for signed integer constants and for > strings, > so I'll try to serialize interval domains and constants using some > standard conversions to/from std::string (like boost::lexical_cast). I > suppose that adding support for types like 'double' and 'float' to > ActorSpec is probably a bad idea (given the platform differences in > representing floats...right?) Hm, I don't know. An ActorSpec just must be able to represent what the system uses, it doesn't have to be platform-independent. The idea is that an ActorSpec just lets you look inside the propagator. If you want to communicate the specs, e.g. over the network, you'll have to make sure that a platform-independent representation is used. E.g., we can use boost serialization to turn ActorSpecs into strings. The serialization classes should allow platform-independent transfer of e.g. doubles. So, I guess we should add support for double in ActorSpec. > Yet another thing is that my branching templates are parametrized not > just by the view type but also by some variable- and value-selecting > classes. This is not strictly necessary, but I did not see a reason > not > to do so before I got here :-) So I intend to use 'mangle' to do the > magic, and I suppose that it should be possible when I add 'type()' to > the appropriate classes (or is there something more to it?) No, that's all there is to it ;-) Just add a type method, that's how we do it, too. > PS: There is an error in the howto, the line > > static Gecode::Symbol ati(void) const { > > should probably be > > static Gecode::Support::Symbol ati(void) { Thanks! I fixed it in the svn. Cheers, Guido _______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users