public void Run() { Array.Clear(mid2, 0, mid2.Length); for (Step = 0; Step < MaxStep; Step++) { Console.WriteLine("maxstep: {0}, current step:{1}", MaxStep, Step); rnext = null; rnext = new R1pnList(); R1pnList rsubset = new R1pnList(); sw.WriteLine(""); sw.WriteLine("NEW R1PN Start: step:" + Step + " 's R1pn List "); // make subset of the R1PN_X step. int indexofbaseR1pn = 0; foreach (R1pn r1 in rlist.rList) { r1.print(ref sw); MakeSubsetofR1pn(ref rsubset, indexofbaseR1pn, r1); indexofbaseR1pn++; } GC.Collect(); //sw.WriteLine(""); //sw.WriteLine("rsubset's List "); //rsubset.print(ref sw); // process each subset. int ccc = 0; foreach (R1pn r1 in rsubset.rList) { Find_Next_R1pn_Set(r1); ccc++; if (ccc < 0) { ccc = 0; } if (ccc % 100000 == 0) { Console.WriteLine("ccc: {0}", ccc); GC.Collect(); } } //sw.WriteLine(""); //sw.WriteLine("rnext's List "); //rnext.print(ref sw); // Remove Current R1pn_X List // Set Next R1pn_X1 List rlist.rList = null; rlist.rList = rnext.rList; //Common.printArray("MID2 :("+Step.ToString()+") ", mid2, ref sw); rnext = null; rsubset = null; GC.Collect(); } // count each pn how many times it comes in all of rlist temp = new int[mid2.Length]; rlist.FinalProcessing_PNS(ref temp); Common.printArray2("Temp :(temp,PN's count that is appeared in the List.) ", temp, ref sw); // then, sort the count by pn // choose highest pn count as much as tspn number. int[] temp2 = new int[mid2.Length]; Array.Copy(temp, temp2, temp.Length); Array.Sort(temp2); // Common.printArray2("Temp2 :(temp2, sort) ", temp2, ref sw); Array.Clear(mid2, 0, mid2.Length); int val = 0, flag = 0, count = 0; for (int i = temp2.Length - 1; i >= 0; i--) { if (flag == 1 || temp2[i] == 0) { break; } if (temp2[i] != val) { val = temp2[i]; } else { continue; } for (int j = 0; j < temp.Length; j++) { if (temp[j] == val) { mid2[j] = 1; count++; } if (count == rd.tpsn + 2) { flag = 1; break; } } } sw.WriteLine("Choose " + (rd.tpsn + 2).ToString("######0") + " PN's"); sw.WriteLine("Threshold Count: " + (val).ToString("######0")); Common.printArray("MID2 :(LAST) ", mid2, ref sw); Common.printIndex("MID2 INDEX Print :(LAST) ", mid2, ref sw); }