[gecode-users] extensional constraints with regular expressions

Kish Shen kisshen at cisco.com
Mon Oct 17 02:09:26 CEST 2011


Hi,

I have just added support for extensional constraints to ECLiPSe's 
Gecode interface, and I started testing the constraint with test cases, 
and I got a seg fault when I used a negative number in the repeat count 
in a regular expression.

The expression was supplied at the ECLiPSe level, but it should be 
equivalent to:


REG r = REG(1)(-1, 3) + *REG(4);
extensional(home, x, r);

The seg fault happened in the call to extensional.

I am using Gecode 3.7.0.

For the following slightly different REG:

REG r = REG(1)(-1) + *REG(4);

the result of the call to extensional is that all the variables in x are 
given the domain 4, I assume from the *REG(4) part of the regular 
expression. Is this correct? To me, the use of a negative number here 
should be equivalent to using 0, i.e. repeat 1 at least -1 times is the 
same as repeating 1 at least 0 times.

I also implemented using DFA for the extensional constraint, but my 
first version of the code had some typo bugs in it that meant some of 
the arguments to create the DFA were not initialised:

int f(fsize);
DFA::Transition t[tsize);
...
DFA d(0, t, f);


The code was supposed to initialise f and t before the DFA d(0, t, f) 
line, so t and f had no valid values. What happen is that Gecode seem to 
go into a loop for the call -- is this because it is failing to find the 
-1 that should be in f?

I understand that the problem is because I did not initialise t and f, 
but is there anyway to avoid a loop, e.g. for an exception to bw raised? 
If the looping is due to the missing -1, would this be a problem, 
because it is probably quite easy for a user to forget to add a 
terminating -1 in their code (this actually would not be a problem for 
my code, as the interface code insert a -1, so the user do not have to)

Cheers,

Kish
-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.



More information about the users mailing list