Exemple #1
0
        public void CreateItems()
        {
            rowCountControl         = new NumericUpDown();
            rowCountControl.Minimum = 10;
            rowCountControl.Maximum = 100;
            SettingItemGUI rowCount = new SettingItemGUI("Number of rows",
                                                         snakeAISettings.SnakeSettings.RowCount.ToString(),
                                                         rowCountControl);

            columnCountControl         = new NumericUpDown();
            columnCountControl.Minimum = 10;
            columnCountControl.Maximum = 100;
            SettingItemGUI columnCount = new SettingItemGUI("Number of columns",
                                                            snakeAISettings.SnakeSettings.ColumnCount.ToString(),
                                                            columnCountControl);

            settingItems.Add(rowCount);
            settingItems.Add(columnCount);
        }
        private void CreateItems()
        {
            NumericUpDown inputNeuronsControl = new NumericUpDown();

            inputNeuronsControl.Minimum = 1;
            inputNeuronsControl.Value   = networkSettings.numberOfInputNeurons;
            inputNeuronsControl.Enabled = false;
            SettingItemGUI numberOfInputNeurons = new SettingItemGUI("Number of input neurons",
                                                                     networkSettings.numberOfInputNeurons.ToString(),
                                                                     inputNeuronsControl);

            hiddenLayersControl               = new NumericUpDown();
            hiddenLayersControl.Value         = networkSettings.hiddenLayerStructure.Length;
            hiddenLayersControl.ValueChanged += OnHiddenLayersChanged;
            hiddenLayersControl.Minimum       = 1;
            hiddenLayersControl.Maximum       = 6;
            hiddenLayersControl.ReadOnly      = true;
            hiddenLayersPrev = hiddenLayersControl.Value;
            SettingItemGUI numberOfHiddenLayers = new SettingItemGUI("Number of hidden layers",
                                                                     networkSettings.hiddenLayerStructure.Length.ToString(),
                                                                     hiddenLayersControl);

            hiddenNeuronsControl = new HiddenNeuronControlGUI(networkSettings);
            SettingItemGUI numberOfHiddenNeurons = new SettingItemGUI("Number of hidden neurons",
                                                                      networkSettings.hiddenLayerStructure.Length.ToString(),
                                                                      hiddenNeuronsControl);

            NumericUpDown outputNeuronsControl = new NumericUpDown();

            outputNeuronsControl.Minimum = 1;
            outputNeuronsControl.Value   = networkSettings.numberOfOutputNeurons;
            outputNeuronsControl.Enabled = false;
            SettingItemGUI numberOfOutputNeurons = new SettingItemGUI("Number of output neurons",
                                                                      networkSettings.numberOfOutputNeurons.ToString(),
                                                                      outputNeuronsControl);

            settingItems.Add(numberOfInputNeurons);
            settingItems.Add(numberOfHiddenLayers);
            settingItems.Add(numberOfHiddenNeurons);
            settingItems.Add(numberOfOutputNeurons);
        }
        public void CreateItems()
        {
            populationSizeControl         = new NumericUpDown();
            populationSizeControl.Maximum = int.MaxValue;
            SettingItemGUI populationSize = new SettingItemGUI("Population size",
                                                               geneticSettings.PopulationSize.ToString(),
                                                               populationSizeControl
                                                               );

            selectionSizeControl         = new NumericUpDown();
            selectionSizeControl.Maximum = populationSizeControl.Value - 1;
            SettingItemGUI selectionSize = new SettingItemGUI("Selection size",
                                                              geneticSettings.SelectionSize.ToString(),
                                                              selectionSizeControl);

            populationSizeControl.ValueChanged += OnPopulationSizeChanged;

            mutationGeneControl               = new NumericUpDown();
            mutationGeneControl.Maximum       = 100;
            mutationGeneControl.DecimalPlaces = 1;
            mutationGeneControl.Increment     = 0.1M;
            SettingItemGUI geneMutation = new SettingItemGUI("Gene mutation chance",
                                                             (geneticSettings.MutationProbabilityGenes * 100).ToString(),
                                                             mutationGeneControl);

            mutationAgentControl               = new NumericUpDown();
            mutationAgentControl.Maximum       = 100;
            mutationAgentControl.DecimalPlaces = 1;
            mutationAgentControl.Increment     = 0.1M;
            SettingItemGUI agentMutation = new SettingItemGUI("Agent mutation chance",
                                                              (geneticSettings.MutationProbabiltyAgents * 100).ToString(),
                                                              mutationAgentControl);

            chromosomeSize = new SettingItemGUI("Chromesome size",
                                                geneticSettings.GeneCount.ToString(),
                                                new TextBox());
            chromosomeSize.EditControl.Enabled = false;

            selectionMethods       = new SelectionMethods();
            selectionMethodControl = new ComboBox();
            selectionMethodControl.DropDownStyle = ComboBoxStyle.DropDownList;
            selectionMethodControl.Items.Add(selectionMethods.TopPerformersSelector);
            selectionMethodControl.Items.Add(selectionMethods.RouletteWheelSelector);
            selectionMethodControl.SelectedItem = selectionMethodControl.Items[0];
            SettingItemGUI selectionMethod = new SettingItemGUI("Selection method",
                                                                geneticSettings.Selector.ToString(),
                                                                selectionMethodControl);

            crossoverMethods       = new CrossoverMethods();
            crossOverMethodControl = new ComboBox();
            crossOverMethodControl.DropDownStyle = ComboBoxStyle.DropDownList;
            crossOverMethodControl.Items.Add(crossoverMethods.OnePointCombineCrossoverRegular);
            crossOverMethodControl.Items.Add(crossoverMethods.OnePointCombinePlusElitismCrossover);
            crossOverMethodControl.SelectedItem = crossOverMethodControl.Items[0];

            SettingItemGUI crossOverMethod = new SettingItemGUI("Crossover method",
                                                                geneticSettings.Crossover.ToString(),
                                                                crossOverMethodControl);

            settingItems.Add(populationSize);
            settingItems.Add(selectionSize);
            settingItems.Add(geneMutation);
            settingItems.Add(agentMutation);
            settingItems.Add(chromosomeSize);
            settingItems.Add(selectionMethod);
            settingItems.Add(crossOverMethod);
        }