private void PSO_OnIteration(object sender, IterationInfo e)
 {
     if (e.Iteration == 0 || e.Iteration == pso.Iterations - 1 || (e.Iteration + 1) % 10 == 0)
     {
         TbxOutput.AppendText(string.Format("Iteration {0:D4} | Best Objective = {1}", e.Iteration + 1, e.BestObjectiveValue) + Environment.NewLine);
     }
 }
        private void PSO_OnEnd(object sender)
        {
            TbxOutput.AppendText("PSO alghorithm finished." + Environment.NewLine);
            TbxOutput.AppendText(string.Format("{0}Final solution:{0}", Environment.NewLine));

            double[] temp = pso.BestSolution.ActualPosition;

            for (int i = 0; i < temp.Length; i++)
            {
                TbxOutput.AppendText(string.Format("\t{0}.    {1}", i + 1, temp[i]) + Environment.NewLine);
            }

            BtnRun.Enabled           = true;
            SettingsGroupBox.Enabled = true;
            BtnRun.BackColor         = Color.Silver;
            BtnRun.Text = "Start";
        }
        /// <summary>
        /// Does the job
        /// </summary>
        private void ExecuteCommand(string input)
        {
            if (input.StartsWith("help") || input.StartsWith("?"))
            {
                ShowHelp();
            }
            else if (input.StartsWith("clr"))
            {
                TbxOutput.Text = "";
            }
            else if (input.StartsWith("debug"))
            {
                TbxOutput.Text += "Debug mode - on" + Environment.NewLine;
                Data.Debug      = true;
            }
            else if (input.StartsWith("nodebug"))
            {
                TbxOutput.Text += "Debug mode - off" + Environment.NewLine;
                Data.Debug      = false;
            }
            else if (input.StartsWith("loadlang"))
            {
                Language.InitLanguages();
                TbxOutput.Text += "Language file loaded." + Environment.NewLine;
            }
            else if (input.StartsWith("importlang"))
            {
                Language.ImportLanguageFile(TbxOutput.Text);
            }
            else if (input.StartsWith("langtowiki"))
            {
                Language.ShowPhrases(4);
            }
            else if (input.StartsWith("genlangfiles"))
            {
                Language.GenerateLangFiles();
                TbxOutput.Text += "Language files generated." + Environment.NewLine;
            }
            else if (input.StartsWith("repairlang"))
            {
                TbxOutput.Text += "Language files repair" + Environment.NewLine +
                                  "---------------------" + Environment.NewLine + "";
                TbxOutput.Text += Language.RapairAllLangFiles();
            }
            else if (input.StartsWith("missingphrases"))
            {
                ShowMissingPhrases();
            }
            else if (input.StartsWith("speedtest"))
            {
                SpeedTest();
            }
            else if (input.StartsWith("str"))
            {
                ShowStrategy();
            }
            else if (input.StartsWith("bar"))
            {
                ShowBar(input);
            }
            else if (input.StartsWith("ind"))
            {
                ShowIndicators(input);
            }
            else if (input.StartsWith("reloadtips"))
            {
                var startingTips = new StartingTips();
                startingTips.Show();
            }
            else if (input.StartsWith("showalltips"))
            {
                var startingTips = new StartingTips {
                    ShowAllTips = true
                };
                startingTips.Show();
            }

            TbxOutput.Focus();
            TbxOutput.ScrollToCaret();

            TbxInput.Focus();
            TbxInput.Text = "";
        }
예제 #4
0
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     TbxOutput.Clear();
 }
예제 #5
0
 public void Clear()
 {
     TbxOutput.Clear();
 }