Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void _experimentPanel_DataLoaded(object sender, EventArgs e)
        {
            //Depending on experimental type of output data (numerical or categorical or boolean)
            // prepare the panels for parameters and type of the factory.
            if (_GPModel == GPModelType.ANNMODEL)
            {
                //create facotry based on column data type
                if (_experimentPanel.IsCategoricalOutput)
                {
                    this._mainANNFactory = new PSOFactory();
                }
                else
                {
                    this._mainANNFactory = new BPFactory();
                }

                //
                if (_setANNPanel == null)
                {
                    _setANNPanel = new ANNSettingsPanel();
                    loadGPPanelInMainWindow(this, _setANNPanel, "Settings");

                    //lock some parameters based on type of output variable
                    if (_experimentPanel.Experiment.GetOutputColumnType() == Core.Experiment.ColumnDataType.Binary ||
                        _experimentPanel.Experiment.GetOutputColumnType() == Core.Experiment.ColumnDataType.Categorical
                        )
                    {
                        _setANNPanel.SetLearnigAlgorithm(1);
                    }
                    else
                    {
                        _setANNPanel.SetLearnigAlgorithm(0);
                    }

                    _setANNPanel.LockLearningAlgoritm();
                }

                if (_runANNPanel == null)
                {
                    _runANNPanel = new ANNRunPanel();
                    loadGPPanelInMainWindow(this, _runANNPanel, "Modeling");
                }

                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    loadGPPanelInMainWindow(this, _infoPanel, "Info");
                }

                if (_runANNPanel != null)
                {
                    this._mainANNFactory.ReportIteration += new EvolutionHandler(annFactory_ReportIteration);
                    _runANNPanel.UpdateChartDataPoint(_experimentPanel.GetOutputValues(), false);
                    _isFileDirty = true;
                }
            }
            else//Preparing GP for modelling nd prediction
            {
                //create facotry based on column data type
                if (_experimentPanel.IsBinarylOutput || _experimentPanel.IsCategoricalOutput)
                {
                    this._mainGPFactory = new GPFactoryClass();
                }
                else if (_experimentPanel.GetOutputColumnType() == Core.Experiment.ColumnDataType.Numeric)
                {
                    this._mainGPFactory = new GPFactory();
                }
                else
                {
                    throw new Exception("Unknown output value type!");
                }



                if (_funPanel == null)
                {
                    _funPanel = new FunctionPanel();
                    loadGPPanelInMainWindow(this, _funPanel, "Functions");
                }

                if (_setPanel == null)
                {
                    _setPanel = new SettingsPanel();
                    loadGPPanelInMainWindow(this, _setPanel, "Settings");
                }
                //set problem type
                _setPanel.SetParamForClassification(_experimentPanel.GetOutputColumnType());

                if (_runPanel == null)
                {
                    _runPanel = new RunPanel();
                    loadGPPanelInMainWindow(this, _runPanel, "Run");
                }


                if (_resultPanel == null)
                {
                    _resultPanel = new ResultPanel();
                    loadGPPanelInMainWindow(this, _resultPanel, "Result");
                }


                if (_infoPanel == null)
                {
                    _infoPanel = new InfoPanel();
                    loadGPPanelInMainWindow(this, _infoPanel, "Info");
                }


                //set base run panel on _runPAnel
                _baseRunPanel = _runPanel;

                if (_runPanel != null)
                {
                    this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);
                    _runPanel.ResetSolution();
                    _runPanel.UpdateChartDataPoint(_experimentPanel.GetOutputValues(), false);
                    _isFileDirty = true;
                }



                if (_funDefinit != null)
                {
                    _funDefinit.btnFinishAnalFun.Click += btnFinishAnalFun_Click;
                }



                if (_setPanel != null)
                {
                    _setPanel.ResetSolution += _setPanel_ResetSolution;
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        void LoadModelWizard(GPModelType model)
        {
            _GPModel = model;

            switch (_GPModel)
            {
            case GPModelType.SR:
            {
                _dataPanel = new DataPanel();
                loadGPPanelInMainWindow(this, _dataPanel, "Load Data");
                _dataPanel.SetProblemType(_GPModel);

                _funPanel = new FunctionPanel();
                loadGPPanelInMainWindow(this, _funPanel, "Functions");

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");

                _runPanel = new RunPanel();
                loadGPPanelInMainWindow(this, _runPanel, "Run");

                _resultPanel = new ResultPanel();
                loadGPPanelInMainWindow(this, _resultPanel, "Result");

                _infoPanel = new InfoPanel();
                loadGPPanelInMainWindow(this, _infoPanel, "Info");

                this._mainGPFactory = new GPFactory();
                this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                //set base run panel on _runPAnel
                _baseRunPanel = _runPanel;
            }
            break;

            case GPModelType.SRO:
            {
                _dataPanel = new DataPanel();
                loadGPPanelInMainWindow(this, _dataPanel, "Load Data");
                _dataPanel.SetProblemType(_GPModel);

                _funPanel = new FunctionPanel();
                loadGPPanelInMainWindow(this, _funPanel, "Functions");

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");

                _runPanel = new RunPanel();
                loadGPPanelInMainWindow(this, _runPanel, "Run");


                _optimizePanel = new OptimizePanel();
                loadGPPanelInMainWindow(this, _optimizePanel, "Optimize Model");

                _resultPanel = new ResultPanel();
                loadGPPanelInMainWindow(this, _resultPanel, "Result");

                _infoPanel = new InfoPanel();
                loadGPPanelInMainWindow(this, _infoPanel, "Info");

                this._mainGPFactory = new GPFactory();
                this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                this._secondFactory = new GPFactory();
                this._secondFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);


                //set base run panel on _runPAnel
                _baseRunPanel = _runPanel;
            }
            break;

            case GPModelType.TS:
            {
                _dataPanel = new DataPanel();
                loadGPPanelInMainWindow(this, _dataPanel, "Load Data");
                _dataPanel.SetProblemType(_GPModel);

                _funPanel = new FunctionPanel();
                loadGPPanelInMainWindow(this, _funPanel, "Functions");

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");
                _setPanel.SetNumOfConstance(0);

                _runPanel = new RunPanel();
                loadGPPanelInMainWindow(this, _runPanel, "Run");

                _resultPanel = new ResultPanel();
                loadGPPanelInMainWindow(this, _resultPanel, "Result");

                _infoPanel = new InfoPanel();
                loadGPPanelInMainWindow(this, _infoPanel, "Info");

                this._mainGPFactory = new GPFactory();
                this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                //set base run panel on _runPAnel
                _baseRunPanel = _runPanel;
            }
            break;

            case GPModelType.AO:
            {
                _funDefinit = new AnaliticFunctionDef();
                loadGPPanelInMainWindow(this, _funDefinit, "Analytic  function");

                _funPanel = new FunctionPanel();
                loadGPPanelInMainWindow(this, _funPanel, "Functions");

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");
                _setPanel.ShowGAParams();

                _optimizePanel = new OptimizePanel();
                loadGPPanelInMainWindow(this, _optimizePanel, "Optimize Model");


                //initi pages after creation
                //
                _funDefinit.LoadFuns(_funPanel.GPFunctions);
                tabControl1.TabPages.RemoveAt(1);

                this._secondFactory = new GPFactory();
                this._secondFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                //set base run panel on _optimizePanel
                _baseRunPanel = _optimizePanel;
            }
            break;

            case GPModelType.TSP:
            {
                _dataPanel = new DataPanel();
                loadGPPanelInMainWindow(this, _dataPanel, "Load Data");
                _dataPanel.SetProblemType(_GPModel);

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");
                _setPanel.ShowGAParams();
                var p = _setPanel.GetParameters();
                p.popSize          = 2500;
                p.eselectionMethod = GPSelectionMethod.SkrgicSelection;
                p.SelParam1        = 2.5f;
                _setPanel.SetParameters(p);

                _tspPanel = new TSPRunPanel();
                loadGPPanelInMainWindow(this, _tspPanel, "Simulation");

                this._mainGPFactory = new GPFactory();
                this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                _infoPanel = new InfoPanel();
                loadGPPanelInMainWindow(this, _infoPanel, "Info");

                //set base run panel on _TSPPanel
                _baseRunPanel = _tspPanel;
            }
            break;

            case GPModelType.AP:
            {
                _dataPanel = new DataPanel();
                loadGPPanelInMainWindow(this, _dataPanel, "Load Data");
                _dataPanel.SetProblemType(_GPModel);

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");
                _setPanel.ShowGAParams();
                var p = _setPanel.GetParameters();
                p.popSize          = 2500;
                p.eselectionMethod = GPSelectionMethod.SkrgicSelection;
                p.SelParam1        = 2.5f;
                _setPanel.SetParameters(p);

                _alocPanel = new ALOCRunPanel();
                loadGPPanelInMainWindow(this, _alocPanel, "Simulation");

                this._mainGPFactory = new GPFactory();
                this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                _infoPanel = new InfoPanel();
                loadGPPanelInMainWindow(this, _infoPanel, "Info");

                //set base run panel on _TSPPanel
                _baseRunPanel = _alocPanel;
            }
            break;

            case GPModelType.TP:
            {
                _dataPanel = new DataPanel();
                loadGPPanelInMainWindow(this, _dataPanel, "Load Data");
                _dataPanel.SetProblemType(_GPModel);

                _setPanel = new SettingsPanel();
                loadGPPanelInMainWindow(this, _setPanel, "Settings");
                _setPanel.ShowGAParams();
                var p = _setPanel.GetParameters();
                p.popSize          = 2500;
                p.eselectionMethod = GPSelectionMethod.SkrgicSelection;
                p.SelParam1        = 2.5f;
                _setPanel.SetParameters(p);

                _alocPanel = new ALOCRunPanel();
                loadGPPanelInMainWindow(this, _alocPanel, "Simulation");

                this._mainGPFactory = new GPFactory();
                this._mainGPFactory.ReportEvolution += new EvolutionHandler(gpFactory_ReportEvolution);

                _infoPanel = new InfoPanel();
                loadGPPanelInMainWindow(this, _infoPanel, "Info");

                //set base run panel on _TSPPanel
                _baseRunPanel = _alocPanel;
            }
            break;

            case GPModelType.ANNMODEL:
            case GPModelType.GPMODEL:
            {
                _experimentPanel = new ExperimentPanel();
                loadGPPanelInMainWindow(this, _experimentPanel, "Load Experiment");
                _experimentPanel.SetProblemType(_GPModel);

                //factory creating moved on place when the experimental data is created and prepared
                //this._mainANNFactory = new ANNFactory();
                //this._mainANNFactory.ReportIteration += new EvolutionHandler(annFactory_ReportIteration);
            }
            break;

            default:
                break;
            }

            //Events from datapanel about loading dat
            if (_dataPanel != null)
            {
                _dataPanel.DataLoaded += _dataPanel_DataLoaded;
            }

            if (_dataPanel != null)
            {
                _dataPanel.DataPredictionLoaded += _dataPanel_DataPredictionLoaded;
            }

            //Events from experiment panel about loading dat
            if (_experimentPanel != null)
            {
                _experimentPanel.DataLoaded += _experimentPanel_DataLoaded;
            }

            if (_experimentPanel != null)
            {
                _experimentPanel.DataPredictionLoaded += _experimentalPanel_DataPredictionLoaded;
            }


            if (_funDefinit != null)
            {
                _funDefinit.btnFinishAnalFun.Click += btnFinishAnalFun_Click;
            }



            if (_setPanel != null)
            {
                _setPanel.ResetSolution += _setPanel_ResetSolution;
            }
        }