Changeset 5356 for trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs
- Timestamp:
- 01/22/11 15:18:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs
r5208 r5356 89 89 public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { 90 90 get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; } 91 } 92 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 93 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 91 94 } 92 95 #endregion … … 126 129 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.")); 127 130 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); 131 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times solutions have been evaluated.")); 128 132 #endregion 129 133 … … 133 137 Placeholder analyzer1 = new Placeholder(); 134 138 ResultsCollector resultsCollector1 = new ResultsCollector(); 135 ResultsCollector resultsCollector2 = new ResultsCollector();136 139 OffspringSelectionGeneticAlgorithmMainOperator mainOperator = new OffspringSelectionGeneticAlgorithmMainOperator(); 137 140 IntCounter generationsCounter = new IntCounter(); … … 141 144 Placeholder comparisonFactorModifier = new Placeholder(); 142 145 Placeholder analyzer2 = new Placeholder(); 143 ResultsCollector resultsCollector3 = new ResultsCollector();144 146 ConditionalBranch conditionalBranch1 = new ConditionalBranch(); 145 147 ConditionalBranch conditionalBranch2 = new ConditionalBranch(); … … 147 149 148 150 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class OffspringSelectionGeneticAlgorithm expects this to be called Generations 149 variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue(0)));150 151 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("SelectionPressure", new DoubleValue(0))); 151 152 variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("CurrentSuccessRatio", new DoubleValue(0))); … … 165 166 resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name; 166 167 167 resultsCollector2.CopyValue = new BoolValue(true);168 resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));169 resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;170 171 168 mainOperator.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; 172 169 mainOperator.CrossoverParameter.ActualName = CrossoverParameter.Name; 173 170 mainOperator.CurrentSuccessRatioParameter.ActualName = "CurrentSuccessRatio"; 174 171 mainOperator.ElitesParameter.ActualName = ElitesParameter.Name; 175 mainOperator.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";172 mainOperator.EvaluatedSolutionsParameter.ActualName = EvaluatedSolutionsParameter.Name; 176 173 mainOperator.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 177 174 mainOperator.MaximizationParameter.ActualName = MaximizationParameter.Name; … … 200 197 201 198 maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual); 202 maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = "EvaluatedSolutions";199 maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = EvaluatedSolutionsParameter.Name; 203 200 maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions"; 204 201 maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions"; … … 209 206 analyzer2.Name = "Analyzer (placeholder)"; 210 207 analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name; 211 212 resultsCollector3.CopyValue = new BoolValue(true);213 resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));214 resultsCollector3.ResultsParameter.ActualName = ResultsParameter.Name;215 208 216 209 conditionalBranch1.Name = "MaximumSelectionPressure reached?"; … … 229 222 comparisonFactorInitializer.Successor = analyzer1; 230 223 analyzer1.Successor = resultsCollector1; 231 resultsCollector1.Successor = resultsCollector2; 232 resultsCollector2.Successor = mainOperator; 224 resultsCollector1.Successor = mainOperator; 233 225 mainOperator.Successor = generationsCounter; 234 226 generationsCounter.Successor = maxGenerationsComparator; … … 237 229 maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier; 238 230 comparisonFactorModifier.Successor = analyzer2; 239 analyzer2.Successor = resultsCollector3; 240 resultsCollector3.Successor = conditionalBranch1; 231 analyzer2.Successor = conditionalBranch1; 241 232 conditionalBranch1.FalseBranch = conditionalBranch2; 242 233 conditionalBranch1.TrueBranch = null;
Note: See TracChangeset
for help on using the changeset viewer.