Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3609


Ignore:
Timestamp:
05/04/10 16:42:03 (15 years ago)
Author:
abeham
Message:

Changed Island GA in that it does not use the GAMainLoop anymore #971

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r3601 r3609  
    8282      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
    8383    }
    84     private ValueParameter<IntValue> MaximumMigrationsParameter {
    85       get { return (ValueParameter<IntValue>)Parameters["MaximumMigrations"]; }
     84    private ValueParameter<IntValue> MaximumGenerationsParameter {
     85      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
    8686    }
    8787    private ConstrainedValueParameter<ISelector> SelectorParameter {
     
    142142      set { PopulationSizeParameter.Value = value; }
    143143    }
    144     public IntValue MaximumMigrations {
    145       get { return MaximumMigrationsParameter.Value; }
    146       set { MaximumMigrationsParameter.Value = value; }
     144    public IntValue MaximumGenerations {
     145      get { return MaximumGenerationsParameter.Value; }
     146      set { MaximumGenerationsParameter.Value = value; }
    147147    }
    148148    public ISelector Selector {
     
    204204      Parameters.Add(new ConstrainedValueParameter<IReplacer>("ImmigrationReplacer", "Selects the population from the unification of the original population and the immigrants."));
    205205      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
    206       Parameters.Add(new ValueParameter<IntValue>("MaximumMigrations", "The maximum number of migrations that should occur.", new IntValue(100)));
     206      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.", new IntValue(1000)));
    207207      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
    208208      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
     
    239239      mainLoop.EmigrantsSelectorParameter.ActualName = EmigrantsSelectorParameter.Name;
    240240      mainLoop.ImmigrationReplacerParameter.ActualName = ImmigrationReplacerParameter.Name;
    241       mainLoop.MaximumMigrationsParameter.ActualName = MaximumMigrationsParameter.Name;
     241      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
    242242      mainLoop.MigrationIntervalParameter.ActualName = MigrationIntervalParameter.Name;
    243243      mainLoop.MigrationRateParameter.ActualName = MigrationRateParameter.Name;
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r3601 r3609  
    7676      get { return (ValueLookupParameter<IntValue>)Parameters["PopulationSize"]; }
    7777    }
    78     public ValueLookupParameter<IntValue> MaximumMigrationsParameter {
    79       get { return (ValueLookupParameter<IntValue>)Parameters["MaximumMigrations"]; }
     78    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
     79      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
    8080    }
    8181    public ValueLookupParameter<IOperator> SelectorParameter {
     
    124124      Parameters.Add(new ValueLookupParameter<IOperator>("ImmigrationReplacer", "Replaces some of the original population with the immigrants."));
    125125      Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions."));
    126       Parameters.Add(new ValueLookupParameter<IntValue>("MaximumMigrations", "The maximum number of migrations after which the operator should terminate."));
     126      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations that the algorithm should process."));
    127127      Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction."));
    128128      Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions."));
     
    138138      #region Create operators
    139139      VariableCreator variableCreator = new VariableCreator();
    140       UniformSubScopesProcessor ussp0 = new UniformSubScopesProcessor();
    141       VariableCreator resultCollectionCreator = new VariableCreator();
     140      UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
     141      VariableCreator islandVariableCreator = new VariableCreator();
     142      BestQualityMemorizer islandBestQualityMemorizer1 = new BestQualityMemorizer();
     143      BestAverageWorstQualityCalculator islandBestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator();
     144      DataTableValuesCollector islandDataTableValuesCollector1 = new DataTableValuesCollector();
     145      QualityDifferenceCalculator islandQualityDifferenceCalculator1 = new QualityDifferenceCalculator();
     146      Placeholder islandVisualizer1 = new Placeholder();
     147      ResultsCollector islandResultsCollector = new ResultsCollector();
    142148      BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer();
     149      BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();
    143150      BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator1 = new BestAverageWorstQualityCalculator();
    144       BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();
    145       BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator();
    146151      DataTableValuesCollector dataTableValuesCollector1 = new DataTableValuesCollector();
    147152      QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator();
    148153      ResultsCollector resultsCollector = new ResultsCollector();
    149       UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor();
    150       GeneticAlgorithmMainLoop geneticAlgorithmMainLoop = new GeneticAlgorithmMainLoop();
     154      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
     155      Placeholder selector = new Placeholder();
     156      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     157      ChildrenCreator childrenCreator = new ChildrenCreator();
     158      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
     159      Placeholder crossover = new Placeholder();
     160      StochasticBranch stochasticBranch = new StochasticBranch();
     161      Placeholder mutator = new Placeholder();
     162      Placeholder evaluator = new Placeholder();
     163      SubScopesRemover subScopesRemover = new SubScopesRemover();
     164      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
     165      BestSelector bestSelector = new BestSelector();
     166      RightReducer rightReducer = new RightReducer();
     167      MergingReducer mergingReducer = new MergingReducer();
     168      BestQualityMemorizer islandBestQualityMemorizer2 = new BestQualityMemorizer();
     169      BestAverageWorstQualityCalculator islandBestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator();
     170      DataTableValuesCollector islandDataTableValuesCollector2 = new DataTableValuesCollector();
     171      QualityDifferenceCalculator islandQualityDifferenceCalculator2 = new QualityDifferenceCalculator();
     172      Placeholder islandVisualizer2 = new Placeholder();
     173      // END GA mainloop
     174      IntCounter generationsSinceLastMigrationCounter = new IntCounter();
     175      Comparator migrationComparator = new Comparator();
     176      ConditionalBranch migrationBranch = new ConditionalBranch();
     177      Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();
     178      IntCounter migrationsCounter = new IntCounter();
     179      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
    151180      Placeholder emigrantsSelector = new Placeholder();
    152181      Placeholder migrator = new Placeholder();
    153       UniformSubScopesProcessor ussp2 = new UniformSubScopesProcessor();
     182      UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
    154183      Placeholder immigrationReplacer = new Placeholder();
    155       IntCounter migrationsCounter = new IntCounter();
    156       Comparator maxMigrationsComparator = new Comparator();
     184      IntCounter generationsCounter = new IntCounter();
     185      Comparator generationsComparator = new Comparator();
    157186      BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer();
    158       BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator3 = new BestAverageWorstQualityCalculator();
     187      BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer();
     188      BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator2 = new BestAverageWorstQualityCalculator();
    159189      DataTableValuesCollector dataTableValuesCollector2 = new DataTableValuesCollector();
    160190      QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
    161       ConditionalBranch migrationTerminationCondition = new ConditionalBranch();
     191      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
    162192
    163193      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
    164 
    165       resultCollectionCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults", new ResultCollection()));
     194      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("GenerationsSinceLastMigration", new IntValue(0)));
     195      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
     196
     197      islandVariableCreator.CollectedValues.Add(new ValueParameter<ResultCollection>("IslandResults", new ResultCollection()));
     198
     199      islandBestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
     200      islandBestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name;
     201      islandBestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name;
     202
     203      islandBestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality";
     204      islandBestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality";
     205      islandBestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name;
     206      islandBestAverageWorstQualityCalculator1.QualityParameter.ActualName = QualityParameter.Name;
     207      islandBestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality";
     208
     209      islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));
     210      islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));
     211      islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));
     212      islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     213      islandDataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality"));
     214      islandDataTableValuesCollector1.DataTableParameter.ActualName = "Qualities";
     215
     216      islandQualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
     217      islandQualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
     218      islandQualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
     219      islandQualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality";
     220
     221      islandVisualizer1.Name = "Visualizer";
     222      islandVisualizer1.OperatorParameter.ActualName = "Visualizer";
     223
     224      islandResultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     225      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));
     226      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));
     227      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));
     228      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     229      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality"));
     230      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));
     231      islandResultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));
     232      islandResultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, "Visualization"));
     233      islandResultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Qualities"));
     234      islandResultsCollector.ResultsParameter.ActualName = "IslandResults";
    166235
    167236      bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
    168237      bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name;
    169       bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name;
    170 
    171       bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageQuality";
    172       bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestQuality";
    173       bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name;
    174       bestAverageWorstQualityCalculator1.QualityParameter.ActualName = QualityParameter.Name;
    175       bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstQuality";
    176 
    177       bestQualityMemorizer2.BestQualityParameter.ActualName = "BestQuality";
     238      bestQualityMemorizer1.QualityParameter.ActualName = "BestQuality";
     239
     240      bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
    178241      bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name;
    179242      bestQualityMemorizer2.QualityParameter.ActualName = "BestQuality";
    180243
    181       bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
    182       bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestBestQuality";
    183       bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name;
    184       bestAverageWorstQualityCalculator2.QualityParameter.ActualName = "CurrentBestQuality";
    185       bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
     244      bestAverageWorstQualityCalculator1.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
     245      bestAverageWorstQualityCalculator1.BestQualityParameter.ActualName = "CurrentBestBestQuality";
     246      bestAverageWorstQualityCalculator1.MaximizationParameter.ActualName = MaximizationParameter.Name;
     247      bestAverageWorstQualityCalculator1.QualityParameter.ActualName = "CurrentBestQuality";
     248      bestAverageWorstQualityCalculator1.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
    186249
    187250      dataTableValuesCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality"));
     
    209272      resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name;
    210273
    211       geneticAlgorithmMainLoop.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
    212       geneticAlgorithmMainLoop.MaximizationParameter.ActualName = MaximizationParameter.Name;
    213       geneticAlgorithmMainLoop.QualityParameter.ActualName = QualityParameter.Name;
    214       geneticAlgorithmMainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
    215       geneticAlgorithmMainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    216       geneticAlgorithmMainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
    217       geneticAlgorithmMainLoop.MaximumGenerationsParameter.ActualName = MigrationIntervalParameter.Name;
    218       geneticAlgorithmMainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    219       geneticAlgorithmMainLoop.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
    220       geneticAlgorithmMainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
    221       geneticAlgorithmMainLoop.RandomParameter.ActualName = RandomParameter.Name;
    222       geneticAlgorithmMainLoop.ResultsParameter.ActualName = "IslandResults";
    223       geneticAlgorithmMainLoop.VisualizerParameter.ActualName = VisualizerParameter.Name;
    224       geneticAlgorithmMainLoop.VisualizationParameter.ActualName = VisualizationParameter.Name;
    225 
    226       emigrantsSelector.Name = "Emigrants Selector (placeholder)";
    227       emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
    228 
    229       migrator.Name = "Migrator (placeholder)";
    230       migrator.OperatorParameter.ActualName = MigratorParameter.Name;
    231 
    232       immigrationReplacer.Name = "Immigration Replacer (placeholder)";
    233       immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;
     274      // START GA mainloop
     275      selector.Name = "Selector (placeholder)";
     276      selector.OperatorParameter.ActualName = SelectorParameter.Name;
     277
     278      childrenCreator.ParentsPerChild = new IntValue(2);
     279
     280      crossover.Name = "Crossover (placeholder)";
     281      crossover.OperatorParameter.ActualName = CrossoverParameter.Name;
     282
     283      stochasticBranch.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
     284      stochasticBranch.RandomParameter.ActualName = RandomParameter.Name;
     285
     286      mutator.Name = "Mutator (placeholder)";
     287      mutator.OperatorParameter.ActualName = MutatorParameter.Name;
     288
     289      evaluator.Name = "Evaluator (placeholder)";
     290      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
     291
     292      subScopesRemover.RemoveAllSubScopes = true;
     293
     294      bestSelector.CopySelected = new BoolValue(false);
     295      bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
     296      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name;
     297      bestSelector.QualityParameter.ActualName = QualityParameter.Name;
     298
     299      islandBestQualityMemorizer2.BestQualityParameter.ActualName = "BestQuality";
     300      islandBestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name;
     301      islandBestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name;
     302
     303      islandBestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageQuality";
     304      islandBestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestQuality";
     305      islandBestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name;
     306      islandBestAverageWorstQualityCalculator2.QualityParameter.ActualName = QualityParameter.Name;
     307      islandBestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstQuality";
     308
     309      islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));
     310      islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));
     311      islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));
     312      islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     313      islandDataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
     314      islandDataTableValuesCollector2.DataTableParameter.ActualName = "Qualities";
     315
     316      islandQualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
     317      islandQualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
     318      islandQualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
     319      islandQualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
     320
     321      islandVisualizer2.Name = "Visualizer";
     322      islandVisualizer2.OperatorParameter.ActualName = "Visualizer";
     323      // END GA mainloop
     324
     325      generationsSinceLastMigrationCounter.ValueParameter.ActualName = "GenerationsSinceLastMigration";
     326      generationsSinceLastMigrationCounter.Increment = new IntValue(1);
     327
     328      migrationComparator.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
     329      migrationComparator.Comparison = new Comparison(ComparisonType.Equal);
     330      migrationComparator.RightSideParameter.ActualName = MigrationIntervalParameter.Name;
     331      migrationComparator.ResultParameter.ActualName = "Migrate";
     332
     333      migrationBranch.ConditionParameter.ActualName = "Migrate";
     334
     335      resetGenerationsSinceLastMigrationAssigner.Name = "Reset Counter";
     336      resetGenerationsSinceLastMigrationAssigner.LeftSideParameter.ActualName = "GenerationsSinceLastMigration";
     337      resetGenerationsSinceLastMigrationAssigner.RightSideParameter.Value = new IntValue(0);
    234338
    235339      migrationsCounter.Name = "Migrations + 1";
     
    237341      migrationsCounter.ValueParameter.ActualName = "Migrations";
    238342
    239       maxMigrationsComparator.Name = "Migrations >= MaximumMigration ?";
    240       maxMigrationsComparator.LeftSideParameter.ActualName = "Migrations";
    241       maxMigrationsComparator.RightSideParameter.ActualName = MaximumMigrationsParameter.Name;
    242       maxMigrationsComparator.Comparison.Value = ComparisonType.GreaterOrEqual;
    243       maxMigrationsComparator.ResultParameter.ActualName = "MigrationTerminate";
     343      emigrantsSelector.Name = "Emigrants Selector (placeholder)";
     344      emigrantsSelector.OperatorParameter.ActualName = EmigrantsSelectorParameter.Name;
     345
     346      migrator.Name = "Migrator (placeholder)";
     347      migrator.OperatorParameter.ActualName = MigratorParameter.Name;
     348
     349      immigrationReplacer.Name = "Immigration Replacer (placeholder)";
     350      immigrationReplacer.OperatorParameter.ActualName = ImmigrationReplacerParameter.Name;
     351
     352      generationsCounter.Name = "Generations + 1";
     353      generationsCounter.Increment = new IntValue(1);
     354      generationsCounter.ValueParameter.ActualName = "Generations";
     355
     356      generationsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     357      generationsComparator.LeftSideParameter.ActualName = "Generations";
     358      generationsComparator.ResultParameter.ActualName = "TerminateGenerations";
     359      generationsComparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
    244360
    245361      bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality";
     
    247363      bestQualityMemorizer3.QualityParameter.ActualName = "BestQuality";
    248364
    249       bestAverageWorstQualityCalculator3.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
    250       bestAverageWorstQualityCalculator3.BestQualityParameter.ActualName = "CurrentBestBestQuality";
    251       bestAverageWorstQualityCalculator3.MaximizationParameter.ActualName = MaximizationParameter.Name;
    252       bestAverageWorstQualityCalculator3.QualityParameter.ActualName = "CurrentBestQuality";
    253       bestAverageWorstQualityCalculator3.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
     365      bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
     366      bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name;
     367      bestQualityMemorizer4.QualityParameter.ActualName = "BestQuality";
     368
     369      bestAverageWorstQualityCalculator2.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
     370      bestAverageWorstQualityCalculator2.BestQualityParameter.ActualName = "CurrentBestBestQuality";
     371      bestAverageWorstQualityCalculator2.MaximizationParameter.ActualName = MaximizationParameter.Name;
     372      bestAverageWorstQualityCalculator2.QualityParameter.ActualName = "CurrentBestQuality";
     373      bestAverageWorstQualityCalculator2.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
    254374
    255375      dataTableValuesCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best BestQuality", null, "CurrentBestBestQuality"));
     
    265385      qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
    266386
    267       migrationTerminationCondition.ConditionParameter.ActualName = "MigrationTerminate";
     387      generationsTerminationCondition.ConditionParameter.ActualName = "TerminateGenerations";
    268388      #endregion
    269389
    270390      #region Create operator graph
    271391      OperatorGraph.InitialOperator = variableCreator;
    272       variableCreator.Successor = ussp0;
    273       ussp0.Operator = resultCollectionCreator;
    274       ussp0.Successor = bestQualityMemorizer2;
    275       resultCollectionCreator.Successor = bestQualityMemorizer1;
    276       bestQualityMemorizer1.Successor = bestAverageWorstQualityCalculator1;
    277       bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator2;
    278       bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector1;
     392      variableCreator.Successor = uniformSubScopesProcessor0;
     393      uniformSubScopesProcessor0.Operator = islandVariableCreator;
     394      uniformSubScopesProcessor0.Successor = bestQualityMemorizer1;
     395      islandVariableCreator.Successor = islandBestQualityMemorizer1;
     396      islandBestQualityMemorizer1.Successor = islandBestAverageWorstQualityCalculator1;
     397      islandBestAverageWorstQualityCalculator1.Successor = islandDataTableValuesCollector1;
     398      islandDataTableValuesCollector1.Successor = islandQualityDifferenceCalculator1;
     399      islandQualityDifferenceCalculator1.Successor = islandVisualizer1;
     400      islandVisualizer1.Successor = islandResultsCollector;
     401      bestQualityMemorizer1.Successor = bestQualityMemorizer2;
     402      bestQualityMemorizer2.Successor = bestAverageWorstQualityCalculator1;
     403      bestAverageWorstQualityCalculator1.Successor = dataTableValuesCollector1;
    279404      dataTableValuesCollector1.Successor = qualityDifferenceCalculator1;
    280405      qualityDifferenceCalculator1.Successor = resultsCollector;
    281       resultsCollector.Successor = ussp1;
    282       ussp1.Operator = geneticAlgorithmMainLoop;
    283       ussp1.Successor = migrator;
    284       geneticAlgorithmMainLoop.Successor = emigrantsSelector;
    285       emigrantsSelector.Successor = null;
    286       migrator.Successor = ussp2;
    287       ussp2.Operator = immigrationReplacer;
    288       ussp2.Successor = migrationsCounter;
    289       immigrationReplacer.Successor = null;
    290       migrationsCounter.Successor = maxMigrationsComparator;
    291       maxMigrationsComparator.Successor = bestQualityMemorizer3;
    292       bestQualityMemorizer3.Successor = bestAverageWorstQualityCalculator3;
    293       bestAverageWorstQualityCalculator3.Successor = dataTableValuesCollector2;
     406      resultsCollector.Successor = uniformSubScopesProcessor1;
     407      uniformSubScopesProcessor1.Operator = selector;
     408      uniformSubScopesProcessor1.Successor = generationsSinceLastMigrationCounter;
     409      selector.Successor = subScopesProcessor1;
     410      subScopesProcessor1.Operators.Add(new EmptyOperator());
     411      subScopesProcessor1.Operators.Add(childrenCreator);
     412      subScopesProcessor1.Successor = subScopesProcessor2;
     413      childrenCreator.Successor = uniformSubScopesProcessor2;
     414      uniformSubScopesProcessor2.Operator = crossover;
     415      uniformSubScopesProcessor2.Successor = null;
     416      crossover.Successor = stochasticBranch;
     417      stochasticBranch.FirstBranch = mutator;
     418      stochasticBranch.SecondBranch = null;
     419      stochasticBranch.Successor = evaluator;
     420      mutator.Successor = null;
     421      evaluator.Successor = subScopesRemover;
     422      subScopesRemover.Successor = null;
     423      subScopesProcessor2.Operators.Add(bestSelector);
     424      subScopesProcessor2.Operators.Add(new EmptyOperator());
     425      subScopesProcessor2.Successor = mergingReducer;
     426      bestSelector.Successor = rightReducer;
     427      rightReducer.Successor = null;
     428      mergingReducer.Successor = islandBestQualityMemorizer2;
     429      islandBestQualityMemorizer2.Successor = islandBestAverageWorstQualityCalculator2;
     430      islandBestAverageWorstQualityCalculator2.Successor = islandDataTableValuesCollector2;
     431      islandDataTableValuesCollector2.Successor = islandQualityDifferenceCalculator2;
     432      islandQualityDifferenceCalculator2.Successor = islandVisualizer2;
     433      islandVisualizer2.Successor = null;
     434      generationsSinceLastMigrationCounter.Successor = migrationComparator;
     435      migrationComparator.Successor = migrationBranch;
     436      migrationBranch.TrueBranch = resetGenerationsSinceLastMigrationAssigner;
     437      migrationBranch.FalseBranch = null;
     438      migrationBranch.Successor = generationsCounter;
     439      resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
     440      migrationsCounter.Successor = uniformSubScopesProcessor3;
     441      uniformSubScopesProcessor3.Operator = emigrantsSelector;
     442      uniformSubScopesProcessor3.Successor = migrator;
     443      migrator.Successor = uniformSubScopesProcessor4;
     444      uniformSubScopesProcessor4.Operator = immigrationReplacer;
     445      uniformSubScopesProcessor4.Successor = null;
     446      generationsCounter.Successor = generationsComparator;
     447      generationsComparator.Successor = bestQualityMemorizer3;
     448      bestQualityMemorizer3.Successor = bestQualityMemorizer4;
     449      bestQualityMemorizer4.Successor = bestAverageWorstQualityCalculator2;
     450      bestAverageWorstQualityCalculator2.Successor = dataTableValuesCollector2;
    294451      dataTableValuesCollector2.Successor = qualityDifferenceCalculator2;
    295       qualityDifferenceCalculator2.Successor = migrationTerminationCondition;
    296       migrationTerminationCondition.FalseBranch = ussp1;
    297       migrationTerminationCondition.TrueBranch = null;
    298       migrationTerminationCondition.Successor = null;
     452      qualityDifferenceCalculator2.Successor = generationsTerminationCondition;
     453      generationsTerminationCondition.TrueBranch = null;
     454      generationsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
     455      generationsTerminationCondition.Successor = null;
    299456      #endregion
    300457    }
Note: See TracChangeset for help on using the changeset viewer.