this repo has no description
at develop 1.2 kB view raw
1% RUNS ON mzn20_fd 2% RUNS ON mzn-fzn_fd 3include "regular.mzn"; 4 5%-----------------------------------------------------------------------------% 6% regular 7%-----------------------------------------------------------------------------% 8% regexp is: 123*21. 9 10int: n_states = 5; 11int: input_max = 3; 12int: initial_state = 1; 13set of int: accepting_states = {5}; 14array[1..5, 1..3] of int: transition_fn = 15 [|2, 0, 0 % transitions from state 1: --1--> state 2 16 |0, 3, 0 % transitions from state 2: --2--> state 3 17 |0, 4, 3 % transitions from state 3: --2--> state 4, --3--> state 3 18 |5, 0, 0 % transitions from state 4: --1--> state 5 19 |0, 0, 0|];% transitions from state 5: (none) 20 21array[-2..4] of var int: reg_input = 22 array1d(-2..4, [1, 2, _, _, _, 2, 1]); 23array[44..54] of var int: reg_input2; 24 25constraint regular(reg_input, n_states, input_max, transition_fn, 26 initial_state, accepting_states); 27 28constraint regular(reg_input2, n_states, input_max, transition_fn, 29 initial_state, accepting_states); 30 31solve satisfy; 32 33output [ 34 "reg_input = array1d(-2..4, ", show(reg_input), ");\n", 35 "reg_input2 = array1d(44..54, ", show(reg_input2), ");\n" 36];