[gecode-users] Unsigned Int Constraint Variables

Christian Schulte cschulte at kth.se
Fri Apr 4 13:05:51 CEST 2014


This again is harder than it sounds because there are two issues:
 - one also needs a 16 byte integer data type as money constraints require
extended precision
 - one would have to go through all of Gecode to check whether the C++ type
int is really an int of there value type of an integer variable (that is
most likely the biggest design flaw in Gecode).

Conceptually easy but lots of work.

Cheers
Christian

--
Christian Schulte, Professor of Computer Science, KTH,
www.ict.kth.se/~cschulte/

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of negate273 at gmail.com
Sent: Friday, April 04, 2014 9:11 AM
To: users at gecode.org
Subject: Re: [gecode-users] Unsigned Int Constraint Variables

Is there any way we can make the integer variable an int64_t (type long on a
64bit machine)  - 8 byte data type instead of the the 4-byte that it is
currently. If not, are there any alternatives for constraint variables that
may take values > 0x7FFF_FFFF ? 

Thanks
~az

> No, that will not work at all. Most constraints assume signedness of 
> integer variables and there are many datatypes that directly depend on 
> the choice of the type for integer variables.
> 
> So, unfortunately, there is no easy way.
> 
> Cheers
> Christian
> 
> --
> Christian Schulte, Professor of Computer Science, KTH, 
> www.ict.kth.se/~cschulte/
> 
>> -----Original Message-----
>> From: users-bounces at gecode.org [mailto:users-bounces at 
>> gecode.org] On Behalf Of  negate273 at gmail.com
>> Sent: Friday, April 04, 2014 8:42 AM
>> To: users at gecode.org
>> Subject: [gecode-users] Unsigned Int Constraint Variables Hi,
>> 
>> Is there anyway by which the bounds of an integer constraint variable be
set to 0..2**32-1 (0xFFFF_FFFF) instead of the bounds for a signed integer
(-0x7FFF_FFFF, 0x7FFF_FFFF) ? 
>> 
>> I tried recompiling gecod by setting 
>>    - gecode/int.hh Gecode::Int::Limits.max to UINT_MAX -1  (original
INT_MAX-1)
>>    - gecode/int.hh Gecode::Int::Limits.min to 0  (original -max) 
>>    - gecode/support/int-type.hpp IntTypeTraits<signed int> min = 0
(originally INT_MIN)
>>    - gecode/support/int-type.hpp IntTypeTraits<signed int> max = 
>> UNIT_MAX-1 (originally INT_MAX) but these do not help, in recognizing
variables that may have values > 2**31.
>> 
>> Any pointers ? 
>> 
>> Thanks
>> ~az
> 

_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list