Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5353


Ignore:
Timestamp:
01/21/11 23:31:09 (14 years ago)
Author:
abeham
Message:

#1333

  • Adapted local search to perform move evaluation in parallel (using the parallel engine)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r4807 r5353  
    116116      Placeholder analyzer1 = new Placeholder();
    117117      ResultsCollector resultsCollector1 = new ResultsCollector();
    118       ResultsCollector resultsCollector2 = new ResultsCollector();
    119118      SubScopesProcessor mainProcessor = new SubScopesProcessor();
    120119      Placeholder moveGenerator = new Placeholder();
    121120      UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor();
    122121      Placeholder moveEvaluator = new Placeholder();
    123       IntCounter evaluatedMovesCounter = new IntCounter();
     122      SubScopesCounter subScopesCounter = new SubScopesCounter();
    124123      BestSelector bestSelector = new BestSelector();
    125124      SubScopesProcessor moveMakingProcessor = new SubScopesProcessor();
     
    134133      IntCounter iterationsCounter = new IntCounter();
    135134      Comparator iterationsComparator = new Comparator();
    136       ResultsCollector resultsCollector3 = new ResultsCollector();
    137135      ConditionalBranch iterationsTermination = new ConditionalBranch();
    138136
     
    151149      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    152150      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     151      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
    153152      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    154 
    155       resultsCollector2.CopyValue = new BoolValue(true);
    156       resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
    157       resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    158153
    159154      moveGenerator.Name = "MoveGenerator (placeholder)";
    160155      moveGenerator.OperatorParameter.ActualName = MoveGeneratorParameter.Name;
    161156
     157      moveEvaluationProcessor.Parallel = new BoolValue(true);
     158
    162159      moveEvaluator.Name = "MoveEvaluator (placeholder)";
    163160      moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;
    164161
    165       evaluatedMovesCounter.Name = "EvaluatedMoves + 1";
    166       evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves";
    167       evaluatedMovesCounter.Increment = new IntValue(1);
     162      subScopesCounter.Name = "Increment EvaluatedMoves";
     163      subScopesCounter.ValueParameter.ActualName = "EvaluatedMoves";
    168164
    169165      bestSelector.CopySelected = new BoolValue(false);
     
    199195      iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name;
    200196      iterationsComparator.ResultParameter.ActualName = "Terminate";
    201 
    202       resultsCollector3.CopyValue = new BoolValue(true);
    203       resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
    204       resultsCollector3.ResultsParameter.ActualName = ResultsParameter.Name;
    205197
    206198      iterationsTermination.Name = "Iterations Termination Condition";
     
    215207      bestQualityInitializer.Successor = analyzer1;
    216208      analyzer1.Successor = null;
    217       resultsCollector1.Successor = resultsCollector2;
    218       resultsCollector2.Successor = mainProcessor;
     209      resultsCollector1.Successor = mainProcessor;
    219210      mainProcessor.Operators.Add(moveGenerator);
    220211      mainProcessor.Successor = iterationsCounter;
    221212      moveGenerator.Successor = moveEvaluationProcessor;
    222213      moveEvaluationProcessor.Operator = moveEvaluator;
    223       moveEvaluationProcessor.Successor = bestSelector;
    224       moveEvaluator.Successor = evaluatedMovesCounter;
    225       evaluatedMovesCounter.Successor = null;
     214      moveEvaluationProcessor.Successor = subScopesCounter;
     215      moveEvaluator.Successor = null;
     216      subScopesCounter.Successor = bestSelector;
    226217      bestSelector.Successor = moveMakingProcessor;
    227218      moveMakingProcessor.Operators.Add(new EmptyOperator());
     
    239230      subScopesRemover.Successor = null;
    240231      iterationsCounter.Successor = iterationsComparator;
    241       iterationsComparator.Successor = resultsCollector3;
    242       resultsCollector3.Successor = iterationsTermination;
     232      iterationsComparator.Successor = iterationsTermination;
    243233      iterationsTermination.TrueBranch = null;
    244234      iterationsTermination.FalseBranch = mainProcessor;
Note: See TracChangeset for help on using the changeset viewer.