Free cookie consent management tool by TermsFeed Policy Generator

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/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
Files:
4 edited

Legend:

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