Skip to content

equivalent regular expression and DFA flatten differently in (at least) Gecode #981

@Pierre-Flener

Description

@Pierre-Flener

A student (Niclas Soika) in my course found the following bug. Try the model below (the example is mine) with Gecode: with only line 6 commented away (as below), we get the expected 1 constraint (gecode_regular), but with instead only the equivalent line 7 commented away, we get n constraints (gecode_int_element2d).

include "globals.mzn";
int: n; % length of X
enum Alphabet = {s,t};  enum State = {a,b,c,d,e};
array[State,Alphabet] of opt State: Transition = [| b,c | d,<> | e,<> | <>,b | c,e |];
array[1..n] of var Alphabet: X;
% constraint regular(X,Transition,a,{d,e});
constraint regular(X,"s s (t s)* | t s (t | s s)*");
solve satisfy;

This seems to be an oversight of the global enum surgery, leading for a provided DFA to fzn_regular_set, for which the bundled Gecode backend was not updated.

I post this here since this might not be limited to Gecode, so other backend designers may want to check their code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolvedIssue is resolved and the feature or fix will be part of next release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions