Is there a way to change the Int::Limits::min and Int::Limits::max

50 views
Skip to first unread message

Vijaya Krishna Kasula (Vijju)

unread,
Jun 20, 2023, 4:35:59 AM6/20/23
to Gecode
It appears that the Int::Limits::min and Int::Limits::max are under 32-bit. We have several applications with 64-bit randomization. Ex: I want to randomize 2 numbers that add to a 64-bit number. Is there a way to do that.

Mikael Zayenz Lagerkvist

unread,
Jun 20, 2023, 10:45:16 AM6/20/23
to gec...@googlegroups.com
Hi,

Unfortunately, there is no easy way to do this. While it would in
theory be easy to "just" change the data type in the representation,
there are a lot of places in Gecode that does arithmetic, and these
would need to be updated as well to the right datatype.

As for the limits not being the full range of the underlying datatype,
that would be much harder to change if it is at all possible. All
arithmetic in a constraint programming solver needs to be safe, and
Gecode relies on having symmetric domains (-Int::Limits::max ==
Int::Limits::min), and having some value outside the domain but still
part of the underlying datatype for certain operations.

With that said, I'm unsure about the use-case that you are describing
about randomization or how it would connect to a constraint
programming system.

Cheers,
Mikael


On Tue, Jun 20, 2023 at 10:36 AM Vijaya Krishna Kasula (Vijju)
<krishna....@gmail.com> wrote:
>
> It appears that the Int::Limits::min and Int::Limits::max are under 32-bit. We have several applications with 64-bit randomization. Ex: I want to randomize 2 numbers that add to a 64-bit number. Is there a way to do that.
>
> --
> You received this message because you are subscribed to the Google Groups "Gecode" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gecode+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gecode/ecd01572-23e7-4ecb-ba10-fc0c46a585fbn%40googlegroups.com.



--
Mikael Zayenz Lagerkvist

Vijaya Krishna Kasula (Vijju)

unread,
Jul 5, 2023, 8:16:08 AM7/5/23
to Gecode
I would like to give it a try.
What is a good start to update the datatype?

I am not worried about the limits as long as I can compile the IntVar to take the next biggest datatype

By randomization I mean any valid solution.

Mikael Zayenz Lagerkvist

unread,
Jul 5, 2023, 8:41:59 AM7/5/23
to gec...@googlegroups.com
Hi,

As I mentioned initially, this is quite a large undertaking, as one
would have to change all places that does any kind of arithmetic or
other operations on the values so that intermediate values are the
right size as well. This is spread out over all of the code in all of
Gecode, so there is no individual place to change, all the code needs
to be checked.

As for randomization, make sure you know exactly what kind of "any
valid solution" you need. For general constraint models, it is quite
hard to get any type of known distribution over the solutions, some
solutions might be much harder/easier to find than others.

Cheers,
Mikael

On Wed, Jul 5, 2023 at 2:16 PM Vijaya Krishna Kasula (Vijju)
> To view this discussion on the web visit https://groups.google.com/d/msgid/gecode/4b024963-87ac-4449-8eea-cf64a1258552n%40googlegroups.com.



--
Mikael Zayenz Lagerkvist
Reply all
Reply to author
Forward
0 new messages