Ejemplo n.º 1
0
//	public LittleBox firstLittleBox;


    public virtual void Initiate()
    {
//		CreateLittleBoxMatrix (columnCount, rowCount);
//		touchyBall.Initiate ();
        expPanel = GetComponentInParent <ExperimentPanel> ();
        gameObject.SetActive(false);
    }
Ejemplo n.º 2
0
        public MainWindow()
        {
            Controller = new AppController();
            Controller.ReportException = this.ReportException;
            InitializeComponent();
            this.Icon = Extensions.LoadIconFromName("GPdotNet.Wnd.Dll.Images.gpdotnet.ico");

            #region additional initialization
            this.expPanel1  = new ExperimentPanel();
            this.funPanel1  = new FunctionPanel();
            this.parPanel1  = new ParametersPanel();
            this.runPanel1  = new RunPanel();
            this.resPanel1  = new ResultPanel();
            this.testPanel1 = new TestPanel();
            this.infoPanel1 = new InfoPanel();
            //
            // expPanel1
            //
            this.expPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.expPanel1.Location = new System.Drawing.Point(3, 3);
            this.expPanel1.Name     = "expPanel1";
            this.expPanel1.Size     = new System.Drawing.Size(463, 222);
            this.expPanel1.TabIndex = 0;
            //
            // runPanel1
            //
            this.infoPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.infoPanel1.Location = new System.Drawing.Point(3, 3);
            this.infoPanel1.Name     = "runPanel1";
            this.infoPanel1.Size     = new System.Drawing.Size(463, 222);
            this.infoPanel1.TabIndex = 1;
            //
            // funPanel1
            //
            this.funPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.funPanel1.Location = new System.Drawing.Point(3, 3);
            this.funPanel1.Name     = "funPanel1";
            this.funPanel1.Size     = new System.Drawing.Size(463, 222);
            this.funPanel1.TabIndex = 0;
            //
            // parPanel1
            //
            this.parPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.parPanel1.Location = new System.Drawing.Point(3, 3);
            this.parPanel1.Name     = "parPanel1";
            this.parPanel1.Size     = new System.Drawing.Size(463, 222);
            this.parPanel1.TabIndex = 0;
            //
            // runPanel1
            //
            this.runPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.runPanel1.Location = new System.Drawing.Point(3, 3);
            this.runPanel1.Name     = "runPanel1";
            this.runPanel1.Size     = new System.Drawing.Size(463, 222);
            this.runPanel1.TabIndex = 0;
            //
            // resPanel1
            //
            this.resPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.resPanel1.Location = new System.Drawing.Point(3, 3);
            this.resPanel1.Name     = "resPanel1";
            this.resPanel1.Size     = new System.Drawing.Size(463, 222);
            this.resPanel1.TabIndex = 0;
            //
            // testPanel1
            //
            this.testPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.testPanel1.Location = new System.Drawing.Point(3, 3);
            this.testPanel1.Name     = "testPanel1";
            this.testPanel1.Size     = new System.Drawing.Size(463, 222);
            this.testPanel1.TabIndex = 0;

            //
            this.tabPage3.Controls.Add(funPanel1);
            this.tabPage4.Controls.Add(parPanel1);
            this.tabPage5.Controls.Add(runPanel1);
            this.tabPage6.Controls.Add(resPanel1);
            this.tabPage7.Controls.Add(testPanel1);
            this.tabPage1.Controls.Add(expPanel1);
            this.tabPage2.Controls.Add(infoPanel1);
            #endregion
            treeView1.LabelEdit  = true;
            this.Load           += MainWindow_Load;
            this.FormClosing    += MainWindow_FormClosing;
            this.ribbonTab1.Text = AboutGPdotNET.AssemblyTitle;

            SetStopMode("");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Builds the application view
        /// </summary>
        public void BuildExperimenterView()
        {
            this.SuspendLayout();
            this.Text = GUIUtils.Strings.APP_NAME;
            this.Size = new System.Drawing.Size(1500, 750);

            // experiment settings
            var experimentPanel = new ExperimentPanel()
            {
                Dock = DockStyle.Fill
            };

            // classifier settings
            var classifierPanel = new ClassificationSchemePanel()
            {
                Dock = DockStyle.Fill
            };

            // stimulus class settings
            var stimulusClassPanel = new StimulusClassPanel()
            {
                Dock = DockStyle.Fill
            };

            // status checker
            var statusChecker = new EmotivStatusCheckerPanel()
            {
                Dock = DockStyle.Fill
            };

            // start button
            var startButton = GUIUtils.CreateFlatButton("Start Experiment", b =>
            {
                var experimentSettings = experimentPanel.ExperimentSettings;
                experimentSettings.ImageDisplaySettings      = stimulusClassPanel.ImageDisplaySettings;
                experimentSettings.ArtifactDetectionSettings = classifierPanel.ArtifactDetectionSettings;

                // check stimulus classes
                if (stimulusClassPanel.StimulusClass1 == null || stimulusClassPanel.StimulusClass2 == null)
                {
                    GUIUtils.Alert("Two stimulus classes must be selected", MessageBoxIcon.Error);
                    return;
                }

                if (stimulusClassPanel.StimulusClass1.UsedStimuli(experimentSettings.QuestionMode).IsEmpty() ||
                    stimulusClassPanel.StimulusClass2.UsedStimuli(experimentSettings.QuestionMode).IsEmpty())
                {
                    GUIUtils.Alert("Each stimulus class must have at least one valid stimulus for the selected question mode", MessageBoxIcon.Error);
                    return;
                }

                if (stimulusClassPanel.StimulusClass1.Settings.Marker == stimulusClassPanel.StimulusClass2.Settings.Marker)
                {
                    GUIUtils.Alert("The two selected stimulus classes must have different marker values", MessageBoxIcon.Error);
                    return;
                }

                // check classifiers
                var classifiers = classifierPanel.SelectedClassifiers;
                foreach (var classifier in classifiers)
                {
                    if (classifier.Settings.FeatureCount <= 0 &&
                        !GUIUtils.IsUserSure("Classifier " + classifier.Settings.Name + " has no features. Continue without this classifier?"))
                    {
                        return;
                    }
                }

                // check headset
                if (!statusChecker.HeadsetConnected &&
                    !GUIUtils.IsUserSure("The Emotiv headset is not connected: run experiment with mock headset (generates random data for testing purposes)?"))
                {
                    return;
                }

                this.Animate(new ExperimentProvider(experimentSettings,
                                                    stimulusClassPanel.StimulusClass1,
                                                    stimulusClassPanel.StimulusClass2,
                                                    classifiers.Where(c => c.Settings.FeatureCount > 0).ToIArray(),
                                                    statusChecker.HeadsetConnected
                        ? EmotivDataSource.Instance
                        : this.mockDataSource ?? (this.mockDataSource = new MockEEGDataSource())));
            });

            // add all controls
            var rows = GUIUtils.CreateTable(new double[] { .5, .5 }, Direction.Vertical);

            // top row
            var topCols = GUIUtils.CreateTable(new double[] { .25, .75 }, Direction.Horizontal);

            topCols.Controls.Add(experimentPanel, 0, 0);
            topCols.Controls.Add(classifierPanel, 1, 0);
            rows.Controls.Add(topCols, 0, 0);

            // bottom row
            var bottomCols = GUIUtils.CreateTable(new double[] { .75, .25 }, Direction.Horizontal);

            bottomCols.Controls.Add(stimulusClassPanel, 0, 0);
            var bottomRightTable = GUIUtils.CreateTable(new double[] { .6, .4 }, Direction.Vertical);

            bottomRightTable.Controls.Add(statusChecker, 0, 0);
            bottomRightTable.Controls.Add(startButton, 0, 1);
            bottomCols.Controls.Add(bottomRightTable, 1, 0);
            rows.Controls.Add(bottomCols, 0, 1);

            this.Controls.Add(rows);
            this.ResumeLayout(false);
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            Controller = new AppController();
            Controller.ReportException = this.ReportException;
            InitializeComponent();


            this.Icon = Extensions.LoadIconFromName("ANNdotNet.Wnd.Dll.Images.anndotnet.ico");

            #region additional initialization
            this.startPanel1 = new ANNdotNet.Wnd.Dll.Panels.StartPanel();
            this.expPanel1   = new ExperimentPanel();
            this.runPanel1   = new RunPanel();
            this.testPanel1  = new TestPanel();
            this.infoPanel1  = new InfoPanel();

            //
            // startPanel1
            //
            this.startPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.startPanel1.Dock         = System.Windows.Forms.DockStyle.Fill;
            this.startPanel1.Location     = new System.Drawing.Point(0, 0);
            this.startPanel1.Margin       = new System.Windows.Forms.Padding(4, 5, 4, 5);
            this.startPanel1.Name         = "startPanel1";
            this.startPanel1.New          = null;
            this.startPanel1.Open         = null;
            this.startPanel1.Size         = new System.Drawing.Size(762, 395);
            this.startPanel1.TabIndex     = 0;

            //
            // expPanel1
            //
            this.expPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.expPanel1.Location = new System.Drawing.Point(3, 3);
            this.expPanel1.Name     = "expPanel1";
            this.expPanel1.Size     = new System.Drawing.Size(463, 222);
            this.expPanel1.ShowOptionPanel();
            this.expPanel1.TabIndex = 0;
            //
            // runPanel1
            //
            this.infoPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.infoPanel1.Location = new System.Drawing.Point(3, 3);
            this.infoPanel1.Name     = "runPanel1";
            this.infoPanel1.Size     = new System.Drawing.Size(463, 222);
            this.infoPanel1.TabIndex = 1;

            //
            // runPanel1
            //
            this.runPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.runPanel1.Location = new System.Drawing.Point(3, 3);
            this.runPanel1.Name     = "runPanel1";
            this.runPanel1.Size     = new System.Drawing.Size(463, 222);
            this.runPanel1.TabIndex = 0;

            //
            // testPanel1
            //
            this.testPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.testPanel1.Location = new System.Drawing.Point(3, 3);
            this.testPanel1.Name     = "testPanel1";
            this.testPanel1.Size     = new System.Drawing.Size(463, 222);
            this.testPanel1.TabIndex = 0;

            //
            this.splitContainer1.Panel2.Controls.Add(this.startPanel1);
            this.tabPage5.Controls.Add(runPanel1);
            this.tabPage7.Controls.Add(testPanel1);
            this.tabPage1.Controls.Add(expPanel1);
            this.tabPage2.Controls.Add(infoPanel1);

            #endregion
            treeView1.LabelEdit  = true;
            this.Load           += MainWindow_Load;
            this.FormClosing    += MainWindow_FormClosing;
            this.ribbonTab1.Text = AboutANNdotNET.AssemblyTitle;

            SetStopMode("");
            //setup expanel
            expPanel1.LockEncoding     = true;
            expPanel1.DefaultBEncoding = DataProcessing.MLBasicTypes.CategoryEncoding.OneHot;
        }
Ejemplo n.º 5
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;
            }
        }