private void buttonGoToRecorder_Click(object sender, EventArgs e)
        {
            (String scType, _) = listBoxStopConditions.SelectedItem as Tuple <String, String>;

            // check if fields are valid
            if (String.IsNullOrEmpty(errorProviderEndValue.GetError(textBoxEndValue)) &&
                String.IsNullOrEmpty(errorProviderOptimum.GetError(textBoxOptimum)))
            {
                String endValueStr           = textBoxEndValue.Text;
                String optimumStr            = textBoxOptimum.Text;
                SetParametersCommand command = new SetParametersCommand(Config);

                // set parameters
                // stop condition type
                command.SetParameter(OptimizationConfiguration.PARAM_STOP_CONDITION_STR, scType);
                // end value
                command.SetParameter(OptimizationConfiguration.PARAM_END_VALUE, endValueStr);
                // optimum
                if (String.IsNullOrWhiteSpace(optimumStr)) // no optimum
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_WITH_OPTIMUM,
                                         false.ToString());
                }
                else // with optimum
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_OPTIMUM, optimumStr);
                    command.SetParameter(OptimizationConfiguration.PARAM_WITH_OPTIMUM,
                                         true.ToString());
                }

                Config.AddConfigureCommand(command);
                panelSelectStopCondition.Visible = false;
                panelSelectRecorder.Visible      = true;
            }
        }
        private void buttonStartLSHADEWGD_Click(object sender, EventArgs e)
        {
            // if no errors
            if (String.IsNullOrEmpty(errorProviderMaxEvaluationsLSHADEWGD.GetError(textBoxMaxEvaluationsLSHADEWGD)) &&
                String.IsNullOrEmpty(errorProviderPopInitLSHADEWGD.GetError(textBoxRpopLSHADEWGD)) &&
                String.IsNullOrEmpty(errorProviderArcInitLSHADEWGD.GetError(textBoxRarcLSHADEWGD)) &&
                String.IsNullOrEmpty(errorProviderHistorySizeLSHADEWGD.GetError(textBoxHSizeLSHADEWGD)) &&
                String.IsNullOrEmpty(errorProviderPLSHADEWGD.GetError(textBoxPLSHADEWGD)) &&
                String.IsNullOrEmpty(errorProviderGeneHistLSHADEWGD.GetError(textBoxGeneHistLSHADEWGD)) &&
                String.IsNullOrEmpty(errorProviderGQLSHADEWGD.GetError(textBoxGqImportanceLSHADEWGD)))
            {
                SetParametersCommand command = new SetParametersCommand(Config);
                String maxEvalsStr           = textBoxMaxEvaluationsLSHADEWGD.Text;
                String popInitStr            = textBoxRpopLSHADEWGD.Text;
                String arcInitStr            = textBoxRarcLSHADEWGD.Text;
                String histSizeStr           = textBoxHSizeLSHADEWGD.Text;
                String pStr           = textBoxPLSHADEWGD.Text;
                String geneHistSizStr = textBoxGeneHistLSHADEWGD.Text;
                String gqStr          = textBoxGqImportanceLSHADEWGD.Text;
                if (!String.IsNullOrEmpty(maxEvalsStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_NUM_OF_EVALS,
                                         maxEvalsStr);
                }
                if (!String.IsNullOrEmpty(popInitStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_POP_INIT,
                                         popInitStr);
                }
                if (!String.IsNullOrEmpty(arcInitStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_ARC_INIT,
                                         arcInitStr);
                }
                if (!String.IsNullOrEmpty(histSizeStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_HISTORY_SIZE,
                                         histSizeStr);
                }
                if (!String.IsNullOrEmpty(pStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_P, pStr);
                }
                if (!String.IsNullOrEmpty(geneHistSizStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADEWGD_GENE_HIST_SIZE,
                                         geneHistSizStr);
                }
                if (!String.IsNullOrEmpty(gqStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADEWGD_GQ,
                                         gqStr);
                }

                Config.AddConfigureCommand(command);
                StartOptimization();
            }
        }
        private void buttonGoToAlgorithm_Click(object sender, EventArgs e)
        {
            SetParametersCommand command = new SetParametersCommand(Config);

            (String recorder, _) = listBoxRecorderType.SelectedItem as Tuple <String, String>;
            command.SetParameter(OptimizationConfiguration.PARAM_RECORDER_STR, recorder);
            command.SetParameter(OptimizationConfiguration.PARAM_SAVE_PATH,
                                 textBoxSaveFilePath.Text);
            Config.AddConfigureCommand(command);

            panelSelectRecorder.Visible  = false;
            panelSelectAlgorithm.Visible = true;
        }
        private void buttonGoToStopCondition_Click(object sender, EventArgs e)
        {
            (String evaluatorType, _) = listBoxEvaluator.SelectedItem as Tuple <String, String>;
            SetParametersCommand command = new SetParametersCommand(Config);

            command.SetParameter(OptimizationConfiguration.PARAM_EVALUATOR_STR, evaluatorType);
            if (!String.IsNullOrEmpty(textBoxTimeout.Text))
            {
                command.SetParameter(OptimizationConfiguration.PARAM_TIMEOUT, textBoxTimeout.Text);
            }

            Config.AddConfigureCommand(command);
            panelSelectEvaluator.Visible     = false;
            panelSelectStopCondition.Visible = true;
        }
        private void buttonGoToParameters_Click(object sender, EventArgs e)
        {
            (String algorithm, _) = listBoxAlgorithm.SelectedItem as Tuple <String, String>;
            SetParametersCommand command = new SetParametersCommand(Config);

            command.SetParameter(OptimizationConfiguration.PARAM_ALGORITHM, algorithm);
            Config.AddConfigureCommand(command);
            panelSelectAlgorithm.Visible = false;
            if (algorithm.Equals(OptimizationConfiguration.ALGORITHM_LSHADE))
            {
                panelLSHADE.Visible = true;
            }
            else if (algorithm.Equals(OptimizationConfiguration.ALGORITHM_LSHADEWGD))
            {
                panelLSHADEWGD.Visible = true;
            }
        }
        private void buttonStartLSHADE_Click(object sender, EventArgs e)
        {
            // if no errors
            if (String.IsNullOrEmpty(errorProviderMaxEvaluations.GetError(textBoxMaxEvaluations)) &&
                String.IsNullOrEmpty(errorProviderPopInit.GetError(textBoxPopInit)) &&
                String.IsNullOrEmpty(errorProviderArcInit.GetError(textBoxArcInit)) &&
                String.IsNullOrEmpty(errorProviderHistorySize.GetError(textBoxHistorySize)) &&
                String.IsNullOrEmpty(errorProviderP.GetError(textBoxP)))
            {
                SetParametersCommand command = new SetParametersCommand(Config);
                String maxEvalsStr           = textBoxMaxEvaluations.Text;
                String popInitStr            = textBoxPopInit.Text;
                String arcInitStr            = textBoxArcInit.Text;
                String histSizeStr           = textBoxHistorySize.Text;
                String pStr = textBoxP.Text;
                if (!String.IsNullOrEmpty(maxEvalsStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_NUM_OF_EVALS,
                                         maxEvalsStr);
                }
                if (!String.IsNullOrEmpty(popInitStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_POP_INIT,
                                         popInitStr);
                }
                if (!String.IsNullOrEmpty(arcInitStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_ARC_INIT,
                                         arcInitStr);
                }
                if (!String.IsNullOrEmpty(histSizeStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_HISTORY_SIZE,
                                         histSizeStr);
                }
                if (!String.IsNullOrEmpty(pStr))
                {
                    command.SetParameter(OptimizationConfiguration.PARAM_LSHADE_P, pStr);
                }

                Config.AddConfigureCommand(command);
                StartOptimization();
            }
        }