git-subtree-dir: software/mza git-subtree-split: f970a59b177c13ca3dd8aaef8cc6681d83b7e813
37 lines
1.2 KiB
MiniZinc
37 lines
1.2 KiB
MiniZinc
% RUNS ON mzn20_fd
|
|
% RUNS ON mzn-fzn_fd
|
|
include "regular.mzn";
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
% regular
|
|
%-----------------------------------------------------------------------------%
|
|
% regexp is: 123*21.
|
|
|
|
int: n_states = 5;
|
|
int: input_max = 3;
|
|
int: initial_state = 1;
|
|
set of int: accepting_states = {5};
|
|
array[1..5, 1..3] of int: transition_fn =
|
|
[|2, 0, 0 % transitions from state 1: --1--> state 2
|
|
|0, 3, 0 % transitions from state 2: --2--> state 3
|
|
|0, 4, 3 % transitions from state 3: --2--> state 4, --3--> state 3
|
|
|5, 0, 0 % transitions from state 4: --1--> state 5
|
|
|0, 0, 0|];% transitions from state 5: (none)
|
|
|
|
array[-2..4] of var int: reg_input =
|
|
array1d(-2..4, [1, 2, _, _, _, 2, 1]);
|
|
array[44..54] of var int: reg_input2;
|
|
|
|
constraint regular(reg_input, n_states, input_max, transition_fn,
|
|
initial_state, accepting_states);
|
|
|
|
constraint regular(reg_input2, n_states, input_max, transition_fn,
|
|
initial_state, accepting_states);
|
|
|
|
solve satisfy;
|
|
|
|
output [
|
|
"reg_input = array1d(-2..4, ", show(reg_input), ");\n",
|
|
"reg_input2 = array1d(44..54, ", show(reg_input2), ");\n"
|
|
];
|