Ejemplo n.º 1
0
        public void Save(Structuring s)
        {
            string result = s.ARFF_ToString();

            filestream.Write(result);
            filestream.Close();
        }
Ejemplo n.º 2
0
        public async Task TestTemplatesAsync(Template Template)
        {
            // Arrange
            TestProcess Process = new TestProcess();

            ProjectName     = "TestProject";
            OutputDirectory = tempPath;
            directories.Add("artifacts");
            directories.Add("build");
            directories.Add("docs");
            directories.Add("lib");
            directories.Add("samples");
            directories.Add("packages");
            directories.Add("test");
            Directory.CreateDirectory(tempPath);
            NetCommand = $" new {Template.ShortName}  -o src/ {ProjectName} -n {ProjectName}";
            var Structuring = new Structuring(Process);

            // Act
            logging.WireEventHandlers(Structuring);
            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            // Assert
            Assert.Equal("dotnet", Process.StartInfo.FileName);
            Assert.Contains($"new {Template.ShortName}", Process.StartInfo.Arguments);

            // Cleanup
            logging.CurrentLog = string.Empty;
            Directory.Delete(tempPath, true);
        }
        public override Structuring TurnOffReduction(Set dataSet, Structuring partition)
        {
            if (partition is ReductionPartition)
            {
                return(((ReductionPartition)partition).Partition);
            }
            else
            {
                Dictionary <string, Cluster> _dic = new Dictionary <string, Cluster>();

                foreach (var item in partition.Clusters)
                {
                    Cluster _cluster    = item.Value;
                    Cluster _newCluster = new Cluster(_cluster.Name, new List <Element>());
                    foreach (var _e in _cluster.Elements)
                    {
                        foreach (var _object in _e.Values)
                        {
                            _newCluster.AddElement((Element)_object);
                        }
                    }
                    _dic.Add(_newCluster.Name, _newCluster);
                }

                return(new Partition()
                {
                    Clusters = _dic, Proximity = partition.Proximity
                });
            }
        }
        double GetSilhouette(Element e)
        {
            if (Structuring.HaveUnassignedElements() && Structuring.IsUnassigned(e))
            {
                return(0);
            }

            EuclideanDistance ed = new EuclideanDistance();

            ed.AttributesToCalculateProximity = Set.Attributes.Values;

            Cluster actual = Structuring.GetCluster(e)[0];

            double ai = ed.CalculateProximity(e, actual.Centroid);

            double bi = double.MaxValue;

            foreach (var cluster in Structuring.Clusters.Values)
            {
                if (actual.Name != cluster.Name)
                {
                    double aux = ed.CalculateProximity(e, cluster.Centroid);
                    if (aux < bi)
                    {
                        bi = aux;
                    }
                }
            }
            return((bi - ai) / Math.Max(bi, ai));
        }
        public void NewStructuring(object sender, NewStructuringEventArgs e)
        {
            try
            {
                Struct           = null;
                Struct           = e.NewStructuring;
                tb_alg_name.Text = e.NewStructuringInfo.AlgorithmName;

                rc_graphic.SeriesMappings = new SeriesMappingCollection();

                List <SeriesMapping> sm = TelerikUtils.InitBubbleChart(Struct, att_x, att_y);

                foreach (SeriesMapping item in sm)
                {
                    rc_graphic.SeriesMappings.Add(item);
                }

                rc_graphic.ItemsSource = null;
                rc_graphic.ItemsSource = TelerikUtils.FillBubbleChartData(Struct, att_x, att_y);
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        public override double EvaluatePartition()
        {
            FillHeaps();

            double result = 0;

            for (int i = 0; i < Set.ElementsCount; i++)
            {
                int cont = 0;
                while (lh[i].First != null)
                {
                    if (cont == Neighbors)
                    {
                        break;
                    }

                    double distance = lh[i].First.Rank;

                    if (!Structuring.BeSameCluster(Set.Elements[i], Set.Elements[lh[i].First.Cluster]))
                    {
                        result += 1 / distance;
                    }

                    lh[i].RemoveFirst();
                    cont++;
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
        public async Task ExecutionTestAsync()
        {
            // Arrange
            StandardProcess Process  = new StandardProcess();
            Template        Template = InitializeTemplates.Templates[1];

            ProjectName     = "TestProject";
            OutputDirectory = tempPath;
            directories.Add("artifacts");
            directories.Add("build");
            directories.Add("docs");
            directories.Add("lib");
            directories.Add("samples");
            directories.Add("packages");
            directories.Add("test");
            Directory.CreateDirectory(tempPath);
            NetCommand = $" new {Template.ShortName}  -o src/ {ProjectName} -n {ProjectName}";
            var Structuring = new Structuring(Process);

            // Act
            logging.WireEventHandlers(Structuring);
            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            // Assert
            Assert.Equal("A Project with this Name already exists!", logging.CurrentLog);

            // Cleanup
            logging.CurrentLog = string.Empty;
            Directory.Delete(tempPath, true);
        }
        public override double EvaluatePartition()
        {
            FillHeaps();

            double minInter = double.MaxValue;
            double maxIntra = double.MinValue;

            for (int i = 0; i < Set.ElementsCount; i++)
            {
                while (lh[i].First != null)
                {
                    double distance = lh[i].First.Rank;

                    if (distance < minInter && !Structuring.BeSameCluster(Set.Elements[i], Set.Elements[lh[i].First.Cluster]))
                    {
                        minInter = distance;
                    }
                    else if (distance > maxIntra && Structuring.BeSameCluster(Set.Elements[i], Set.Elements[lh[i].First.Cluster]))
                    {
                        maxIntra = distance;
                    }

                    lh[i].RemoveFirst();
                }
            }
            return(minInter / maxIntra);
        }
Ejemplo n.º 9
0
        public override double CalculateDistance(Structuring structA, Structuring structB, Set dataSet)
        {
            bool[,] adjMatrix = new bool[dataSet.ElementsCount, dataSet.ElementsCount];
            int[] visited = new int[dataSet.ElementsCount];
            int   ccCount = 0;

            for (int i = 0; i < dataSet.ElementsCount - 1; i++)
            {
                for (int j = i + 1; j < dataSet.ElementsCount; j++)
                {
                    if (structA.BeSameCluster(dataSet[i], dataSet[j]) || structB.BeSameCluster(dataSet[i], dataSet[j]))
                    {
                        adjMatrix[i, j] = adjMatrix[j, i] = true;
                    }
                }
            }

            for (int i = 0; i < dataSet.ElementsCount; i++)
            {
                if (visited[i] == 0)
                {
                    ccCount++;
                    DFS(i, adjMatrix, visited, ccCount);
                }
            }

            return(2 * (dataSet.ElementsCount - ccCount) - (dataSet.ElementsCount - structA.ClustersCount) - (dataSet.ElementsCount - structB.ClustersCount));
        }
Ejemplo n.º 10
0
        public override double EvaluatePartition()
        {
            Structuring _A = Structuring;
            Structuring _B = RealPartition;

            double _result = MI(_A, _B, Set.ElementsCount) / ((Entropy(_A) + Entropy(_B)) / 2);

            return(_result);
        }
Ejemplo n.º 11
0
        private Pair Fitness(Structuring s1, Structuring s2)
        {
            Pair p1 = FitnessOneWay(s1, s2);
            Pair p2 = FitnessOneWay(s2, s1);

            return(new Pair()
            {
                Rank = p1.Rank + p2.Rank, C1 = p1.C1, C2 = p1.C2, P1 = s1, P2 = s2
            });
        }
        public Structuring BuildStructuring()
        {
            if (ConsensusFunction == null || ConsensusFunction.Set == null || ConsensusFunction.Structurings == null)
                throw new NullReferenceException();

            Structuring result = ConsensusFunction.BuildStructuring();
            Structuring = result;

            return result;
        }
Ejemplo n.º 13
0
        public Structuring BuildStructuring()
        {
            if (ConsensusFunction == null || ConsensusFunction.Set == null || ConsensusFunction.Structurings == null)
            {
                throw new NullReferenceException();
            }

            Structuring result = ConsensusFunction.BuildStructuring();

            Structuring = result;

            return(result);
        }
        private void bt_Run_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (HasSelectedMeasures)
                {
                    List <PartitionInfo> _partitionsInfo = this.uctrl_ListClusterAlgVisualizerClustEnsemble.GetSelected();
                    string             _Error            = "";
                    List <MeasureInfo> _MeasuresChecked  = GetMeasuresChecked();
                    if (_MeasuresChecked == null || _MeasuresChecked.Count == 0)
                    {
                        _Error = "You must select at least one Validation Index.";
                        MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                    if (_partitionsInfo == null || _partitionsInfo.Count == 0)
                    {
                        _Error = "You must select at least one Structuring to apply an Validation Index.";
                        MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    Structuring          _realpartition  = RealPartitionBuilder.BuildRealPartition(Enviroment.Set, Att_objetive);
                    List <MeasureOutput> _measuresOutput = new List <MeasureOutput>();
                    List <Measure>       _measures       = new List <Measure>();

                    ReflectionTools _rct = new ReflectionTools();
                    for (int i = 0; i < _MeasuresChecked.Count; i++)
                    {
                        Measure _TempMeasure = ReflectionTools.GetInstance <Measure>(_MeasuresChecked[i].Tree.Value.FullName);
                        _measures.Add(_TempMeasure);
                        foreach (CEDS.Property _p in _MeasuresChecked[i].Tree.Value.InProperties)
                        {
                            _rct.SetProperty(_MeasuresChecked[i].Tree.Value.FullName, _TempMeasure, _p);
                        }
                    }

                    Run _run = RunMethod;
                    _run.BeginInvoke(_partitionsInfo, _measures, _realpartition, _measuresOutput, _MeasuresChecked, RunFinish, _run);
                }
                else
                {
                    MessageBox.Show("You must first select a Validation Index.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Ejemplo n.º 15
0
        private double Entropy(Structuring aStructuring)
        {
            double _result        = 0;
            double _elementsCount = aStructuring.Elements.Count;//(aStructuring.HaveUnassignedElements())?aStructuring.Elements.Count-aStructuring.UnassignedElements.Count:aStructuring.Elements.Count;

            foreach (Cluster _cluster in aStructuring.Clusters.Values)
            {
                //esta probabilidad siempre es > 0 ya que cada cluster tiene al menos un elemento
                double _probability = _cluster.ElementsCount / ((double)_elementsCount);
                double _log         = Math.Log10(_probability);

                _result += _probability * _log;
            }
            return(-(_result));
        }
Ejemplo n.º 16
0
        public static List <SeriesMapping> InitBubbleChart(Structuring s, ClusterEnsemble.Attribute att_x, ClusterEnsemble.Attribute att_y)
        {
            List <SeriesMapping> result = new List <SeriesMapping>();

            int i = 0;

            foreach (Cluster item in s.Clusters.Values)
            {
                SeriesMapping sm = new SeriesMapping();
                sm.SeriesDefinition = new BubbleSeriesDefinition();
                sm.LegendLabel      = item.Name;
                sm.CollectionIndex  = i;
                i++;

                ItemMapping bubblesize = new ItemMapping("BubbleSize", DataPointMember.BubbleSize);
                ItemMapping imXCat     = new ItemMapping("XCategory", DataPointMember.XCategory);
                ItemMapping imX        = new ItemMapping("XValue", DataPointMember.XValue);
                ItemMapping imY        = new ItemMapping("YValue", DataPointMember.YValue);
                sm.ItemMappings.Add(bubblesize);
                sm.ItemMappings.Add(imXCat);
                sm.ItemMappings.Add(imX);
                sm.ItemMappings.Add(imY);

                result.Add(sm);
            }

            if (s.HaveUnassignedElements())
            {
                SeriesMapping sm = new SeriesMapping();
                sm.SeriesDefinition = new BubbleSeriesDefinition();
                sm.LegendLabel      = "Unassigned Elements";
                sm.CollectionIndex  = i;
                i++;

                ItemMapping bubblesize = new ItemMapping("BubbleSize", DataPointMember.BubbleSize);
                ItemMapping imXCat     = new ItemMapping("XCategory", DataPointMember.XCategory);
                ItemMapping imX        = new ItemMapping("XValue", DataPointMember.XValue);
                ItemMapping imY        = new ItemMapping("YValue", DataPointMember.YValue);
                sm.ItemMappings.Add(bubblesize);
                sm.ItemMappings.Add(imXCat);
                sm.ItemMappings.Add(imX);
                sm.ItemMappings.Add(imY);

                result.Add(sm);
            }

            return(result);
        }
Ejemplo n.º 17
0
        public async void ExecButton_Click(object sender, RoutedEventArgs e)
        {
            StandardProcess process = new StandardProcess();

            OutputBox.Text = "";
            Structuring OutputLogs = new Structuring(process);

            this.Dispatcher.Invoke(() =>
            {
                pbStatus.IsIndeterminate = true;
                Style style    = this.FindResource("ProgressBarWarningStripe") as Style;
                pbStatus.Style = style;
            });
            WireEventHandlers(OutputLogs);
            await OutputLogs.RunStructuringAsync(FolderPath, Directories, NetCommand, ProjectName);
        }
Ejemplo n.º 18
0
        public Structuring BuildStructuringWithTime()
        {
            try
            {
                Stopwatch _Stopwatch = new Stopwatch();
                _Stopwatch.Start();
                Structuring _temp = this.BuildStructuring();
                _Stopwatch.Stop();
                Time = _Stopwatch.Elapsed;

                return(_temp);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 19
0
        public static List <List <DataPoint> > FillBubbleChartData(Structuring s, ClusterEnsemble.Attribute att_x, ClusterEnsemble.Attribute att_y)
        {
            List <List <DataPoint> > result = new List <List <DataPoint> >();

            foreach (Cluster item in s.Clusters.Values)
            {
                List <DataPoint> temp = FillOneClusterData(item, att_x, att_y);
                result.Add(temp);
            }
            if (s.HaveUnassignedElements())
            {
                List <DataPoint> temp = FillUnassignedData(s.UnassignedElements, att_x, att_y);
                result.Add(temp);
            }

            ResetCategory();
            return(result);
        }
Ejemplo n.º 20
0
        public Structuring BuildStructuringWithReduction()
        {
            try
            {
                if (ReductionFunction == null)
                {
                    throw new ArgumentNullException();
                }

                List <Structuring> _tempStructurings = Structurings;
                Set _tempSet = Set;
                Set _newSet  = null;

                Stopwatch _Stopwatch = new Stopwatch();
                _Stopwatch.Start();
                List <Structuring> _reduction = ReductionFunction.GetReduction(Set, Structurings, out _newSet);

                Set          = _newSet;
                Structurings = _reduction;

                RealSet          = _tempSet;
                RealStructurings = _tempStructurings;

                ReductionElementCount = _newSet.ElementsCount;
                Structuring _temp = this.BuildStructuring();
                Structuring = ReductionFunction.TurnOffReduction(Set, _temp);
                _Stopwatch.Stop();
                Time = _Stopwatch.Elapsed;

                Structurings = _tempStructurings;
                Set          = _tempSet;

                RealStructurings = null;
                RealSet          = null;

                return(Structuring);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void NewSet(object sender, NewSetEventArgs e)
        {
            try
            {
                tb_alg_name.Text = "";

                Struct = null;
                rc_graphic.SeriesMappings.Reset();
                rc_graphic.ItemsSource = null;

                cb_objetiveX.ItemsSource = null;
                cb_objetiveY.ItemsSource = null;

                if (e.NewSet != null)
                {
                    cb_objetiveX.ItemsSource = e.NewSet.Attributes.Values;
                    cb_objetiveX.DisplayMemberPath = "Name";
                    cb_objetiveY.ItemsSource = e.NewSet.Attributes.Values;
                    cb_objetiveY.DisplayMemberPath = "Name";

                    if (e.NewSet.Attributes.Values.Count > 0)
                    {
                        cb_objetiveX.SelectedIndex = 0;
                        att_x = (ClusterEnsemble.Attribute)cb_objetiveX.SelectedItem;
                        cb_objetiveY.SelectedIndex = 0;
                        att_y = (ClusterEnsemble.Attribute)cb_objetiveY.SelectedItem;
                    }
                    if (att_x != null && att_y != null)
                    {
                        rc_graphic.DefaultView.ChartArea.AxisX.Title = att_x.Name;
                        rc_graphic.DefaultView.ChartArea.AxisY.Title = att_y.Name;
                    }
                    TelerikUtils.SetAnimationsSettings(rc_graphic);
                }

            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Actual_set != null)
         {
             Structuring s = RealPartitionBuilder.BuildRealPartition(Actual_set, att_obj);
             if (NewStructuringEventHandler != null)
             {
                 NewStructuringEventHandler(this, new NewStructuringEventArgs(new PartitionInfo()
                 {
                     AlgorithmName = Actual_set.RelationName, Partition = s
                 }));
             }
         }
     }
     catch (Exception _ex)
     {
         GeneralTools.Tools.WriteToLog(_ex);
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (NewStructuringEventHandler != null)
         {
             if (Enviroment.Set != null)
             {
                 Structuring s = RealPartitionBuilder.BuildRealPartition(Enviroment.Set, Att_objetive);
                 NewStructuringEventHandler(this, new NewStructuringEventArgs(new PartitionInfo()
                 {
                     AlgorithmName = "Real Partition", Partition = s
                 }));
             }
         }
     }
     catch (Exception _ex)
     {
         GeneralTools.Tools.WriteToLog(_ex);
     }
 }
Ejemplo n.º 24
0
        public static void Run(string template, string name, string output, bool artifacts, bool build, bool docs, bool lib, bool samples, bool packages, bool test)
        {
            string NETCommand;

            if (artifacts)
            {
                Directories.Add("artifacts");
            }
            if (build)
            {
                Directories.Add("build");
            }
            if (docs)
            {
                Directories.Add("docs");
            }
            if (lib)
            {
                Directories.Add("lib");
            }
            if (samples)
            {
                Directories.Add("samples");
            }
            if (packages)
            {
                Directories.Add("packages");
            }
            if (test)
            {
                Directories.Add("test");
            }

            NETCommand = $" new {template} -o src/{name} -n {name}";
            StandardProcess process = new StandardProcess();
            Structuring     execute = new Structuring(process);

            WireEventHandlers(execute);
            execute.RunStructuringAsync(output, Directories, NETCommand, name).Wait();
        }
        public void NewSet(object sender, NewSetEventArgs e)
        {
            try
            {
                tb_alg_name.Text = "";

                Struct = null;
                rc_graphic.SeriesMappings.Reset();
                rc_graphic.ItemsSource = null;

                cb_objetiveX.ItemsSource = null;
                cb_objetiveY.ItemsSource = null;

                if (e.NewSet != null)
                {
                    cb_objetiveX.ItemsSource       = e.NewSet.Attributes.Values;
                    cb_objetiveX.DisplayMemberPath = "Name";
                    cb_objetiveY.ItemsSource       = e.NewSet.Attributes.Values;
                    cb_objetiveY.DisplayMemberPath = "Name";

                    if (e.NewSet.Attributes.Values.Count > 0)
                    {
                        cb_objetiveX.SelectedIndex = 0;
                        att_x = (ClusterEnsemble.Attribute)cb_objetiveX.SelectedItem;
                        cb_objetiveY.SelectedIndex = 0;
                        att_y = (ClusterEnsemble.Attribute)cb_objetiveY.SelectedItem;
                    }
                    if (att_x != null && att_y != null)
                    {
                        rc_graphic.DefaultView.ChartArea.AxisX.Title = att_x.Name;
                        rc_graphic.DefaultView.ChartArea.AxisY.Title = att_y.Name;
                    }
                    TelerikUtils.SetAnimationsSettings(rc_graphic);
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Ejemplo n.º 26
0
        private void RunFinish(Structuring aStructuring, ClusterAlgorithm aClusterAlgorithm)
        {
            try
            {
                ClusterAlgorithm _ClusterAlg  = aClusterAlgorithm;
                Structuring      _structuring = aStructuring;

                if (_structuring != null)
                {
                    TimeSpan ts          = _ClusterAlg.Time;
                    string   elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

                    PartitionInfo _partinfo = new PartitionInfo()
                    {
                        AlgorithmName    = this.tb_SelectClusterAlg.Text,
                        ClusterAlgorithm = _ClusterAlg,
                        Partition        = _structuring,
                        AlgorithmType    = AlgorithmType.Clustering,
                        Time             = elapsedTime,
                        Index            = -1
                    };

                    this.uctrl_ListClusterAlgVisualizer.AddPartitionInfo(_partinfo);
                    this.tb_output.Text = _ClusterAlg.Output;

                    if (NewStructuringEventHandler != null)
                    {
                        NewStructuringEventHandler(this, new NewStructuringEventArgs(_partinfo));
                    }

                    //Experimental Mode
                    this.ExperimentalMode = false;
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Ejemplo n.º 27
0
        private void RunFinish(Structuring aStructuring, ConsensusFunction aConsensusFunction)
        {
            try
            {
                ConsensusFunction _EnsembleAlg = aConsensusFunction;
                Structuring       _structuring = aStructuring;

                if (_structuring != null)
                {
                    TimeSpan ts          = _EnsembleAlg.Time;
                    string   elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

                    PartitionInfo _partInfo = new PartitionInfo()
                    {
                        AlgorithmName     = this.tb_SelectEnsembleAlg.Text,
                        ConsensusFunction = _EnsembleAlg,
                        Partition         = _structuring,
                        AlgorithmType     = AlgorithmType.Ensemble,
                        Time         = elapsedTime,
                        ElementCount = aConsensusFunction.ReductionElementCount,
                        SearchSpace  = ReductionFunction.BellNumber(aConsensusFunction.ReductionElementCount),
                        Index        = -1
                    };
                    this.uctrl_ListClusterAlgVisualizerEnsemble.AddPartitionInfo(_partInfo);
                    this.tb_output.Text = _EnsembleAlg.Output;


                    if (NewStructuringEventHandler != null)
                    {
                        NewStructuringEventHandler(this, new NewStructuringEventArgs(_partInfo));
                    }
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Ejemplo n.º 28
0
        public override double CalculateDistance(Structuring structA, Structuring structB, Set Set)
        {
            int _FP = 0, _FN = 0;

            for (int i = 0; i < Set.ElementsCount; i++)
            {
                for (int j = i + 1; j < Set.ElementsCount; j++)
                {
                    bool sameClusterA = structA.BeSameCluster(Set[i], Set[j]);
                    bool sameClusterB = structB.BeSameCluster(Set[i], Set[j]);

                    if (!sameClusterA && sameClusterB)
                    {
                        _FP++;
                    }
                    if (sameClusterA && !sameClusterB)
                    {
                        _FN++;
                    }
                }
            }
            return(_FN + _FP);
        }
Ejemplo n.º 29
0
        private double MI(Structuring aA, Structuring aB, int aElementsCount)
        {
            double _result = 0;

            foreach (var _cA in aA.Clusters.Values)
            {
                foreach (var _cB in aB.Clusters.Values)
                {
                    int _nab = CalculateIntersection(_cA, _cB);
                    int _na  = _cA.ElementsCount;
                    int _nb  = _cB.ElementsCount;
                    int _n   = aElementsCount;

                    double _probability = _nab / ((double)_n);

                    if (_probability != 0)
                    {
                        _result += (_probability) * Math.Log10((_nab * _n) / ((double)_na * _nb));
                    }
                }
            }
            return(_result);
        }
Ejemplo n.º 30
0
        Pair FitnessOneWay(Structuring s1, Structuring s2)
        {
            double result = 0;
            double best   = double.MinValue;

            Cluster best_c1 = null;
            Cluster best_c2 = null;

            foreach (Cluster c1 in s1.Clusters.Values)
            {
                double  max_overlap = double.MinValue;
                Cluster temp_c2     = null;
                foreach (Cluster c2 in s2.Clusters.Values)
                {
                    double temp = c1.Elements.FindAll(e => c2.Elements.Contains(e)).Count;

                    if (temp > max_overlap)
                    {
                        max_overlap = temp;
                        temp_c2     = c2;
                    }
                }
                if (max_overlap > best)
                {
                    best    = max_overlap;
                    best_c1 = c1;
                    best_c2 = temp_c2;
                }
                result += max_overlap;
            }

            return(new Pair()
            {
                Rank = result, C1 = best_c1, C2 = best_c2
            });
        }
Ejemplo n.º 31
0
        Pair FitnessOneWay(Structuring s1, Structuring s2)
        {

            double result = 0;
            double best = double.MinValue;

            Cluster best_c1 = null;
            Cluster best_c2 = null;

            foreach (Cluster c1 in s1.Clusters.Values)
            {
                double max_overlap = double.MinValue;
                Cluster temp_c2 = null;
                foreach (Cluster c2 in s2.Clusters.Values)
                {
                    double temp = c1.Elements.FindAll(e => c2.Elements.Contains(e)).Count;

                    if (temp > max_overlap)
                    {
                        max_overlap = temp;
                        temp_c2 = c2;
                    }
                }
                if (max_overlap > best)
                {
                    best = max_overlap;
                    best_c1 = c1;
                    best_c2 = temp_c2;
                }
                result += max_overlap;
            }

            return new Pair() { Rank = result, C1 = best_c1, C2 = best_c2 };
        }
Ejemplo n.º 32
0
        public override Structuring BuildStructuring()
        {
            try
            {
                if (Set == null || Structurings == null)
                {
                    throw new NullReferenceException();
                }

                int _current = 1, _max = IterationsCount;
                if (IContainerProgressBar != null)
                {
                    IContainerProgressBar.ResetProgressBar(1, _max, true);
                    IContainerProgressBar.UpdateProgressBar(0, "Running Simulated Annealing MeetJoinClusters algorithm...", true);
                }

                int random_pos = new Random(Environment.TickCount).Next(0, StructuringsCount);
                //EuclideanDistance _eu = new EuclideanDistance();
                //_eu.AttributesToCalculateProximity = Set.Attributes.Values;
                //KMeans _kmeans = new KMeans(Set, _eu);
                //_kmeans.ClustersCount =3;
                //_kmeans.Seed = Environment.TickCount;
                //_kmeans.IterationsCount = 100;

                //Structuring initial = Structurings[random_pos];

                BOK bok = new BOK(Set, Structurings)
                {
                    GenericDistances = new MirkinDistance()
                };
                Structuring initial = UseBOK ? bok.BuildStructuring() : Structurings[0];

                string[] initial_sol = new string[Set.ElementsCount];
                for (int i = 0; i < Set.ElementsCount; i++)
                {
                    initial_sol[i] = initial.Elements[Set[i]][0];
                }

                int _maxCluster = initial.ClustersCount;

                List <string[]> labels_List = new List <string[]>();
                //Convertir todas las particiones a arreglo de string, donde en cada posicion
                //esta la etiqueta del cluster al que pertenece el elemento j
                for (int i = 0; i < Structurings.Count; i++)
                {
                    string[] _temp = new string[Set.ElementsCount];
                    labels_List.Add(_temp);
                    for (int j = 0; j < Set.ElementsCount; j++)
                    {
                        _temp[j] = Structurings[i].Elements[Set[j]][0];
                    }
                }

                string[] _result_labels = SA <string[]> .RunSAOMNewNeighbor(Set, initial_sol, labels_List, Temperature, .99, 50, 1.05, 10, .5, IterationsCount, IContainerProgressBar, _current, GenericDistances, ref _maxCluster);

                Dictionary <string, Cluster> dic_clusters = new Dictionary <string, Cluster>();
                for (int i = 0; i < Set.ElementsCount; i++)
                {
                    if (dic_clusters.ContainsKey(_result_labels[i]))
                    {
                        dic_clusters[_result_labels[i]].AddElement(Set[i]);
                    }
                    else
                    {
                        Cluster c = new Cluster(_result_labels[i]);
                        c.AddElement(Set[i]);
                        dic_clusters.Add(c.Name, c);
                    }
                }

                if (IContainerProgressBar != null)
                {
                    IContainerProgressBar.FinishProgressBar();
                }

                Structuring = new Partition()
                {
                    Clusters = dic_clusters
                };
                return(Structuring);
            }
            catch
            {
                if (IContainerProgressBar != null)
                {
                    IContainerProgressBar.ShowError("Error occurred in Simulated Annealing MeetJoinClusters algorithm.");
                }
                return(null);
            }
        }
        private void RunFinish(Structuring aStructuring, ClusterAlgorithm aClusterAlgorithm)
        {
            try
            {
                ClusterAlgorithm _ClusterAlg = aClusterAlgorithm;
                Structuring _structuring = aStructuring;

                if (_structuring != null)
                {
                    TimeSpan ts = _ClusterAlg.Time;
                    string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",ts.Hours, ts.Minutes, ts.Seconds,ts.Milliseconds / 10);

                    PartitionInfo _partinfo = new PartitionInfo()
                    {
                        AlgorithmName = this.tb_SelectClusterAlg.Text,
                        ClusterAlgorithm = _ClusterAlg,
                        Partition = _structuring,
                        AlgorithmType = AlgorithmType.Clustering,
                        Time = elapsedTime,
                        Index = -1
                    };

                    this.uctrl_ListClusterAlgVisualizer.AddPartitionInfo(_partinfo);
                    this.tb_output.Text = _ClusterAlg.Output;

                    if (NewStructuringEventHandler != null)
                    {
                        NewStructuringEventHandler(this, new NewStructuringEventArgs(_partinfo));
                    }

                    //Experimental Mode
                    this.ExperimentalMode = false;
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        private double MI(Structuring aA, Structuring aB, int aElementsCount)
        {
            double _result = 0;
            foreach (var _cA in aA.Clusters.Values)
            {
                foreach (var _cB in aB.Clusters.Values)
                {
                    int _nab = CalculateIntersection(_cA, _cB);
                    int _na = _cA.ElementsCount;
                    int _nb = _cB.ElementsCount;
                    int _n = aElementsCount;

                    double _probability = _nab / ((double)_n);

                    if (_probability != 0)
                        _result += (_probability) * Math.Log10((_nab * _n) / ((double)_na * _nb));
                }
            }
            return _result;
        }
        private double Entropy(Structuring aStructuring)
        {
            double _result = 0;
            double _elementsCount = aStructuring.Elements.Count;//(aStructuring.HaveUnassignedElements())?aStructuring.Elements.Count-aStructuring.UnassignedElements.Count:aStructuring.Elements.Count;
            foreach (Cluster _cluster in aStructuring.Clusters.Values)
            {
                //esta probabilidad siempre es > 0 ya que cada cluster tiene al menos un elemento
                double _probability = _cluster.ElementsCount / ((double)_elementsCount);
                double _log = Math.Log10(_probability);

                _result += _probability * _log;
            }
            return -(_result);
        }
 public void Save(Structuring s)
 {            
     string result = s.ARFF_ToString();
     filestream.Write(result);
     filestream.Close();
 }
Ejemplo n.º 37
0
        public override Structuring BuildStructuring()
        {
            if (Structurings == null || Set == null)
            {
                throw new NullReferenceException();
            }

            if (IContainerProgressBar != null)
            {
                IContainerProgressBar.ResetProgressBar(1, 1, true);
                IContainerProgressBar.UpdateProgressBar(0, "Running QMI algorithm...", true);
            }

            List <Attribute> list_att = new List <Attribute>();
            int cont = 0;

            foreach (Structuring s in Structurings)
            {
                foreach (Cluster c in s.Clusters.Values)
                {
                    Attribute att = new Attribute("x" + cont, null);
                    cont++;

                    att.AttributeType = AttributeType.Numeric;
                    list_att.Add(att);
                }
            }

            Set newset = new Set("Artificial");

            newset.Attributes  = new Attributes(list_att);
            newset.ElementType = ElementType.Numeric;


            foreach (Element e in Set.Elements)
            {
                List <object> values = new List <object>();
                foreach (Structuring s in Structurings)
                {
                    foreach (Cluster c in s.Clusters.Values)
                    {
                        double temp = c.HaveElement(e) ? 1 : 0;
                        temp = temp - ((double)c.ElementsCount / (double)Set.ElementsCount);
                        values.Add(temp);
                    }
                }
                Element newelement = new Element(newset, values);
                newelement.Name  = e.Name;
                newelement.Index = e.Index;

                newset.AddElement(newelement);
            }

            KMeans kms = new KMeans(newset, new EuclideanDistance()
            {
                AttributesToCalculateProximity = newset.Attributes.Values
            });

            kms.ClustersCount   = ClusterCount;
            kms.IterationsCount = IterationsCount;
            kms.Seed            = Environment.TickCount;

            kms.IContainerProgressBar = IContainerProgressBar;

            Structuring art_struct = kms.BuildStructuring();

            List <Cluster> clusters = new List <Cluster>();

            cont = 0;
            foreach (Cluster c in art_struct.Clusters.Values)
            {
                Cluster temp = new Cluster("C-" + cont);
                cont++;
                foreach (Element item in c.Elements)
                {
                    temp.AddElement(Set[item.Index]);
                }
                clusters.Add(temp);
            }

            Dictionary <string, Cluster> temp_dic = new Dictionary <string, Cluster>();

            foreach (Cluster item in clusters)
            {
                temp_dic.Add(item.Name, item);
            }

            Structuring real_struct = new Partition()
            {
                Clusters = temp_dic
            };

            return(real_struct);
        }
Ejemplo n.º 38
0
        private Pair Fitness(Structuring s1, Structuring s2)
        {
            Pair p1 = FitnessOneWay(s1, s2);
            Pair p2 = FitnessOneWay(s2, s1);

            return new Pair() { Rank = p1.Rank + p2.Rank, C1 = p1.C1, C2 = p1.C2, P1 = s1, P2 = s2 };
        }
        public void PaintClusters(Structuring aStructuring)
        {
            try
            {
                Grid _grid = new Grid();

                RowDefinition _rd1 = new RowDefinition();
                _rd1.Height = new GridLength(2, GridUnitType.Star);
                RowDefinition _rd2 = new RowDefinition();
                _rd2.Height = new GridLength(2, GridUnitType.Star);
                _grid.RowDefinitions.Add(_rd1);
                _grid.RowDefinitions.Add(_rd2);

                int _RealClusters = aStructuring.ClustersCount + ((aStructuring.HaveUnassignedElements()) ? 1 : 0);
                int _columns = (_RealClusters % 2 == 0) ? _RealClusters / 2 : (_RealClusters / 2) + 1;

                for (int i = 0; i < _columns; i++)
                {
                    ColumnDefinition _cd = new ColumnDefinition();
                    _cd.Width = new GridLength(_columns, GridUnitType.Star);
                    _grid.ColumnDefinitions.Add(_cd);
                }
                int _row = 0;
                int _column = 0;
                foreach (Cluster _cluster in aStructuring.Clusters.Values)
                {
                    Border b = new Border();
                    b.HorizontalAlignment = HorizontalAlignment.Left;
                    b.VerticalAlignment = VerticalAlignment.Top;
                    b.Margin = new Thickness(5);
                    b.BorderThickness = new Thickness(1);
                    //B7D6F5
                    SolidColorBrush _mySolidColorBrush = new SolidColorBrush();
                    _mySolidColorBrush.Color = Color.FromArgb(255, 183, 214, 245);
                    b.Background = _mySolidColorBrush;
                    b.CornerRadius = new CornerRadius(10);
                    b.Tag = _cluster;

                    Grid.SetRow(b, _row);
                    Grid.SetColumn(b, _column);
                    _grid.Children.Add(b);

                    Grid _cElements = new Grid();
                    _cElements.Margin = new Thickness(5);
                    RowDefinition _rdTemp1 = new RowDefinition();
                    _rdTemp1.Height = new GridLength(0, GridUnitType.Auto);
                    RowDefinition _rdTemp2 = new RowDefinition();
                    _rdTemp2.Height = new GridLength(1, GridUnitType.Star);
                    _cElements.RowDefinitions.Add(_rdTemp1);
                    _cElements.RowDefinitions.Add(_rdTemp2);

                    b.Child = _cElements;

                    //Fila 0- Nombre del Cluster
                    TextBlock _tblk = new TextBlock();
                    _tblk.Text = _cluster.Name + " (" + _cluster.ElementsCount + ")";
                    _tblk.FontWeight = FontWeights.Bold;
                    _tblk.HorizontalAlignment = HorizontalAlignment.Center;
                    Grid.SetColumn(_tblk, 0);
                    Grid.SetRow(_tblk, 0);
                    _cElements.Children.Add(_tblk);

                    //Fila 1- Los elementos
                    ElementsVisualizer _ev = new ElementsVisualizer();
                    _ev.Elements = _cluster.Elements;
                    Grid.SetColumn(_ev, 0);
                    Grid.SetRow(_ev, 1);
                    _cElements.Children.Add(_ev);

                    _column++;
                    if (_column == _columns)
                    {
                        _column = 0;
                        _row++;
                    }
                }

                if (aStructuring.HaveUnassignedElements())
                {
                    Border b = new Border();
                    b.HorizontalAlignment = HorizontalAlignment.Left;
                    b.VerticalAlignment = VerticalAlignment.Top;
                    b.Margin = new Thickness(5);
                    b.BorderThickness = new Thickness(1);
                    b.Background = new SolidColorBrush(Colors.LightBlue);
                    b.CornerRadius = new CornerRadius(10);
                    b.Tag = aStructuring.UnassignedElements;

                    Grid.SetRow(b, _row);
                    Grid.SetColumn(b, _column);
                    _grid.Children.Add(b);

                    Grid _cElements = new Grid();
                    _cElements.Margin = new Thickness(5);
                    RowDefinition _rdTemp1 = new RowDefinition();
                    _rdTemp1.Height = new GridLength(0, GridUnitType.Auto);
                    RowDefinition _rdTemp2 = new RowDefinition();
                    _rdTemp2.Height = new GridLength(1, GridUnitType.Star);
                    _cElements.RowDefinitions.Add(_rdTemp1);
                    _cElements.RowDefinitions.Add(_rdTemp2);

                    b.Child = _cElements;

                    //Fila 0- Nombre del Cluster
                    TextBlock _tblk = new TextBlock();
                    _tblk.Text = "Unnassigned Elements (" + aStructuring.UnassignedElements.Count + ")";
                    _tblk.FontStyle = FontStyles.Italic;
                    _tblk.FontWeight = FontWeights.Bold;
                    _tblk.HorizontalAlignment = HorizontalAlignment.Center;
                    Grid.SetColumn(_tblk, 0);
                    Grid.SetRow(_tblk, 0);
                    _cElements.Children.Add(_tblk);

                    //Fila 1- Los elementos
                    ElementsVisualizer _ev = new ElementsVisualizer();
                    _ev.Elements = aStructuring.UnassignedElements;
                    Grid.SetColumn(_ev, 0);
                    Grid.SetRow(_ev, 1);
                    _cElements.Children.Add(_ev);
                }

                spMain.Children.Add(_grid);
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
            #region OLD CODE

            #region Painting All Clusters
            //foreach (Cluster _cluster in aStructuring.Clusters.Values)
            //{
            //    Border b = new Border();
            //    b.HorizontalAlignment = HorizontalAlignment.Left;
            //    b.VerticalAlignment = VerticalAlignment.Top;
            //    b.Margin = new Thickness(0, 0, 5, 0);
            //    b.BorderThickness = new Thickness(1);
            //    b.Background = new SolidColorBrush(Colors.Beige);
            //    b.CornerRadius = new CornerRadius(10);
            //    b.Tag = _cluster;
            //    b.MouseDown += GroupClick;

            //    WrapPanel sp = new WrapPanel();
            //    sp.Orientation = Orientation.Vertical;


            //    b.Child = sp;
            //    spMain.Children.Add(b);

            //    ElementsVisualizer _ev = new ElementsVisualizer();
            //    _ev.Elements = _cluster.Elements;
            //    sp.Children.Add(_ev);

            //    #region Painting All Elements of this Cluster
            //    //foreach (Element e in _cluster.Elements)
            //    //{
            //    //    Border subB = new Border();
            //    //    subB.HorizontalAlignment = HorizontalAlignment.Left;
            //    //    subB.VerticalAlignment = VerticalAlignment.Top;
            //    //    subB.Margin = new Thickness(5, 3, 5, 0);
            //    //    subB.Padding = new Thickness(5, 2, 5, 2);
            //    //    subB.BorderThickness = new Thickness(1);

            //    //    //subB.Background = new SolidColorBrush(colors[ZooEnvironment.RealPartition.GetCluster(e)[0]]);

            //    //    subB.CornerRadius = new CornerRadius(5);

            //    //    TextBlock tb = new TextBlock();
            //    //    tb.HorizontalAlignment = HorizontalAlignment.Center;

            //    //    if (!e.IsMissing(0))
            //    //        tb.Text = e.Values[0].ToString();
            //    //    else
            //    //        tb.Text = "?";

            //    //    subB.Child = tb;
            //    //    sp.Children.Add(subB);
            //    //}
            //    #endregion
            //}
            #endregion

            #region Painting All Unassigned Elements
            //if (aStructuring.HaveUnassignedElements())
            //{
            //    Border b = new Border();
            //    b.HorizontalAlignment = HorizontalAlignment.Left;
            //    b.VerticalAlignment = VerticalAlignment.Top;
            //    b.Margin = new Thickness(0, 0, 5, 0);
            //    b.BorderThickness = new Thickness(1);
            //    b.Background = new SolidColorBrush(Colors.LightBlue);
            //    b.CornerRadius = new CornerRadius(10);
            //    b.Tag = aStructuring.UnassignedElements;
            //    b.MouseDown += GroupClick;

            //    WrapPanel sp = new WrapPanel();
            //    sp.Orientation = Orientation.Vertical;


            //    b.Child = sp;
            //    spMain.Children.Add(b);

            //    #region Painting All Unassigned Elements
            //    foreach (Element e in aStructuring.UnassignedElements)
            //    {
            //        Border subB = new Border();
            //        subB.HorizontalAlignment = HorizontalAlignment.Left;
            //        subB.VerticalAlignment = VerticalAlignment.Top;
            //        subB.Margin = new Thickness(5, 3, 5, 0);
            //        subB.Padding = new Thickness(5, 2, 5, 2);
            //        subB.BorderThickness = new Thickness(1);

            //        subB.CornerRadius = new CornerRadius(5);

            //        TextBlock tb = new TextBlock();
            //        tb.HorizontalAlignment = HorizontalAlignment.Center;

            //        if (!e.IsMissing(0))
            //            tb.Text = e.Values[0].ToString();
            //        else
            //            tb.Text = "?";

            //        subB.Child = tb;
            //        sp.Children.Add(subB);
            //    }

            //    #endregion
            //}
            #endregion

            #endregion
        }
        private void RunFinish(Structuring aStructuring, ConsensusFunction aConsensusFunction)
        {
            try
            {
                ConsensusFunction _EnsembleAlg = aConsensusFunction;
                Structuring _structuring = aStructuring;

                if (_structuring != null)
                {
                    TimeSpan ts = _EnsembleAlg.Time;
                    string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

                    PartitionInfo _partInfo = new PartitionInfo()
                    {
                        AlgorithmName = this.tb_SelectEnsembleAlg.Text,
                        ConsensusFunction = _EnsembleAlg,
                        Partition = _structuring,
                        AlgorithmType = AlgorithmType.Ensemble,
                        Time = elapsedTime,
                        ElementCount = aConsensusFunction.ReductionElementCount,
                        SearchSpace = ReductionFunction.BellNumber(aConsensusFunction.ReductionElementCount),
                        Index = -1
                    };
                    this.uctrl_ListClusterAlgVisualizerEnsemble.AddPartitionInfo(_partInfo);
                    this.tb_output.Text = _EnsembleAlg.Output;


                    if (NewStructuringEventHandler != null)
                    {
                        NewStructuringEventHandler(this, new NewStructuringEventArgs(_partInfo));
                    }
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        public void NewStructuring(object sender, NewStructuringEventArgs e)
        {
            try
            {
                Struct = null;
                Struct = e.NewStructuring;
                tb_alg_name.Text = e.NewStructuringInfo.AlgorithmName;

                rc_graphic.SeriesMappings = new SeriesMappingCollection();

                List<SeriesMapping> sm = TelerikUtils.InitBubbleChart(Struct, att_x, att_y);

                foreach (SeriesMapping item in sm)
                {
                    rc_graphic.SeriesMappings.Add(item);
                }

                rc_graphic.ItemsSource = null;
                rc_graphic.ItemsSource = TelerikUtils.FillBubbleChartData(Struct, att_x, att_y);

            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
 public void Save(string filename, Structuring s)
 {
     ResetDestination();
     filestream = new StreamWriter(filename, false, Encoding.Default);
     Save(s);
 }
        private List<MeasureOutput> RunMethod(List<PartitionInfo> _partitionsInfo, List<Measure> _measures, Structuring _realpartition, List<MeasureOutput> _measuresOutput, List<MeasureInfo> _MeasuresChecked)
        {
            try
            {
                int _current=1;
                if (IContainerProgressBar != null)
                    IContainerProgressBar.ResetProgressBar(1, _partitionsInfo.Count * _measures.Count + _measures.Count, false);

                for (int i = 0; i < _partitionsInfo.Count; i++)
                {
                    double[] _values = new double[_measures.Count];
                    //Evaluar cada Medida según la partición correspondiente
                    for (int k = 0; k < _measures.Count; k++)
                    {
                        if (IContainerProgressBar != null)
                            IContainerProgressBar.UpdateProgressBar(_current++, "Computing Measure " + _measures[k].Name + " in Partition " + _partitionsInfo[i].AlgorithmName, false);

                        Measure _measureTemp = _measures[k];
                        _measureTemp.Set = Enviroment.Set;
                        _measureTemp.Structuring = _partitionsInfo[i].Partition;
                        _measureTemp.RealPartition = _realpartition;
                        _measureTemp.ObjetiveAttribute = Att_objetive;

                        _values[k] = _measureTemp.EvaluatePartition();

                        _values[k] = Math.Round(_values[k], 4);
                    }

                    _measuresOutput.Add(new MeasureOutput()
                    {
                        AlgorithmName = _partitionsInfo[i].AlgorithmName,
                        Measures = _MeasuresChecked,
                        Partition = _partitionsInfo[i].Partition,
                        Values = _values
                    });
                }

                {
                    //Evaluar la particion real, para poder comparar los valores de las demas particiones con respecto a los valores de la real
                    double[] _valuesRealPartition = new double[_measures.Count];
                    //Evaluar cada Medida según la partición correspondiente
                    for (int k = 0; k < _measures.Count; k++)
                    {
                        if (IContainerProgressBar != null)
                            IContainerProgressBar.UpdateProgressBar(_current++, "Computing Measure " + _measures[k].Name + " in Real Partition", false);

                        Measure _measureTemp = _measures[k];
                        _measureTemp.Set = Enviroment.Set;
                        _measureTemp.Structuring = _realpartition;
                        _measureTemp.RealPartition = _realpartition;
                        _measureTemp.ObjetiveAttribute = Att_objetive;

                        _valuesRealPartition[k] = _measureTemp.EvaluatePartition();

                        _valuesRealPartition[k] = Math.Round(_valuesRealPartition[k], 4);
                    }

                    _measuresOutput.Add(new MeasureOutput()
                    {
                        AlgorithmName = "Real Partition",
                        Measures = _MeasuresChecked,
                        Partition = _realpartition,
                        Values = _valuesRealPartition
                    });
                }
                if (IContainerProgressBar != null)
                    IContainerProgressBar.FinishProgressBar();

                return _measuresOutput;
            }
            catch(Exception ex)
            {
                if (IContainerProgressBar != null)
                    IContainerProgressBar.ShowError("Error occurred in Measures");

                return null;

            }
        }