Changeset 3809 for trunk/sources/HeuristicLab.Algorithms.LocalSearch
- Timestamp:
- 05/14/10 17:47:49 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs
r3750 r3809 72 72 get { return (ValueParameter<IntValue>)Parameters["SampleSize"]; } 73 73 } 74 private ValueParameter<MultiAnalyzer> MoveAnalyzerParameter {75 get { return (ValueParameter<MultiAnalyzer>)Parameters["MoveAnalyzer"]; }76 }77 74 private ValueParameter<MultiAnalyzer> AnalyzerParameter { 78 75 get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; } … … 108 105 get { return SampleSizeParameter.Value; } 109 106 set { SampleSizeParameter.Value = value; } 110 }111 public MultiAnalyzer MoveAnalyzer {112 get { return MoveAnalyzerParameter.Value; }113 set { MoveAnalyzerParameter.Value = value; }114 107 } 115 108 public MultiAnalyzer Analyzer { … … 141 134 Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000))); 142 135 Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(100))); 143 Parameters.Add(new ValueParameter<MultiAnalyzer>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer())); 144 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer())); 136 Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution and moves.", new MultiAnalyzer())); 145 137 146 138 RandomCreator randomCreator = new RandomCreator(); … … 165 157 lsMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 166 158 lsMainLoop.ResultsParameter.ActualName = "Results"; 167 lsMainLoop.MoveAnalyzerParameter.ActualName = MoveAnalyzerParameter.Name;168 159 lsMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 169 160 … … 318 309 private void UpdateAnalyzers() { 319 310 Analyzer.Operators.Clear(); 320 MoveAnalyzer.Operators.Clear();321 MoveAnalyzer.Operators.Add(moveQualityAnalyzer);322 311 if (Problem != null) { 323 312 foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name)) { … … 327 316 } 328 317 } 318 Analyzer.Operators.Add(moveQualityAnalyzer); 329 319 } 330 320 private void ClearMoveParameters() { -
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs
r3750 r3809 68 68 get { return (ValueLookupParameter<IOperator>)Parameters["MoveMaker"]; } 69 69 } 70 public ValueLookupParameter<IOperator> MoveAnalyzerParameter {71 get { return (ValueLookupParameter<IOperator>)Parameters["MoveAnalyzer"]; }72 }73 70 public ValueLookupParameter<IOperator> AnalyzerParameter { 74 71 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } … … 104 101 Parameters.Add(new ValueLookupParameter<IOperator>("MoveEvaluator", "The operator that evaluates a move.")); 105 102 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.")); 103 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution and moves.")); 108 104 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied.")); 109 105 #endregion … … 123 119 Placeholder moveAnalyzer = new Placeholder(); 124 120 BestSelector bestSelector = new BestSelector(); 125 RightReducer rightReducer = new RightReducer();126 121 SubScopesProcessor moveMakingProcessor = new SubScopesProcessor(); 122 UniformSubScopesProcessor selectedMoveMakingProcessor = new UniformSubScopesProcessor(); 127 123 QualityComparator qualityComparator = new QualityComparator(); 128 124 ConditionalBranch improvesQualityBranch = new ConditionalBranch(); 129 125 Placeholder moveMaker = new Placeholder(); 130 126 Assigner bestQualityUpdater = new Assigner(); 127 MergingReducer mergingReducer = new MergingReducer(); 128 Placeholder analyzer2 = new Placeholder(); 131 129 SubScopesRemover subScopesRemover = new SubScopesRemover(); 132 130 IntCounter iterationsCounter = new IntCounter(); 133 131 Comparator iterationsComparator = new Comparator(); 134 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();135 Placeholder analyzer2 = new Placeholder();136 132 ResultsCollector resultsCollector3 = new ResultsCollector(); 137 133 ConditionalBranch iterationsTermination = new ConditionalBranch(); … … 167 163 evaluatedMovesCounter.Increment = new IntValue(1); 168 164 169 moveAnalyzer.Name = "MoveAnalyzer (placeholder)";170 moveAnalyzer.OperatorParameter.ActualName = MoveAnalyzerParameter.Name;171 172 165 bestSelector.CopySelected = new BoolValue(false); 173 166 bestSelector.MaximizationParameter.ActualName = MaximizationParameter.Name; … … 187 180 bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality"; 188 181 bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name; 182 183 analyzer2.Name = "Analyzer (placeholder)"; 184 analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name; 189 185 190 186 subScopesRemover.RemoveAllSubScopes = true; … … 199 195 iterationsComparator.RightSideParameter.ActualName = MaximumIterationsParameter.Name; 200 196 iterationsComparator.ResultParameter.ActualName = "Terminate"; 201 202 analyzer2.Name = "Analyzer (placeholder)";203 analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;204 197 205 198 resultsCollector3.CopyValue = new BoolValue(true); … … 228 221 evaluatedMovesCounter.Successor = null; 229 222 moveAnalyzer.Successor = bestSelector; 230 bestSelector.Successor = rightReducer;231 rightReducer.Successor = moveMakingProcessor;232 moveMakingProcessor.Operators.Add( qualityComparator);233 moveMakingProcessor.Successor = subScopesRemover;234 s ubScopesRemover.Successor = null;223 bestSelector.Successor = moveMakingProcessor; 224 moveMakingProcessor.Operators.Add(new EmptyOperator()); 225 moveMakingProcessor.Operators.Add(selectedMoveMakingProcessor); 226 moveMakingProcessor.Successor = mergingReducer; 227 selectedMoveMakingProcessor.Operator = qualityComparator; 235 228 qualityComparator.Successor = improvesQualityBranch; 236 229 improvesQualityBranch.TrueBranch = moveMaker; … … 239 232 moveMaker.Successor = bestQualityUpdater; 240 233 bestQualityUpdater.Successor = null; 234 mergingReducer.Successor = analyzer2; 235 analyzer2.Successor = subScopesRemover; 236 subScopesRemover.Successor = null; 241 237 iterationsCounter.Successor = iterationsComparator; 242 iterationsComparator.Successor = subScopesProcessor1; 243 subScopesProcessor1.Operators.Add(analyzer2); 244 subScopesProcessor1.Successor = resultsCollector3; 245 analyzer2.Successor = null; 238 iterationsComparator.Successor = resultsCollector3; 246 239 resultsCollector3.Successor = iterationsTermination; 247 240 iterationsTermination.TrueBranch = null;
Note: See TracChangeset
for help on using the changeset viewer.