[gecode-users] Reflection support for FloatVars questions

Guido Tack tack at ps.uni-sb.de
Mon Aug 25 10:48:14 CEST 2008


Christian Schulte wrote:
> for 3.0 all these types have been added already ;-)

Only for mangle, i.e., for turning template arguments into strings.   
Arg, and therefore ActorSpec and VarSpec, still can't store doubles.

Cheers,
	Guido

> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On  
> Behalf
> Of Filip Konvicka
> Sent: Monday, August 25, 2008 9:20 AM
> To: users at gecode.org
> Subject: Re: [gecode-users] Reflection support for FloatVars questions
>
> Hi Guido,
>
>>> 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.
>
> Cool, in that case maybe we could consider adding support for all
> "basic" C++ numeric types: float, double, long double, long long. I'm
> sure that Boost.Serialization handles portability issues well.
>
> My concern about portability was related to your JavaScript example:
> adding these types means that you have to extend the parser quite a  
> bit.
> (For example, you need to solve the ambiguities between types.)
>
>> So, I guess we should add support for double in ActorSpec.
>
> Another option, of course, is adding support just for double, which is
> probably what most people would use. For now, anyway, I'm planning to
> use some default conversion to/from string (using  
> boost::lexical_cast),
> and let the users override this for their numeric type of choice if  
> that
> doesn't work with lexical_cast. The thing to keep in mind with  
> FloatVar
> is that you never know in advance what numeric type it'll run with, so
> we have to provide such mechanism anyway.
>
> I'll come back with more questions if my attempts to run FloatVar
> examples with Gist fail :-)
>
> Cheers,
> Filip
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list