Exemplo n.º 1
0
        private void bt_select_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string _errors = "";
                if (!Enviroment.CanRunAlgorithm(out _errors, AlgorithmType.Ensemble))
                {
                    MessageBox.Show(_errors, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                bool _ok;

                _errors = VerifyErrors(out _ok);

                if (!_ok)
                {
                    MessageBox.Show(_errors, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (NewEnsembleAlgorithm != null)
                {
                    NewEnsembleAlgorithm(this, new NewEnsembleAlgorithmEventArgs(Tree));
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Exemplo n.º 2
0
        private void bt_Run_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (HasSelectedAlgorithm)
                {
                    string _Error = "";
                    if (!Enviroment.CanRunAlgorithm(out _Error, AlgorithmType.Clustering))
                    {
                        MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                    ReflectionTools  _rct        = new ReflectionTools();
                    ClusterAlgorithm _ClusterAlg = ReflectionTools.GetInstance <ClusterAlgorithm>(Tree.Value.FullName);

                    foreach (CEDS.Property _p in Tree.Value.InProperties)
                    {
                        _rct.SetProperty(Tree.Value.FullName, _ClusterAlg, _p);
                    }


                    if (!VisualUtils.SetGlobalInProperties(_rct, _ClusterAlg, Tree, out _Error, this.chbx_AttrRnd.IsChecked.Value))
                    {
                        MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    Run _run = RunMethod;

                    _run.BeginInvoke(_ClusterAlg, RunFinish, new DataThread()
                    {
                        Run = _run, ClusterAlgorithm = _ClusterAlg
                    });
                }
                else
                {
                    MessageBox.Show("You must first select a Clustering algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
Exemplo n.º 3
0
        private void bt_Run_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (HasSelectedAlgorithm)
                {
                    string _Error = "";
                    if (!Enviroment.CanRunAlgorithm(out _Error, AlgorithmType.Ensemble))
                    {
                        MessageBox.Show(_Error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                    ReflectionTools   _rcet        = new ReflectionTools();
                    ConsensusFunction _EnsembleAlg = ReflectionTools.GetInstance <ConsensusFunction>(Tree.Value.FullName);

                    foreach (CEDS.Property _p in Tree.Value.InProperties)
                    {
                        _rcet.SetProperty(Tree.Value.FullName, _EnsembleAlg, _p);
                    }

                    List <Structuring> _structuringsParams = GetSelectedStructurings();
                    if (_structuringsParams == null || _structuringsParams.Count == 0)
                    {
                        MessageBox.Show("You must select at least one Structuring to apply an Ensemble algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                    VisualUtils.SetGlobalInProperties(_rcet, _EnsembleAlg, Tree, _structuringsParams);

                    #region OLD CODE
                    //Structuring _structuring = _EnsembleAlg.BuildStructuring();

                    //PartitionInfo _partInfo = new PartitionInfo()
                    //{
                    //    AlgorithmName = this.tb_SelectEnsembleAlg.Text,
                    //    ConsensusFunction = _EnsembleAlg,
                    //    Partition = _structuring,
                    //    AlgorithmType = AlgorithmType.Ensemble,
                    //    Index = -1
                    //};
                    //this.uctrl_ListClusterAlgVisualizerEnsemble.AddPartitionInfo(_partInfo);


                    //if (NewStructuringEventHandler != null)
                    //{
                    //    NewStructuringEventHandler(this, new NewStructuringEventArgs(_partInfo));
                    //}
                    #endregion

                    Run _run = RunMethod;
                    _run.BeginInvoke(_EnsembleAlg, RunFinish, new DataThread()
                    {
                        ConsensusFunction = _EnsembleAlg, Run = _run
                    });
                }
                else
                {
                    MessageBox.Show("You must first select an Ensemble algorithm.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }