Changeset 3521


Ignore:
Timestamp:
04/24/10 17:07:51 (12 years ago)
Author:
abeham
Message:

Updated tabu search to show best quality and best known quality in the chart. Also simplified the operator graph in the main loop. #840

Location:
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3
Files:
2 edited

Legend:

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

    r3376 r3521  
    125125      Placeholder visualizer1 = new Placeholder();
    126126      ResultsCollector resultsCollector = new ResultsCollector();
    127       UniformSubScopesProcessor mainProcessor = new UniformSubScopesProcessor();
     127      SubScopesProcessor solutionProcessor = new SubScopesProcessor();
    128128      Placeholder moveGenerator = new Placeholder();
    129129      UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor();
     
    135135      ConditionalBranch emptyNeighborhoodBranch1 = new ConditionalBranch();
    136136      RightReducer rightReducer = new RightReducer();
    137       UniformSubScopesProcessor moveMakingProcessor = new UniformSubScopesProcessor();
     137      SubScopesProcessor moveMakingProcessor = new SubScopesProcessor();
    138138      Placeholder tabuMaker = new Placeholder();
    139139      Placeholder moveMaker = new Placeholder();
    140       DataTableValuesCollector valuesCollector = new DataTableValuesCollector();
    141       SubScopesRemover subScopesRemover1 = new SubScopesRemover();
     140      SubScopesRemover subScopesRemover = new SubScopesRemover();
    142141      ConditionalBranch emptyNeighborhoodBranch2 = new ConditionalBranch();
    143       UniformSubScopesProcessor removeMoves = new UniformSubScopesProcessor();
    144       SubScopesRemover subScopesRemover2 = new SubScopesRemover();
    145142      IntCounter iterationsCounter = new IntCounter();
    146143      Comparator iterationsComparator = new Comparator();
     
    149146      QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
    150147      Placeholder visualizer2 = new Placeholder();
     148      DataTableValuesCollector valuesCollector = new DataTableValuesCollector();
    151149      ConditionalBranch iterationsTermination = new ConditionalBranch();
    152150
     
    155153      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Average Move Quality", new DoubleValue(0)));
    156154      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Worst Move Quality", new DoubleValue(0)));
    157       variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("MoveQualities", new DataTable("MoveQualities")));
    158155      variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("EmptyNeighborhood", new BoolValue(false)));
     156      variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("MoveQualities", new DataTable("Move Qualities", "Progress of the tabu search showing the best, average, and worst move found in each iteration.")));
    159157
    160158      bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
     
    173171      visualizer1.Name = "Visualizer (placeholder)";
    174172      visualizer1.OperatorParameter.ActualName = VisualizerParameter.Name;
    175 
     173     
    176174      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    177175      resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     
    186184      resultsCollector.ResultsParameter.ActualName = "Results";
    187185
    188       mainProcessor.Name = "Solution processor (UniformSubScopesProcessor)";
    189 
    190186      moveGenerator.Name = "MoveGenerator (placeholder)";
    191187      moveGenerator.OperatorParameter.ActualName = MoveGeneratorParameter.Name;
     
    206202      bestAverageWorstMoveQualityCalculator.WorstQualityParameter.ActualName = "Worst Move Quality";
    207203
    208       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Move Quality"));
    209       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Move Quality"));
    210       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Worst Move Quality"));
    211       valuesCollector.DataTableParameter.ActualName = "MoveQualities";
    212 
     204      tabuSelector.AspirationParameter.Value = new BoolValue(true);
     205      tabuSelector.BestQualityParameter.ActualName = "BestQuality";
     206      tabuSelector.CopySelected = new BoolValue(false);
     207      tabuSelector.EmptyNeighborhoodParameter.ActualName = "EmptyNeighborhood";
     208      tabuSelector.MaximizationParameter.ActualName = MaximizationParameter.Name;
     209      tabuSelector.MoveQualityParameter.ActualName = MoveQualityParameter.Name;
     210      tabuSelector.MoveTabuParameter.ActualName = MoveTabuParameter.Name;
     211     
    213212      moveMakingProcessor.Name = "MoveMaking processor (UniformSubScopesProcessor)";
    214213
     
    222221      moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;
    223222
    224       subScopesRemover1.RemoveAllSubScopes = true;
    225 
    226       emptyNeighborhoodBranch2.Name = "Neighborhood empty?";
    227       emptyNeighborhoodBranch2.ConditionParameter.ActualName = "EmptyNeighborhood";
    228 
    229       subScopesRemover2.RemoveAllSubScopes = true;
     223      subScopesRemover.RemoveAllSubScopes = true;
    230224
    231225      iterationsCounter.Name = "Iterations Counter";
     
    254248      visualizer2.Name = "Visualizer (placeholder)";
    255249      visualizer2.OperatorParameter.ActualName = VisualizerParameter.Name;
     250     
     251      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Move Quality"));
     252      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Move Quality"));
     253      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Worst Move Quality"));
     254      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     255      valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
     256      valuesCollector.DataTableParameter.ActualName = "MoveQualities";
     257
     258      emptyNeighborhoodBranch2.Name = "Neighborhood empty?";
     259      emptyNeighborhoodBranch2.ConditionParameter.ActualName = "EmptyNeighborhood";
    256260
    257261      iterationsTermination.Name = "Iterations Termination Condition";
     
    267271      qualityDifferenceCalculator1.Successor = visualizer1;
    268272      visualizer1.Successor = resultsCollector;
    269       resultsCollector.Successor = mainProcessor;
    270       mainProcessor.Operator = moveGenerator;
    271       mainProcessor.Successor = emptyNeighborhoodBranch2;
     273      resultsCollector.Successor = solutionProcessor;
     274      solutionProcessor.Operators.Add(moveGenerator);
     275      solutionProcessor.Successor = iterationsCounter;
    272276      moveGenerator.Successor = moveEvaluationProcessor;
    273277      moveEvaluationProcessor.Operator = moveEvaluator;
     
    276280      tabuChecker.Successor = null;
    277281      moveQualitySorter.Successor = bestAverageWorstMoveQualityCalculator;
    278       bestAverageWorstMoveQualityCalculator.Successor = valuesCollector;
    279       valuesCollector.Successor = tabuSelector;
     282      bestAverageWorstMoveQualityCalculator.Successor = tabuSelector;
    280283      tabuSelector.Successor = emptyNeighborhoodBranch1;
    281284      emptyNeighborhoodBranch1.FalseBranch = rightReducer;
    282285      emptyNeighborhoodBranch1.TrueBranch = null;
    283       emptyNeighborhoodBranch1.Successor = null;
     286      emptyNeighborhoodBranch1.Successor = subScopesRemover;
    284287      rightReducer.Successor = moveMakingProcessor;
    285       moveMakingProcessor.Operator = tabuMaker;
    286       moveMakingProcessor.Successor = subScopesRemover1;
     288      moveMakingProcessor.Operators.Add(tabuMaker);
     289      moveMakingProcessor.Successor = null;
    287290      tabuMaker.Successor = moveMaker;
    288291      moveMaker.Successor = null;
    289       subScopesRemover1.Successor = null;
    290       emptyNeighborhoodBranch2.FalseBranch = iterationsCounter;
    291       emptyNeighborhoodBranch2.TrueBranch = removeMoves;
    292       emptyNeighborhoodBranch2.Successor = null;
    293       removeMoves.Operator = subScopesRemover2;
    294       removeMoves.Successor = null;
    295       subScopesRemover2.Successor = null;
     292      subScopesRemover.Successor = null;
    296293      iterationsCounter.Successor = iterationsComparator;
    297294      iterationsComparator.Successor = bestQualityMemorizer3;
     
    299296      bestQualityMemorizer4.Successor = qualityDifferenceCalculator2;
    300297      qualityDifferenceCalculator2.Successor = visualizer2;
    301       visualizer2.Successor = iterationsTermination;
     298      visualizer2.Successor = valuesCollector;
     299      valuesCollector.Successor = emptyNeighborhoodBranch2;
     300      emptyNeighborhoodBranch2.TrueBranch = null;
     301      emptyNeighborhoodBranch2.FalseBranch = iterationsTermination;
     302      emptyNeighborhoodBranch2.Successor = null;
    302303      iterationsTermination.TrueBranch = null;
    303       iterationsTermination.FalseBranch = mainProcessor;
     304      iterationsTermination.FalseBranch = solutionProcessor;
    304305      #endregion
    305306    }
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSelector.cs

    r3376 r3521  
    9494      Parameters.Add(new SubScopesLookupParameter<BoolValue>("MoveTabu", "The tabu status of the move."));
    9595      Parameters.Add(new ValueLookupParameter<BoolValue>("CopySelected", "True if the selected move should be copied.", new BoolValue(false)));
    96       Parameters.Add(new LookupParameter<BoolValue>("EmptyNeighborhood", "Will be set to true if the neighborhood didn't contain any non-tabu moves. It is not set to false."));
     96      Parameters.Add(new LookupParameter<BoolValue>("EmptyNeighborhood", "Will be set to true if the neighborhood didn't contain any non-tabu moves, otherwise it is set to false."));
    9797    }
    9898
     
    128128        EmptyNeighborhoodParameter.ActualValue = new BoolValue(true);
    129129        selected[0] = new Scope("All moves are tabu.");
    130       }
     130      } else EmptyNeighborhoodParameter.ActualValue = new BoolValue(false);
    131131
    132132      // remove from last to first so that the stored indices remain the same
Note: See TracChangeset for help on using the changeset viewer.