0

我正在尝试编写一个最小化转换图的程序(它基本上结合了具有相似数字的状态)。基本上,该算法是首先找到具有相同 'a' 和 'b' 输入的状态,将它们组合起来,将它们从 'leftovers' 列表中删除,然后找到具有 'a' 或 'b' 的状态并将它们组合起来。

这是一个例子:

Initial TG:
final state is state 1
State  Input a  Input b
[0]    [3]      [1]
[1]    [1]      [4]
[2]    [3]      [1]
[3]    [6]      [3]
[4]    [2]      [7]
[5]    [1]      [3]
[6]    [2]      [5]
[7]    [1]      [3]

final state     leftover
[ 1 ]           [ 0 2 3 4 5 6 7 ]

final state    same a,b   leftover
[ 1 ]          [ 0 2 ]    [ 3 4 5 6 7 ]

final state    same a,b   same a,b    leftover
[ 1 ]          [ 0 2 ]    [5 7 ]      [ 3 4 6 ]

final state    same a,b   same a,b    same a     leftover
[ 1 ]          [ 0 2 ]    [ 5 7 ]     [ 4 6 ]    [ 3 ]

The Final Minimized TG is now:
State  Input a  Input b
[0,2]  [3]      [1]
[1]    [1]      [4,6]
[3]    [4,6]    [3]
[4,6]  [0,2]    [5,7]
[5,7]  [1]      [3]

我面临的问题是知道如何/如何处理数组,因为可能存在任意数量的组合,具体取决于给定转换图中的状态数量。关于如何编码的任何想法或关于如何处理一切的任何建议?

干杯

4

0 回答 0