private static void ResetData() { stateMapping = new Dictionary <State, int>(); labelMapping = new Dictionary <string, int>(); removeLabels = new List <int>(); removeBlocks = new List <Block>(); tempParition = new List <Block>(); partition = new List <Block>(); relation = new SimRel(1); }
/// <summary> /// Line 1-2 /// </summary> /// <returns></returns> private static void SetInitPartition(SymbolicLTS actionbasedLTS) { //Line 1 partition = new List <Block>(); relation = new SimRel(1); state2Block = new Block[lts.numStates]; foreach (var pair in actionbasedLTS.mapOldLoc2NewStates) { List <State> statesSameLoc = pair.Value; if (statesSameLoc.Count > 0) { List <int> states = new List <int>(); Block newBlock = new Block(lts.numSymbols, lts.numStates, states); newBlock.index = relation.NewEntry(); foreach (var state in statesSameLoc) { states.Add(stateMapping[state]); state2Block[stateMapping[state]] = newBlock; } partition.Add(newBlock); relation.SetRelation(newBlock.index, newBlock.index, true); } } //Line 2-4 foreach (var B in partition) { for (int a = 0; a < lts.numSymbols; a++) { List <int>[] post_a = lts.DataPost(a); List <int>[] pre_a = lts.dataPre[a]; //Line 3 foreach (var v in delta1[a]) { //transition v-a-q foreach (var q in post_a[v]) { //q has relation to B if (relation.GetRelation(B.index, GetBlock(q).index)) { B.relCount.Incr(a, v); } } } tmp = new bool[lts.numStates]; for (int i = 0; i < tmp.Length; i++) { tmp[i] = true; } HashSet <int> remove = new HashSet <int>(); foreach (var c in partition) { if (relation.GetRelation(B.index, c.index)) { foreach (var r in c.states) { foreach (var q in pre_a[r]) { //q-a-r //state q has transition a to a state in block c having relation with B tmp[q] = false; } } } } for (int i = 0; i < tmp.Length; i++) { if (tmp[i]) { remove.Add(i); } } B.remove[a] = remove; if (remove.Count > 0) { NewTask(a, B); } } } }