Beispiel #1
0
        private ArrayList GetAltVector(MulticriterionProblemMethods.DataTypes.Alternative alt)
        {
            ArrayList result = new ArrayList();

            foreach (MulticriterionProblemMethods.DataTypes.Criterium crit in mMatrix.Criteriums)
            {
                result.Add(mMatrix[alt.Name, crit.Name]);
            }
            return(result);
        }
Beispiel #2
0
 private bool AlternativeValidation(MulticriterionProblemMethods.DataTypes.Alternative alt)
 {
     foreach (MulticriterionProblemMethods.DataTypes.Criterium crit in alt.Criteriums)
     {
         if (mMatrix[alt.Name, crit.Name] <= limit)
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #3
0
        private string GetAltComponents(MulticriterionProblemMethods.DataTypes.Alternative alt)
        {
            StringBuilder builder = new StringBuilder();
            bool          isFirst = true;

            foreach (MulticriterionProblemMethods.DataTypes.Criterium crit in alt.Criteriums)
            {
                if (!isFirst)
                {
                    builder.Append(" ,");
                }
                builder.Append(mMatrix[alt.Name, crit.Name].ToString());
                isFirst = false;
            }
            return(builder.ToString());
        }
Beispiel #4
0
        private MulticriterionProblemMethods.DataTypes.Alternative[] Maximize(double[] temp)
        {
            List <Alternative>          altsRes = new List <Alternative>();
            Dictionary <int, ArrayList> vects   = new Dictionary <int, ArrayList>();
            Dictionary <int, double>    marks   = new Dictionary <int, double>();
            ArrayList vectCount = new ArrayList();
            int       i         = 0;

            foreach (MulticriterionProblemMethods.DataTypes.Alternative alt in mMatrix.Alternatives)
            {
                ArrayList altVect = GetAltVector(alt);
                if (i > temp.Length - 1)
                {
                    break;
                }
                ArrayList newVect = Mult(temp[i], altVect);
                vects.Add(i++, newVect);
            }

            foreach (KeyValuePair <int, ArrayList> vect in vects)
            {
                marks.Add(vect.Key, SumVect((ArrayList)vect.Value));
            }

            ArrayList indeces = GetMaxValMarks(marks);

            foreach (int j in indeces)
            {
                MulticriterionProblemMethods.DataTypes.Alternative alt = mMatrix.GetAlternativeByIndex(j);
                if (AlternativeValidation(alt))
                {
                    altsRes.Add(alt);
                }
            }

            return(altsRes.ToArray());
        }