- Timestamp:
- 05/05/10 14:52:19 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs
r3626 r3636 140 140 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000))); 141 141 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>())); 144 144 145 145 RandomCreator randomCreator = new RandomCreator(); … … 229 229 ParameterizeMoveEvaluators(); 230 230 ParameterizeMoveMakers(); 231 ParameterizeAnalyzers(); 231 232 base.Problem_OperatorsChanged(sender, e); 232 233 } -
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs
r3621 r3636 104 104 Parameters.Add(new ValueLookupParameter<IOperator>("MoveEvaluator", "The operator that evaluates a move.")); 105 105 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.")); 108 108 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied.")); 109 109 #endregion … … 111 111 #region Create operators 112 112 VariableCreator variableCreator = new VariableCreator(); 113 SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor(); 114 Assigner bestQualityInitializer = new Assigner(); 115 Placeholder analyzer1 = new Placeholder(); 113 116 ResultsCollector resultsCollector1 = new ResultsCollector(); 114 UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor(); 115 Placeholder analyzer1 = new Placeholder(); 116 UniformSubScopesProcessor mainProcessor = new UniformSubScopesProcessor(); 117 SubScopesProcessor mainProcessor = new SubScopesProcessor(); 117 118 Placeholder moveGenerator = new Placeholder(); 118 119 UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor(); 119 120 Placeholder moveEvaluator = new Placeholder(); 121 IntCounter evaluatedMovesCounter = new IntCounter(); 120 122 Placeholder moveAnalyzer = new Placeholder(); 121 123 BestSelector bestSelector = new BestSelector(); 122 124 RightReducer rightReducer = new RightReducer(); 123 UniformSubScopesProcessor moveMakingProcessor = new UniformSubScopesProcessor();125 SubScopesProcessor moveMakingProcessor = new SubScopesProcessor(); 124 126 QualityComparator qualityComparator = new QualityComparator(); 125 127 ConditionalBranch improvesQualityBranch = new ConditionalBranch(); 126 128 Placeholder moveMaker = new Placeholder(); 129 Assigner bestQualityUpdater = new Assigner(); 127 130 SubScopesRemover subScopesRemover = new SubScopesRemover(); 128 131 IntCounter iterationsCounter = new IntCounter(); 129 132 Comparator iterationsComparator = new Comparator(); 133 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); 134 Placeholder analyzer2 = new Placeholder(); 130 135 ResultsCollector resultsCollector2 = new ResultsCollector(); 131 UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();132 Placeholder analyzer2 = new Placeholder();133 136 ConditionalBranch iterationsTermination = new ConditionalBranch(); 134 137 135 138 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; 139 145 140 146 analyzer1.Name = "Analyzer (placeholder)"; 141 147 analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name; 142 148 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; 144 153 145 154 moveGenerator.Name = "MoveGenerator (placeholder)"; … … 148 157 moveEvaluator.Name = "MoveEvaluator (placeholder)"; 149 158 moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name; 159 160 evaluatedMovesCounter.Name = "EvaluatedMoves + 1"; 161 evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves"; 162 evaluatedMovesCounter.Increment = new IntValue(1); 150 163 151 164 moveAnalyzer.Name = "MoveAnalyzer (placeholder)"; … … 157 170 bestSelector.QualityParameter.ActualName = MoveQualityParameter.Name; 158 171 159 moveMakingProcessor.Name = "MoveMaking processor (UniformSubScopesProcessor)";160 161 172 qualityComparator.LeftSideParameter.ActualName = MoveQualityParameter.Name; 162 173 qualityComparator.RightSideParameter.ActualName = QualityParameter.Name; … … 167 178 moveMaker.Name = "MoveMaker (placeholder)"; 168 179 moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name; 180 181 bestQualityUpdater.Name = "Update BestQuality"; 182 bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality"; 183 bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name; 169 184 170 185 subScopesRemover.RemoveAllSubScopes = true; … … 180 195 iterationsComparator.ResultParameter.ActualName = "Terminate"; 181 196 182 resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));183 resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;184 185 197 analyzer2.Name = "Analyzer (placeholder)"; 186 198 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; 187 204 188 205 iterationsTermination.Name = "Iterations Termination Condition"; … … 192 209 #region Create operator graph 193 210 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; 198 215 analyzer1.Successor = null; 199 mainProcessor.Operator = moveGenerator; 216 resultsCollector1.Successor = mainProcessor; 217 mainProcessor.Operators.Add(moveGenerator); 200 218 mainProcessor.Successor = iterationsCounter; 201 219 moveGenerator.Successor = moveEvaluationProcessor; 202 220 moveEvaluationProcessor.Operator = moveEvaluator; 203 221 moveEvaluationProcessor.Successor = moveAnalyzer; 222 moveEvaluator.Successor = evaluatedMovesCounter; 223 evaluatedMovesCounter.Successor = null; 204 224 moveAnalyzer.Successor = bestSelector; 205 225 bestSelector.Successor = rightReducer; 206 226 rightReducer.Successor = moveMakingProcessor; 207 moveMakingProcessor.Operator = qualityComparator;227 moveMakingProcessor.Operators.Add(qualityComparator); 208 228 moveMakingProcessor.Successor = subScopesRemover; 209 229 subScopesRemover.Successor = null; … … 212 232 improvesQualityBranch.FalseBranch = null; 213 233 improvesQualityBranch.Successor = null; 214 moveMaker.Successor = null; 234 moveMaker.Successor = bestQualityUpdater; 235 bestQualityUpdater.Successor = null; 215 236 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; 220 240 analyzer2.Successor = null; 241 resultsCollector2.Successor = iterationsTermination; 221 242 iterationsTermination.TrueBranch = null; 222 243 iterationsTermination.FalseBranch = mainProcessor; -
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/HeuristicLab.Algorithms.TabuSearch-3.3.csproj
r3384 r3636 86 86 <SubType>Code</SubType> 87 87 </Compile> 88 <Compile Include="TabuNeighborhoodAnalyzer.cs" /> 88 89 <Compile Include="TabuSelector.cs"> 89 90 <SubType>Code</SubType> -
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r3616 r3636 33 33 using HeuristicLab.PluginInfrastructure; 34 34 using HeuristicLab.Random; 35 using HeuristicLab.Analysis; 35 36 36 37 namespace HeuristicLab.Algorithms.TabuSearch { … … 80 81 get { return (ValueParameter<IntValue>)Parameters["SampleSize"]; } 81 82 } 83 private ValueParameter<MultiAnalyzer<IPopulationAnalyzer>> MoveAnalyzerParameter { 84 get { return (ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>)Parameters["MoveAnalyzer"]; } 85 } 86 private ValueParameter<MultiAnalyzer<ISolutionAnalyzer>> AnalyzerParameter { 87 get { return (ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>)Parameters["Analyzer"]; } 88 } 82 89 #endregion 83 90 … … 119 126 set { MaximumIterationsParameter.Value = value; } 120 127 } 128 public MultiAnalyzer<IPopulationAnalyzer> MoveAnalyzer { 129 get { return MoveAnalyzerParameter.Value; } 130 set { MoveAnalyzerParameter.Value = value; } 131 } 132 public MultiAnalyzer<ISolutionAnalyzer> Analyzer { 133 get { return AnalyzerParameter.Value; } 134 set { AnalyzerParameter.Value = value; } 135 } 121 136 private RandomCreator RandomCreator { 122 137 get { return (RandomCreator)OperatorGraph.InitialOperator; } … … 128 143 get { return (TabuSearchMainLoop)SolutionsCreator.Successor; } 129 144 } 145 private PopulationBestAverageWorstQualityAnalyzer moveQualityAnalyzer; 146 private TabuNeighborhoodAnalyzer tabuNeighborhoodAnalyzer; 130 147 #endregion 131 148 … … 142 159 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000))); 143 160 Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The neighborhood size for stochastic sampling move generators", new IntValue(100))); 144 161 Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer<IPopulationAnalyzer>())); 162 Parameters.Add(new ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer<ISolutionAnalyzer>())); 163 145 164 RandomCreator randomCreator = new RandomCreator(); 146 165 SolutionsCreator solutionsCreator = new SolutionsCreator(); … … 166 185 tsMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 167 186 tsMainLoop.ResultsParameter.ActualName = "Results"; 187 tsMainLoop.MoveAnalyzerParameter.ActualName = MoveAnalyzerParameter.Name; 188 tsMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 168 189 169 190 Initialize(); … … 199 220 UpdateMoveGenerator(); 200 221 UpdateMoveParameters(); 222 UpdateAnalyzers(); 201 223 ParameterizeMoveGenerators(); 202 224 ParameterizeMoveEvaluator(); … … 204 226 ParameterizeTabuMaker(); 205 227 ParameterizeTabuChecker(); 228 ParameterizeAnalyzers(); 206 229 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 207 230 base.OnProblemChanged(); … … 220 243 ParameterizeTabuMaker(); 221 244 ParameterizeTabuChecker(); 245 ParameterizeAnalyzers(); 222 246 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); 223 247 base.Problem_EvaluatorChanged(sender, e); … … 237 261 UpdateMoveGenerator(); 238 262 UpdateMoveParameters(); 263 UpdateAnalyzers(); 239 264 ParameterizeMainLoop(); 240 265 ParameterizeMoveGenerators(); … … 243 268 ParameterizeTabuMaker(); 244 269 ParameterizeTabuChecker(); 270 ParameterizeAnalyzers(); 245 271 base.Problem_OperatorsChanged(sender, e); 246 272 } … … 261 287 ParameterizeTabuMaker(); 262 288 ParameterizeTabuChecker(); 289 ParameterizeAnalyzers(); 263 290 } 264 291 private void MoveEvaluator_MoveQualityParameter_ActualNameChanged(object sender, EventArgs e) { … … 268 295 ParameterizeTabuMaker(); 269 296 ParameterizeTabuChecker(); 297 ParameterizeAnalyzers(); 270 298 } 271 299 private void TabuCheckerParameter_ValueChanged(object sender, EventArgs e) { 272 300 ParameterizeMainLoop(); 301 ParameterizeAnalyzers(); 273 302 } 274 303 private void TabuChecker_MoveTabuParameter_ActualNameChanged(object sender, EventArgs e) { 275 304 ParameterizeMainLoop(); 305 ParameterizeAnalyzers(); 276 306 } 277 307 private void SampleSizeParameter_NameChanged(object sender, EventArgs e) { … … 283 313 [StorableHook(HookType.AfterDeserialization)] 284 314 private void Initialize() { 315 InitializeAnalyzers(); 316 UpdateAnalyzers(); 285 317 if (Problem != null) { 286 318 Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); … … 293 325 TabuCheckerParameter.ValueChanged += new EventHandler(TabuCheckerParameter_ValueChanged); 294 326 SampleSizeParameter.NameChanged += new EventHandler(SampleSizeParameter_NameChanged); 327 } 328 private void InitializeAnalyzers() { 329 moveQualityAnalyzer = new PopulationBestAverageWorstQualityAnalyzer(); 330 tabuNeighborhoodAnalyzer = new TabuNeighborhoodAnalyzer(); 331 ParameterizeAnalyzers(); 295 332 } 296 333 private void UpdateMoveGenerator() { … … 349 386 } 350 387 } 388 private void UpdateAnalyzers() { 389 Analyzer.Operators.Clear(); 390 MoveAnalyzer.Operators.Clear(); 391 MoveAnalyzer.Operators.Add(moveQualityAnalyzer); 392 MoveAnalyzer.Operators.Add(tabuNeighborhoodAnalyzer); 393 if (Problem != null) { 394 foreach (ISolutionAnalyzer analyzer in Problem.Operators.OfType<ISolutionAnalyzer>().OrderBy(x => x.Name)) 395 Analyzer.Operators.Add(analyzer); 396 } 397 } 351 398 private void ClearMoveParameters() { 352 399 MoveMakerParameter.ValidValues.Clear(); … … 405 452 } 406 453 } 454 private void ParameterizeAnalyzers() { 455 moveQualityAnalyzer.ResultsParameter.ActualName = "Results"; 456 tabuNeighborhoodAnalyzer.ResultsParameter.ActualName = "Results"; 457 tabuNeighborhoodAnalyzer.PercentTabuParameter.ActualName = "PercentTabu"; 458 if (Problem != null) { 459 moveQualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name; 460 if (MoveEvaluator != null) 461 moveQualityAnalyzer.QualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName; 462 moveQualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name; 463 if (TabuChecker != null) 464 tabuNeighborhoodAnalyzer.IsTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName; 465 } 466 } 407 467 #endregion 408 468 } -
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearchMainLoop.cs
r3521 r3636 77 77 get { return (ValueLookupParameter<IOperator>)Parameters["TabuMaker"]; } 78 78 } 79 public ValueLookupParameter<IOperator> VisualizerParameter {80 get { return (ValueLookupParameter<IOperator>)Parameters[" Visualizer"]; }81 } 82 public LookupParameter<IItem> VisualizationParameter {83 get { return ( LookupParameter<IItem>)Parameters["Visualization"]; }79 public ValueLookupParameter<IOperator> MoveAnalyzerParameter { 80 get { return (ValueLookupParameter<IOperator>)Parameters["MoveAnalyzer"]; } 81 } 82 public ValueLookupParameter<IOperator> AnalyzerParameter { 83 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } 84 84 } 85 85 public ValueLookupParameter<VariableCollection> ResultsParameter { … … 112 112 Parameters.Add(new ValueLookupParameter<IOperator>("TabuMaker", "The operator that declares a move tabu.")); 113 113 114 Parameters.Add(new ValueLookupParameter<IOperator>(" Visualizer", "The operator used to visualize solutions."));115 Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));114 Parameters.Add(new ValueLookupParameter<IOperator>("MoveAnalyzer", "The operator used to analyze the moves.")); 115 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution.")); 116 116 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored.")); 117 117 #endregion 118 118 119 119 #region Create operators 120 TabuListCreator tabuListCreator = new TabuListCreator();121 120 VariableCreator variableCreator = new VariableCreator(); 122 BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer(); 123 BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer(); 124 QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator(); 125 Placeholder visualizer1 = new Placeholder(); 126 ResultsCollector resultsCollector = new ResultsCollector(); 121 SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor(); 122 Assigner bestQualityInitializer = new Assigner(); 123 Placeholder analyzer1 = new Placeholder(); 124 ResultsCollector resultsCollector1 = new ResultsCollector(); 127 125 SubScopesProcessor solutionProcessor = new SubScopesProcessor(); 128 126 Placeholder moveGenerator = new Placeholder(); 129 127 UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor(); 130 128 Placeholder moveEvaluator = new Placeholder(); 129 IntCounter evaluatedMovesCounter = new IntCounter(); 131 130 Placeholder tabuChecker = new Placeholder(); 131 Placeholder moveAnalyzer = new Placeholder(); 132 132 SubScopesSorter moveQualitySorter = new SubScopesSorter(); 133 BestAverageWorstQualityCalculator bestAverageWorstMoveQualityCalculator = new BestAverageWorstQualityCalculator();134 133 TabuSelector tabuSelector = new TabuSelector(); 135 134 ConditionalBranch emptyNeighborhoodBranch1 = new ConditionalBranch(); … … 140 139 SubScopesRemover subScopesRemover = new SubScopesRemover(); 141 140 ConditionalBranch emptyNeighborhoodBranch2 = new ConditionalBranch(); 141 BestQualityMemorizer bestQualityUpdater = new BestQualityMemorizer(); 142 142 IntCounter iterationsCounter = new IntCounter(); 143 143 Comparator iterationsComparator = new Comparator(); 144 BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer(); 145 BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer(); 146 QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator(); 147 Placeholder visualizer2 = new Placeholder(); 148 DataTableValuesCollector valuesCollector = new DataTableValuesCollector(); 144 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); 145 Placeholder analyzer2 = new Placeholder(); 146 ResultsCollector resultsCollector2 = new ResultsCollector(); 149 147 ConditionalBranch iterationsTermination = new ConditionalBranch(); 150 148 151 149 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); 152 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Best Move Quality", new DoubleValue(0))); 153 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Average Move Quality", new DoubleValue(0))); 154 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Worst Move Quality", new DoubleValue(0))); 150 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue(0))); 155 151 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."))); 157 158 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; 159 bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name; 160 bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name; 161 162 bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 163 bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name; 164 bestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name; 165 166 qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 167 qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 168 qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 169 qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality"; 170 171 visualizer1.Name = "Visualizer (placeholder)"; 172 visualizer1.OperatorParameter.ActualName = VisualizerParameter.Name; 152 variableCreator.CollectedValues.Add(new ValueParameter<ItemList<IItem>>("TabuList", new ItemList<IItem>())); 153 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0))); 154 155 bestQualityInitializer.Name = "Initialize BestQuality"; 156 bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality"; 157 bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name; 158 159 analyzer1.Name = "Analyzer (placeholder)"; 160 analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name; 173 161 174 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 175 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 176 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Move Quality")); 177 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Move Quality")); 178 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Worst Move Quality")); 179 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("MoveQualities")); 180 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name)); 181 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest")); 182 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest")); 183 resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, VisualizationParameter.Name)); 184 resultsCollector.ResultsParameter.ActualName = "Results"; 162 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 163 resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 164 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves")); 165 resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name; 185 166 186 167 moveGenerator.Name = "MoveGenerator (placeholder)"; … … 190 171 moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name; 191 172 173 evaluatedMovesCounter.Name = "EvaluatedMoves + 1"; 174 evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves"; 175 evaluatedMovesCounter.Increment = new IntValue(1); 176 192 177 tabuChecker.Name = "TabuChecker (placeholder)"; 193 178 tabuChecker.OperatorParameter.ActualName = TabuCheckerParameter.Name; 194 179 180 moveAnalyzer.Name = "MoveAnalyzer (placeholder)"; 181 moveAnalyzer.OperatorParameter.ActualName = MoveAnalyzerParameter.Name; 182 195 183 moveQualitySorter.DescendingParameter.ActualName = MaximizationParameter.Name; 196 184 moveQualitySorter.ValueParameter.ActualName = MoveQualityParameter.Name; 197 198 bestAverageWorstMoveQualityCalculator.AverageQualityParameter.ActualName = "Average Move Quality";199 bestAverageWorstMoveQualityCalculator.BestQualityParameter.ActualName = "Best Move Quality";200 bestAverageWorstMoveQualityCalculator.MaximizationParameter.ActualName = "Maximization";201 bestAverageWorstMoveQualityCalculator.QualityParameter.ActualName = MoveQualityParameter.Name;202 bestAverageWorstMoveQualityCalculator.WorstQualityParameter.ActualName = "Worst Move Quality";203 185 204 186 tabuSelector.AspirationParameter.Value = new BoolValue(true); … … 223 205 subScopesRemover.RemoveAllSubScopes = true; 224 206 207 bestQualityUpdater.Name = "Update BestQuality"; 208 bestQualityUpdater.MaximizationParameter.ActualName = MaximizationParameter.Name; 209 bestQualityUpdater.QualityParameter.ActualName = QualityParameter.Name; 210 bestQualityUpdater.BestQualityParameter.ActualName = "BestQuality"; 211 225 212 iterationsCounter.Name = "Iterations Counter"; 226 213 iterationsCounter.Increment = new IntValue(1); … … 233 220 iterationsComparator.ResultParameter.ActualName = "Terminate"; 234 221 235 bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality"; 236 bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name; 237 bestQualityMemorizer3.QualityParameter.ActualName = QualityParameter.Name; 238 239 bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 240 bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name; 241 bestQualityMemorizer4.QualityParameter.ActualName = QualityParameter.Name; 242 243 qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest"; 244 qualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 245 qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest"; 246 qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality"; 247 248 visualizer2.Name = "Visualizer (placeholder)"; 249 visualizer2.OperatorParameter.ActualName = VisualizerParameter.Name; 222 analyzer2.Name = "Analyzer (placeholder)"; 223 analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name; 250 224 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"; 225 resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 226 resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 227 resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves")); 228 resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name; 257 229 258 230 emptyNeighborhoodBranch2.Name = "Neighborhood empty?"; … … 264 236 265 237 #region Create operator graph 266 OperatorGraph.InitialOperator = tabuListCreator; 267 tabuListCreator.Successor = variableCreator; 268 variableCreator.Successor = bestQualityMemorizer1; 269 bestQualityMemorizer1.Successor = bestQualityMemorizer2; 270 bestQualityMemorizer2.Successor = qualityDifferenceCalculator1; 271 qualityDifferenceCalculator1.Successor = visualizer1; 272 visualizer1.Successor = resultsCollector; 273 resultsCollector.Successor = solutionProcessor; 238 OperatorGraph.InitialOperator = variableCreator; 239 variableCreator.Successor = subScopesProcessor0; 240 subScopesProcessor0.Operators.Add(bestQualityInitializer); 241 subScopesProcessor0.Successor = resultsCollector1; 242 resultsCollector1.Successor = solutionProcessor; 274 243 solutionProcessor.Operators.Add(moveGenerator); 275 244 solutionProcessor.Successor = iterationsCounter; 276 245 moveGenerator.Successor = moveEvaluationProcessor; 277 246 moveEvaluationProcessor.Operator = moveEvaluator; 278 moveEvaluationProcessor.Successor = moveQualitySorter; 279 moveEvaluator.Successor = tabuChecker; 247 moveEvaluationProcessor.Successor = moveAnalyzer; 248 moveEvaluator.Successor = evaluatedMovesCounter; 249 evaluatedMovesCounter.Successor = tabuChecker; 280 250 tabuChecker.Successor = null; 281 move QualitySorter.Successor = bestAverageWorstMoveQualityCalculator;282 bestAverageWorstMoveQualityCalculator.Successor = tabuSelector;251 moveAnalyzer.Successor = moveQualitySorter; 252 moveQualitySorter.Successor = tabuSelector; 283 253 tabuSelector.Successor = emptyNeighborhoodBranch1; 284 254 emptyNeighborhoodBranch1.FalseBranch = rightReducer; … … 292 262 subScopesRemover.Successor = null; 293 263 iterationsCounter.Successor = iterationsComparator; 294 iterationsComparator.Successor = bestQualityMemorizer3; 295 bestQualityMemorizer3.Successor = bestQualityMemorizer4; 296 bestQualityMemorizer4.Successor = qualityDifferenceCalculator2; 297 qualityDifferenceCalculator2.Successor = visualizer2; 298 visualizer2.Successor = valuesCollector; 299 valuesCollector.Successor = emptyNeighborhoodBranch2; 264 iterationsComparator.Successor = subScopesProcessor1; 265 subScopesProcessor1.Operators.Add(analyzer2); 266 subScopesProcessor1.Successor = resultsCollector2; 267 resultsCollector2.Successor = emptyNeighborhoodBranch2; 300 268 emptyNeighborhoodBranch2.TrueBranch = null; 301 269 emptyNeighborhoodBranch2.FalseBranch = iterationsTermination;
Note: See TracChangeset
for help on using the changeset viewer.