[gecode-users] Extending Integer Variable

Filip Konvička filip.konvicka at logis.cz
Tue Apr 8 00:10:40 CEST 2008


> Yes, you are right. Also IntVars with unlimited precision using gmp... All
> doable, the only thing is that we sort out which occurrence of "int" refers
> to variables and which refer to other occurrences.
>   
Sure, but IMHO that is the easy part. Keeping the templates reasonably 
understandable and yet still working together is more of a challenge in 
my experience... :-)
> The problem with 64 bit integers, though is that we have to have a datatype
> that is bigger than the data type of variables. Now we use double for that
> purpose. With 64 bit integers we might resort to 128 bit integers...
>   
I can almost recall seeing "double" being used for arithmetics in 
integer constraint filters - are you referring to that? It was a bit 
surprising to see that - I'd expect to see long long used instead (but, 
in terms of portability, double is perhaps a safer choice). I did not 
make any measurements, but I'd expect long long to be much faster. In 
fact, I'm using long long for int-based fixed-point arithmetics. For 
long long-based fixed-point arithmetics (I need both these), I'm doing 
"in-place" multiplication, still using long long for products, but done 
"per partes" (it's a bit tricky with fixed-point arithmetics, but much 
easier with integers).

Anyway, is there a 128-bit integer available somewhere? I think that on 
x64, the only C type that changes size is "long int" - from 32 to 64 
bits. "int" stays 32bit, and "long long" stays 64bit.
> If you implement FloatVars, please keep us posted. If you want to contribute
> to Gecode we would be more than happy to help!
>   
I'm happy to hear that. I do not have a precise plan yet, but I do need 
such variables. (I'm using IntVars now, but the model has some 
limitations because of that.) I first need to make some experiments with 
Boost.Intervals, because I think I'll need some rounding-error 
propagation - so it would be nice to reuse some existing work....and I 
already use Boost, so that would be the ideal choice. My intention is to 
do some simple implementation of FloatVars and some very basic 
propagators for addition, multiplication and relations (I need to be 
able to model basic arithmetic constraints).

Cheers,
Filip

> All the best
> Christian
>
> --
> Christian Schulte, www.ict.kth.se/~cschulte/
>
>
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
> Of Filip Konvicka
> Sent: Monday, April 07, 2008 8:22 AM
> To: users at gecode.org
> Subject: Re: [gecode-users] Extending Integer Variable
>
>   
>> let me first elaborate a little bit how Gecode's variables and propagators
>> are structured before I actually attempt to give an answer.
>>     
> ...
>   
>> What do you want to do? Do you think it me be generally useful to be
>> included in Gecode anyway?
>>     
>
> Hi,
>
> I am currently thinking of implementing floating-point-based variables 
> (maybe based on Boost.Interval), so thanks for the summary :-)
>
> Anyway, before I decided that I need floating-point numbers, I was 
> thinking why you can't have "long long"-based variables when you already 
> have IntVars. On 64bit platforms, long long might be an interesting 
> choice IMO. But I realize that if that should be a part of Gecode, it 
> would probably mean adding template parameters to many classes/functions 
> and maybe it would make things less understandable. But then, if it's 
> only restricted to integral types, who knows.... the point is that 
> there's a lot of work done for the IntVars, so it'd be great to reuse it.
>
> Regards,
> Filip
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>   





More information about the gecode-users mailing list