Re: Integer size in Eclipse

From: <wh_at_icparc.ic.ac.uk>
Date: Tue 15 Feb 2005 09:18:45 PM GMT
Message-ID: <20050215211845.GA1850@tempest.icparc.ic.ac.uk>
Hi Cristina,

When reporting a problem, please specify the version of ECLiPSe that you are
using.  It is also helpful to specify the solver you are using (IC) and the
architecture you're using (presumably not alpha_linux).  Help us to help
you.  (More guidelines for useful information to include in problem reports
can be found on the web site, under "How to report a bug"
http://www.icparc.ic.ac.uk/eclipse/bugs.html)

On Tue, Feb 15, 2005 at 08:28:30PM +0100, Cristina Marconcini wrote:
> Dear All,
> I would like to submit you a question about integer size in eclipse.
> 
> I have tried the following example
> p :-  I1 :: -536870912..536870911, I2 :: -536870912..536870911, (I1 #= 
> 0) and (neg(I2 #= 0)) ,  indomain(I1, random), indomain(I2, random), 
> writeln(I1), writeln(I2).
> and eclipse gave me the error
> 
> *** Overflow of the global/trail stack in spite of garbage collection!
> You are probably out of virtual memory (swap space).
> Peak sizes were: global stack 56620 kbytes, trail stack 4180 kbytes

The IC solver tries to represent domains with holes in them (your
constraints imply that I2's domain does not contain 0) as bitmaps.
Obviously this is impractical for such large domains - it requires too much
memory.  The IC solver is not really designed for such extremely large
integer domains.

> so, I tried to change the range of I1 variable like
> p1 :-  I1 :: -5368709120..5368709110, I2 :: -5368709120..5368709110, (I1 
> #= 0) and (neg(I2 #= 0)) ,  indomain(I1, random), indomain(I2, random), 
> writeln(I1), writeln(I2).
> and I get a solution, withouth memory problems.
> As you can see the variable range is larger than in problem p.
> So I suppose that is not a problem of my pc.

This behaves differently because the domain is now clearly too large to be
represented as a bitmap without risking integer overflow with the operations
required to maintain the bitmap.  So the disequality constraint handles
things a bit differently (essentially, it delays acting on the I2 #\= 0
constraint until I2 is known).  Unfortunately for you, not all the code in
the IC library is written to handle such extreme cases, so sometimes you
will just get a range error.  For example, if I ask for another solution to
p1, I get:

?- p1.
0
-4097948016  

Yes (0.00s cpu, solution 1, maybe more) ? ;
out of range in -(-4097948016) + I2{-5368709120 .. 5368709110} #\= 0
Abort


In short, if you really must work with such large integer domains (why?),
either try not to punch holes in the middle of the domains, or find a solver
designed to handle it.

Cheers,
Warwick
Received on Tue Feb 15 21:16:20 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:33 PM GMT GMT