Changeset 5725 for trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs
- Timestamp:
- 03/17/11 09:12:25 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs
r5683 r5725 40 40 [StorableClass] 41 41 public sealed class SuccessfulOffspringAnalyzer : SingleSuccessorOperator, IAnalyzer { 42 public ValueParameter<StringValue> SuccessfulOffspringFlag {42 public ValueParameter<StringValue> SuccessfulOffspringFlagParameter { 43 43 get { return (ValueParameter<StringValue>)Parameters["SuccessfulOffspringFlag"]; } 44 44 } 45 45 46 public ValueParameter<ItemCollection<StringValue>> CollectedValues {46 public ValueParameter<ItemCollection<StringValue>> CollectedValuesParameter { 47 47 get { return (ValueParameter<ItemCollection<StringValue>>)Parameters["CollectedValues"]; } 48 48 } … … 50 50 public ValueLookupParameter<ResultCollection> ResultsParameter { 51 51 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 52 } 53 54 public LookupParameter<ResultCollection> SuccessfulOffspringAnalysisParameter { 55 get { return (LookupParameter<ResultCollection>)Parameters["SuccessfulOffspringAnalysis"]; } 52 56 } 53 57 … … 71 75 Parameters.Add(new ValueParameter<ItemCollection<StringValue>>("CollectedValues", "The properties of the successful offspring that should be collected.", new ItemCollection<StringValue>())); 72 76 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the succedd progress analysis results should be stored.")); 73 Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations.")); 77 Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations.")); 78 Parameters.Add(new LookupParameter<ResultCollection>("SuccessfulOffspringAnalysis", "The successful offspring analysis which is created.")); 74 79 Parameters.Add(new ValueParameter<IntValue>("Depth", "The depth of the individuals in the scope tree.", new IntValue(1))); 75 80 } … … 82 87 scopes = scopes.Select(x => (IEnumerable<IScope>)x.SubScopes).Aggregate((a, b) => a.Concat(b)).ToList(); 83 88 84 ItemCollection<StringValue> collectedValues = CollectedValues .Value;89 ItemCollection<StringValue> collectedValues = CollectedValuesParameter.Value; 85 90 foreach (StringValue collected in collectedValues) { 86 91 //collect the values of the successful offspring … … 88 93 for (int i = 0; i < scopes.Count; i++) { 89 94 IScope child = scopes[i]; 90 string successfulOffspringFlag = SuccessfulOffspringFlag .Value.Value;95 string successfulOffspringFlag = SuccessfulOffspringFlagParameter.Value.Value; 91 96 if (child.Variables.ContainsKey(collected.Value) && 92 97 child.Variables.ContainsKey(successfulOffspringFlag) && … … 103 108 104 109 //create a data table containing the collected values 110 ResultCollection successfulOffspringAnalysis; 111 112 if (SuccessfulOffspringAnalysisParameter.ActualValue == null) { 113 successfulOffspringAnalysis = new ResultCollection(); 114 SuccessfulOffspringAnalysisParameter.ActualValue = successfulOffspringAnalysis; 115 } else { 116 successfulOffspringAnalysis = SuccessfulOffspringAnalysisParameter.ActualValue; 117 } 118 119 string resultKey = "SuccessfulOffspringAnalyzer Results"; 120 if (!results.ContainsKey(resultKey)) { 121 results.Add(new Result(resultKey, successfulOffspringAnalysis)); 122 } else { 123 results[resultKey].Value = successfulOffspringAnalysis; 124 } 125 105 126 DataTable successProgressAnalysis; 106 string resultKey = "Success Progress " + collected.Value; 107 if (!results.ContainsKey(resultKey)) { 127 if (!successfulOffspringAnalysis.ContainsKey(collected.Value)) { 108 128 successProgressAnalysis = new DataTable(); 109 successProgressAnalysis.Name = "Success Progress Analysis";110 results.Add(new Result(resultKey, successProgressAnalysis));129 successProgressAnalysis.Name = collected.Value; 130 successfulOffspringAnalysis.Add(new Result(collected.Value, successProgressAnalysis)); 111 131 } else { 112 successProgressAnalysis = results[resultKey].Value as DataTable;113 } 132 successProgressAnalysis = successfulOffspringAnalysis[collected.Value].Value as DataTable; 133 } 114 134 115 135 int successfulCount = 0;
Note: See TracChangeset
for help on using the changeset viewer.