private StackPanel InitGeneticSettings()
        {
            // Population
            var populationValidity  = StringExtensions.IsInt().And(StringExtensions.InRange(2, 10000));
            var updatePopulation    = new Action <string>(str => GeneticSettings = GeneticSettings.WithPopulation(int.Parse(str)));
            var populationContainer = HorizontalContainerStrecherd.Create()
                                      .AddLeft(TextBlockCreator.RegularTextBlock("Population").WithBullet())
                                      .AsDock(InteractiveTextBox.Create(GeneticSettings.Population.ToString(), populationValidity, updatePopulation, Dispatcher));

            // Mutation Rate
            var mutationRateValidity  = StringExtensions.IsDouble().And(StringExtensions.InRange(0, 1));
            var updateMutationRate    = new Action <string>(str => GeneticSettings = GeneticSettings.WithMutationRate(double.Parse(str)));
            var mutationRateContainer = HorizontalContainerStrecherd.Create()
                                        .AddLeft(TextBlockCreator.RegularTextBlock("Mutation Rate").WithBullet())
                                        .AsDock(InteractiveTextBox.Create(this.GeneticSettings.MutationRate.ToString(), mutationRateValidity, updateMutationRate, Dispatcher));

            // Elitism Rate
            var elitismRateValidity  = StringExtensions.IsDouble().And(StringExtensions.InRange(0, 1));
            var updateElitismRate    = new Action <string>(str => GeneticSettings = GeneticSettings.WithMutationRate(double.Parse(str)));
            var elitismRateContainer = HorizontalContainerStrecherd.Create()
                                       .AddLeft(TextBlockCreator.RegularTextBlock("Elitism Rate").WithBullet())
                                       .AsDock(InteractiveTextBox.Create(this.GeneticSettings.ElitismRate.ToString(), elitismRateValidity, updateElitismRate, Dispatcher));


            // New Genes Rate
            var newGenesRateValidity  = StringExtensions.IsDouble().And(StringExtensions.InRange(0, 1));
            var updateNewGenesRate    = new Action <string>(str => GeneticSettings = GeneticSettings.WithMutationRate(double.Parse(str)));
            var newGenesRateContainer = HorizontalContainerStrecherd.Create()
                                        .AddLeft(TextBlockCreator.RegularTextBlock("New Genes Rate").WithBullet())
                                        .AsDock(InteractiveTextBox.Create(this.GeneticSettings.NewGenesRate.ToString(), newGenesRateValidity, updateNewGenesRate, Dispatcher));

            var title = TextBlockCreator.TitleTextBlock("Genetic Settings");

            return(GuiExtensions.CreateStackPanel(title, populationContainer, mutationRateContainer, elitismRateContainer, newGenesRateContainer));
        }
コード例 #2
0
        private void PrepareResultWindow()
        {
            var title             = TextBlockCreator.TitleTextBlock("Result Status");
            var statusDescreption = TextBlockCreator.RegularTextBlock("Summation of edges:");

            ResultTextBlock           = TextBlockCreator.RegularTextBlock("").WithHorizonalAlignment(HorizontalAlignment.Center).PlusFontSize(10);
            this.StatusViewer.Content = GuiExtensions.CreateStackPanel(title, statusDescreption, ResultTextBlock);
        }
コード例 #3
0
        public static StackPanel Create(Dispatcher d, Action <OptimizationType> onOptimizationChosen)
        {
            var title = TextBlockCreator.TitleTextBlock("Method");
            var chooseOptimizationRadioButtonChooser = RadioButtonChooser.Create(d, OptimizationTypeUtils.All,
                                                                                 OptimizationTypeUtils.AsString, onOptimizationChosen);

            return(GuiExtensions.CreateStackPanel(title, chooseOptimizationRadioButtonChooser));
        }
        private UIElement ShowVisual()
        {
            var chooser = RadioButtonChooser.Create(Dispatcher, new[] { true, false }, b => b.ToString(), OnVisualChanged);

            chooser.Orientation = Orientation.Horizontal;
            var text       = TextBlockCreator.RegularTextBlock("Show Visual:").WithBullet();
            var stackPanel = GuiExtensions.CreateStackPanel(text, chooser);

            stackPanel.Orientation = Orientation.Horizontal;
            (chooser.Children[0] as RadioButton).IsChecked = true;
            return(stackPanel);
        }
コード例 #5
0
        private StackPanel InitBranchAndBoundSettings()
        {
            var title = TextBlockCreator.TitleTextBlock("Branch & Bound Settings");

            return(GuiExtensions.CreateStackPanel(title));
        }
コード例 #6
0
        private StackPanel InitLocalSearchSettings()
        {
            var title = TextBlockCreator.TitleTextBlock("Local Search Settings");

            return(GuiExtensions.CreateStackPanel(title));
        }