this repo has no description
at develop 1.3 kB view raw
1include "fzn_regular_regexp.mzn"; 2 3/** @group globals.extensional 4 The sequence of values in array \a x is accepted by the regular 5 expression \a r. This constraint generates it's DFA equivalent. 6 7 Regular expressions can use the following syntax: 8 9 - Selection: 10 11 - Concatenation: "12 34", 12 followed by 34. 12 (Characters are assumed to be the part of the same number unless split 13 by syntax or whitespace.) 14 - Union: "7|11", a 7 or 11. 15 - Groups: "7(6|8)", a 7 followed by a 6 or an 8. 16 - Wildcard: ".", any value within the domain. 17 - Classes: "[3-6 7]", a 3,4,5,6, or 7. 18 - Negated classes: "[^3 5]", any value within the domain except for a 3 or a 5. 19 20 - Quantifiers: 21 22 - Asterisk: "12*", 0 or more times a 12. 23 - Question mark: "5?", 0 or 1 times a 5. (optional) 24 - Plus sign: "42+", 1 or more time a 42. 25 - Exact: "1{3}", exactly 3 times a 1. 26 - At least: "9{5,}", 5 or more times a 9. 27 - Between: "7{3,5}", at least 3 times, but at most 5 times a 7. 28 29 Members of enumerated types can be used in place of any integer (e.g., "A B", 30 A followed by B). Enumerated identifiers still use whitespace for concatenation. 31*/ 32predicate regular(array[int] of var int: x, string: r) = 33 fzn_regular(x, r);