Rev | Line | |
---|
[15292] | 1 | using System.Linq;
|
---|
[11514] | 2 | using System.Windows.Forms;
|
---|
| 3 |
|
---|
| 4 | using HeuristicLab.Algorithms.GeneticAlgorithm;
|
---|
| 5 | using HeuristicLab.MainForm;
|
---|
| 6 | using HeuristicLab.MainForm.WindowsForms;
|
---|
| 7 | using HeuristicLab.Optimization;
|
---|
| 8 | using HeuristicLab.Optimization.Views;
|
---|
| 9 | using HeuristicLab.Problems.TravelingSalesman;
|
---|
| 10 |
|
---|
| 11 | public class GUIAutomationScript : HeuristicLab.Scripting.CSharpScriptBase {
|
---|
| 12 | public override void Main() {
|
---|
| 13 | var ga = new GeneticAlgorithm {
|
---|
| 14 | MaximumGenerations = { Value = 50 },
|
---|
| 15 | PopulationSize = { Value = 10 },
|
---|
| 16 | Problem = new TravelingSalesmanProblem()
|
---|
| 17 | };
|
---|
| 18 |
|
---|
| 19 | var experiment = new Experiment();
|
---|
| 20 | for (int i = 0; i < 5; i++) {
|
---|
| 21 | experiment.Optimizers.Add(new BatchRun() { Optimizer = (IOptimizer)ga.Clone(), Repetitions = 10 });
|
---|
| 22 | ga.PopulationSize.Value *= 2;
|
---|
| 23 | }
|
---|
| 24 | experiment.Start();
|
---|
| 25 |
|
---|
| 26 | vars.experiment = experiment;
|
---|
| 27 | MainFormManager.MainForm.ShowContent(experiment);
|
---|
| 28 | var viewHost = (ViewHost)MainFormManager.MainForm.ShowContent(experiment.Runs, typeof(RunCollectionBubbleChartView));
|
---|
| 29 | var bubbleChart = (UserControl)(viewHost.ActiveView);
|
---|
| 30 | bubbleChart.Controls.OfType<ComboBox>().Single(x => x.Name == "yAxisComboBox").SelectedItem = "BestQuality";
|
---|
| 31 | bubbleChart.Controls.OfType<ComboBox>().Single(x => x.Name == "xAxisComboBox").SelectedItem = "PopulationSize";
|
---|
| 32 | }
|
---|
| 33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.