Changeset 5356 for trunk/sources/HeuristicLab.Algorithms.LocalSearch
- Timestamp:
- 01/22/11 15:18:20 (14 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
r4722 r5356 27 27 using HeuristicLab.Core; 28 28 using HeuristicLab.Data; 29 using HeuristicLab.Operators; 29 30 using HeuristicLab.Optimization; 30 31 using HeuristicLab.Optimization.Operators; … … 117 118 } 118 119 private LocalSearchMainLoop MainLoop { 119 get { return (LocalSearchMainLoop)SolutionsCreator.Successor; } 120 get { 121 return (LocalSearchMainLoop)( 122 (ResultsCollector)( 123 (VariableCreator)SolutionsCreator.Successor 124 ).Successor 125 ).Successor; 126 } 120 127 } 121 128 [Storable] … … 150 157 RandomCreator randomCreator = new RandomCreator(); 151 158 SolutionsCreator solutionsCreator = new SolutionsCreator(); 152 LocalSearchMainLoop lsMainLoop = new LocalSearchMainLoop(); 159 VariableCreator variableCreator = new VariableCreator(); 160 ResultsCollector resultsCollector = new ResultsCollector(); 161 LocalSearchMainLoop mainLoop = new LocalSearchMainLoop(); 153 162 OperatorGraph.InitialOperator = randomCreator; 154 163 … … 161 170 162 171 solutionsCreator.NumberOfSolutions = new IntValue(1); 163 solutionsCreator.Successor = lsMainLoop; 164 165 lsMainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name; 166 lsMainLoop.MoveMakerParameter.ActualName = MoveMakerParameter.Name; 167 lsMainLoop.MoveEvaluatorParameter.ActualName = MoveEvaluatorParameter.Name; 168 lsMainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; 169 lsMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 170 lsMainLoop.ResultsParameter.ActualName = "Results"; 171 lsMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 172 solutionsCreator.Successor = variableCreator; 173 174 variableCreator.Name = "Initialize EvaluatedMoves"; 175 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue())); 176 variableCreator.Successor = resultsCollector; 177 178 resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves")); 179 resultsCollector.ResultsParameter.ActualName = "Results"; 180 resultsCollector.Successor = mainLoop; 181 182 mainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name; 183 mainLoop.MoveMakerParameter.ActualName = MoveMakerParameter.Name; 184 mainLoop.MoveEvaluatorParameter.ActualName = MoveEvaluatorParameter.Name; 185 mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name; 186 mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName; 187 mainLoop.ResultsParameter.ActualName = "Results"; 188 mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name; 189 mainLoop.EvaluatedMovesParameter.ActualName = "EvaluatedMoves"; 172 190 173 191 moveQualityAnalyzer = new BestAverageWorstQualityAnalyzer(); -
trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs
r5353 r5356 70 70 get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; } 71 71 } 72 73 private ScopeParameter CurrentScopeParameter { 74 get { return (ScopeParameter)Parameters["CurrentScope"]; } 75 } 76 public IScope CurrentScope { 77 get { return CurrentScopeParameter.ActualValue; } 72 public LookupParameter<IntValue> EvaluatedMovesParameter { 73 get { return (LookupParameter<IntValue>)Parameters["EvaluatedMoves"]; } 78 74 } 79 75 #endregion … … 107 103 108 104 Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution and moves.")); 109 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied."));105 Parameters.Add(new LookupParameter<IntValue>("EvaluatedMoves", "The number of evaluated moves.")); 110 106 #endregion 111 107 … … 137 133 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0))); // Class LocalSearch expects this to be called Iterations 138 134 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0))); 139 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue(0)));140 135 141 136 bestQualityInitializer.Name = "Initialize BestQuality"; … … 149 144 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations")); 150 145 resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality")); 151 resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));152 146 resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name; 153 147 … … 161 155 162 156 subScopesCounter.Name = "Increment EvaluatedMoves"; 163 subScopesCounter.ValueParameter.ActualName = "EvaluatedMoves";157 subScopesCounter.ValueParameter.ActualName = EvaluatedMovesParameter.Name; 164 158 165 159 bestSelector.CopySelected = new BoolValue(false);
Note: See TracChangeset
for help on using the changeset viewer.