Free cookie consent management tool by TermsFeed Policy Generator

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

Adapted EAs to enable parallel solution evaluation (#1333)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.