示例#1
0
 public void EvaluatorDBL(int column, int times, Objects.AnalizedTuple analizedTuple)
 {
     EvaluationOfEmpty.Add(0);
     EvaluationOfDispersia.Add(0);
     for (int l = 0; l < analizedTuple.groupedArray.Length; l++)
     {
         if (analizedTuple.groupedArray[l] == 0)
         {
             EvaluationOfEmpty[times] = EvaluationOfEmpty[times] + 1;
         }
     }
     for (int m = 0; m < analizedTuple.analizedGroups.Length; m++)
     {
         EvaluationOfDispersia[times] = EvaluationOfDispersia[times] + analizedTuple.analizedGroups[m].dispersia;
     }
     EvaluationOfDispersia[times] = EvaluationOfDispersia[times] / analizedTuple.analizedGroups.Length;
     EvaluationOfEmpty[times]     = EvaluationOfEmpty[times] / analizedTuple.InputArray.Length;
     if (minDispers >= EvaluationOfDispersia[times] && times < MaxCalls)
     {
         this.bestAnalizedTuple = analizedTuple;
         minDispers             = EvaluationOfDispersia[times];
         Entropy = Entropy + 0.25;
         times++;
         DataGetter(15, Entropy, times, column, false);
     }
     else
     {
         Entropy = Entropy - 0.25;
         DataGetter(15, Entropy, times, column, true);
         Entropy = 1.0;
         times   = 0;
         column++;
         DataGetter(15, Entropy, times, column, false);
     }
 }
示例#2
0
 public void EvaluatorDAU(int column, int times, Objects.AnalizedTuple analizedTuple)
 {
     if (times < MaxCalls / 2)
     {
         times++;
         candidatsAnalizedTuples.Add(analizedTuple);
         groupCountsList.Add(analizedTuple.groupsCount);
         DataGetter(0, (double)times * 2 / MaxCalls, times, column, false);
     }
     else
     {
         bestAnalizedTuplesList.Add(candidatsAnalizedTuples[groupCountsList.IndexOf(groupCountsList.Min())]);
         candidatsAnalizedTuples = new List <Objects.AnalizedTuple>();
         groupCountsList         = new List <int>();
         times = 0;
         column++;
         DataGetter(0, times * 2 / MaxCalls, times, column, false);
     }
 }
示例#3
0
        public Objects.AnalizedTuple DAUResearcher(int column, double Entropy, Objects.AnalizedTuple analizedTuple)
        {
            DenseAbsorbsUndense          denseAbsorbsUndense = new DenseAbsorbsUndense();
            List <Objects.AnalizedGroup> analizedGroupsList  = analizedTuple.analizedGroups.ToList();

            for (int i = 0; i < analizedTuple.analizedGroups.Length; i++)
            {
                if (analizedTuple.analizedGroups[i].dispersia > minDispers)
                {
                    Objects.AnalizedTuple analizedTupleNew = denseAbsorbsUndense.Worker(analizedTuple.analizedGroups[i].participatns, column, Entropy);
                    analizedGroupsList.Remove(analizedTuple.analizedGroups[i]);
                    analizedGroupsList.AddRange(analizedTupleNew.analizedGroups);
                }
            }
            Objects.AnalizedGroup[] analizedGroupsArray = new Objects.AnalizedGroup[analizedGroupsList.Count];
            analizedGroupsArray          = analizedGroupsList.OrderBy(x => x.mediana).ToArray();
            analizedTuple.groupsCount    = analizedGroupsArray.Length;
            analizedTuple.analizedGroups = analizedGroupsArray;
            return(analizedTuple);
        }
示例#4
0
 public void DataGetter(double Upper, double Entropy, int times, int column, bool OneSided)
 {
     if (method == DBL)
     {
         DistantBecomesLast distantBecomesLast = new DistantBecomesLast();
         if (column < inputHumenArray[0].Normalized.Length && !OneSided)
         {
             this.Entropy = Entropy;
             if (times == 0)
             {
                 this.minDispers = 10000;
             }
             EvaluatorDBL(column, times, distantBecomesLast.Sorter(inputHumenArray, column, Upper, Entropy, false));
         }
         else if (column < inputHumenArray[0].Normalized.Length)
         {
             bestAnalizedTuplesList.Add(distantBecomesLast.Sorter(inputHumenArray, column, Upper, Entropy, true));
             //mainPage.UpdateStats("ended " + column);
         }
         else
         {
             Objects.AnalizedTuple[] analizedTuplesArray = new Objects.AnalizedTuple[bestAnalizedTuplesList.Count];
             analizedTuplesArray = GroupsWritter(bestAnalizedTuplesList.ToArray());
             string bestObjects = JsonConvert.SerializeObject(new Objects.AlgorhytmOutPut(inputHumenArray, analizedTuplesArray, method));
             if (!Directory.Exists(storageFolder))
             {
                 Directory.CreateDirectory(storageFolder);
             }
             File.WriteAllText(storageFolder + "\\temp.json", bestObjects);
         }
     }
     else
     {
         DenseAbsorbsUndense denseAbsorbsUndense = new DenseAbsorbsUndense();
         if (column < inputHumenArray[0].Normalized.Length && !OneSided)
         {
             this.Entropy = Entropy;
             if (times == 0)
             {
                 this.minDispers = denseAbsorbsUndense.DispersiaOfArray(column, inputHumenArray) / DispersiaDivideIndex;
             }
             Objects.AnalizedTuple analizedTuple = denseAbsorbsUndense.Sorter(inputHumenArray, column, Entropy);
             int step = 0;
             do
             {
                 step++;
                 analizedTuple = DAUResearcher(column, Entropy, analizedTuple);
             } while (analizedTuple.analizedGroups.Any(x => x.dispersia > minDispers) && step < MaxCalls / 5);
             EvaluatorDAU(column, times, analizedTuple);
             //mainPage.UpdateStats("ended " + column);
         }
         else
         {
             Objects.AnalizedTuple[] analizedTuplesArray = new Objects.AnalizedTuple[bestAnalizedTuplesList.Count];
             analizedTuplesArray = GroupsWritter(bestAnalizedTuplesList.ToArray());
             string bestObjects = JsonConvert.SerializeObject(new Objects.AlgorhytmOutPut(inputHumenArray, analizedTuplesArray, method));
             if (!Directory.Exists(storageFolder))
             {
                 Directory.CreateDirectory(storageFolder);
             }
             File.WriteAllText(storageFolder + "\\temp.json", bestObjects);
         }
     }
 }