Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/10 14:52:19 (14 years ago)
Author:
abeham
Message:

#999

  • changes in LS
    • counting evaluated moves
    • tracking best quality which is needed by the algorithm
  • changes in TS
    • adapted to analyzer
    • added a neighborhood analyzer that shows what percentage of the neighborhood is tabu
Location:
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3
Files:
2 edited

Legend:

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

    r3626 r3636  
    140140      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000)));
    141141      Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(100)));
    142       Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("MoveAnalyzer", "The operator used to analyze the moves in each iteration.", new MultiAnalyzer<IPopulationAnalyzer>()));
    143       Parameters.Add(new ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>("Analyzer", "The operator used to analyze each iteration.", new MultiAnalyzer<ISolutionAnalyzer>()));
     142      Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer<IPopulationAnalyzer>()));
     143      Parameters.Add(new ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer<ISolutionAnalyzer>()));
    144144     
    145145      RandomCreator randomCreator = new RandomCreator();
     
    229229      ParameterizeMoveEvaluators();
    230230      ParameterizeMoveMakers();
     231      ParameterizeAnalyzers();
    231232      base.Problem_OperatorsChanged(sender, e);
    232233    }
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r3621 r3636  
    104104      Parameters.Add(new ValueLookupParameter<IOperator>("MoveEvaluator", "The operator that evaluates a move."));
    105105
    106       Parameters.Add(new ValueLookupParameter<IOperator>("MoveAnalyzer", "The operator used to analyze the moves in each iteration."));
    107       Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each iteration."));
     106      Parameters.Add(new ValueLookupParameter<IOperator>("MoveAnalyzer", "The operator used to analyze the moves."));
     107      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution."));
    108108      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied."));
    109109      #endregion
     
    111111      #region Create operators
    112112      VariableCreator variableCreator = new VariableCreator();
     113      SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
     114      Assigner bestQualityInitializer = new Assigner();
     115      Placeholder analyzer1 = new Placeholder();
    113116      ResultsCollector resultsCollector1 = new ResultsCollector();
    114       UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
    115       Placeholder analyzer1 = new Placeholder();
    116       UniformSubScopesProcessor mainProcessor = new UniformSubScopesProcessor();
     117      SubScopesProcessor mainProcessor = new SubScopesProcessor();
    117118      Placeholder moveGenerator = new Placeholder();
    118119      UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor();
    119120      Placeholder moveEvaluator = new Placeholder();
     121      IntCounter evaluatedMovesCounter = new IntCounter();
    120122      Placeholder moveAnalyzer = new Placeholder();
    121123      BestSelector bestSelector = new BestSelector();
    122124      RightReducer rightReducer = new RightReducer();
    123       UniformSubScopesProcessor moveMakingProcessor = new UniformSubScopesProcessor();
     125      SubScopesProcessor moveMakingProcessor = new SubScopesProcessor();
    124126      QualityComparator qualityComparator = new QualityComparator();
    125127      ConditionalBranch improvesQualityBranch = new ConditionalBranch();
    126128      Placeholder moveMaker = new Placeholder();
     129      Assigner bestQualityUpdater = new Assigner();
    127130      SubScopesRemover subScopesRemover = new SubScopesRemover();
    128131      IntCounter iterationsCounter = new IntCounter();
    129132      Comparator iterationsComparator = new Comparator();
     133      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     134      Placeholder analyzer2 = new Placeholder();
    130135      ResultsCollector resultsCollector2 = new ResultsCollector();
    131       UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
    132       Placeholder analyzer2 = new Placeholder();
    133136      ConditionalBranch iterationsTermination = new ConditionalBranch();
    134137
    135138      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    136 
    137       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    138       resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
     139      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     140      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue(0)));
     141
     142      bestQualityInitializer.Name = "Initialize BestQuality";
     143      bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";
     144      bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name;
    139145
    140146      analyzer1.Name = "Analyzer (placeholder)";
    141147      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
    142148
    143       mainProcessor.Name = "Solution processor (UniformSubScopesProcessor)";
     149      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     150      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     151      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     152      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    144153
    145154      moveGenerator.Name = "MoveGenerator (placeholder)";
     
    148157      moveEvaluator.Name = "MoveEvaluator (placeholder)";
    149158      moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;
     159
     160      evaluatedMovesCounter.Name = "EvaluatedMoves + 1";
     161      evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves";
     162      evaluatedMovesCounter.Increment = new IntValue(1);
    150163
    151164      moveAnalyzer.Name = "MoveAnalyzer (placeholder)";
     
    157170      bestSelector.QualityParameter.ActualName = MoveQualityParameter.Name;
    158171
    159       moveMakingProcessor.Name = "MoveMaking processor (UniformSubScopesProcessor)";
    160 
    161172      qualityComparator.LeftSideParameter.ActualName = MoveQualityParameter.Name;
    162173      qualityComparator.RightSideParameter.ActualName = QualityParameter.Name;
     
    167178      moveMaker.Name = "MoveMaker (placeholder)";
    168179      moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;
     180
     181      bestQualityUpdater.Name = "Update BestQuality";
     182      bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality";
     183      bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name;
    169184
    170185      subScopesRemover.RemoveAllSubScopes = true;
     
    180195      iterationsComparator.ResultParameter.ActualName = "Terminate";
    181196
    182       resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    183       resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    184 
    185197      analyzer2.Name = "Analyzer (placeholder)";
    186198      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
     199
     200      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     201      resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     202      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     203      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    187204
    188205      iterationsTermination.Name = "Iterations Termination Condition";
     
    192209      #region Create operator graph
    193210      OperatorGraph.InitialOperator = variableCreator;
    194       variableCreator.Successor = resultsCollector1;
    195       resultsCollector1.Successor = uniformSubScopesProcessor0;
    196       uniformSubScopesProcessor0.Operator = analyzer1;
    197       uniformSubScopesProcessor0.Successor = mainProcessor;
     211      variableCreator.Successor = subScopesProcessor0;
     212      subScopesProcessor0.Operators.Add(bestQualityInitializer);
     213      subScopesProcessor0.Successor = resultsCollector1;
     214      bestQualityInitializer.Successor = analyzer1;
    198215      analyzer1.Successor = null;
    199       mainProcessor.Operator = moveGenerator;
     216      resultsCollector1.Successor = mainProcessor;
     217      mainProcessor.Operators.Add(moveGenerator);
    200218      mainProcessor.Successor = iterationsCounter;
    201219      moveGenerator.Successor = moveEvaluationProcessor;
    202220      moveEvaluationProcessor.Operator = moveEvaluator;
    203221      moveEvaluationProcessor.Successor = moveAnalyzer;
     222      moveEvaluator.Successor = evaluatedMovesCounter;
     223      evaluatedMovesCounter.Successor = null;
    204224      moveAnalyzer.Successor = bestSelector;
    205225      bestSelector.Successor = rightReducer;
    206226      rightReducer.Successor = moveMakingProcessor;
    207       moveMakingProcessor.Operator = qualityComparator;
     227      moveMakingProcessor.Operators.Add(qualityComparator);
    208228      moveMakingProcessor.Successor = subScopesRemover;
    209229      subScopesRemover.Successor = null;
     
    212232      improvesQualityBranch.FalseBranch = null;
    213233      improvesQualityBranch.Successor = null;
    214       moveMaker.Successor = null;
     234      moveMaker.Successor = bestQualityUpdater;
     235      bestQualityUpdater.Successor = null;
    215236      iterationsCounter.Successor = iterationsComparator;
    216       iterationsComparator.Successor = resultsCollector2;
    217       resultsCollector2.Successor = uniformSubScopesProcessor1;
    218       uniformSubScopesProcessor1.Operator = analyzer2;
    219       uniformSubScopesProcessor1.Successor = iterationsTermination;
     237      iterationsComparator.Successor = subScopesProcessor1;
     238      subScopesProcessor1.Operators.Add(analyzer2);
     239      subScopesProcessor1.Successor = resultsCollector2;
    220240      analyzer2.Successor = null;
     241      resultsCollector2.Successor = iterationsTermination;
    221242      iterationsTermination.TrueBranch = null;
    222243      iterationsTermination.FalseBranch = mainProcessor;
Note: See TracChangeset for help on using the changeset viewer.