public void find_Path(GraphVariables.clsGraph graph, int fromN, GraphVariables.clsLoop clsLoop, int workLoop, int loop, int fromNode, int toNode, ref bool[] mark, ref int[] X, int header, ref int[] searchNode, ref int nSearchNode) { //must guarantee no EXIT in PdFlow() for (int j = 0; j < graph.Network[fromN].Node[fromNode].nPost; j++) { int postNode = graph.Network[fromN].Node[fromNode].Post[j]; if (mark[postNode] == false && gProAnalyzer.Ultilities.checkGraph.Node_In_Loop(clsLoop, workLoop, postNode, loop)) { X[fromNode] = postNode; mark[postNode] = true; if (postNode == toNode) { //getResult(ref X, header, toNode, ref searchNode, ref nSearchNode); mark[postNode] = false; } else { mark[postNode] = true; find_Path(graph, fromN, clsLoop, workLoop, loop, postNode, toNode, ref mark, ref X, header, ref searchNode, ref nSearchNode); mark[postNode] = false; } } } }
public static int getCID_IL(GraphVariables.clsGraph graph, int fromN, GraphVariables.clsLoop clsLoop, int workLoop, int loop) { //gProAnalyzer.Ultilities.findIntersection interSect = new gProAnalyzer.Ultilities.findIntersection(); //gProAnalyzer.Ultilities.reduceGraph reduceG = new gProAnalyzer.Ultilities.reduceGraph(); int[] calDom = null; for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nEntry; k++) { calDom = gProAnalyzer.Ultilities.findIntersection.find_Intersection(graph.Network[fromN].nNode, calDom, graph.Network[fromN].Node[clsLoop.Loop[workLoop].Loop[loop].Entry[k]].Dom); } if (calDom.Length > 0) { int CID = -1; //pick another CID if current CID for (int i = calDom.Length - 1; i > -1; i--) { if (gProAnalyzer.Ultilities.reduceGraph.check_CID_In_Loop(clsLoop, workLoop, loop, calDom[i]) == false) { CID = calDom[i]; break; } } if (CID == -1) { MessageBox.Show("Find_IncludeNode of DFlow error", "Error"); return(-1); //error } int header = CID; return(header); } return(-1); }
public static bool check_header(ref GraphVariables.clsLoop clsLoop, int currentLoop, int i, int k, ref int loop) { for (int j = 0; j < clsLoop.Loop[currentLoop].Loop[i].nChild; j++) { if (clsLoop.Loop[currentLoop].Loop[i].Node[k] == clsLoop.Loop[currentLoop].Loop[clsLoop.Loop[currentLoop].Loop[i].child[j]].header) { loop = clsLoop.Loop[currentLoop].Loop[i].child[j]; return(true); } } return(false); }
public static bool check_UntanglingIL(GraphVariables.clsLoop clsLoop, int workLoop, int curLoop) { //if no exclusive entries exist (concurrency = 0) => no Untangling for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].Concurrency.Length; i++) { if (clsLoop.Loop[workLoop].Loop[curLoop].Concurrency[i] == 0) { return(true); } } return(false); }
public static void find_ParentLoop(GraphVariables.clsLoop clsLoop, int workLoop, int loop, ref int[] pLoopS, ref int npLoopS) { if (clsLoop.Loop[workLoop].Loop[loop].parentLoop == -1) { return; } pLoopS[npLoopS] = clsLoop.Loop[workLoop].Loop[loop].parentLoop; npLoopS++; find_ParentLoop(clsLoop, workLoop, clsLoop.Loop[workLoop].Loop[loop].parentLoop, ref pLoopS, ref npLoopS); }
private int Initialize_loopDAG(GraphVariables.clsGraph graph, int currentN, GraphVariables.clsLoop clsLoop, int currentLoop) { int countDAG = 0; for (int i = 0; i < clsLoop.Loop[currentLoop].nLoop; i++) { if (clsLoop.Loop[currentLoop].Loop[i].nEntry == 1) { countDAG += 2; } else { countDAG += 3; } } return(countDAG); }
public static void start_Indexing_Acyclic(ref GraphVariables.clsGraph graph, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsHWLS clsHWLS_Untangle, ref GraphVariables.clsLoop clsLoop, ref GraphVariables.clsSESE clsSESE, bool[] flag_Check) { Initialize_All(); gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.orgNet, graph.midNet); gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.orgLoop, ref clsLoop.IrreducibleError); graph.Network[graph.finalNet] = graph.Network[graph.midNet]; gProAnalyzer.Functionalities.NodeSplittingType2.Run_Split_Type2(ref graph, graph.midNet, graph.finalNet, ref clsLoop, clsLoop.orgLoop); gProAnalyzer.Functionalities.DominanceIdentification.find_Dom(ref graph, graph.finalNet); gProAnalyzer.Functionalities.DominanceIdentification.find_Pdom(ref graph, graph.finalNet); gProAnalyzer.Functionalities.DominanceIdentification.find_DomEI(ref graph, graph.finalNet, -2); gProAnalyzer.Functionalities.DominanceIdentification.find_PdomEI(ref graph, graph.finalNet); gProAnalyzer.Functionalities.SESEIdentification.find_SESE_WithLoop(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, -2); gProAnalyzer.Functionalities.NodeSplittingType3.Run_Split_Type3(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, true); //Make nesting forest gProAnalyzer.Ultilities.makeNestingForest.make_NestingForest(ref graph, graph.finalNet, ref clsHWLS, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE); GraphVariables.clsError clsError = new gProAnalyzer.GraphVariables.clsError(); //Fix each SOS entry for Bond and Rigid gProAnalyzer.Functionalities.VerificationG.Initialize_Verification(ref graph, ref clsError, ref clsLoop, ref clsSESE, ref clsHWLS); //verify bond first =>> int workNet = graph.finalNet; int workLoop = clsLoop.orgLoop; int workSESE = clsSESE.finalSESE; //== get initial behavior profile == graph.Network[graph.reduceNet] = graph.Network[workNet]; gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, graph.reduceNet, 0, 0); get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS, ref clsLoop, workLoop, ref clsSESE, workSESE, flag_Check); //Database storing }
public static bool check_CID_In_Loop(GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, int canCID) { Initialized_All(); int curDepth = clsLoop.Loop[workLoop].Loop[curLoop].depth; for (int i = 0; i < clsLoop.Loop[workLoop].nLoop; i++) { if (clsLoop.Loop[workLoop].Loop[i].depth == curDepth) { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Loop(clsLoop, workLoop, canCID, i)) { if (!(clsLoop.Loop[workLoop].Loop[i].header == canCID && clsLoop.Loop[workLoop].Loop[i].nEntry == 1)) { return(true); } } } } return(false); }
public void build_loopDAG(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsLoop clsLoop, int currentLoop, ref GraphVariables.clsSESE clsSESE, ref GraphVariables.clsLoopDAG clsLoopDAG, int currentLoopDAG) { int init_n = Initialize_loopDAG(graph, currentN, clsLoop, currentLoop); clsLoopDAG.loopDAG[currentLoopDAG].loopDAG = new GraphVariables.clsLoopDAG.strLoopDAGInfo[init_n]; clsLoopDAG.loopDAG[currentLoopDAG].nLoopDAG = 0; //clsLoopDAG.loopDAG[currentLoopDAG].loopDAG[1].DAG.header; //int count_loopDAG = 0; for (int i = 0; i < clsLoop.Loop[currentLoop].nLoop; i++) { gProAnalyzer.GraphVariables.clsLoop.strLoopInform loop = clsLoop.Loop[currentLoop].Loop[i]; if (loop.nEntry == 1) //NL { gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, currentN, graph.acyclicNet, ref clsLoop, currentLoop, i, ref clsSESE, "FF", -1); } else //IL { } } }
public static bool isConcurrentEntry(GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, int cur_concurrency, int entry, int curEnIndex) { if (cur_concurrency == 0) { if (entry == curEnIndex) { return(true); } } else { for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].nEntry; i++) { if (clsLoop.Loop[workLoop].Loop[curLoop].Entry[i] == entry) { if (clsLoop.Loop[workLoop].Loop[curLoop].Concurrency[i] == cur_concurrency) { return(true); } } } } return(false); }
public static void add_to_exclusiveInst(GraphVariables.clsGraph graph, int tempNet, ref GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, int curEnIndx, int[] InstantNode, int nInstantNode) { int temp_nExclusive = clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx]; int[] temp_exclusiveInst = new int[temp_nExclusive]; temp_exclusiveInst = clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx]; clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx] = 0; clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx] = new int[nInstantNode]; for (int j = 0; j < nInstantNode; j++) { int orgInstNode = graph.Network[tempNet].Node[InstantNode[j]].orgNum; if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx], clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx], orgInstNode) == false) { if (clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx] < 1) { clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx] = 0; } int instIndex = clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx]; clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx][instIndex] = orgInstNode; instIndex++; clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx] = instIndex; } } int temp_nExclusive_2 = clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx]; int[] temp_exclusiveInst_2 = new int[temp_nExclusive_2]; temp_exclusiveInst_2 = clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx]; int[] totalTemp = new int[temp_nExclusive_2 + temp_nExclusive]; int nTotal = 0; for (int i = 0; i < temp_nExclusive; i++) { totalTemp[nTotal] = temp_exclusiveInst[i]; nTotal++; } for (int i = 0; i < temp_nExclusive_2; i++) { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(totalTemp, nTotal, temp_exclusiveInst_2[i]) == false) { totalTemp[nTotal] = temp_exclusiveInst_2[i]; nTotal++; } } //cleaning array int[] newArray = new int[nTotal]; for (int i = 0; i < nTotal; i++) { newArray[i] = totalTemp[i]; } clsLoop.Loop[workLoop].Loop[curLoop].nExclusiveInst[curEnIndx] = nTotal; clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx] = newArray; //clsLoop.Loop[workLoop].Loop[curLoop].exclusiveInst[curEnIndx] = }
//Get concurrency combination of IL<entries> from their CID (Output => SubNet) public static void check_Concurrency(ref GraphVariables.clsGraph graph, int currentN, int conNet, int subNet, GraphVariables.clsLoop clsLoop, int workLoop, int loop, ref GraphVariables.clsSESE clsSESE) { Initialize_All(); //make_ConcurrencyFlow graph.Network[conNet] = graph.Network[currentN]; //CIDFlow begining is stored in conNet (Network[8]) gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, conNet, 0, 0); gProAnalyzer.Ultilities.copyLoop.copy_Loop(ref clsLoop, workLoop, clsLoop.tempLoop); //reduce all loop except "loop" and its parents. (Applied NEW TYPE OF IL REDUCTION) ==>> REDUCE SAME DEPTH??? => ITS OK!! gProAnalyzer.Ultilities.reduceGraph.Preprocessing_total_reduceSubgraph(ref graph, conNet, clsLoop, workLoop, loop); //make DFlow() + CID in this procedure. gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, conNet, subNet, ref clsLoop, clsLoop.tempLoop, loop, ref clsSESE, "CC", -1); //find concurrency set //============ (by pass) using "CC" subgraph to find other parameter (just lazy) ============== DFlow_IL_Flow = null; nNodeDFlow_IL = 0; expand_DFlow_IL_Flow = null; //combine DFlow+IL and expand nested loops (if any) expand_nNodeDFlow_IL = 0; DFlow = null; nDFlow = 0; expand_DFlow = null; expand_nDFlow = 0; orgCID = getCID_IL(graph, conNet, clsLoop, workLoop, loop); //CID of original graph index (All entries) expand_boundaryNodes = getBoundaryNode(graph, conNet, subNet, clsLoop, workLoop, loop, ref expand_DFlow_IL_Flow, ref expand_nNodeDFlow_IL, ref expand_DFlow, ref expand_nDFlow, true); boundaryNodes = getBoundaryNode(graph, conNet, subNet, clsLoop, workLoop, loop, ref DFlow_IL_Flow, ref nNodeDFlow_IL, ref DFlow, ref nDFlow, false); //============================================================================================== gProAnalyzer.Ultilities.makeSubNetwork.make_subGraph_DFlow(ref graph, conNet, subNet, ref clsLoop, clsLoop.tempLoop, loop, DFlow, nDFlow, boundaryNodes, orgCID); //subgraph contains DFlow + boundaryNode //========>>>>> NEED FIX THE CONCURRENT ENTRY SET IDENTIFICATION => Recording all set, not optimize anything make_ConcurrencyInstance(graph, subNet, ref clsLoop, clsLoop.tempLoop, loop); //find concurrency entry sets using DFlow() => store in clsLoop. //========>>>>> MUST FIX <<<<<============ //some ERRORS here, check it for QUERY paper (Next paper) make_ConcurrencyInstance_Untangling(ref graph, subNet, ref clsLoop, clsLoop.tempLoop, loop); //find the instanceNode to each concurrencySet => store in clsLoop also //copy concurrency inform =============== THIS IS FOR THE VERIFICATION PAPER ONLY clsLoop.Loop[workLoop].Loop[loop].nConcurrency = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nConcurrency; //tranfer all the concurrency value from tempLoop [3] to workloop [2] if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].Concurrency != null) { clsLoop.Loop[workLoop].Loop[loop].Concurrency = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry]; for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nEntry; k++) { clsLoop.Loop[workLoop].Loop[loop].Concurrency[k] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].Concurrency[k]; } } //copy InstanceNode_DFlow to workLoop - Concurrent Entry clsLoop.Loop[workLoop].Loop[loop].nConcurrInst = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nConcurrInst.Length]; //tranfer all the concurrency value from tempLoop [3] to workloop [2] for (int i = 0; i < clsLoop.Loop[workLoop].Loop[loop].nConcurrInst.Length; i++) { clsLoop.Loop[workLoop].Loop[loop].nConcurrInst[i] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nConcurrInst[i]; } if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst != null) { clsLoop.Loop[workLoop].Loop[loop].concurrInst = new int[clsLoop.Loop[workLoop].Loop[loop].nConcurrInst.Length][]; for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nConcurrInst.Length; k++) { if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst[k] == null) { continue; } clsLoop.Loop[workLoop].Loop[loop].concurrInst[k] = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst[k].Length]; for (int l = 0; l < clsLoop.Loop[workLoop].Loop[loop].nConcurrInst[k]; l++) { clsLoop.Loop[workLoop].Loop[loop].concurrInst[k][l] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst[k][l]; } } } //copy InstanceNode_DFlow to workLoop - Exclusive entries clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nExclusiveInst.Length]; //tranfer all the concurrency value from tempLoop [3] to workloop [2] for (int i = 0; i < clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst.Length; i++) { clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst[i] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nExclusiveInst[i]; } if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst != null) { clsLoop.Loop[workLoop].Loop[loop].exclusiveInst = new int[clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst.Length][]; for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst.Length; k++) { if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst[k] == null) { continue; } clsLoop.Loop[workLoop].Loop[loop].exclusiveInst[k] = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst[k].Length]; for (int l = 0; l < clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst[k]; l++) { clsLoop.Loop[workLoop].Loop[loop].exclusiveInst[k][l] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst[k][l]; } } } //output is the model in Network.SUBNET //output: Get Concurrency[] and ConcurrencyInst of DFlow(). }
public static void make_ConcurrencyInstance_Untangling(ref GraphVariables.clsGraph graph, int tempNet, ref GraphVariables.clsLoop clsLoop, int workLoop, int loop) { //set the initiated value for SearchXOR, nSearch, nCurrentXOR int[] SearchXOR = new int[graph.Network[tempNet].nNode]; // 0-탐색 //navigation?? int nSearchXOR = 0; int nCurrentXOR = 0; clsLoop.Loop[workLoop].Loop[loop].nConcurrInst = new int[clsLoop.Loop[workLoop].Loop[loop].nConcurrency + 1]; //+1 for compatable of concurrencyIndex (loop) clsLoop.Loop[workLoop].Loop[loop].concurrInst = new int[clsLoop.Loop[workLoop].Loop[loop].nConcurrency + 1][]; clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry]; clsLoop.Loop[workLoop].Loop[loop].exclusiveInst = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry][]; do { nCurrentXOR = 0; for (int j = 0; j < graph.Network[tempNet].nLink; j++) { graph.Network[tempNet].Link[j].bInstance = false; } int[] InstantNode = new int[graph.Network[tempNet].nNode]; int nInstantNode = 0; string[] strCombination_OR = new string[graph.Network[tempNet].nNode]; int sNode = graph.Network[tempNet].header; InstantNode[nInstantNode] = sNode; nInstantNode++; //Instant Flow //SearchXOR[] will be use in here //instanceNode() => will find the path of each instance flow (i.g. 1->4->5->8) if (gProAnalyzer.Ultilities.makeInstanceFlow.find_InstanceNode(ref graph, tempNet, sNode, ref InstantNode, ref nInstantNode, ref SearchXOR, ref nSearchXOR, ref nCurrentXOR, ref strCombination_OR)) { string[] readable = new string[nInstantNode]; readable = convert_Readable(ref graph, tempNet, InstantNode, nInstantNode); for (int k = 0; k <= clsLoop.Loop[workLoop].Loop[loop].nConcurrency; k++) { int countE = 0; int countInst = 0; for (int m = 0; m < clsLoop.Loop[workLoop].Loop[loop].nEntry; m++) { if (clsLoop.Loop[workLoop].Loop[loop].Concurrency[m] != k) { continue; } countE++; int curEntry = get_NewNodeIndex(graph, tempNet, clsLoop.Loop[workLoop].Loop[loop].Entry[m]); if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(InstantNode, nInstantNode, curEntry) == true) { countInst++; if (k == 0) { add_to_exclusiveInst(graph, tempNet, ref clsLoop, workLoop, loop, m, InstantNode, nInstantNode); } } } if (countE == countInst) { //store InstanceNode //set Union of all instance node add_to_concurrInst(graph, tempNet, ref clsLoop, workLoop, loop, k, InstantNode, nInstantNode); } if (true) { } } } } while (nSearchXOR > 0); }
public static void make_ConcurrencyInstance(GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsLoop clsLoop, int workLoop, int loop) //Must check here !!!!!!!!!!!! { //INPUT: A acyclic graph with single start //OUTPUT: Mark into CONCURRENCY field of the clsLoop.Loop[workLoop].Loop[loop]; int conNum = 0; int[][] conEntry = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry][]; for (int i = 0; i < clsLoop.Loop[workLoop].Loop[loop].nEntry; i++) { conEntry[i] = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry]; } //set the initiated value for SearchXOR, nSearch, nCurrentXOR int[] SearchXOR = new int[graph.Network[currentN].nNode]; // 0-탐색 //navigation?? int nSearchXOR = 0; int nCurrentXOR = 0; do { nCurrentXOR = 0; for (int j = 0; j < graph.Network[currentN].nLink; j++) { graph.Network[currentN].Link[j].bInstance = false; } int[] InstantNode = new int[graph.Network[currentN].nNode]; int nInstantNode = 0; string[] strCombination_OR = new string[graph.Network[currentN].nNode]; int sNode = graph.Network[currentN].header; InstantNode[nInstantNode] = sNode; nInstantNode++; //Instant Flow 찾으면 //SearchXOR[] will be use in here //instanceNode() => will find the path of each instance flow (i.g. 1->4->5->8) if (gProAnalyzer.Ultilities.makeInstanceFlow.find_InstanceNode(ref graph, currentN, sNode, ref InstantNode, ref nInstantNode, ref SearchXOR, ref nSearchXOR, ref nCurrentXOR, ref strCombination_OR)) { //find int[] imEntry = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry]; bool isError = true; for (int i = 0; i < nInstantNode; i++) { for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { if (graph.Network[currentN].Node[InstantNode[i]].orgNum == clsLoop.Loop[workLoop].Loop[loop].Entry[j]) { imEntry[j] = 1; //import entry cua node thu j (ko phai node j) = 1 sau nay no co the = 2 3 4 ... isError = false; break; } } } if (!isError) { //Same Check int sameCon = 0; //sameConcurrent?? bool[] kCon = new bool[conNum]; for (int k = 0; k < conNum; k++) { for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { if (imEntry[j] == 1 && conEntry[k][j] == 1) { sameCon++; kCon[k] = true; break; } } } if (sameCon == 0) { conEntry[conNum] = imEntry; conNum++; } else { int conNum_T = conNum; int[][] conEntry_T = new int[conNum][]; for (int k = 0; k < conNum_T; k++) { conEntry_T[k] = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry]; for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { conEntry_T[k][j] = conEntry[k][j]; } } conNum = 0; for (int k = 0; k < conNum_T; k++) { if (kCon[k]) { continue; } for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { conEntry[conNum][j] = conEntry[k][j]; } conNum++; } for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { conEntry[conNum][j] = 0; if (imEntry[j] == 1) { conEntry[conNum][j] = 1; } for (int k = 0; k < conNum_T; k++) { if (!kCon[k]) { continue; } if (conEntry_T[k][j] == 1) { conEntry[conNum][j] = 1; } } } conNum++; } } } // if error } while (nSearchXOR > 0); //here => what I need to know //number of Concurrency = number of Loop Entry clsLoop.Loop[workLoop].Loop[loop].Concurrency = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry]; int numType = 1; for (int k = 0; k < conNum; k++) { int cntTrue = 0; for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { if (conEntry[k][j] == 1) { cntTrue++; } } if (cntTrue > 1) { for (int j = 0; j < clsLoop.Loop[workLoop].Loop[loop].nEntry; j++) { if (conEntry[k][j] == 1) { clsLoop.Loop[workLoop].Loop[loop].Concurrency[j] = numType; } } numType++; } } clsLoop.Loop[workLoop].Loop[loop].nConcurrency = numType - 1; }
public int[] get_InstanceFlow(ref GraphVariables.clsGraph graph, int currentN, GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, int concurEn) { SearchXOR = new int[graph.Network[currentN].nNode]; // 0-탐색 nSearchXOR = 0; nCurrentXOR = 0; nInst = 0; int[] searchNode = new int[graph.Network[currentN].nNode]; int nSearchNode = 0; do { nCurrentXOR = 0; for (int j = 0; j < graph.Network[currentN].nLink; j++) //fill all this subnetwork is un-visit { graph.Network[currentN].Link[j].bInstance = false; //bInstance is used for mark the node which have token (instance flow) } int[] InstantNode = new int[graph.Network[currentN].nNode]; int nInstantNode = 0; string[] strCombination_OR = new string[graph.Network[currentN].nNode]; //for indexing the current propagation of OR split e.g., which successors are activated. //int nOR_SplitIndex = 0; int sNode = graph.Network[currentN].header; InstantNode[nInstantNode] = sNode; nInstantNode++; if (find_InstanceNode(ref graph, currentN, sNode, ref InstantNode, ref nInstantNode, ref SearchXOR, ref nSearchXOR, ref nCurrentXOR, ref strCombination_OR)) //find_InstanceNode() => output will be stored in InstantNode[] (Global variable!) - all the node which is activated in currentN. { string[] readable = new string[nInstantNode]; nInst++; } //check whether current InstanceNode contains concurrentEntries or not int countE = 0; int countInst = 0; for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].nConcurrency; i++) { if (clsLoop.Loop[workLoop].Loop[curLoop].Concurrency[i] == concurEn) { countE++; for (int j = 0; j < nInstantNode; j++) { if (graph.Network[currentN].Node[InstantNode[j]].orgNum == clsLoop.Loop[workLoop].Loop[curLoop].Entry[i]) { countInst++; } } } } //if current Inst contain cc_entries set => store it if (countE == countInst) { //set Union of all instance node for (int j = 0; j < nInstantNode; j++) { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(searchNode, nSearchNode, InstantNode[j]) == false) { searchNode[nSearchNode] = InstantNode[j]; nSearchNode++; } } } } while (nSearchXOR > 0); int[] tempArr = new int[nSearchNode]; for (int i = 0; i < nSearchNode; i++) { tempArr[i] = searchNode[i]; } return(tempArr); //cardinality = nInst; }
public static bool make_UntanglingIL(ref GraphVariables.clsGraph graph, int currentN, int untangleNet, GraphVariables.clsHWLS clsHWLS, GraphVariables.clsLoop clsLoop, int workLoop, GraphVariables.clsSESE clsSESE, int workSESE) { Initialize_All(); bool existUntangle = false; //scan for all IL and analyze at the lowest lever first. graph.Network[untangleNet] = graph.Network[currentN]; gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, untangleNet, 0, 0); //now work in untangleNet gProAnalyzer.Ultilities.copyLoop.copy_Loop(ref clsLoop, workLoop, clsLoop.untangleLoop); int curDepth = clsHWLS.FBLOCK.maxDepth; do { for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { if (clsHWLS.FBLOCK.FBlock[i].depth != curDepth || clsHWLS.FBLOCK.FBlock[i].nEntry == 1) { continue; //only get IL } int orgLoopIndx = clsHWLS.FBLOCK.FBlock[i].refIndex; int newLoopIndx = find_newLoopIndex(graph, untangleNet, clsLoop, workLoop, clsLoop.untangleLoop, orgLoopIndx); gProAnalyzer.Ultilities.findConcurrencyEntriesIL.check_Concurrency(ref graph, untangleNet, graph.conNet, graph.subNet, clsLoop, clsLoop.untangleLoop, newLoopIndx, ref clsSESE); //concurrency[] and concurrencyInst[] were found in clsLoop. //find CID again => int CID = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.orgCID; //we can access searchNode[] in fndConcurrencyIL to get DF => then find boundaries nodes of current IL int[] DFlow_IL_Flow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.DFlow_IL_Flow;; int nNodeDFlow_IL = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.nNodeDFlow_IL; int[] expand_DFlow_IL_Flow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_DFlow_IL_Flow; int expand_nNodeDFlow_IL = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_nNodeDFlow_IL; int[] DFlow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.DFlow; int nDFlow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.nDFlow; int[] expand_DFlow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_DFlow; int expand_nDFlow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_nDFlow; int[] boundaryNodes = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.boundaryNodes;//get the boundaryNode of currentN graph. int[] expand_boundaryNode = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_boundaryNodes; //check whether need to untangle the IL or not? => if need -> next step (Check PdFlow? also) if (!check_UntanglingIL(clsLoop, clsLoop.untangleLoop, newLoopIndx)) { continue; } graph.Network[graph.nickNet] = graph.Network[untangleNet]; gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, graph.nickNet, 0, 0); //Using NICKNET for reference of Link remove_DFlow_IL(ref graph, untangleNet, ref clsLoop, clsLoop.untangleLoop, newLoopIndx, expand_boundaryNode, CID, expand_DFlow_IL_Flow, expand_nNodeDFlow_IL); //must use expand version //Next: make_subNet of new Untangling subGraph based on concurrencyInst[] of current IL //Next: plug into original network + expand loops in DFlow (if any) - links/ edges' index should be modified also gProAnalyzer.Ultilities.makeSubNetwork.combine_subGraph_Untangling(ref graph, graph.nickNet, untangleNet, graph.conNet, graph.subNet, graph.dummyNet, clsLoop, clsLoop.untangleLoop, newLoopIndx, expand_boundaryNode, boundaryNodes, CID); //using subNet as referrence (also //Using NICKNET for reference of Link) //return true; //final step => polishing the subgraph by removing some unnecessary node (gateways only have 1 incoming/ outgoing edge?) //remove disconnected nodes (~ mark Done = true) removing_disconnectedNode(ref graph, untangleNet); existUntangle = true; //At least done 1 untangle of 1 IL //return true;; for (int k = 0; k < graph.Network[untangleNet].nNode; k++) { gProAnalyzer.Ultilities.clsFindNodeInfo.find_NodeInfo(ref graph, untangleNet, k); } gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.untangleNet, graph.midNet); gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.untangleLoop, ref clsLoop.IrreducibleError); gProAnalyzer.Functionalities.NodeSplittingType2.Run_Split_Type2(ref graph, untangleNet, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop); } curDepth--; } while (curDepth > 0); //find PRE/POST DOM/ PDOM + LOOP + SESE + Node splitting again for (int i = 0; i < graph.Network[untangleNet].nNode; i++) { gProAnalyzer.Ultilities.clsFindNodeInfo.find_NodeInfo(ref graph, untangleNet, i); } return(existUntangle); }
public static void make_NestingForest(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsLoop clsLoop, int workLoop, ref GraphVariables.clsSESE clsSESE, int workSESE) { int bIndex = 0; //FBLOCK.FBlock = new strFBlock[SESE[currentSESE].nSESE + Loop[currentLoop].nLoop]; if (workSESE >= 0 && workLoop >= 0) { clsHWLS.FBLOCK.FBlock = new GraphVariables.clsHWLS.strFBlock[clsSESE.SESE[workSESE].nSESE + clsLoop.Loop[workLoop].nLoop]; } else { if (workSESE >= 0) { clsHWLS.FBLOCK.FBlock = new GraphVariables.clsHWLS.strFBlock[clsSESE.SESE[workSESE].nSESE]; } else { clsHWLS.FBLOCK.FBlock = new GraphVariables.clsHWLS.strFBlock[clsLoop.Loop[workLoop].nLoop]; } } //Copy SESE if (workSESE >= 0 && clsSESE.SESE[workSESE].nSESE > 0) { //copy SESE and LOOP to FBlock; for (int i = 0; i < clsSESE.SESE[workSESE].nSESE; i++) { //copy SESE to FBlock //FBlock[bIndex].child = SESE[currentSESE].SESE[i].child; //FBlock[bIndex].depth = SESE[currentSESE].SESE[i].depth; clsHWLS.FBLOCK.FBlock[bIndex].Entry = new int[1]; clsHWLS.FBLOCK.FBlock[bIndex].Entry[0] = clsSESE.SESE[workSESE].SESE[i].Entry; clsHWLS.FBLOCK.FBlock[bIndex].Exit = new int[1]; clsHWLS.FBLOCK.FBlock[bIndex].Exit[0] = clsSESE.SESE[workSESE].SESE[i].Exit; clsHWLS.FBLOCK.FBlock[bIndex].nEntry = 1; clsHWLS.FBLOCK.FBlock[bIndex].nExit = 1; clsHWLS.FBLOCK.FBlock[bIndex].Node = clsSESE.SESE[workSESE].SESE[i].Node; clsHWLS.FBLOCK.FBlock[bIndex].nNode = clsSESE.SESE[workSESE].SESE[i].nNode; //FBlock[bIndex].parentBlock ?? clsHWLS.FBLOCK.FBlock[bIndex].SESE = true; clsHWLS.FBLOCK.FBlock[bIndex].refIndex = i; bIndex++; } } //Copy Loop if (workLoop >= 0 && clsLoop.Loop[workLoop].nLoop > 0) { copy_Loop(ref clsLoop, workLoop, clsLoop.newTempLoop); //modify tempLoop => expand the node for (int i = 0; i < clsLoop.Loop[clsLoop.newTempLoop].nLoop; i++) { if (clsLoop.Loop[clsLoop.newTempLoop].Loop[i].parentLoop != -1) { continue; //only start with the outter loop //Log: Otc28_2020 } //MAKE A SLIGHT CHANGE HERE ====================================== //if (clsLoop.Loop[clsLoop.newTempLoop].Loop[i].depth != 1) continue; int n = 0; int[] temp = GetFullNode(ref graph, currentN, ref clsLoop, clsLoop.newTempLoop, i, ref n); //get full node of Loop (newTempLoop) update this loop and all child (including header) //remove redundancy in Loop[i].Node[]; //temp = removeRedundancyNode(temp); } //copy Loop to FBlock for (int i = 0; i < clsLoop.Loop[clsLoop.newTempLoop].nLoop; i++) { //FBlock[bIndex].child = ?? //FBlock[bIndex].depth = ?? clsHWLS.FBLOCK.FBlock[bIndex].Entry = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].Entry; clsHWLS.FBLOCK.FBlock[bIndex].Exit = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].Exit; clsHWLS.FBLOCK.FBlock[bIndex].nEntry = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].nEntry; clsHWLS.FBLOCK.FBlock[bIndex].nExit = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].nExit; clsHWLS.FBLOCK.FBlock[bIndex].Node = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].Node; clsHWLS.FBLOCK.FBlock[bIndex].nNode = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].nNode; //FBlock[bIndex].parentBlock = ?? clsHWLS.FBLOCK.FBlock[bIndex].SESE = false; clsHWLS.FBLOCK.FBlock[bIndex].refIndex = i; bIndex++; } } clsHWLS.FBLOCK.nFBlock = bIndex; //remove same block check_Block_Same(ref clsHWLS); //Find parent block for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { int j = find_nearestParentBlock(ref clsHWLS, i); clsHWLS.FBLOCK.FBlock[i].parentBlock = j; } //find Children for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { int[] child_of_i = new int[clsHWLS.FBLOCK.nFBlock]; int nChild = 0; for (int j = 0; j < clsHWLS.FBLOCK.nFBlock; j++) { if (clsHWLS.FBLOCK.FBlock[j].parentBlock == i) { child_of_i[nChild] = j; nChild++; } } clsHWLS.FBLOCK.FBlock[i].child = child_of_i; clsHWLS.FBLOCK.FBlock[i].nChild = nChild; } //find Depth clsHWLS.FBLOCK.maxDepth = 0; //int maxDepth = 0; int curDepth = 0; for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { curDepth = 1; //FBLOCK.maxDepth = 1; if (clsHWLS.FBLOCK.FBlock[i].parentBlock != -1) { continue; } clsHWLS.FBLOCK.FBlock[i].depth = curDepth; find_BlockDepth(ref clsHWLS, i, ref curDepth); } if (clsHWLS.FBLOCK.nFBlock > 0 && clsHWLS.FBLOCK.maxDepth == 0) { clsHWLS.FBLOCK.maxDepth = 1; } }
//might not use private void reduceAllChild(ref GraphVariables.clsGraph graph, int currentN, GraphVariables.clsHWLS clsHWLS, int currBlock, GraphVariables.clsLoop clsLoop, int workLoop, GraphVariables.clsSESE clsSESE, int workSESE, int orgIndex) { for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { if (clsHWLS.FBLOCK.FBlock[i].parentBlock == currBlock) { if (clsHWLS.FBLOCK.FBlock[i].SESE == true) { gProAnalyzer.Ultilities.reduceGraph.reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndex); } if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndex].nEntry == 1) { gProAnalyzer.Ultilities.reduceGraph.reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndex, "", false); } //if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndex].nEntry > 1) //reduceG.reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, orgIndex); } } }
public void total_reduceSubgraph(ref GraphVariables.clsGraph graph, int currentN, GraphVariables.clsHWLS clsHWLS, GraphVariables.clsLoop clsLoop, int workLoop, GraphVariables.clsSESE clsSESE, int workSESE, int stopDepth) //Reduce all the loops inside (NL, IL) { int curDepth = clsHWLS.FBLOCK.maxDepth; if (curDepth == stopDepth) { return; } //curDepth = 1; do { for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { if (clsHWLS.FBLOCK.FBlock[i].depth != curDepth) { continue; } int orgIndx = clsHWLS.FBLOCK.FBlock[i].refIndex; //If SESE => Make subnetwork and find Dominator Behavior relation matrix (1 matrix) if (clsHWLS.FBLOCK.FBlock[i].SESE) { reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndx); } //If NL => Make subnetwork and find Dom/ Pdom Behavior relation matrix (2 matrices) if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry == 1) { reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndx, "", false); } //if IL => Find CIPd => Make subnetwork with CIPd and find Dom/ Pdom Behavior relation matrix (2 matrices) if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry > 1) { reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, orgIndx); } } curDepth--; } while (curDepth > stopDepth); }
//make an empty space of CID+IL for Untangling the IL latter. public static void remove_DFlow_IL(ref GraphVariables.clsGraph graph, int tempNet, ref GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, int[] boundaryNodes, int CID, int[] DFlow_IL_Flow, int nNodeDFlow) { GraphVariables.clsEdge.strEdge[] imLink = new GraphVariables.clsEdge.strEdge[graph.Network[tempNet].nLink]; int nImLink = 0; //remove the links of boundary nodes except CID for (int i = 0; i < graph.Network[tempNet].nLink; i++) { int fromNode = graph.Network[tempNet].Link[i].fromNode; int toNode = graph.Network[tempNet].Link[i].toNode; if (!(gProAnalyzer.Ultilities.checkGraph.Node_In_Set(DFlow_IL_Flow, nNodeDFlow, fromNode) == true && gProAnalyzer.Ultilities.checkGraph.Node_In_Set(DFlow_IL_Flow, nNodeDFlow, toNode) == true)) { imLink[nImLink] = graph.Network[tempNet].Link[i]; nImLink++; } } //mark DONE for removed nodes for (int i = 0; i < graph.Network[tempNet].nNode; i++) { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(DFlow_IL_Flow, nNodeDFlow, i) && gProAnalyzer.Ultilities.checkGraph.Node_In_Set(boundaryNodes, boundaryNodes.Length, i) == false && graph.Network[tempNet].Node[i].orgNum != CID) { graph.Network[tempNet].Node[i].done = true; //need i? } } graph.Network[tempNet].nLink = nImLink; graph.Network[tempNet].Link = new GraphVariables.clsEdge.strEdge[nImLink]; for (int i = 0; i < graph.Network[tempNet].nLink; i++) { graph.Network[tempNet].Link[i] = imLink[i]; } //update pre/post of each nodes for (int i = 0; i < graph.Network[tempNet].nNode; i++) { gProAnalyzer.Ultilities.clsFindNodeInfo.find_NodeInfo(ref graph, tempNet, i); } }
//fromN = currentN (as referrence) private void make_UntanglingSubGraph(ref GraphVariables.clsGraph graph, int fromN, int toN, ref GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, int[] boundaryNodes, int[] DFlow_IL_Flow, int nNodeDFlow, int[] DFlow, int nDFlow, int orgCID) { //fill out searchNode of makeSubNetwork (fromN network) gProAnalyzer.Ultilities.makeSubNetwork.searchNode = new int[nDFlow]; gProAnalyzer.Ultilities.makeSubNetwork.nSearchNode = 0; int newSubgraph_Index = -1; for (int i = 0; i < nDFlow; i++) { gProAnalyzer.Ultilities.makeSubNetwork.searchNode[i] = DFlow[i]; //DFlow contain original index of fromN.. if (DFlow[i] == orgCID) { newSubgraph_Index = i; } } //make subNetwork (like SESE) gProAnalyzer.Ultilities.makeSubNetwork.make_subNode(ref graph, fromN, toN, false, "", true, "OR"); //only add 1 node to subNetwork graph.Network[toN].header = newSubgraph_Index; gProAnalyzer.Ultilities.makeSubNetwork.make_subLink(ref graph, fromN, toN, ref clsLoop, workLoop, curLoop, "", false, null, false, null, -1); //One more thing. => connect all boundary nodes in DFlow to virtual new "OR" join //makeSubLink_Untangling(ref graph, fromN, toN, boundaryNodes, orgCID); //multiple end subgraph is allowed for (int i = 0; i < graph.Network[toN].nNode; i++) { gProAnalyzer.Ultilities.clsFindNodeInfo.find_NodeInfo(ref graph, toN, i); } //============== Do UNTANGLING =================== (NOW WE HAVE A FULL CLONE SUBGRAPH WITH DFLOW + IL + Boundary nodes => do again everything (include findLoop-reduceLoop) int nConcur = clsLoop.Loop[workLoop].Loop[curLoop].nConcurrency; int[] Combine_searchNode = new int[graph.Network[toN].nNode * nConcur]; int nCombine = 0; //for each concurrency Entry set for (int i = 0; i < nConcur; i++) { //find searchNode by InstanceFlow from CID to cc_Entries (Remember to mark different node for duplication) int[] searchNode = makInstF.get_InstanceFlow(ref graph, toN, clsLoop, workLoop, curLoop, i); //CheckAgain int nSearchNode = searchNode.Length; //combine searchNode with current IL nodes (Remember marking different node for duplication) //make_subNetwork for current branch //insert node into nodeList (makeSubNode()) //insert links into linkList (Using searchNode to makeSubLink()) - (Remember to adjust the node index - e.g traceable node[i].orgNum) //connect to/with virtual boundary nodes => when merging to original => just replace virtual boundary nodes //do again with other branch => } //====Make subLink of all nodes in Untangling subgraph (Remember duplication of nodes and Link index when duplication) //find nodeInfo //================================================ }
public static int check_real_errors(GraphVariables.clsGraph graph, int currentN, GraphVariables.clsHWLS clsHWLS, GraphVariables.clsLoop clsLoop, int currentLoop, ref GraphVariables.clsError clsError, int errorNode) //return(1) => Real; return(2) => Potential; return(3) => Dom { int[][] adjList = null; if (true) //acyclic { int[] getPath = new int[graph.Network[currentN].nNode]; int START = graph.Network[currentN].header; int nGetPath = 0; bool[] Mark = new bool[graph.Network[currentN].nNode]; gProAnalyzer.Ultilities.mappingGraph.to_adjList_Directed(ref graph, currentN, ref adjList); //We already buil an instance subgraph based on InstanceNode !! Huaahhh~ //Check "Real error" first for (int i = 0; i < clsError.nError; i++) //filtering the DL or LoS of acyclic only { if (!check_Error_Num(clsError, i)) { continue; //filtering acylci error } bool flag_Real_error = true; //0: real; int EXIT = Convert.ToInt32(clsError.Error[i].Node); DFS_Recursive(adjList, ref Mark, START, EXIT, ref getPath, ref nGetPath, clsError, ref flag_Real_error); if (flag_Real_error == true) { clsError.Error[i].TypeOfError = "R"; } else { clsError.Error[i].TypeOfError = "P"; } } //Check "Domiance error" from "Potential error" for (int i = 0; i < clsError.nError; i++) //filtering the DL or LoS of acyclic only { if (!check_Error_Num(clsError, i)) { continue; //filtering acylci error } if (clsError.Error[i].TypeOfError != "R") { continue; //only pick REAL errors for referencing } int currError = Convert.ToInt32(clsError.Error[i].Node); //This is a real error for (int k = 0; k < clsError.nError; k++) //filtering the DL or LoS of acyclic only { if (!check_Error_Num(clsError, k)) { continue; //filtering acylci error } if (clsError.Error[k].Node == clsError.Error[i].Node) { continue; } if (Ultilities.checkGraph.Node_In_Set(graph.Network[currentN].Node[currError].DomEI, graph.Network[currentN].Node[currError].nDomEI, Convert.ToInt32(clsError.Error[k].Node))) { clsError.Error[k].TypeOfError = "D"; } } } //Check "Dominance_by_Potential error" of Potential errors (From the leftover potential errors) for (int i = 0; i < clsError.nError; i++) //filtering the DL or LoS of acyclic only { if (!check_Error_Num(clsError, i)) { continue; //filtering acyclic error } if (clsError.Error[i].TypeOfError != "P") { continue; } int currError = Convert.ToInt32(clsError.Error[i].Node); for (int k = 0; k < clsError.nError; k++) //filtering the DL or LoS of acyclic only { if (!check_Error_Num(clsError, k)) { continue; //filtering acylci error } if (clsError.Error[k].Node == clsError.Error[i].Node) { continue; } if (Ultilities.checkGraph.Node_In_Set(graph.Network[currentN].Node[currError].DomEI, graph.Network[currentN].Node[currError].nDomEI, Convert.ToInt32(clsError.Error[k].Node))) { clsError.Error[k].TypeOfError = "DP"; } } } } else //if cylic graph { //First, check Error type DL, LoS, same with above (Must reduce all loop) => Compute the dominance relations //If error from inside NL => check (IF REDUCE LOOP => MUST MARK other reducedLoop as having Error for easily check). //If current NL => Take out NL subgraph => run DFS to check "Real_Error" and "Potential_errors" -> Check "Dominance_Errors" //If current NL Header is "Real" => keep everything original //If current NL Header is "Dom" => All error wil be "Dominace_Errors" //If current NL Header is "Potential" => All error will be "Potential_Errors" #region int curDepth = clsHWLS.FBLOCK.maxDepth; do { for (int k = 0; k < clsHWLS.FBLOCK.nFBlock; k++) { if (clsHWLS.FBLOCK.FBlock[k].depth != curDepth) { continue; } int orgIndx = clsHWLS.FBLOCK.FBlock[k].refIndex; if (clsHWLS.FBLOCK.FBlock[k].SESE == false && clsLoop.Loop[currentLoop].Loop[orgIndx].nEntry == 1) { gProAnalyzer.Ultilities.makeSubNetwork.make_AcyclicSubGraph(ref graph, currentN, graph.subNet, ref clsLoop, currentLoop, orgIndx, "NL"); int[] getPath = new int[graph.Network[graph.subNet].nNode]; int START = graph.Network[graph.subNet].header; int nGetPath = 0; bool[] Mark = new bool[graph.Network[graph.subNet].nNode]; gProAnalyzer.Ultilities.mappingGraph.to_adjList_Directed(ref graph, graph.subNet, ref adjList); //We already buil an instance subgraph based on InstanceNode !! Huaahhh~ //Check "Real error" first for (int i = 0; i < clsError.nError; i++) //filtering the DL or LoS of acyclic only { if (!(clsError.Error[k].messageNum == 3 || clsError.Error[k].messageNum == 4 || clsError.Error[k].messageNum == 29 || clsError.Error[k].messageNum == 5 || clsError.Error[k].messageNum == 6)) { continue; //filtering Loop error only [3,4,5,6,29] } bool flag_Real_error = true; //0: real; int EXIT = Convert.ToInt32(clsError.Error[i].Node); DFS_Recursive(adjList, ref Mark, START, EXIT, ref getPath, ref nGetPath, clsError, ref flag_Real_error); if (flag_Real_error == true) { clsError.Error[i].TypeOfError = "R"; } else { clsError.Error[i].TypeOfError = "P"; } } } } curDepth--; } while (curDepth > 0); #endregion } return(1); }
public static int[] getBoundaryNode(GraphVariables.clsGraph graph, int finalNet, int subNet, GraphVariables.clsLoop clsLoop, int workLoop, int curLoop, ref int[] tempSet, ref int nTempSet, ref int[] DFlow, ref int nDFlow, bool CheckCombineLoops) { DFlow = new int[graph.Network[finalNet].nNode]; nDFlow = 0; tempSet = new int[graph.Network[finalNet].nNode]; nTempSet = 0; int[] listCID_Loop = new int[clsLoop.Loop[workLoop].nLoop]; //index of reduced loops int nList = 0; for (int i = 0; i < graph.Network[subNet].nNode; i++) { if (graph.Network[subNet].Node[i].orgNum != -1) { tempSet[nTempSet] = graph.Network[subNet].Node[i].orgNum; nTempSet++; DFlow[nDFlow] = graph.Network[subNet].Node[i].orgNum; nDFlow++; if (graph.Network[subNet].Node[i].header == true) { listCID_Loop[nList] = graph.Network[subNet].Node[i].headerOfLoop; nList++; } } } if (CheckCombineLoops) { //combine tempSet + Loops (Expanded from reduced before) for (int i = 0; i < nList; i++) { for (int j = 0; j < clsLoop.Loop[workLoop].Loop[listCID_Loop[i]].nNode; j++) { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(tempSet, nTempSet, clsLoop.Loop[workLoop].Loop[listCID_Loop[i]].Node[j]) == true) { continue; } tempSet[nTempSet] = clsLoop.Loop[workLoop].Loop[listCID_Loop[i]].Node[j]; nTempSet++; DFlow[nDFlow] = clsLoop.Loop[workLoop].Loop[listCID_Loop[i]].Node[j]; nDFlow++; } } } //combine tempSet + current IL if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(tempSet, nTempSet, clsLoop.Loop[workLoop].Loop[curLoop].header) == false) { tempSet[nTempSet] = clsLoop.Loop[workLoop].Loop[curLoop].header; nTempSet++; } for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].nNode; i++) { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(tempSet, nTempSet, clsLoop.Loop[workLoop].Loop[curLoop].Node[i]) == false) { tempSet[nTempSet] = clsLoop.Loop[workLoop].Loop[curLoop].Node[i]; nTempSet++; } } int[] boundarySet = new int[nTempSet]; int nBoundary = 0; for (int i = 0; i < nTempSet; i++) { int node = tempSet[i]; for (int j = 0; j < graph.Network[finalNet].nLink; j++) { if (graph.Network[finalNet].Link[j].fromNode == node) //boundary nodes is always split-node { if (gProAnalyzer.Ultilities.checkGraph.Node_In_Set(tempSet, nTempSet, graph.Network[finalNet].Link[j].toNode) == false) { boundarySet[nBoundary] = node; nBoundary++; } } } } int[] returnSet = new int[nBoundary]; for (int i = 0; i < nBoundary; i++) { returnSet[i] = boundarySet[i]; } return(returnSet); }
public static void start_Indexing(ref GraphVariables.clsGraph graph, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsHWLS clsHWLS_Untangle, ref GraphVariables.clsLoop clsLoop, ref GraphVariables.clsSESE clsSESE, bool[] flag_Check) { Initialize_All(); gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.orgNet, graph.midNet); gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.orgLoop, ref clsLoop.IrreducibleError); graph.Network[graph.finalNet] = graph.Network[graph.midNet]; gProAnalyzer.Functionalities.NodeSplittingType2.Run_Split_Type2(ref graph, graph.midNet, graph.finalNet, ref clsLoop, clsLoop.orgLoop); gProAnalyzer.Functionalities.DominanceIdentification.find_Dom(ref graph, graph.finalNet); gProAnalyzer.Functionalities.DominanceIdentification.find_Pdom(ref graph, graph.finalNet); gProAnalyzer.Functionalities.DominanceIdentification.find_DomEI(ref graph, graph.finalNet, -2); gProAnalyzer.Functionalities.DominanceIdentification.find_PdomEI(ref graph, graph.finalNet); gProAnalyzer.Functionalities.SESEIdentification.find_SESE_WithLoop(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, -2); gProAnalyzer.Functionalities.NodeSplittingType3.Run_Split_Type3(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, true); //Make nesting forest gProAnalyzer.Ultilities.makeNestingForest.make_NestingForest(ref graph, graph.finalNet, ref clsHWLS, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE); int workNet = graph.finalNet; int workLoop = clsLoop.orgLoop; int workSESE = clsSESE.finalSESE; bool checkUntangle = false; //Untangling of Irreducible loops ==> USING UNTANGLE NET only (new graph) if (gProAnalyzer.Functionalities.UntanglingIL.make_UntanglingIL(ref graph, graph.finalNet, graph.untangleNet, clsHWLS, clsLoop, clsLoop.orgLoop, clsSESE, clsSESE.finalSESE)) { //return; //frmAnl.displayProcessModel(ref graph, graph.untangleNet, ref clsLoop, -1, ref clsSESE, -1); //frmAnl.Show(); //return; gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.untangleNet, graph.midNet); gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.untangleLoop, ref clsLoop.IrreducibleError); gProAnalyzer.Functionalities.NodeSplittingType2.Run_Split_Type2(ref graph, graph.midNet, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop); gProAnalyzer.Functionalities.DominanceIdentification.find_Dom(ref graph, graph.untangleNet); gProAnalyzer.Functionalities.DominanceIdentification.find_Pdom(ref graph, graph.untangleNet); gProAnalyzer.Functionalities.DominanceIdentification.find_DomEI(ref graph, graph.untangleNet, -2); gProAnalyzer.Functionalities.DominanceIdentification.find_PdomEI(ref graph, graph.untangleNet); gProAnalyzer.Functionalities.SESEIdentification.find_SESE_WithLoop(ref graph, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE, -2); gProAnalyzer.Functionalities.NodeSplittingType3.Run_Split_Type3(ref graph, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE, true); gProAnalyzer.Ultilities.makeNestingForest.make_NestingForest(ref graph, graph.untangleNet, ref clsHWLS_Untangle, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE); workNet = graph.untangleNet; workLoop = clsLoop.untangleLoop; workSESE = clsSESE.untangleSESE; checkUntangle = true; graph.check_untangle = true; //frmAnl.displayProcessModel(ref graph, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE); //frmAnl.Show(); } //== get initial behavior profile == graph.Network[graph.reduceNet] = graph.Network[workNet]; gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, graph.reduceNet, 0, 0); if (checkUntangle) { get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS_Untangle, ref clsLoop, workLoop, ref clsSESE, workSESE, flag_Check); } else { get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS, ref clsLoop, workLoop, ref clsSESE, workSESE, flag_Check); } //Database storing }
//prepare for Concurrency Check and Subgraph making (ONLY REDUCE LOOPS) public static void Preprocessing_total_reduceSubgraph(ref GraphVariables.clsGraph graph, int currentN, GraphVariables.clsLoop clsLoop, int workLoop, int curLoop) { int npLoopS = 0; //number of parent int[] pLoopS = new int[clsLoop.Loop[workLoop].nLoop]; //pLoopS => parent(s) of this loop find_ParentLoop(clsLoop, workLoop, curLoop, ref pLoopS, ref npLoopS); // return value of pLoops int curDepth = clsLoop.Loop[workLoop].maxDepth; //curDepth = 1; do { for (int i = 0; i < clsLoop.Loop[workLoop].nLoop; i++) { if (clsLoop.Loop[workLoop].Loop[i].depth != curDepth) { continue; } int orgIndx = i; if (clsLoop.Loop[workLoop].Loop[orgIndx].depth != curDepth) { continue; } if (graph.Network[currentN].Node[clsLoop.Loop[workLoop].Loop[orgIndx].header].Name.Substring(0, 1) == "L") { continue; } if (orgIndx == curLoop) { continue; } bool bParent = false; for (int k = 0; k < npLoopS; k++) { if (orgIndx == pLoopS[k]) { bParent = true; break; } } if (bParent) { continue; } //If SESE =>NO REDUCE SESE //if (clsHWLS.FBLOCK.FBlock[i].SESE) { // reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndx); //} //If NL => Make subnetwork and find Dom/ Pdom Behavior relation matrix (2 matrices) if (clsLoop.Loop[workLoop].Loop[orgIndx].nEntry == 1) { reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndx, "", false); } //if IL => Find CIPd => Make subnetwork with CIPd and find Dom/ Pdom Behavior relation matrix (2 matrices) if (clsLoop.Loop[workLoop].Loop[orgIndx].nEntry > 1) { reduce_IrLoop_Preprocessing(ref graph, currentN, clsLoop, workLoop, orgIndx); } } curDepth--; } while (curDepth > 0); }
public static void Run_Split_Type3(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsLoop clsLoop, int orgLoop, ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int currentSESE, bool isRigidSplit) //isRigidSplit is used for flag to determine whether to split entry of rigid containing start events or not!! { Initialize_All(); bool mStop = false; int sNode; int eNode; int curDepth = clsSESE.SESE[currentSESE].maxDepth; do { for (int j = 0; j < clsSESE.SESE[currentSESE].nSESE; j++) //Visit all the SESE flow { if (clsSESE.SESE[currentSESE].SESE[j].depth != curDepth) { continue; } sNode = clsSESE.SESE[currentSESE].SESE[j].Entry; eNode = clsSESE.SESE[currentSESE].SESE[j].Exit; if (!check_SESE_Entry(ref graph, currentN, ref clsSESE, currentSESE, sNode, j)) { Type_III_Split_Entry(ref graph, currentN, ref clsSESE, currentSESE, j, 1, sNode, eNode, ""); } if (!check_SESE_Entry(ref graph, currentN, ref clsSESE, currentSESE, eNode, j)) { Type_III_Split_Exit(ref graph, currentN, ref clsSESE, currentSESE, j, 1, eNode, eNode); } } curDepth--; } while (curDepth > 0 && !mStop); gProAnalyzer.Functionalities.DominanceIdentification.find_Dom(ref graph, currentN); //Dom gProAnalyzer.Functionalities.DominanceIdentification.find_Pdom(ref graph, currentN); //Postdom gProAnalyzer.Functionalities.DominanceIdentification.find_DomEI(ref graph, currentN, -1); //SS split node만..... //eDom^-1(NodeD) gProAnalyzer.Functionalities.DominanceIdentification.find_PdomEI(ref graph, currentN); // join node만..... //ePdom^-1(NodeR) gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, currentN, ref clsLoop, orgLoop, ref clsLoop.IrreducibleError); }
//recursive update Full node of loop[i] and all its child loop[j,k,l] public static int[] GetFullNode(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsLoop clsLoop, int workLoop, int i, ref int n) { int depth = clsLoop.Loop[workLoop].maxDepth; int loop = -1; //bool check = false; int[] tempArr = new int[graph.Network[currentN].nNode]; int nTempArr = 0; int[] tmpLoop = new int[graph.Network[currentN].nNode]; //1 header // for each node of this loop => if node is header => find again; else => add to arrNode for (int k = 0; k < clsLoop.Loop[workLoop].Loop[i].nNode; k++) { tmpLoop = new int[graph.Network[currentN].nNode]; n = 0; if (check_header(ref clsLoop, workLoop, i, k, ref loop)) { tmpLoop = GetFullNode(ref graph, currentN, ref clsLoop, workLoop, loop, ref n); addArr(tmpLoop, ref tempArr, n, ref nTempArr); } else { tempArr[nTempArr] = clsLoop.Loop[workLoop].Loop[i].Node[k]; nTempArr++; } } tempArr[nTempArr] = clsLoop.Loop[workLoop].Loop[i].header; nTempArr++; clsLoop.Loop[workLoop].Loop[i].nNode = nTempArr; clsLoop.Loop[workLoop].Loop[i].Node = tempArr; n = nTempArr; return(tempArr); }
public static int find_newLoopIndex(GraphVariables.clsGraph graph, int currentN, GraphVariables.clsLoop clsLoop, int old_workLoop, int new_workLoop, int loopIndx) { for (int i = 0; i < clsLoop.Loop[new_workLoop].nLoop; i++) { if (clsLoop.Loop[new_workLoop].Loop[i].nEntry == clsLoop.Loop[old_workLoop].Loop[loopIndx].nEntry) { int countE = 0; for (int j = 0; j < clsLoop.Loop[new_workLoop].Loop[i].nEntry; j++) { if (graph.Network[currentN].Node[clsLoop.Loop[new_workLoop].Loop[i].Entry[j]].orgNum == clsLoop.Loop[old_workLoop].Loop[loopIndx].Entry[j]) { countE++; } if (countE == clsLoop.Loop[new_workLoop].Loop[i].nEntry) { return(i); } } countE = 0; } } return(-1); }
private static void copy_Loop(ref GraphVariables.clsLoop clsLoop, int fromLoop, int toLoop) { clsLoop.Loop[toLoop] = new GraphVariables.clsLoop.strLoop(); clsLoop.Loop[toLoop].maxDepth = clsLoop.Loop[fromLoop].maxDepth; clsLoop.Loop[toLoop].nLoop = clsLoop.Loop[fromLoop].nLoop; clsLoop.Loop[toLoop].Loop = new GraphVariables.clsLoop.strLoopInform[clsLoop.Loop[toLoop].nLoop]; for (int i = 0; i < clsLoop.Loop[toLoop].nLoop; i++) { clsLoop.Loop[toLoop].Loop[i].Irreducible = clsLoop.Loop[fromLoop].Loop[i].Irreducible; clsLoop.Loop[toLoop].Loop[i].depth = clsLoop.Loop[fromLoop].Loop[i].depth; clsLoop.Loop[toLoop].Loop[i].parentLoop = clsLoop.Loop[fromLoop].Loop[i].parentLoop; clsLoop.Loop[toLoop].Loop[i].nChild = clsLoop.Loop[fromLoop].Loop[i].nChild; clsLoop.Loop[toLoop].Loop[i].child = new int[clsLoop.Loop[toLoop].Loop[i].nChild]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nChild; k++) { clsLoop.Loop[toLoop].Loop[i].child[k] = clsLoop.Loop[fromLoop].Loop[i].child[k]; } clsLoop.Loop[toLoop].Loop[i].header = clsLoop.Loop[fromLoop].Loop[i].header; clsLoop.Loop[toLoop].Loop[i].nBackEdge = clsLoop.Loop[fromLoop].Loop[i].nBackEdge; clsLoop.Loop[toLoop].Loop[i].linkBack = new int[clsLoop.Loop[toLoop].Loop[i].nBackEdge]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nBackEdge; k++) { clsLoop.Loop[toLoop].Loop[i].linkBack[k] = clsLoop.Loop[fromLoop].Loop[i].linkBack[k]; } clsLoop.Loop[toLoop].Loop[i].nBackSplit = clsLoop.Loop[fromLoop].Loop[i].nBackSplit; clsLoop.Loop[toLoop].Loop[i].BackSplit = new int[clsLoop.Loop[toLoop].Loop[i].nBackSplit]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nBackSplit; k++) { clsLoop.Loop[toLoop].Loop[i].BackSplit[k] = clsLoop.Loop[fromLoop].Loop[i].BackSplit[k]; } clsLoop.Loop[toLoop].Loop[i].nEntry = clsLoop.Loop[fromLoop].Loop[i].nEntry; clsLoop.Loop[toLoop].Loop[i].Entry = new int[clsLoop.Loop[toLoop].Loop[i].nEntry]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nEntry; k++) { clsLoop.Loop[toLoop].Loop[i].Entry[k] = clsLoop.Loop[fromLoop].Loop[i].Entry[k]; } clsLoop.Loop[toLoop].Loop[i].nExit = clsLoop.Loop[fromLoop].Loop[i].nExit; clsLoop.Loop[toLoop].Loop[i].Exit = new int[clsLoop.Loop[toLoop].Loop[i].nExit]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nExit; k++) { clsLoop.Loop[toLoop].Loop[i].Exit[k] = clsLoop.Loop[fromLoop].Loop[i].Exit[k]; } clsLoop.Loop[toLoop].Loop[i].nNode = clsLoop.Loop[fromLoop].Loop[i].nNode; clsLoop.Loop[toLoop].Loop[i].Node = new int[clsLoop.Loop[toLoop].Loop[i].nNode]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nNode; k++) { clsLoop.Loop[toLoop].Loop[i].Node[k] = clsLoop.Loop[fromLoop].Loop[i].Node[k]; } clsLoop.Loop[toLoop].Loop[i].nConcurrency = clsLoop.Loop[fromLoop].Loop[i].nConcurrency; if (clsLoop.Loop[fromLoop].Loop[i].Concurrency != null) { clsLoop.Loop[toLoop].Loop[i].Concurrency = new int[clsLoop.Loop[toLoop].Loop[i].nEntry]; for (int k = 0; k < clsLoop.Loop[toLoop].Loop[i].nEntry; k++) { clsLoop.Loop[toLoop].Loop[i].Concurrency[k] = clsLoop.Loop[fromLoop].Loop[i].Concurrency[k]; } } } }
//Build behavior profile for each header of each decomposed acyclic structure. each matrix for each pair? public static void get_InitialBehaviorProfile(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsLoop clsLoop, int workLoop, ref GraphVariables.clsSESE clsSESE, int workSESE, bool[] flag_Check) { //input: a decomposed DAG //output: behavior profile of it header and its children //makeSubNetwork of clsDASPT //make instantFlow (AnalyseBehavior_InstF) of HEADER and its childs. //create behaviorProfile matrix for HEADER Initialize_All(); //bool[] flag_Check = new bool[8]; int curDepth = clsHWLS.FBLOCK.maxDepth; //curDepth = 1; do { for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++) { if (clsHWLS.FBLOCK.FBlock[i].depth != curDepth) { continue; } int orgIndx = clsHWLS.FBLOCK.FBlock[i].refIndex; //If SESE => Make subnetwork and find Dominator Behavior relation matrix (1 matrix) if (clsHWLS.FBLOCK.FBlock[i].SESE) { //Make subnet gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, currentN, graph.subNet, ref clsLoop, workSESE, orgIndx, ref clsSESE, "SESE", -1); int nNode = graph.Network[graph.subNet].nNode; int x = graph.Network[graph.subNet].Node[graph.Network[graph.subNet].header].Post[0]; bool[] returnBhPrfl = new bool[8]; clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl = new int[9, nNode + 1]; clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[x].orgNum; //ENTRY SESE org index. clsHWLS.FBLOCK.FBlock[i].nDomBh = 1; //get behavior matrix of SESE ENTRY for (int j = 0; j < graph.Network[graph.subNet].nNode; j++) { int y = j; if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1) { continue; //Exclude VS, VE } gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check); store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[x].orgNum, graph.Network[graph.subNet].Node[y].orgNum, returnBhPrfl, true); } //reduce current Block LASTLY (already imply by depth pick) gProAnalyzer.Ultilities.reduceGraph.reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndx); } //If NL => Make subnetwork and find Dom/ Pdom Behavior relation matrix (2 matrices) if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry == 1) { //Make subnet gProAnalyzer.Ultilities.makeSubNetwork.make_AcyclicSubGraph(ref graph, currentN, graph.subNet, ref clsLoop, workLoop, orgIndx, "NL"); int nNode = graph.Network[graph.subNet].nNode; int x, y; //get behavior matrix of HEADER ENTRY and its childs x = graph.Network[graph.subNet].Node[graph.Network[graph.subNet].header].Post[0]; //Get NL Loop HEADER bool[] returnBhPrfl = new bool[8]; clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl = new int[9, nNode + 2]; //store itself behavior clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[x].orgNum; //Header org index. clsHWLS.FBLOCK.FBlock[i].nDomBh = 1; for (int j = 0; j < graph.Network[graph.subNet].nNode; j++) { y = j; if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1) { continue; } gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check); store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[x].orgNum, graph.Network[graph.subNet].Node[y].orgNum, returnBhPrfl, true); } //get behavior matrix of Its childs and HEADER (Pdom) y = get_NodeByName(graph, graph.subNet, "V_HEADER"); if (y == -1) { continue; } returnBhPrfl = new bool[8]; clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl = new int[9, nNode + 2]; clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[y].orgNum; //Header index. clsHWLS.FBLOCK.FBlock[i].nPdomBh = 1; for (int j = 0; j < graph.Network[graph.subNet].nNode; j++) { x = j; if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1) { continue; } gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check); store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[y].orgNum, graph.Network[graph.subNet].Node[x].orgNum, returnBhPrfl, false); } //reduce current Block (NL) gProAnalyzer.Ultilities.reduceGraph.reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndx, "", false); } //if IL => Find CIPd => Make subnetwork with CIPd and find Dom/ Pdom Behavior relation matrix (2 matrices) if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry > 1) { //Make subnet gProAnalyzer.Ultilities.makeSubNetwork.make_AcyclicSubGraph(ref graph, currentN, graph.subNet, ref clsLoop, workLoop, orgIndx, "IL"); int nNode = graph.Network[graph.subNet].nNode; int x, y; //get behavior matrix of HEADER ENTRY and its childs x = graph.Network[graph.subNet].Node[graph.Network[graph.subNet].header].Post[0]; //Get CIPd of IL clsHWLS.FBLOCK.FBlock[i].CIPd = graph.Network[graph.subNet].Node[x].orgNum; bool[] returnBhPrfl = new bool[8]; clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl = new int[9, nNode + 2]; //store itself behavior clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[x].orgNum; //CIPd org index. clsHWLS.FBLOCK.FBlock[i].nDomBh = 1; for (int j = 0; j < graph.Network[graph.subNet].nNode; j++) { y = j; if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1) { continue; } gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check); store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[x].orgNum, graph.Network[graph.subNet].Node[y].orgNum, returnBhPrfl, true); } //combine from CID(x, y) ==>> MISSING => SOLVED (no need) //get behavior matrix of Its childs and HEADER (Pdom) y = get_NodeByName(graph, graph.subNet, "V_CIPd"); if (y == -1) { continue; } returnBhPrfl = new bool[8]; clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl = new int[9, nNode + 2]; clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[y].orgNum; //Header index. clsHWLS.FBLOCK.FBlock[i].nPdomBh = 1; for (int j = 0; j < graph.Network[graph.subNet].nNode; j++) { x = j; if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1) { continue; } gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check); store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[y].orgNum, graph.Network[graph.subNet].Node[x].orgNum, returnBhPrfl, false); } //combine from CID(x, y) ==>> MISSING => SOLVED (no need) //reduce current Block (IL) gProAnalyzer.Ultilities.reduceGraph.reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, orgIndx); } } curDepth--; } while (curDepth > 0); }