public void run_SESE(ref GraphVariables.clsGraph graph, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsHWLS clsHWLS_Untangle, ref GraphVariables.clsLoop clsLoop, ref GraphVariables.clsSESE clsSESE) { HiPerfTimer pt = new HiPerfTimer(); pt.Start(); double time = 0; DateTime dt = new DateTime(); DateTime dt2 = new DateTime(); double duration = 0; double duration_SESE = 0; System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); Initialize_All(); for (int i = 0; i < 1; i++) { dt = DateTime.Now; watch.Start(); 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); dt2 = DateTime.Now; gProAnalyzer.Functionalities.SESEIdentification.find_SESE_Dummy(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, -2); duration_SESE = duration_SESE + (DateTime.Now - dt2).TotalMilliseconds; gProAnalyzer.Functionalities.NodeSplittingType3.Run_Split_Type3(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, true); gProAnalyzer.Functionalities.PolygonIdentification.polygonIdentification(ref graph, graph.finalNet, ref clsSESE, clsSESE.finalSESE); //Make nesting forest gProAnalyzer.Ultilities.makeNestingForest.make_NestingForest(ref graph, graph.finalNet, ref clsHWLS, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE); duration = duration + (DateTime.Now - dt).TotalMilliseconds; watch.Stop(); } informList = new double[30]; count_Bonds_Rigids(ref graph, graph.finalNet, ref clsSESE, clsSESE.finalSESE, ref clsLoop, clsLoop.orgLoop, ref clsHWLS); MessageBox.Show("The SESE identification is in: " + (duration_SESE).ToString() + " milisecond", "Finish-SESE"); MessageBox.Show("The System has finished identify the SESE region in: " + (watch.ElapsedMilliseconds / 1).ToString() + " milisecond", "Finish"); }
private void startBtn_Click(object sender, EventArgs e) //QUERY BUTTON { bool check_untangle = true; //listView1.Columns.Add("Models Name", 100); //listView1.Clear(); dataGridView1.Rows.Clear(); dataGridView1.Refresh(); if (rp.repository == null) { MessageBox.Show("Repository not found", "Error"); return; } //Initialized PQ = new gProAnalyzer.Functionalities.ProcessQuery(); bool[] flag_Check = new bool[8]; string[] Results_List = new string[rp.nModel]; int nResults = 0; //get (X, Y) if (textBox2.Text == "" || textBox1.Text == "" || comboBox_BhR.Text == "" || comboBox_BhR.Text == "Select BhR") { MessageBox.Show("Input Empty", "Warnning"); //(X, Y) must be ACTIVITY or TASK return; } int x = Int32.Parse(textBox1.Text); int y = Int32.Parse(textBox2.Text); //get query request (what behavior relation need to check) =>> flag_Check[] = false => get this relation flag_Check[0] = true; //totalConcurrency flag_Check[1] = true; //existConcurrency flag_Check[2] = true; //totalCausal flag_Check[3] = true; //existCausal //==================== flag_Check[4] = true; //canConflict flag_Check[5] = true; //NOTcanConflict flag_Check[6] = true; //canCoocur flag_Check[7] = true; //NOTcanCoocur if (Convert.ToInt32(comboBox_BhR.Text[0].ToString()) == 0) { flag_Check[0] = false; } if (Convert.ToInt32(comboBox_BhR.Text[0].ToString()) == 1) { flag_Check[1] = false; } if (Convert.ToInt32(comboBox_BhR.Text[0].ToString()) == 2) { flag_Check[2] = false; } if (Convert.ToInt32(comboBox_BhR.Text[0].ToString()) == 3) { flag_Check[3] = false; } if (Convert.ToInt32(comboBox_BhR.Text[0].ToString()) == 4) { flag_Check[4] = false; } if (Convert.ToInt32(comboBox_BhR.Text[0].ToString()) == 6) { flag_Check[6] = false; } //get Scope of the query (FROM *) - how many model need to check. //For each MODEL => Perform query //retrieve the model from DATABASE (or retrieve in BATH) //perform the query technique //if MODEL satisfy the query => store in a list RESULTS[] DateTime totalTime = new DateTime(); totalTime = DateTime.Now; double Run_Times_total = 0; for (int i = 0; i < rp.nModel; i++) { int currentN = rp.repository[i].graph.finalNet; GraphVariables.clsHWLS curr_HWLS = rp.repository[i].clsHWLS; int workLoop = rp.repository[i].clsLoop.orgLoop; int workSESE = rp.repository[i].clsSESE.finalSESE; if (rp.repository[i].graph.check_untangle) { currentN = rp.repository[i].graph.untangleNet; curr_HWLS = rp.repository[i].clsHWLS_Untangle; workLoop = rp.repository[i].clsLoop.untangleLoop; workSESE = rp.repository[i].clsSESE.untangleSESE; } if (check_XY(rp, currentN, i, x, y) == false) { //MessageBox.Show("Index illegal", "Warning"); continue; } //check loop //NOT CONSIDER LOOP //if (rp.repository[i].clsLoop.Loop[0].nLoop > 0) continue; bool hold_PQ; if (rp.repository[i].graph.check_untangle) { hold_PQ = PQ.start_ProcessQuery(ref rp.repository[i].graph, currentN, ref rp.repository[i].clsHWLS_Untangle, rp.repository[i].clsLoop, workLoop, rp.repository[i].clsSESE, workSESE, x, y, flag_Check); } else { hold_PQ = PQ.start_ProcessQuery(ref rp.repository[i].graph, currentN, ref rp.repository[i].clsHWLS, rp.repository[i].clsLoop, workLoop, rp.repository[i].clsSESE, workSESE, x, y, flag_Check); } if (hold_PQ) { Results_List[nResults] = rp.repository[i].ID_model; //add to listview //ListViewItem itm; //itm = new ListViewItem(Results_List[nResults]); //listView1.Items.Add(itm); dataGridView1.Rows.Add(Results_List[nResults]); nResults++; } } Run_Times_total = (DateTime.Now - totalTime).TotalSeconds; //MessageBox.Show("Finish in " + Run_Times_total.ToString() + " seconds", "Message"); //display the Results_List[] - list of satisfied models to user. Results.Text = nResults.ToString() + " model(s)"; string st = "Execution Time: "; ExeTime.Text = st + Run_Times_total.ToString() + "s"; QueryStatus.Text = "Success"; }
public void count_Bonds_Rigids(ref GraphVariables.clsGraph graph, int finalNet, ref GraphVariables.clsSESE clsSESE, int workSESE, ref GraphVariables.clsLoop clsLoop, int workLoop, ref GraphVariables.clsHWLS clsHWLS) { gProAnalyzer.Ultilities.copySESE.copy_SESE(ref clsSESE, workSESE, clsSESE.tempSESE); int currentN = graph.tempNet; //just assign a temporary variable. graph.Network[currentN] = graph.Network[finalNet]; gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, currentN, 0, 0); int curDepth = clsHWLS.FBLOCK.maxDepth; do { for (int j = 0; j < clsHWLS.FBLOCK.nFBlock; j++) { if (clsHWLS.FBLOCK.FBlock[j].depth != curDepth) { continue; } int i = clsHWLS.FBLOCK.FBlock[j].refIndex; if (clsHWLS.FBLOCK.FBlock[j].SESE) { if (gProAnalyzer.Ultilities.checkGraph.Bond_Check(ref graph, currentN, ref clsSESE, workSESE, i, ref clsHWLS) == "B") //bond model { informList[13]++; clsHWLS.FBLOCK.FBlock[j].type = "B"; clsSESE.SESE[workSESE].SESE[i].type = "B"; } if (gProAnalyzer.Ultilities.checkGraph.Bond_Check(ref graph, currentN, ref clsSESE, workSESE, i, ref clsHWLS) == "R") //rigid model { informList[14]++; clsHWLS.FBLOCK.FBlock[j].type = "R"; clsSESE.SESE[workSESE].SESE[i].type = "R"; } if (gProAnalyzer.Ultilities.checkGraph.Bond_Check(ref graph, currentN, ref clsSESE, workSESE, i, ref clsHWLS) == "P") { informList[12]++; clsHWLS.FBLOCK.FBlock[j].type = "P"; clsSESE.SESE[workSESE].SESE[i].type = "P"; } gProAnalyzer.Ultilities.reduceGraph.reduce_SESE(ref graph, currentN, clsSESE, clsSESE.tempSESE, i); } else { if (clsLoop.Loop[workLoop].Loop[i].Irreducible) // Irreducible Loop면 { gProAnalyzer.Ultilities.reduceGraph.reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, i); //reduce_Network(currentN, workLoop, i, "", true); } else // Natural Loop면 { //Natural Loop have single exit also an SESE; solution => Check L<h> whether the children is single entry single exit or not. if (clsLoop.Loop[workLoop].Loop[i].nEntry == 1 && clsLoop.Loop[workLoop].Loop[i].nExit == 1) { bool checkBond_Loop = true; int count_gateway = 0; for (int k = 0; k < clsLoop.Loop[workLoop].Loop[i].nNode; k++) { int node = clsLoop.Loop[workLoop].Loop[i].Node[k]; if (graph.Network[currentN].Node[node].nPre > 1 || graph.Network[currentN].Node[node].nPost > 1) { count_gateway++; if (count_gateway > 2) { checkBond_Loop = false; } } } if (checkBond_Loop) { for (int k = 0; k < clsHWLS.FBLOCK.FBlock[j].nChild; k++) { int childLoop = clsHWLS.FBLOCK.FBlock[j].child[k]; //maybe it is SESE if (clsHWLS.FBLOCK.FBlock[childLoop].nEntry > 1 || clsHWLS.FBLOCK.FBlock[childLoop].nExit > 1) { checkBond_Loop = false; break; } } } if (checkBond_Loop) { informList[13]++; clsHWLS.FBLOCK.FBlock[j].type = "B"; } else { informList[14]++; clsHWLS.FBLOCK.FBlock[j].type = "R"; } } gProAnalyzer.Ultilities.reduceGraph.reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, i, "", true); } } } curDepth--; } while (curDepth > 0); }