[gecode-users] Reflection support for FloatVars questions

Filip Konvička filip.konvicka at logis.cz
Sat Aug 23 20:30:03 CEST 2008


Hi,

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 :-)

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.

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?)

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?)

Cheers,
Filip


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) {





More information about the gecode-users mailing list