Ignore:
Timestamp:
03/23/10 01:48:44 (12 years ago)
Author:
abeham
Message:

fixed algorithm when neighborhood contains only tabu moves. It will now terminate correctly. #840

File:
1 edited

Legend:

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

    r3193 r3195  
    131131      BestAverageWorstQualityCalculator bestAverageWorstMoveQualityCalculator = new BestAverageWorstQualityCalculator();
    132132      TabuSelector tabuSelector = new TabuSelector();
     133      ConditionalBranch emptyNeighborhoodBranch1 = new ConditionalBranch();
    133134      RightReducer rightReducer = new RightReducer();
    134135      UniformSubScopesProcessor moveMakingProcessor = new UniformSubScopesProcessor();
     
    136137      Placeholder moveMaker = new Placeholder();
    137138      DataTableValuesCollector valuesCollector = new DataTableValuesCollector();
    138       SubScopesRemover subScopesRemover = new SubScopesRemover();
     139      SubScopesRemover subScopesRemover1 = new SubScopesRemover();
     140      ConditionalBranch emptyNeighborhoodBranch2 = new ConditionalBranch();
     141      UniformSubScopesProcessor removeMoves = new UniformSubScopesProcessor();
     142      SubScopesRemover subScopesRemover2 = new SubScopesRemover();
    139143      IntCounter iterationsCounter = new IntCounter();
    140144      Comparator iterationsComparator = new Comparator();
     
    150154      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Worst Move Quality", new DoubleValue(0)));
    151155      variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("MoveQualities", new DataTable("MoveQualities")));
     156      variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("EmptyNeighborhood", new BoolValue(false)));
    152157
    153158      bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
     
    206211      moveMakingProcessor.Name = "MoveMaking processor (UniformSubScopesProcessor)";
    207212
     213      emptyNeighborhoodBranch1.Name = "Neighborhood empty?";
     214      emptyNeighborhoodBranch1.ConditionParameter.ActualName = "EmptyNeighborhood";
     215
    208216      tabuMoveMaker.Name = "TabuMoveMaker (placeholder)";
    209217      tabuMoveMaker.OperatorParameter.ActualName = TabuMoveMakerParameter.Name;
     
    212220      moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;
    213221
    214       subScopesRemover.RemoveAllSubScopes = true;
     222      subScopesRemover1.RemoveAllSubScopes = true;
     223
     224      emptyNeighborhoodBranch2.Name = "Neighborhood empty?";
     225      emptyNeighborhoodBranch2.ConditionParameter.ActualName = "EmptyNeighborhood";
     226
     227      subScopesRemover2.RemoveAllSubScopes = true;
    215228
    216229      iterationsCounter.Name = "Iterations Counter";
     
    254267      resultsCollector.Successor = mainProcessor;
    255268      mainProcessor.Operator = moveGenerator;
    256       mainProcessor.Successor = iterationsCounter;
     269      mainProcessor.Successor = emptyNeighborhoodBranch2;
    257270      moveGenerator.Successor = moveEvaluationProcessor;
    258271      moveEvaluationProcessor.Operator = moveEvaluator;
     
    263276      bestAverageWorstMoveQualityCalculator.Successor = valuesCollector;
    264277      valuesCollector.Successor = tabuSelector;
    265       tabuSelector.Successor = rightReducer;
     278      tabuSelector.Successor = emptyNeighborhoodBranch1;
     279      emptyNeighborhoodBranch1.FalseBranch = rightReducer;
     280      emptyNeighborhoodBranch1.TrueBranch = null;
     281      emptyNeighborhoodBranch1.Successor = null;
    266282      rightReducer.Successor = moveMakingProcessor;
    267283      moveMakingProcessor.Operator = tabuMoveMaker;
    268       moveMakingProcessor.Successor = subScopesRemover;
     284      moveMakingProcessor.Successor = subScopesRemover1;
    269285      tabuMoveMaker.Successor = moveMaker;
    270286      moveMaker.Successor = null;
    271       subScopesRemover.Successor = null;
     287      subScopesRemover1.Successor = null;
     288      emptyNeighborhoodBranch2.FalseBranch = iterationsCounter;
     289      emptyNeighborhoodBranch2.TrueBranch = removeMoves;
     290      emptyNeighborhoodBranch2.Successor = null;
     291      removeMoves.Operator = subScopesRemover2;
     292      removeMoves.Successor = null;
     293      subScopesRemover2.Successor = null;
    272294      iterationsCounter.Successor = iterationsComparator;
    273295      iterationsComparator.Successor = bestQualityMemorizer3;
Note: See TracChangeset for help on using the changeset viewer.