예제 #1
0
        public Mid_1(ref RawData rd)
        {
            int[]     spc;
            IComparer myComparer = new myReverserClass();

            spc     = new int[rd.Cols];
            mid1    = new int[rd.Cols];
            this.rd = rd;
            sw      = new StreamWriter(Common.debugpath + "\\" + "MID1.txt");
            Array.Copy(rd.spc, spc, rd.Cols);
            Array.Sort(spc, myComparer);
            Array.Clear(mid1, 0, mid1.Length);
            int val = spc[rd.tpsn - 1 + 2];

            sumofSPC = 0;
            for (int i = 0; i < spc.Length; i++)
            {
                if (rd.spc[i] >= val)
                {
                    mid1[i] = 1;
                }
                sumofSPC = sumofSPC + rd.spc[i];
            }
            maxSPC = spc[0];
            printSPC();

            printInputValues();
        }
예제 #2
0
        public void printRankArray(string header, int[] arr, int kkk = 0)
        {
            int[]     spc        = new int[arr.Length];
            int[]     rank       = new int[arr.Length];
            IComparer myComparer = new myReverserClass();

            Array.Copy(arr, spc, arr.Length);
            Array.Sort(spc, myComparer);
            int prev = Int32.MinValue;

            for (int i = 0; i < arr.Length; i++)
            {
                if (prev != spc[i])
                {
                    for (int j = 0; j < arr.Length; j++)
                    {
                        if (arr[j] == spc[i])
                        {
                            rank[j] = i + 1;
                        }
                    }
                    prev = spc[i];
                }
            }
            printArray(header, rank, kkk);
        }
예제 #3
0
        public static void makeRankArray(ref int[] source, ref int[] rank)
        {
            int[]     spc        = new int[source.Length];
            IComparer myComparer = new myReverserClass();

            Array.Copy(source, spc, source.Length);
            Array.Sort(spc, myComparer);
            int prev = Int32.MinValue;

            for (int i = 0; i < source.Length; i++)
            {
                if (prev != spc[i])
                {
                    for (int j = 0; j < source.Length; j++)
                    {
                        if (source[j] == spc[i])
                        {
                            rank[j] = i + 1;
                        }
                    }
                    prev = spc[i];
                }
            }
        }
예제 #4
0
        public ResultDB(Form1 f)
        {
            form = f;
            sw   = new StreamWriter(Common.debugpath + "\\" + "ResultDB.txt");
            Cols = f.rd.Cols;
            rdb  = new int[20, Cols];
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < f.rd.Cols; j++)
                {
                    rdb[i, j] = 0;
                }
            }
            Rows = 0;
            for (int j = 0; j < Cols; j++)
            {
                rdb[Rows, j] = f.md1.mid1[j];
            }
            Rows++;
            for (int j = 0; j < Cols; j++)
            {
                rdb[Rows, j] = f.md2.mid2[j];
            }
            Rows++;
            for (int k = 0; k < f.md3_1.mid3_1_Count; k++)
            {
                for (int j = 0; j < Cols; j++)
                {
                    rdb[Rows, j] = f.md3_1.mid3_1[k, j];
                }
                Rows++;
            }
            for (int j = 0; j < Cols; j++)
            {
                rdb[Rows, j] = f.md3_2.mid3_2[j];
            }
            Rows++;
            for (int j = 0; j < Cols; j++)
            {
                rdb[Rows, j] = f.md3_4.mid3_4[j];
            }
            Rows++;
            for (int j = 0; j < Cols; j++)
            {
                rdb[Rows, j] = f.md4_1.mid4_1[j];
            }
            Rows++;
            for (int j = 0; j < Cols; j++)
            {
                rdb[Rows, j] = (f.md4_3.mid4_3[j] > 0)?1:0;
            }
            Rows++;
            // sum
            int sum;

            rsum = new int[Cols];
            int [] temp = new int[Cols];
            for (int i = 0; i < Cols; i++)
            {
                sum = 0;
                for (int j = 0; j < Rows; j++)
                {
                    if (rdb[j, i] > 0)
                    {
                        sum++;
                    }
                }
                rdb[Rows, i] = sum;
                rsum[i]      = sum;
                temp[i]      = sum;
            }
            Rows++;

            Common.printArray("MID-1 ", form.md1.mid1, ref sw);
            Common.printArray("MID-2 ", form.md2.mid2, ref sw);
            int[] temp2 = new int[Cols];
            for (int k = 0; k < f.md3_1.mid3_1_Count; k++)
            {
                for (int i = 0; i < Cols; i++)
                {
                    temp2[i] = form.md3_1.mid3_1[k, i];
                }
                if (f.md3_1.mid3_1_Count == 1)
                {
                    Common.printArray("MID3-1 ", temp2, ref sw);
                }
                else
                {
                    Common.printArray("MID3-1-" + (k + 1).ToString(), temp2, ref sw);
                }
            }
            Common.printArray("MID3-2 ", form.md3_2.mid3_2, ref sw);
            Common.printArray("MID3-4 ", form.md3_4.mid3_4, ref sw);
            Common.printArray("MID4-1 ", form.md4_1.mid4_1, ref sw);
            Common.printArray("MID4-3 ", form.md4_3.mid4_3, ref sw);
            sw.WriteLine("");
            Common.printArray("ResultDB: SUM ", rsum, ref sw);

            // choose tspn + 2 PN's
            IComparer myComparer = new myReverserClass();

            Array.Sort(temp, myComparer);
            //Common.printArray("temp ", temp, ref sw);
            ThreshVal = temp[f.rd.tpsn - 1 + 2];

            sw.WriteLine("");
            sw.WriteLine((f.rd.tpsn + 2).ToString() + "th biggist value is " + ThreshVal.ToString());
            sw.WriteLine("");

            printTable(ref sw);
        }