Changeset 3195
- Timestamp:
- 03/23/10 01:48:44 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearchMainLoop.cs
r3193 r3195 131 131 BestAverageWorstQualityCalculator bestAverageWorstMoveQualityCalculator = new BestAverageWorstQualityCalculator(); 132 132 TabuSelector tabuSelector = new TabuSelector(); 133 ConditionalBranch emptyNeighborhoodBranch1 = new ConditionalBranch(); 133 134 RightReducer rightReducer = new RightReducer(); 134 135 UniformSubScopesProcessor moveMakingProcessor = new UniformSubScopesProcessor(); … … 136 137 Placeholder moveMaker = new Placeholder(); 137 138 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(); 139 143 IntCounter iterationsCounter = new IntCounter(); 140 144 Comparator iterationsComparator = new Comparator(); … … 150 154 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Worst Move Quality", new DoubleValue(0))); 151 155 variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("MoveQualities", new DataTable("MoveQualities"))); 156 variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("EmptyNeighborhood", new BoolValue(false))); 152 157 153 158 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; … … 206 211 moveMakingProcessor.Name = "MoveMaking processor (UniformSubScopesProcessor)"; 207 212 213 emptyNeighborhoodBranch1.Name = "Neighborhood empty?"; 214 emptyNeighborhoodBranch1.ConditionParameter.ActualName = "EmptyNeighborhood"; 215 208 216 tabuMoveMaker.Name = "TabuMoveMaker (placeholder)"; 209 217 tabuMoveMaker.OperatorParameter.ActualName = TabuMoveMakerParameter.Name; … … 212 220 moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name; 213 221 214 subScopesRemover.RemoveAllSubScopes = true; 222 subScopesRemover1.RemoveAllSubScopes = true; 223 224 emptyNeighborhoodBranch2.Name = "Neighborhood empty?"; 225 emptyNeighborhoodBranch2.ConditionParameter.ActualName = "EmptyNeighborhood"; 226 227 subScopesRemover2.RemoveAllSubScopes = true; 215 228 216 229 iterationsCounter.Name = "Iterations Counter"; … … 254 267 resultsCollector.Successor = mainProcessor; 255 268 mainProcessor.Operator = moveGenerator; 256 mainProcessor.Successor = iterationsCounter;269 mainProcessor.Successor = emptyNeighborhoodBranch2; 257 270 moveGenerator.Successor = moveEvaluationProcessor; 258 271 moveEvaluationProcessor.Operator = moveEvaluator; … … 263 276 bestAverageWorstMoveQualityCalculator.Successor = valuesCollector; 264 277 valuesCollector.Successor = tabuSelector; 265 tabuSelector.Successor = rightReducer; 278 tabuSelector.Successor = emptyNeighborhoodBranch1; 279 emptyNeighborhoodBranch1.FalseBranch = rightReducer; 280 emptyNeighborhoodBranch1.TrueBranch = null; 281 emptyNeighborhoodBranch1.Successor = null; 266 282 rightReducer.Successor = moveMakingProcessor; 267 283 moveMakingProcessor.Operator = tabuMoveMaker; 268 moveMakingProcessor.Successor = subScopesRemover ;284 moveMakingProcessor.Successor = subScopesRemover1; 269 285 tabuMoveMaker.Successor = moveMaker; 270 286 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; 272 294 iterationsCounter.Successor = iterationsComparator; 273 295 iterationsComparator.Successor = bestQualityMemorizer3; -
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSelector.cs
r3140 r3195 72 72 get { return (IValueLookupParameter<BoolValue>)Parameters["CopySelected"]; } 73 73 } 74 public ILookupParameter<BoolValue> EmptyNeighborhoodParameter { 75 get { return (ILookupParameter<BoolValue>)Parameters["EmptyNeighborhood"]; } 76 } 74 77 75 78 public BoolValue CopySelected { … … 90 93 Parameters.Add(new SubScopesLookupParameter<BoolValue>("MoveTabu", "The tabu status of the move.")); 91 94 Parameters.Add(new ValueLookupParameter<BoolValue>("CopySelected", "True if the selected move should be copied.", new BoolValue(false))); 95 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.")); 92 96 } 93 97 … … 120 124 } 121 125 122 if (selected[0] == null) throw new InvalidOperationException("TabuSelector: The neighborhood contained no or too little moves that are not tabu."); 126 if (selected[0] == null) { 127 EmptyNeighborhoodParameter.ActualValue = new BoolValue(true); 128 selected[0] = new Scope("All moves are tabu."); 129 } 123 130 124 131 // remove from last to first so that the stored indices remain the same
Note: See TracChangeset
for help on using the changeset viewer.