我试图编写一个程序来最小化转换图(它基本上组合了具有相似数字的状态)。基本上,该算法首先找到具有相同“a”和“b”输入的状态,将它们组合,从“剩余”列表中删除它们,然后找到具有“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]
我面临的问题是知道如何/如何处理数组,因为根据给定转换图中的状态量,可能存在任意数量的组合。有关如何编写此代码的任何想法或有关如何处理所有内容的任何建议?
干杯