[gecode-users] Gecode/J: Invalid Memory Access
Christian Schulte
cschulte at kth.se
Wed Nov 7 10:06:10 CET 2007
Leaving the Java quirks aside (in Gecode everything works as expected), a
variable with an empty domain is very much out of the question: the
invariant that variable domains are not empty is the most fundamental
invariant in the system and can't be broken... That is true for all cp
systems I know of, actually.
Cheers
Christian
--
Christian Schulte, http://www.imit.kth.se/~schulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Malcolm Ryan
Sent: Tuesday, November 06, 2007 11:56 AM
To: users at gecode.org
Subject: Re: [gecode-users] Gecode/J: Invalid Memory Access
On 06/11/2007, at 6:10 PM, Malcolm Ryan wrote:
> I'm getting a crash in my Gecode/J program with the message:
>
> Invalid memory access of location 00000004 eip=0e61227c
I've isolated the cause. The domain IntSet was empty.
The following code will reproduce the bug:
Space space = new Space() {};
IntSet empty = new IntSet(new int[0]);
IntVar bad = new IntVar(space, empty);
Similarly the line:
IntVar bad = new IntVar(space, 1, 0);
will produce the error:
terminate called after throwing an instance of
'Gecode::Int::VariableEmptyDomain'
what(): IntVar::IntVar: Attempt to create variable with empty
domain
which is better that a memory error, but which really should respond
with an Exception that can be caught at the Java level.
I think the correct solution is to allow a variable to be created
with an empty domain. This would just result in a model that is never
satisfiable, which is nothing unusual and is quite straightforward to
handle. I don't see any real reason to single it out as a special case.
Malcolm
--
"Progress should mean that we are always changing the world to fit
the vision, instead we are always changing the vision."
- G.K.Chesterton, Orthodoxy
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list