[gecode-users] FloatVar implementation
Guido Tack
tack at ps.uni-sb.de
Wed Apr 9 14:28:08 CEST 2008
Filip Konvička wrote:
> I'll have to take a closer look at what kernel actually does with
> these.
> But our implementation, already in its current state, can generate
> multiple variable classes. For example, one may choose to use either
> boost::numeric::interval<float> or boost::numeric::interval<double>
> (or
> even <long double>) - and the domain implementation code will be
> reused.
>
> Similarly, I think that many views and constraints can be generic. If
> the implementation is designed carefully, it should be quite
> independent
> on whether we use boost.interval or whatever else.
>
> But when we let the users instantiate their own FloatVars by supplying
> their FP-arithmetics library of choice, we don't have the variable
> type
> in advance and can't expose it to the kernel at Gecode compile time.
> Or
> can we? Is it sufficient that all the variables have a common base
> class? (Even with the restriction that there is just one instantiation
> of FloatVar in a program?)
The kernel only needs to know about the modification events and
propagation conditions for a variable type. You could therefore add a
generic FloatVar to the kernel, and let the user decide which domain
representation to use (as long as the domain representation has no
impact on the kind of events that are needed). However, this assumes
that the resulting system always only uses a single instance of
FloatVar (you can't mix e.g. variables based on float and double).
Cheers,
Guido
More information about the gecode-users
mailing list