Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5208


Ignore:
Timestamp:
01/04/11 06:17:50 (14 years ago)
Author:
swagner
Message:

Adapted EAs to enable parallel solution evaluation (#1333)

Location:
trunk/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.EvolutionStrategy/3.3/EvolutionStrategyMainLoop.cs

    r4722 r5208  
    120120      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    121121      Parameters.Add(new ValueLookupParameter<IOperator>("Recombinator", "The operator used to cross solutions."));
    122       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     122      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    123123      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
    124124      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation."));
     
    142142      Placeholder strategyMutator1 = new Placeholder();
    143143      Placeholder mutator1 = new Placeholder();
    144       Placeholder evaluator1 = new Placeholder();
    145144      SubScopesRemover subScopesRemover = new SubScopesRemover();
    146145      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
    147146      Placeholder strategyMutator2 = new Placeholder();
    148147      Placeholder mutator2 = new Placeholder();
    149       Placeholder evaluator2 = new Placeholder();
     148      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
     149      Placeholder evaluator = new Placeholder();
    150150      ConditionalBranch plusOrCommaReplacementBranch = new ConditionalBranch();
    151151      MergingReducer plusReplacement = new MergingReducer();
     
    195195      mutator1.OperatorParameter.ActualName = MutatorParameter.Name;
    196196
    197       evaluator1.Name = "Evaluator (placeholder)";
    198       evaluator1.OperatorParameter.ActualName = EvaluatorParameter.Name;
    199 
    200197      subScopesRemover.RemoveAllSubScopes = true;
    201198
     
    206203      mutator2.OperatorParameter.ActualName = MutatorParameter.Name;
    207204
    208       evaluator2.Name = "Evaluator (placeholder)";
    209       evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name;
     205      uniformSubScopesProcessor3.Parallel.Value = true;
     206
     207      evaluator.Name = "Evaluator (placeholder)";
     208      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
    210209
    211210      plusOrCommaReplacementBranch.ConditionParameter.ActualName = PlusSelectionParameter.Name;
     
    245244      useRecombinationBranch.TrueBranch = childrenCreator;
    246245      useRecombinationBranch.FalseBranch = uniformSubScopesProcessor2;
    247       useRecombinationBranch.Successor = null;
     246      useRecombinationBranch.Successor = uniformSubScopesProcessor3;
    248247      childrenCreator.Successor = uniformSubScopesProcessor1;
    249248      uniformSubScopesProcessor1.Operator = recombinator;
     
    252251      strategyRecombinator.Successor = strategyMutator1;
    253252      strategyMutator1.Successor = mutator1;
    254       mutator1.Successor = evaluator1;
    255       evaluator1.Successor = subScopesRemover;
     253      mutator1.Successor = subScopesRemover;
    256254      subScopesRemover.Successor = null;
    257255      uniformSubScopesProcessor2.Operator = strategyMutator2;
    258256      uniformSubScopesProcessor2.Successor = null;
    259257      strategyMutator2.Successor = mutator2;
    260       mutator2.Successor = evaluator2;
     258      mutator2.Successor = null;
     259      uniformSubScopesProcessor3.Operator = evaluator;
     260      uniformSubScopesProcessor3.Successor = null;
     261      evaluator.Successor = null;
    261262      plusOrCommaReplacementBranch.TrueBranch = plusReplacement;
    262263      plusOrCommaReplacementBranch.FalseBranch = commaReplacement;
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithmMainLoop.cs

    r4722 r5208  
    104104      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    105105      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    106       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     106      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    107107      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
    108108      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
     
    119119      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
    120120      ChildrenCreator childrenCreator = new ChildrenCreator();
    121       UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
     121      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
    122122      Placeholder crossover = new Placeholder();
    123123      StochasticBranch stochasticBranch = new StochasticBranch();
    124124      Placeholder mutator = new Placeholder();
     125      SubScopesRemover subScopesRemover = new SubScopesRemover();
     126      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
    125127      Placeholder evaluator = new Placeholder();
    126       SubScopesRemover subScopesRemover = new SubScopesRemover();
    127128      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
    128129      BestSelector bestSelector = new BestSelector();
     
    157158      mutator.OperatorParameter.ActualName = "Mutator";
    158159
     160      subScopesRemover.RemoveAllSubScopes = true;
     161
     162      uniformSubScopesProcessor2.Parallel.Value = true;
     163
    159164      evaluator.Name = "Evaluator";
    160165      evaluator.OperatorParameter.ActualName = "Evaluator";
    161 
    162       subScopesRemover.RemoveAllSubScopes = true;
    163166
    164167      bestSelector.CopySelected = new BoolValue(false);
     
    193196      subScopesProcessor1.Operators.Add(childrenCreator);
    194197      subScopesProcessor1.Successor = subScopesProcessor2;
    195       childrenCreator.Successor = uniformSubScopesProcessor;
    196       uniformSubScopesProcessor.Operator = crossover;
    197       uniformSubScopesProcessor.Successor = null;
     198      childrenCreator.Successor = uniformSubScopesProcessor1;
     199      uniformSubScopesProcessor1.Operator = crossover;
     200      uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2;
    198201      crossover.Successor = stochasticBranch;
    199202      stochasticBranch.FirstBranch = mutator;
    200203      stochasticBranch.SecondBranch = null;
    201       stochasticBranch.Successor = evaluator;
     204      stochasticBranch.Successor = subScopesRemover;
    202205      mutator.Successor = null;
    203       evaluator.Successor = subScopesRemover;
    204206      subScopesRemover.Successor = null;
     207      uniformSubScopesProcessor2.Operator = evaluator;
     208      uniformSubScopesProcessor2.Successor = null;
     209      evaluator.Successor = null;
    205210      subScopesProcessor2.Operators.Add(bestSelector);
    206211      subScopesProcessor2.Operators.Add(new EmptyOperator());
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r4722 r5208  
    130130      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    131131      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    132       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     132      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    133133      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
    134134      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
     
    153153      StochasticBranch stochasticBranch = new StochasticBranch();
    154154      Placeholder mutator = new Placeholder();
     155      SubScopesRemover subScopesRemover = new SubScopesRemover();
     156      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
    155157      Placeholder evaluator = new Placeholder();
    156       SubScopesRemover subScopesRemover = new SubScopesRemover();
    157158      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
    158159      BestSelector bestSelector = new BestSelector();
     
    166167      Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();
    167168      IntCounter migrationsCounter = new IntCounter();
    168       UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
     169      UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
    169170      Placeholder emigrantsSelector = new Placeholder();
    170171      Placeholder migrator = new Placeholder();
    171       UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
     172      UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor();
    172173      Placeholder immigrationReplacer = new Placeholder();
    173174      Comparator generationsComparator = new Comparator();
     
    211212      mutator.OperatorParameter.ActualName = MutatorParameter.Name;
    212213
     214      subScopesRemover.RemoveAllSubScopes = true;
     215
     216      uniformSubScopesProcessor3.Parallel.Value = true;
     217
    213218      evaluator.Name = "Evaluator (placeholder)";
    214219      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
    215 
    216       subScopesRemover.RemoveAllSubScopes = true;
    217220
    218221      bestSelector.CopySelected = new BoolValue(false);
     
    293296      childrenCreator.Successor = uniformSubScopesProcessor2;
    294297      uniformSubScopesProcessor2.Operator = crossover;
    295       uniformSubScopesProcessor2.Successor = null;
     298      uniformSubScopesProcessor2.Successor = uniformSubScopesProcessor3;
    296299      crossover.Successor = stochasticBranch;
    297300      stochasticBranch.FirstBranch = mutator;
    298301      stochasticBranch.SecondBranch = null;
    299       stochasticBranch.Successor = evaluator;
     302      stochasticBranch.Successor = subScopesRemover;
    300303      mutator.Successor = null;
    301       evaluator.Successor = subScopesRemover;
    302304      subScopesRemover.Successor = null;
     305      uniformSubScopesProcessor3.Operator = evaluator;
     306      uniformSubScopesProcessor3.Successor = null;
     307      evaluator.Successor = null;
    303308      subScopesProcessor2.Operators.Add(bestSelector);
    304309      subScopesProcessor2.Operators.Add(new EmptyOperator());
     
    315320      migrationBranch.Successor = generationsComparator;
    316321      resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
    317       migrationsCounter.Successor = uniformSubScopesProcessor3;
    318       uniformSubScopesProcessor3.Operator = emigrantsSelector;
    319       uniformSubScopesProcessor3.Successor = migrator;
    320       migrator.Successor = uniformSubScopesProcessor4;
    321       uniformSubScopesProcessor4.Operator = immigrationReplacer;
    322       uniformSubScopesProcessor4.Successor = null;
     322      migrationsCounter.Successor = uniformSubScopesProcessor4;
     323      uniformSubScopesProcessor4.Operator = emigrantsSelector;
     324      uniformSubScopesProcessor4.Successor = migrator;
     325      migrator.Successor = uniformSubScopesProcessor5;
     326      uniformSubScopesProcessor5.Operator = immigrationReplacer;
     327      uniformSubScopesProcessor5.Successor = null;
    323328      generationsComparator.Successor = analyzer2;
    324329      analyzer2.Successor = resultsCollector3;
  • trunk/sources/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2MainLoop.cs

    r5143 r5208  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829using HeuristicLab.Selection;
    29 using HeuristicLab.Common;
    3030
    3131namespace HeuristicLab.Algorithms.NSGA2 {
     
    9797      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    9898      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    99       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     99      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    100100      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
    101101      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
     
    110110      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
    111111      ChildrenCreator childrenCreator = new ChildrenCreator();
    112       UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
     112      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
    113113      StochasticBranch crossoverStochasticBranch = new StochasticBranch();
    114114      Placeholder crossover = new Placeholder();
     
    116116      StochasticBranch mutationStochasticBranch = new StochasticBranch();
    117117      Placeholder mutator = new Placeholder();
     118      SubScopesRemover subScopesRemover = new SubScopesRemover();
     119      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
    118120      Placeholder evaluator = new Placeholder();
    119       SubScopesRemover subScopesRemover = new SubScopesRemover();
    120121      MergingReducer mergingReducer = new MergingReducer();
    121122      RankAndCrowdingSorter rankAndCrowdingSorter = new RankAndCrowdingSorter();
     
    156157      mutator.OperatorParameter.ActualName = MutatorParameter.Name;
    157158
     159      subScopesRemover.RemoveAllSubScopes = true;
     160
     161      uniformSubScopesProcessor2.Parallel.Value = true;
     162
    158163      evaluator.Name = "Evaluator";
    159164      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
    160 
    161       subScopesRemover.RemoveAllSubScopes = true;
    162165
    163166      rankAndCrowdingSorter.CrowdingDistanceParameter.ActualName = "CrowdingDistance";
     
    193196      subScopesProcessor1.Operators.Add(childrenCreator);
    194197      subScopesProcessor1.Successor = mergingReducer;
    195       childrenCreator.Successor = uniformSubScopesProcessor;
    196       uniformSubScopesProcessor.Operator = crossoverStochasticBranch;
    197       uniformSubScopesProcessor.Successor = null;
     198      childrenCreator.Successor = uniformSubScopesProcessor1;
     199      uniformSubScopesProcessor1.Operator = crossoverStochasticBranch;
     200      uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2;
    198201      crossoverStochasticBranch.FirstBranch = crossover;
    199202      crossoverStochasticBranch.SecondBranch = noCrossover;
     
    203206      mutationStochasticBranch.FirstBranch = mutator;
    204207      mutationStochasticBranch.SecondBranch = null;
    205       mutationStochasticBranch.Successor = evaluator;
     208      mutationStochasticBranch.Successor = subScopesRemover;
    206209      mutator.Successor = null;
    207       evaluator.Successor = subScopesRemover;
    208210      subScopesRemover.Successor = null;
     211      uniformSubScopesProcessor2.Operator = evaluator;
     212      uniformSubScopesProcessor2.Successor = null;
     213      evaluator.Successor = null;
    209214      mergingReducer.Successor = rankAndCrowdingSorter;
    210215      rankAndCrowdingSorter.Successor = leftSelector;
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs

    r4722 r5208  
    153153      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    154154      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    155       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     155      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    156156      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
    157157      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r4722 r5208  
    115115      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    116116      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    117       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     117      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    118118      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
    119119      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs

    r4722 r5208  
    109109      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    110110      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    111       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     111      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    112112      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions."));
    113113      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
     
    124124      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
    125125      ChildrenCreator childrenCreator = new ChildrenCreator();
    126       UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
    127       Placeholder crossover = new Placeholder();
    128126      ConditionalBranch osBeforeMutationBranch = new ConditionalBranch();
     127      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
     128      Placeholder crossover1 = new Placeholder();
     129      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
    129130      Placeholder evaluator1 = new Placeholder();
    130131      IntCounter evaluationCounter1 = new IntCounter();
    131132      WeightedParentsQualityComparator qualityComparer1 = new WeightedParentsQualityComparator();
     133      SubScopesRemover subScopesRemover1 = new SubScopesRemover();
     134      UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor();
    132135      StochasticBranch mutationBranch1 = new StochasticBranch();
    133136      Placeholder mutator1 = new Placeholder();
     137      VariableCreator variableCreator1 = new VariableCreator();
     138      VariableCreator variableCreator2 = new VariableCreator();
     139      ConditionalSelector conditionalSelector = new ConditionalSelector();
     140      SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
     141      UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
    134142      Placeholder evaluator2 = new Placeholder();
    135143      IntCounter evaluationCounter2 = new IntCounter();
     144      MergingReducer mergingReducer1 = new MergingReducer();
     145      UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor();
     146      Placeholder crossover2 = new Placeholder();
    136147      StochasticBranch mutationBranch2 = new StochasticBranch();
    137148      Placeholder mutator2 = new Placeholder();
     149      UniformSubScopesProcessor uniformSubScopesProcessor6 = new UniformSubScopesProcessor();
    138150      Placeholder evaluator3 = new Placeholder();
    139151      IntCounter evaluationCounter3 = new IntCounter();
    140152      WeightedParentsQualityComparator qualityComparer2 = new WeightedParentsQualityComparator();
    141       SubScopesRemover subScopesRemover = new SubScopesRemover();
     153      SubScopesRemover subScopesRemover2 = new SubScopesRemover();
    142154      OffspringSelector offspringSelector = new OffspringSelector();
    143       SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor();
     155      SubScopesProcessor subScopesProcessor3 = new SubScopesProcessor();
    144156      BestSelector bestSelector = new BestSelector();
    145157      WorstSelector worstSelector = new WorstSelector();
    146158      RightReducer rightReducer = new RightReducer();
    147159      LeftReducer leftReducer = new LeftReducer();
    148       MergingReducer mergingReducer = new MergingReducer();
     160      MergingReducer mergingReducer2 = new MergingReducer();
    149161
    150162      selector.Name = "Selector (placeholder)";
     
    153165      childrenCreator.ParentsPerChild = new IntValue(2);
    154166
    155       crossover.Name = "Crossover (placeholder)";
    156       crossover.OperatorParameter.ActualName = CrossoverParameter.Name;
    157 
    158167      osBeforeMutationBranch.Name = "Apply OS before mutation?";
    159168      osBeforeMutationBranch.ConditionParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
     169
     170      crossover1.Name = "Crossover (placeholder)";
     171      crossover1.OperatorParameter.ActualName = CrossoverParameter.Name;
     172
     173      uniformSubScopesProcessor2.Parallel.Value = true;
    160174
    161175      evaluator1.Name = "Evaluator (placeholder)";
     
    172186      qualityComparer1.ResultParameter.ActualName = "SuccessfulOffspring";
    173187
     188      subScopesRemover1.RemoveAllSubScopes = true;
     189
    174190      mutationBranch1.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
    175191      mutationBranch1.RandomParameter.ActualName = RandomParameter.Name;
     
    177193      mutator1.Name = "Mutator (placeholder)";
    178194      mutator1.OperatorParameter.ActualName = MutatorParameter.Name;
     195
     196      variableCreator1.Name = "MutatedOffspring = true";
     197      variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true), false));
     198
     199      variableCreator2.Name = "MutatedOffspring = false";
     200      variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false), false));
     201
     202      conditionalSelector.ConditionParameter.ActualName = "MutatedOffspring";
     203      conditionalSelector.ConditionParameter.Depth = 1;
     204      conditionalSelector.CopySelected.Value = false;
     205
     206      uniformSubScopesProcessor4.Parallel.Value = true;
    179207
    180208      evaluator2.Name = "Evaluator (placeholder)";
     
    185213      evaluationCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    186214
     215      crossover2.Name = "Crossover (placeholder)";
     216      crossover2.OperatorParameter.ActualName = CrossoverParameter.Name;
     217
    187218      mutationBranch2.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
    188219      mutationBranch2.RandomParameter.ActualName = RandomParameter.Name;
     
    190221      mutator2.Name = "Mutator (placeholder)";
    191222      mutator2.OperatorParameter.ActualName = MutatorParameter.Name;
     223
     224      uniformSubScopesProcessor6.Parallel.Value = true;
    192225
    193226      evaluator3.Name = "Evaluator (placeholder)";
     
    204237      qualityComparer2.ResultParameter.ActualName = "SuccessfulOffspring";
    205238
    206       subScopesRemover.RemoveAllSubScopes = true;
     239      subScopesRemover2.RemoveAllSubScopes = true;
    207240
    208241      offspringSelector.CurrentSuccessRatioParameter.ActualName = CurrentSuccessRatioParameter.Name;
     
    231264      subScopesProcessor1.Operators.Add(childrenCreator);
    232265      subScopesProcessor1.Successor = offspringSelector;
    233       childrenCreator.Successor = uniformSubScopesProcessor;
    234       uniformSubScopesProcessor.Operator = crossover;
    235       uniformSubScopesProcessor.Successor = null;
    236       crossover.Successor = osBeforeMutationBranch;
    237       osBeforeMutationBranch.TrueBranch = evaluator1;
    238       osBeforeMutationBranch.FalseBranch = mutationBranch2;
    239       osBeforeMutationBranch.Successor = subScopesRemover;
     266      childrenCreator.Successor = osBeforeMutationBranch;
     267      osBeforeMutationBranch.TrueBranch = uniformSubScopesProcessor1;
     268      osBeforeMutationBranch.FalseBranch = uniformSubScopesProcessor5;
     269      osBeforeMutationBranch.Successor = null;
     270      uniformSubScopesProcessor1.Operator = crossover1;
     271      uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2;
     272      crossover1.Successor = null;
     273      uniformSubScopesProcessor2.Operator = evaluator1;
     274      uniformSubScopesProcessor2.Successor = uniformSubScopesProcessor3;
    240275      evaluator1.Successor = evaluationCounter1;
    241276      evaluationCounter1.Successor = qualityComparer1;
    242       qualityComparer1.Successor = mutationBranch1;
     277      qualityComparer1.Successor = subScopesRemover1;
     278      subScopesRemover1.Successor = null;
     279      uniformSubScopesProcessor3.Operator = mutationBranch1;
     280      uniformSubScopesProcessor3.Successor = conditionalSelector;
    243281      mutationBranch1.FirstBranch = mutator1;
    244       mutationBranch1.SecondBranch = null;
     282      mutationBranch1.SecondBranch = variableCreator2;
    245283      mutationBranch1.Successor = null;
    246       mutator1.Successor = evaluator2;
     284      mutator1.Successor = variableCreator1;
     285      variableCreator1.Successor = null;
     286      variableCreator2.Successor = null;
     287      conditionalSelector.Successor = subScopesProcessor2;
     288      subScopesProcessor2.Operators.Add(new EmptyOperator());
     289      subScopesProcessor2.Operators.Add(uniformSubScopesProcessor4);
     290      subScopesProcessor2.Successor = mergingReducer1;
     291      uniformSubScopesProcessor4.Operator = evaluator2;
     292      uniformSubScopesProcessor4.Successor = null;
    247293      evaluator2.Successor = evaluationCounter2;
    248294      evaluationCounter2.Successor = null;
     295      mergingReducer1.Successor = null;
     296      uniformSubScopesProcessor5.Operator = crossover2;
     297      uniformSubScopesProcessor5.Successor = uniformSubScopesProcessor6;
     298      crossover2.Successor = mutationBranch2;
    249299      mutationBranch2.FirstBranch = mutator2;
    250300      mutationBranch2.SecondBranch = null;
    251       mutationBranch2.Successor = evaluator3;
     301      mutationBranch2.Successor = null;
    252302      mutator2.Successor = null;
     303      uniformSubScopesProcessor6.Operator = evaluator3;
     304      uniformSubScopesProcessor6.Successor = null;
    253305      evaluator3.Successor = evaluationCounter3;
    254306      evaluationCounter3.Successor = qualityComparer2;
    255       subScopesRemover.Successor = null;
     307      qualityComparer2.Successor = subScopesRemover2;
     308      subScopesRemover2.Successor = null;
    256309      offspringSelector.OffspringCreator = selector;
    257       offspringSelector.Successor = subScopesProcessor2;
    258       subScopesProcessor2.Operators.Add(bestSelector);
    259       subScopesProcessor2.Operators.Add(worstSelector);
    260       subScopesProcessor2.Successor = mergingReducer;
     310      offspringSelector.Successor = subScopesProcessor3;
     311      subScopesProcessor3.Operators.Add(bestSelector);
     312      subScopesProcessor3.Operators.Add(worstSelector);
     313      subScopesProcessor3.Successor = mergingReducer2;
    261314      bestSelector.Successor = rightReducer;
    262315      rightReducer.Successor = null;
    263316      worstSelector.Successor = leftReducer;
    264317      leftReducer.Successor = null;
    265       mergingReducer.Successor = null;
     318      mergingReducer2.Successor = null;
    266319      #endregion
    267320    }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r4722 r5208  
    129129      Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution."));
    130130      Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));
    131       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
     131      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    132132      Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation."));
    133133      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The results collection to store the results."));
  • trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs

    r4722 r5208  
    3333  [StorableClass]
    3434  public sealed class IntCounter : SingleSuccessorOperator {
     35    private object locker = new object();
     36
    3537    public LookupParameter<IntValue> ValueParameter {
    3638      get { return (LookupParameter<IntValue>)Parameters["Value"]; }
     
    6062
    6163    public override IOperation Apply() {
    62       if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue();
    63       ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value;
     64      lock (locker) {
     65        if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue();
     66        ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value;
     67      }
    6468      return base.Apply();
    6569    }
  • trunk/sources/HeuristicLab.Optimization.Operators/3.3/SolutionsCreator.cs

    r4722 r5208  
    2929namespace HeuristicLab.Optimization.Operators {
    3030  /// <summary>
    31   /// An operator which creates new solutions.
     31  /// An operator which creates new solutions. Evaluation of the new solutions is executed in parallel, if an engine is used which supports parallelization.
    3232  /// </summary>
    33   [Item("SolutionsCreator", "An operator which creates new solutions.")]
     33  [Item("SolutionsCreator", "An operator which creates new solutions. Evaluation of the new solutions is executed in parallel, if an engine is used which supports parallelization.")]
    3434  [StorableClass]
    3535  public sealed class SolutionsCreator : SingleSuccessorOperator {
     
    6161      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSolutions", "The number of solutions that should be created."));
    6262      Parameters.Add(new ValueLookupParameter<IOperator>("SolutionCreator", "The operator which is used to create new solutions."));
    63       Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator which is used to evaluate new solutions."));
     63      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator which is used to evaluate new solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));
    6464      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope to which the new solutions are added as sub-scopes."));
    6565    }
     
    7878        CurrentScope.SubScopes.Add(new Scope((current + i).ToString()));
    7979
     80      OperationCollection creation = new OperationCollection();
     81      OperationCollection evaluation = new OperationCollection() { Parallel = true };
     82      for (int i = 0; i < count; i++) {
     83        if (creator != null) creation.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i]));
     84        if (evaluator != null) evaluation.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i]));
     85      }
    8086      OperationCollection next = new OperationCollection();
    81       for (int i = 0; i < count; i++) {
    82         if (creator != null) next.Add(ExecutionContext.CreateOperation(creator, CurrentScope.SubScopes[current + i]));
    83         if (evaluator != null) next.Add(ExecutionContext.CreateOperation(evaluator, CurrentScope.SubScopes[current + i]));
    84       }
     87      next.Add(creation);
     88      next.Add(evaluation);
    8589      next.Add(base.Apply());
    8690      return next;
Note: See TracChangeset for help on using the changeset viewer.