Exemplo n.º 1
0
        public void Run(ProgressBar progressBar)
        {
            for (int currentImprovisation = 0; currentImprovisation < NI; currentImprovisation++)
            {
                Harmony newHarmony = new Harmony();
                newHarmony.notes = new double[TotalNotes];
                for (int currentNote = 0; currentNote < TotalNotes; currentNote++)
                {
                    float randomFloat = Randomizer.getRandomFloat(0.0f, 1.0f);
                    if (randomFloat <= HMCR)
                    {
                        int randomHarmony = Convert.ToInt32(Randomizer.getRandomDouble(0, HMSize - 1));
                        newHarmony.notes[currentNote] = Memory[randomHarmony].notes[currentNote];
                        adjustPitch(newHarmony);
                    }
                    else
                    {
                        newHarmony.notes[currentNote] = Randomizer.getRandomDouble(MinimumValues[currentNote], MaximumValues[currentNote]);
                    }
                }
                updateMemory(newHarmony, currentImprovisation);
                //if (currentImprovisation == 249)
                //{
                //    countDuplicates();
                //}
                base.bestHarmoniesAesthetics[currentImprovisation]  = getHarmonyAesthetics(Memory[0]);
                base.newHarmoniesAesthetics[currentImprovisation]   = getHarmonyAesthetics(newHarmony);
                base.worstHarmoniesAesthetics[currentImprovisation] = getHarmonyAesthetics(Memory[HMSize - 1]);
                for (int i = 0; i < TotalNotes; i++)
                {
                    base.bestHarmoniesNotes[currentImprovisation, i] = Memory[0].notes.ElementAt(i);
                }
                if (ShowAll == true)
                {
                    base.writeResults(currentImprovisation);

                    //Console.WriteLine(Results);
                    //Console.WriteLine("Press any key to continue...");
                    //Console.ReadKey();
                }

                progressBar.Value = currentImprovisation;
                int    percent         = (int)(((double)(progressBar.Value - progressBar.Minimum) / (double)(progressBar.Maximum - progressBar.Minimum)) * 100);
                string progressMessage = "Please wait... Harmony Search in progress. " + percent.ToString() + "%" + " completed.";
                ControlStyle.SetProgressBarText(progressBar, progressMessage, ControlStyle.ProgressBarTextLocation.Centered, Color.Black, new Font("Arial", 16));
            }
        }
Exemplo n.º 2
0
        private void createNewTextbox(int totalNotes)
        {
            for (int i = totalNotesControls + 1; i <= totalNotes; i++)
            {
                TextBox minTextBox = new TextBox();
                minTextBox.Name = "x" + i + "MinTextBox";
                TextBox maxTextBox = new TextBox();
                maxTextBox.Name = "x" + i + "MaxTextBox";
                Label label = new Label();
                label.Name = "x" + i + "Label";

                ControlStyle.TextBoxStyle(minTextBox, i);
                ControlStyle.TextBoxStyle(maxTextBox, i);
                ControlStyle.ConfigurationLabelStyle(label, i);
                variablesTab.Controls.Add(minTextBox);
                variablesTab.Controls.Add(maxTextBox);
                variablesTab.Controls.Add(label);
            }
        }
Exemplo n.º 3
0
        private void plotChart()
        {
            BestHarmonyChart.Series.Clear();
            NewHarmonyChart.Series.Clear();
            WorstHarmonyChart.Series.Clear();
            //X1Chart.Series.Clear();
            //X2Chart.Series.Clear();

            if (classicHS != null)
            {
                if (classicHS.ShowAll == true)
                {
                    resultsRichTextBox.Text = classicHS.Results.ToString();
                }
                totalNotes = classicHS.TotalNotes;
                BestHarmonyChart.Series.Add("Aesthetics");
                BestHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                BestHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                NewHarmonyChart.Series.Add("Aesthetics");
                NewHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                NewHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                WorstHarmonyChart.Series.Add("Aesthetics");
                WorstHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                WorstHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                List <Chart> allDecisionVariables = new List <Chart>();
                for (int i = 1; i <= classicHS.TotalNotes; i++)
                {
                    Chart noteChart = new Chart();
                    ControlStyle.ChartStyle(noteChart, i);
                    allDecisionVariables.Add(noteChart);
                    Label noteLabel = new Label();
                    ControlStyle.GraphsLabelStyle(noteLabel, i);
                    notesTab.Controls.Add(noteLabel);
                }
                for (int j = 0; j < classicHS.NI; j++)
                {
                    BestHarmonyChart.Series[0].Points.AddXY(j, classicHS.bestHarmoniesAesthetics[j]);
                    NewHarmonyChart.Series[0].Points.AddXY(j, classicHS.newHarmoniesAesthetics[j]);
                    WorstHarmonyChart.Series[0].Points.AddXY(j, classicHS.worstHarmoniesAesthetics[j]);
                    for (int i = 1; i <= classicHS.TotalNotes; i++)
                    {
                        allDecisionVariables[i - 1].Series[0].Points.AddXY(j, classicHS.bestHarmoniesNotes[j, i - 1]);
                    }
                }
                for (int i = 0; i < classicHS.TotalNotes; i++)
                {
                    notesTab.Controls.Add(allDecisionVariables[i]);
                }
                Label aestheticsLabel = new Label();
                ControlStyle.LabelStyle(aestheticsLabel, classicHS.bestHarmoniesAesthetics[classicHS.NI - 1]);
                numericsTab.Controls.Add(aestheticsLabel);
                for (int k = 1; k <= classicHS.TotalNotes; k++)
                {
                    Label note = new Label();
                    ControlStyle.LabelStyle(note, k, classicHS.bestHarmoniesNotes[classicHS.NI - 1, k - 1]);
                    numericsTab.Controls.Add(note);
                }

                saveResults(classicHS.bestHarmoniesAesthetics[classicHS.NI - 1]);
                //if (ShowAll == true)
                //    System.Diagnostics.Process.Start("Results.txt");
            }
            if (improvedHS != null)
            {
                if (improvedHS.ShowAll == true)
                {
                    resultsRichTextBox.Text = improvedHS.Results.ToString();
                }
                totalNotes = improvedHS.TotalNotes;
                BestHarmonyChart.Series.Add("Aesthetics");
                BestHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                BestHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                NewHarmonyChart.Series.Add("Aesthetics");
                NewHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                NewHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                WorstHarmonyChart.Series.Add("Aesthetics");
                WorstHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                WorstHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                List <Chart> allDecisionVariables = new List <Chart>();
                for (int i = 1; i <= improvedHS.TotalNotes; i++)
                {
                    Chart noteChart = new Chart();
                    ControlStyle.ChartStyle(noteChart, i);
                    allDecisionVariables.Add(noteChart);
                    Label noteLabel = new Label();
                    ControlStyle.GraphsLabelStyle(noteLabel, i);
                    notesTab.Controls.Add(noteLabel);
                }
                for (int j = 0; j < improvedHS.NI; j++)
                {
                    BestHarmonyChart.Series[0].Points.AddXY(j, improvedHS.bestHarmoniesAesthetics[j]);
                    NewHarmonyChart.Series[0].Points.AddXY(j, improvedHS.newHarmoniesAesthetics[j]);
                    WorstHarmonyChart.Series[0].Points.AddXY(j, improvedHS.worstHarmoniesAesthetics[j]);
                    for (int i = 1; i <= improvedHS.TotalNotes; i++)
                    {
                        allDecisionVariables[i - 1].Series[0].Points.AddXY(j, improvedHS.bestHarmoniesNotes[j, i - 1]);
                    }
                }
                for (int i = 0; i < improvedHS.TotalNotes; i++)
                {
                    notesTab.Controls.Add(allDecisionVariables[i]);
                }
                Label aestheticsLabel = new Label();
                ControlStyle.LabelStyle(aestheticsLabel, improvedHS.bestHarmoniesAesthetics[improvedHS.NI - 1]);
                numericsTab.Controls.Add(aestheticsLabel);
                for (int k = 1; k <= improvedHS.TotalNotes; k++)
                {
                    Label note = new Label();
                    ControlStyle.LabelStyle(note, k, improvedHS.bestHarmoniesNotes[improvedHS.NI - 1, k - 1]);
                    numericsTab.Controls.Add(note);
                }
                saveResults(improvedHS.bestHarmoniesAesthetics[improvedHS.NI - 1]);
                //if (ShowAll == true)
                //    System.Diagnostics.Process.Start("Results.txt");
            }
            if (globalHS != null)
            {
                if (globalHS.ShowAll == true)
                {
                    resultsRichTextBox.Text = globalHS.Results.ToString();
                }
                totalNotes = globalHS.TotalNotes;
                BestHarmonyChart.Series.Add("Aesthetics");
                BestHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                BestHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                NewHarmonyChart.Series.Add("Aesthetics");
                NewHarmonyChart.Series[0].ChartType = SeriesChartType.Pie;
                NewHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                WorstHarmonyChart.Series.Add("Aesthetics");
                WorstHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                WorstHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                List <Chart> allDecisionVariables = new List <Chart>();
                for (int i = 1; i <= globalHS.TotalNotes; i++)
                {
                    Chart noteChart = new Chart();
                    ControlStyle.ChartStyle(noteChart, i);
                    allDecisionVariables.Add(noteChart);
                    Label noteLabel = new Label();
                    ControlStyle.GraphsLabelStyle(noteLabel, i);
                    notesTab.Controls.Add(noteLabel);
                }
                for (int j = 0; j < globalHS.NI; j++)
                {
                    BestHarmonyChart.Series[0].Points.AddXY(j, globalHS.bestHarmoniesAesthetics[j]);
                    NewHarmonyChart.Series[0].Points.AddXY(j, globalHS.newHarmoniesAesthetics[j]);
                    WorstHarmonyChart.Series[0].Points.AddXY(j, globalHS.worstHarmoniesAesthetics[j]);
                    for (int i = 1; i <= globalHS.TotalNotes; i++)
                    {
                        allDecisionVariables[i - 1].Series[0].Points.AddXY(j, globalHS.bestHarmoniesNotes[j, i - 1]);
                    }
                }
                for (int i = 0; i < globalHS.TotalNotes; i++)
                {
                    notesTab.Controls.Add(allDecisionVariables[i]);
                }
                Label aestheticsLabel = new Label();
                ControlStyle.LabelStyle(aestheticsLabel, globalHS.bestHarmoniesAesthetics[globalHS.NI - 1]);
                numericsTab.Controls.Add(aestheticsLabel);
                for (int k = 1; k <= globalHS.TotalNotes; k++)
                {
                    Label note = new Label();
                    ControlStyle.LabelStyle(note, k, globalHS.bestHarmoniesNotes[globalHS.NI - 1, k - 1]);
                    numericsTab.Controls.Add(note);
                }
                saveResults(globalHS.bestHarmoniesAesthetics[globalHS.NI - 1]);
                //if (ShowAll == true)
                //    System.Diagnostics.Process.Start("Results.txt");
            }
            if (adaptiveHS != null)
            {
                if (adaptiveHS.ShowAll == true)
                {
                    resultsRichTextBox.Text = adaptiveHS.Results.ToString();
                }
                totalNotes = adaptiveHS.TotalNotes;
                BestHarmonyChart.Series.Add("Aesthetics");
                BestHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                BestHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                NewHarmonyChart.Series.Add("Aesthetics");
                NewHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                NewHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                WorstHarmonyChart.Series.Add("Aesthetics");
                WorstHarmonyChart.Series[0].ChartType = SeriesChartType.Line;
                WorstHarmonyChart.Series[0].Color     = System.Drawing.Color.Blue;
                List <Chart> allDecisionVariables = new List <Chart>();
                for (int i = 1; i <= adaptiveHS.TotalNotes; i++)
                {
                    Chart noteChart = new Chart();
                    ControlStyle.ChartStyle(noteChart, i);
                    allDecisionVariables.Add(noteChart);
                    Label noteLabel = new Label();
                    ControlStyle.GraphsLabelStyle(noteLabel, i);
                    notesTab.Controls.Add(noteLabel);
                }
                for (int j = 0; j < adaptiveHS.NI; j++)
                {
                    BestHarmonyChart.Series[0].Points.AddXY(j, adaptiveHS.bestHarmoniesAesthetics[j]);
                    NewHarmonyChart.Series[0].Points.AddXY(j, adaptiveHS.newHarmoniesAesthetics[j]);
                    WorstHarmonyChart.Series[0].Points.AddXY(j, adaptiveHS.worstHarmoniesAesthetics[j]);
                    for (int i = 1; i <= adaptiveHS.TotalNotes; i++)
                    {
                        allDecisionVariables[i - 1].Series[0].Points.AddXY(j, adaptiveHS.bestHarmoniesNotes[j, i - 1]);
                    }
                }
                for (int i = 0; i < adaptiveHS.TotalNotes; i++)
                {
                    notesTab.Controls.Add(allDecisionVariables[i]);
                }
                Label aestheticsLabel = new Label();
                ControlStyle.LabelStyle(aestheticsLabel, adaptiveHS.bestHarmoniesAesthetics[adaptiveHS.NI - 1]);
                numericsTab.Controls.Add(aestheticsLabel);
                for (int k = 1; k <= adaptiveHS.TotalNotes; k++)
                {
                    Label note = new Label();
                    ControlStyle.LabelStyle(note, k, adaptiveHS.bestHarmoniesNotes[adaptiveHS.NI - 1, k - 1]);
                    numericsTab.Controls.Add(note);
                }
                saveResults(adaptiveHS.bestHarmoniesAesthetics[adaptiveHS.NI - 1]);
                //if (ShowAll == true)
                //    System.Diagnostics.Process.Start("Results.txt");
            }
            BestHarmonyChart.ChartAreas[0].AxisX.MajorGrid.LineColor     = System.Drawing.Color.LightGray;
            BestHarmonyChart.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot;
            BestHarmonyChart.ChartAreas[0].AxisY.MajorGrid.LineColor     = System.Drawing.Color.LightGray;
            BestHarmonyChart.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dot;
        }
Exemplo n.º 4
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (!isInputOk())
            {
                //ControlStyle.MessageBoxStyle("Parameters are not valid.");
                ControlStyle.MessageBoxStyle("Οι παράμετροι δεν είναι σωστοί.");
                return;
            }

            string path = pathTextBox.Text;

            if (String.IsNullOrEmpty(path) || String.IsNullOrWhiteSpace(path) || !path.EndsWith(".txt") || !path.Contains("\\"))
            {
                ControlStyle.MessageBoxStyle("Η τοποθεσία(URI) του αρχείου δεν είναι έγκυρη");
                return;
            }

            Parameters parameters = new Parameters();

            parameters.Objective = ObjectiveRichTextBox.Text;
            parameters.ShowAll   = showAllCheckBox.Checked;
            if (MaxRadioBtn.Checked == true)
            {
                parameters.Optimum = OptimizationGoal.Max;
            }
            if (MinRadioBtn.Checked == true)
            {
                parameters.Optimum = OptimizationGoal.Min;
            }
            if (MinAbsRadioBtn.Checked == true)
            {
                parameters.Optimum = OptimizationGoal.MinAbs;
            }
            parameters.MaxValues = new double[totalNotesControls];
            parameters.MinValues = new double[totalNotesControls];
            for (int i = 0; i < totalNotesControls; i++)
            {
                TextBox maxTextbox = (TextBox)this.Controls.Find("x" + (i + 1) + "MaxTextBox", true)[0];
                parameters.MaxValues[i] = double.Parse(maxTextbox.Text, CultureInfo.InvariantCulture);
                TextBox minTextbox = (TextBox)this.Controls.Find("x" + (i + 1) + "MinTextBox", true)[0];
                parameters.MinValues[i] = double.Parse(minTextbox.Text, CultureInfo.InvariantCulture);
            }
            parameters.NI     = Int32.Parse(NITextBox.Text);
            parameters.HMS    = Int32.Parse(HMSTextBox.Text);
            parameters.HMCR   = Convert.ToDouble(HMCRTextBox.Text);
            parameters.PAR    = Convert.ToDouble(PARTextBox.Text);
            parameters.BW     = Convert.ToDouble(BWTextBox.Text);
            parameters.PARmin = Convert.ToDouble(PARMinTextBox.Text);
            parameters.PARmax = Convert.ToDouble(PARMaxTextBox.Text);
            parameters.BWmin  = Convert.ToDouble(BWMinTextBox.Text);
            parameters.BWmax  = Convert.ToDouble(BWMaxTextBox.Text);
            if (ClassicRadioButton.Checked == true)
            {
                parameters.Variant = HarmonySearchVariant.Classic;
            }
            if (ImprovedRadioButton.Checked == true)
            {
                parameters.Variant = HarmonySearchVariant.Improved;
            }
            if (GlobalRadioButton.Checked == true)
            {
                parameters.Variant = HarmonySearchVariant.GlobalBest;
            }
            if (AdaptiveRadioButton.Checked == true)
            {
                parameters.Variant = HarmonySearchVariant.SelfAdaptive;
            }

            string json = JsonConvert.SerializeObject(parameters);

            File.WriteAllText(@path, json);

            ControlStyle.MessageBoxSuccessStyle("Οι παράμετροι του αλγορίθμου αποθηκεύτηκαν επιτυχώς σε αρχείο.");
        }
Exemplo n.º 5
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            Parameters parameters = new Parameters();
            string     path       = pathTextBox.Text;

            if (String.IsNullOrEmpty(path) || String.IsNullOrWhiteSpace(path) || !path.EndsWith(".txt") || !path.Contains("\\"))
            {
                ControlStyle.MessageBoxStyle("Η τοποθεσία(URI) του αρχείου δεν είναι έγκυρη");
                return;
            }
            using (StreamReader r = new StreamReader(path))
            {
                string json = r.ReadToEnd();
                parameters = JsonConvert.DeserializeObject <Parameters>(json);
            }
            ObjectiveRichTextBox.Text = parameters.Objective;
            if (parameters.Optimum == OptimizationGoal.Max)
            {
                MaxRadioBtn.Checked = true;
            }
            if (parameters.Optimum == OptimizationGoal.Min)
            {
                MinRadioBtn.Checked = true;
            }
            if (parameters.Optimum == OptimizationGoal.MinAbs)
            {
                MinAbsRadioBtn.Checked = true;
            }
            showAllCheckBox.Checked = parameters.ShowAll;
            checkDecisionVariables();
            for (int j = 0; j < totalNotesControls; j++)
            {
                Controls.Find("x" + (j + 1) + "MinTextBox", true)[0].Text = parameters.MinValues[j].ToString();
                Controls.Find("x" + (j + 1) + "MaxTextBox", true)[0].Text = parameters.MaxValues[j].ToString();
            }
            NITextBox.Text     = parameters.NI.ToString();
            HMSTextBox.Text    = parameters.HMS.ToString();
            HMCRLabel.Text     = parameters.HMCR.ToString();
            PARTextBox.Text    = parameters.PAR.ToString();
            BWTextBox.Text     = parameters.BW.ToString();
            PARMinTextBox.Text = parameters.PARmin.ToString();
            PARMaxTextBox.Text = parameters.PARmax.ToString();
            BWMinTextBox.Text  = parameters.PARmin.ToString();
            BWMaxTextBox.Text  = parameters.PARmax.ToString();
            if (parameters.Variant == HarmonySearchVariant.Classic)
            {
                ClassicRadioButton.Checked = true;
            }
            if (parameters.Variant == HarmonySearchVariant.Improved)
            {
                ImprovedRadioButton.Checked = true;
            }
            if (parameters.Variant == HarmonySearchVariant.GlobalBest)
            {
                GlobalRadioButton.Checked = true;
            }
            if (parameters.Variant == HarmonySearchVariant.SelfAdaptive)
            {
                AdaptiveRadioButton.Checked = true;
            }

            ControlStyle.MessageBoxSuccessStyle("Οι παράμετροι του αλγορίθμου φορτώθηκαν επιτυχώς από το αρχείο.");
        }
Exemplo n.º 6
0
        private Boolean isInputOk()
        {
            //if(ObjectiveRichTextBox.Text.Equals("") || ObjectiveRichTextBox.Text == null)
            //{
            //    ControlStyle.MessageBoxStyle("The objective function is null or empty.");
            //    return false;
            //}
            objective = new Expression(ObjectiveRichTextBox.Text);
            //if (objective.HasErrors())
            //{
            //    ControlStyle.MessageBoxStyle("The objective function is not valid. \n\n" + objective.Error);
            //    return false;
            //}
            //if (objective == null)
            //{
            //    ControlStyle.MessageBoxStyle("The objective function is not valid. Please try again.");
            //    return false;
            //}
            if (totalNotesControls < 2)
            {
                //ControlStyle.MessageBoxStyle("The algorithm requires at least 2 decision variables.");
                ControlStyle.MessageBoxStyle("Ο αλγόριθμος απαιτεί τουλάχιστον 2 μεταβλητές απόφασης.");
                return(false);
            }
            try
            {
                for (int k = 1; k <= totalNotesControls; k++)
                {
                    objective.Parameters["x" + k] = 5;
                }
                object res = objective.Evaluate();
            }
            catch (Exception e)
            {
                //ControlStyle.MessageBoxStyle("The objective function is not valid. Please try again.");
                ControlStyle.MessageBoxStyle("Η αντικειμενική συνάρτηση δεν συντάχθηκε σωστά.");
                return(false);
            }

            for (int i = 0; i < totalNotesControls; i++)
            {
                TextBox minTextBox = (TextBox)this.Controls.Find("x" + (i + 1) + "MinTextBox", true)[0];
                TextBox maxTextBox = (TextBox)this.Controls.Find("x" + (i + 1) + "MaxTextBox", true)[0];
                if (!ConfigurationRules.areExtremeValuesValid(minTextBox.Text, maxTextBox.Text))
                {
                    //ControlStyle.MessageBoxStyle("Decision variable " + "X" + (i + 1) + " bounds are not valid.");
                    ControlStyle.MessageBoxStyle("Τα όρια της μεταβλητής απόφασης " + "X" + (i + 1) + " δεν είναι σωστά.");
                    return(false);
                }
            }
            if (!ConfigurationRules.isNIValid(NITextBox.Text))
            {
                //ControlStyle.MessageBoxStyle("NI(Number of Improvisations) field is not valid. Please try again.");
                ControlStyle.MessageBoxStyle("Το πεδίο NI(Number of Improvisations) δεν είναι σωστό.");
                return(false);
            }
            if (!ConfigurationRules.isHMSValid(HMSTextBox.Text))
            {
                //ControlStyle.MessageBoxStyle("HMS(Harmony Memory Size) field is not valid. Please try again.");
                ControlStyle.MessageBoxStyle("Το πεδίο HMS(Harmony Memory Size) δεν είναι σωστό.");
                return(false);
            }
            if (!ConfigurationRules.isHMCRValid(HMCRTextBox.Text))
            {
                //ControlStyle.MessageBoxStyle("HMCR(Harmony Memory Consideration Rate) field is not valid. Please try again.");
                ControlStyle.MessageBoxStyle("Το πεδίο HMCR(Harmony Memory Consideration Rate) δεν είναι σωστό.");
                return(false);
            }
            if (!currentVariant.Equals(HarmonySearchVariant.Improved))
            {
                if (!ConfigurationRules.isPARValid(PARTextBox.Text))
                {
                    //ControlStyle.MessageBoxStyle("PAR(Pitch Adjustment Rate) field is not valid.");
                    ControlStyle.MessageBoxStyle("Το πεδίο PAR(Pitch Adjustment Rate) δεν είναι σωστό.");
                    return(false);
                }
                if (currentVariant.Equals(HarmonySearchVariant.Classic))
                {
                    if (!ConfigurationRules.isBWValid(BWTextBox.Text))
                    {
                        //ControlStyle.MessageBoxStyle("BW(Bandwidth) field is not valid.");
                        ControlStyle.MessageBoxStyle("Το πεδίο BW(Bandwidth) δεν είναι σωστό.");
                        return(false);
                    }
                }
            }
            else
            {
                if (!ConfigurationRules.arePARExtremesValid(PARMinTextBox.Text, PARMaxTextBox.Text))
                {
                    //ControlStyle.MessageBoxStyle("PAR(Pitch Adjustment Rate) bounds are not valid.");
                    ControlStyle.MessageBoxStyle("Τα όρια του πεδίου PAR(Pitch Adjustment Rate) δεν είναι σωστά.");
                    return(false);
                }
                if (!ConfigurationRules.areΒWExtremesValid(BWMinTextBox.Text, BWMaxTextBox.Text))
                {
                    //ControlStyle.MessageBoxStyle("BW(Bandwidth) bounds are not not valid.");
                    ControlStyle.MessageBoxStyle("Τα όρια του πεδίου BW(Bandwidth) δεν είναι σωστά.");
                    return(false);
                }
            }

            return(true);
        }