Ejemplo n.º 1
0
 private void button2_Click_1(object sender, EventArgs e)
 {
     GenerateComparison.Create_Criteria_Comparison_Array(statistics.exp_random_cases[0].GetFeatures().Count - 2);
     dG_Prob.Columns.Clear();
     dG_Non.Columns.Clear();
     dG_With.Columns.Clear();
 }
Ejemplo n.º 2
0
 private void radioButton4_Click(object sender, EventArgs e)
 {
     GenerateComparison.Create_Criteria_Comparison_Array(mybestchoice.Cases[0].GetFeatures().Count - 2);
     for (int i = 0; i < DG_comparing.Columns.Count - 1; i++)
     {
         for (int j = 0; j < DG_comparing.Columns.Count - 1; j++)
         {
             DG_comparing.Rows[i + 1].Cells[j + 1].Value = GenerateComparison.CriteriaComparisonMatrix[i, j];
         }
     }
     CriteriaArr = GenerateComparison.CriteriaComparisonMatrix;
 }
Ejemplo n.º 3
0
        private void radioButton5_Click(object sender, EventArgs e)
        {
            GenerateComparison.Create_All_Criteria_Choice_Comparison_Array(mybestchoice.Cases);
            ChoicesArr_Non = GenerateComparison.ChoicesComparisonMatrix;
            int count_solution = ChoicesArr_Non[0].GetLength(0);

            for (int j = 0; j < count_solution + 1; j++)
            {
                dG_Non.Columns.Add("", "");
            }

            dG_Non.Columns[0].DefaultCellStyle.BackColor = Color.RoyalBlue;

            List <string> criteria = Db.get_criteria(mybestchoice.CaseName);
            int           rowcount = 0;

            for (int i = 0; i < criteria.Count; i++)
            {
                dG_Non.Rows.Add();
                dG_Non.Rows[rowcount].DefaultCellStyle.BackColor = Color.RoyalBlue;
                dG_Non.Rows[rowcount].Cells[0].Value             = criteria[i];
                for (int j = 0; j < mybestchoice.Cases.Count; j++)
                {
                    dG_Non.Rows[rowcount].Cells[j + 1].Value = mybestchoice.Cases[j].GetFeature("id").GetFeatureValue().ToString();
                }

                for (int j = 0; j < mybestchoice.Cases.Count; j++)
                {
                    dG_Non.Rows.Add();
                    rowcount++;

                    for (int k = 0; k < mybestchoice.Cases.Count; k++)
                    {
                        dG_Non.Rows[rowcount].Cells[0].Value     = mybestchoice.Cases[j].GetFeature("id").GetFeatureValue().ToString();
                        dG_Non.Rows[rowcount].Cells[k + 1].Value = ChoicesArr_Non[i][j, k];
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void button21_Click(object sender, EventArgs e)
        {
            // display


            int dG_WithR = 0;

            dG_With.Columns.Clear();



            //dG_Non.Columns.Add("Porblem No ", "Porblem No  ");
            dG_With.Columns.Add("SolNum", "Sol Num  ");
            dG_With.Columns.Add("Weight  ", "Weight  ");
            dG_With.Columns.Add("Sim  ", "Sim  ");



            List <Case> solutions = statistics.FindAlternative_WithClustering(statistics.exp_random_cases[problem_num]);

            // call method
            listBox1.Items.Add("Finding Alternatices by specifying best cluster");

            double[] ranks;
            Dictionary <int, double[, ]> choices;

            double[,] criteriaarr;

            MyFuzzyAHP myfahp = new MyFuzzyAHP(statistics.count_citeria, solutions.Count);

            criteriaarr = GenerateComparison.CriteriaComparisonMatrix;

            myfahp.AddCriteria(criteriaarr);
            myfahp.CalculatedCriteria();
            choices = GenerateComparison.Create_All_Criteria_Choice_Comparison_Array(solutions);
            myfahp.AddCriterionRatedChoices(choices);
            ranks = myfahp.CalculatedChoices();
            for (int i = 0; i < ranks.Length; i++)
            {
                dG_With.Rows.Add();
                dG_With.Rows[dG_WithR].Cells[0].Value = solutions[i].GetFeature("id").GetFeatureValue().ToString();
                dG_With.Rows[dG_WithR].Cells[1].Value = Math.Round(ranks[i] * 100, 2);
                EuclideanSimilarity s = new EuclideanSimilarity();
                dG_With.Rows[dG_WithR].Cells[2].Value = Math.Round(s.Similarity(solutions[i], statistics.exp_random_cases[problem_num]) * 100, 2);
                dG_WithR++;
            }


            dG_With.Sort(dG_With.Columns[1], ListSortDirection.Descending);

            if (dG_Prob.Columns.Count == 0)
            {
                dG_Prob.Columns.Add("Criteria", " Criteria ");
                dG_Prob.Columns.Add("AHP", "AHP");
                dG_Prob.Columns.Add("FuzzyAHP", "Fuzzy AHP");
                for (int i = 1; i < solutions[0].GetFeatures().Count - 1; i++)
                {
                    dG_Prob.Rows.Add();
                    Feature f = (Feature)solutions[0].GetFeatures()[i];
                    dG_Prob.Rows[i - 1].Cells[0].Value = f.GetFeatureName().ToString();
                    dG_Prob.Rows[i - 1].Cells[2].Value = Math.Round(myfahp.CriteriaWeights[i - 1] * 100, 2);
                }
            }
            else
            {
                for (int i = 1; i < solutions[0].GetFeatures().Count - 1; i++)
                {
                    Feature f = (Feature)solutions[0].GetFeatures()[i];
                    dG_Prob.Rows[i - 1].Cells[2].Value = Math.Round(myfahp.CriteriaWeights[i - 1] * 100, 2);
                }
            }

            dG_Prob.AutoResizeColumns();
            dG_Prob.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dG_With.AutoResizeColumns();
            dG_With.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            // display
        }