/// <summary> /// Default constructor - Get the default profile settings prepared, along with /// creating any objects we need to. /// </summary> public GPProjectProfile() { m_ModelingProfile = new GPModelingProfile(); ModelType = new GPModelType(); Dirty = false; // // Setup the Function Set m_FunctionSet = new List <string>(); // // Provide some default function selections m_FunctionSet.Add("Add"); m_FunctionSet.Add("Subtract"); m_FunctionSet.Add("Multiply"); m_FunctionSet.Add("Divide"); m_FunctionSet.Add("Average"); m_FunctionSet.Add("Min"); m_FunctionSet.Add("Max"); m_FunctionSet.Add("Sqrt"); m_FunctionSet.Add("Exp"); m_FunctionSet.Add("Pow"); m_ADFSet = new List <byte>(); m_ADLSet = new List <byte>(); m_ADRSet = new List <byte>(); // // Set a default fitness functin ID = Raw Fitness // TODO: Yes, this is dangerous, the value "should" be read // from the database, along with some additional UI protection. FitnessFunctionID = 1; }
/// <summary> /// Load data for training GO /// </summary> /// <param name="data"></param> /// <returns></returns> public bool LoadTrainingData(double[][] data, GPModelType type) { if (data != null) { _trainig = data; if (type == GPModelType.TSP) { FillGridWithTSPData(data); } else if (type == GPModelType.AP) { FillGridWithAPData(data); } else if (type == GPModelType.TP) { FillGridWithTPData(data); } else { FillGridWithData(data); } //send event about dataLoading if (DataLoaded != null) { DataLoaded(this, new EventArgs()); } return(true); } else { MessageBox.Show("The data were not loaded!"); return(false); } }
/// <summary> /// Hiding or showing controls for diferent type of programs /// </summary> /// <param name="p"></param> public void SetProblemType(GPModelType type) { _problemType = type; if (_problemType == GPModelType.TS) { groupBox5.Visible = true; //btnLoadTesting.Text="Load Series"; //btnLoadTesting.Visible = true; //btnLoadTraining.Visible = false; } else if (_problemType == GPModelType.SR || _problemType == GPModelType.SRO) { var sz = this.listView1.Size; //this.listView1.Size = new System.Drawing.Size(sz.Width, sz.Height + groupBox5.Height-2*btnLoadTesting.Height); } else if (_problemType == GPModelType.TSP) { groupBox5.Visible = false; //btnLoadTesting.Text = "Load Cities Map"; //btnLoadTesting.Visible = true; //btnLoadTraining.Visible = false; var sz = this.listView1.Size; // this.listView1.Size = new System.Drawing.Size(sz.Width, sz.Height + groupBox5.Height-btnLoadTesting.Height); } else if (_problemType == GPModelType.AP || _problemType == GPModelType.TP) { groupBox5.Visible = false; //btnLoadTesting.Text = "Load Data"; //btnLoadTesting.Visible = true; //btnLoadTraining.Visible = false; var sz = this.listView1.Size; //this.listView1.Size = new System.Drawing.Size(sz.Width, sz.Height + groupBox5.Height - btnLoadTesting.Height); } }
/// <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; } }