- Timestamp:
- 09/24/09 11:37:28 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/DefaultStructureIdentificationOperators.cs
r2363 r2385 68 68 individualProc.AddSubOperator(validationEvaluator); 69 69 70 Counter bestValidationSolutionAgeCounter = new Counter(); 71 bestValidationSolutionAgeCounter.Name = "BestSolutionAgeCounter"; 72 bestValidationSolutionAgeCounter.GetVariableInfo("Value").ActualName = "BestValidationSolutionAge"; 73 70 74 BestSolutionStorer solutionStorer = new BestSolutionStorer(); 71 75 solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution"; … … 88 92 89 93 seq.AddSubOperator(subScopesProc); 94 seq.AddSubOperator(bestValidationSolutionAgeCounter); 90 95 seq.AddSubOperator(solutionStorer); 91 96 seq.AddSubOperator(validationQualityCalculator); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/OffspringSelectionGPRegression.cs
r2375 r2385 33 33 using HeuristicLab.DataAnalysis; 34 34 using HeuristicLab.Operators.Programmable; 35 using HeuristicLab.GP.Algorithms; 35 36 36 37 namespace HeuristicLab.GP.StructureIdentification { … … 100 101 get { return GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data; } 101 102 set { GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data = value; } 103 } 104 105 public virtual int MaxBestValidationSolutionAge { 106 get { return GetVariableInjector().GetVariable("MaxBestValidationSolutionAge").GetValue<IntData>().Data; } 107 set { GetVariableInjector().GetVariable("MaxBestValidationSolutionAge").GetValue<IntData>().Data = value; } 102 108 } 103 109 … … 116 122 : base() { 117 123 PunishmentFactor = 10.0; 124 MaxBestValidationSolutionAge = 10; 118 125 } 119 126 … … 160 167 selectionPressureStorer.GetVariableInfo("Output").ActualName = "SelectionPressure"; 161 168 169 ProgrammableOperator resetBestSolutionAge = new ProgrammableOperator(); 170 resetBestSolutionAge.RemoveVariable("Result"); 171 resetBestSolutionAge.AddVariableInfo( 172 new VariableInfo("BestValidationSolutionAge", "Age of best validation solution", typeof(IntData), VariableKind.In | VariableKind.Out)); 173 resetBestSolutionAge.Code = "BestValidationSolutionAge.Data = 0;"; 174 162 175 seq.AddSubOperator(evaluatedSolutionsStorer); 163 176 seq.AddSubOperator(selectionPressureStorer); 177 seq.AddSubOperator(resetBestSolutionAge); 164 178 165 179 op.OperatorGraph.AddOperator(seq); … … 171 185 VariableInjector injector = base.CreateGlobalInjector(); 172 186 injector.AddVariable(new HeuristicLab.Core.Variable("PunishmentFactor", new DoubleData())); 187 injector.AddVariable(new HeuristicLab.Core.Variable("BestValidationSolutionAge", new IntData())); 188 injector.AddVariable(new HeuristicLab.Core.Variable("MaxBestValidationSolutionAge", new IntData())); 173 189 return injector; 174 190 } … … 203 219 } 204 220 221 protected override IOperator CreateTerminationCondition() { 222 CombinedOperator terminationCritertion = new CombinedOperator(); 223 terminationCritertion.Name = "TerminationCondition"; 224 GreaterThanComparator bestSolutionAge = new GreaterThanComparator(); 225 bestSolutionAge.GetVariableInfo("LeftSide").ActualName = "BestValidationSolutionAge"; 226 bestSolutionAge.GetVariableInfo("RightSide").ActualName = "MaxBestValidationSolutionAge"; 227 bestSolutionAge.GetVariableInfo("Result").ActualName = "TerminationCriterion"; 228 229 IOperator combinedTerminationCriterion = AlgorithmBase.CombineTerminationCriterions(base.CreateTerminationCondition(), bestSolutionAge); 230 231 terminationCritertion.OperatorGraph.AddOperator(combinedTerminationCriterion); 232 terminationCritertion.OperatorGraph.InitialOperator = combinedTerminationCriterion; 233 return terminationCritertion; 234 } 235 205 236 protected override IOperator CreatePostProcessingOperator() { 206 237 CombinedOperator op = new CombinedOperator(); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGPRegression.cs
r2375 r2385 32 32 using HeuristicLab.DataAnalysis; 33 33 using HeuristicLab.Operators.Programmable; 34 using HeuristicLab.GP.Algorithms; 34 35 35 36 namespace HeuristicLab.GP.StructureIdentification { … … 101 102 get { return GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data; } 102 103 set { GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data = value; } 104 } 105 106 public virtual int MaxBestValidationSolutionAge { 107 get { return GetVariableInjector().GetVariable("MaxBestValidationSolutionAge").GetValue<IntData>().Data; } 108 set { GetVariableInjector().GetVariable("MaxBestValidationSolutionAge").GetValue<IntData>().Data = value; } 103 109 } 104 110 … … 116 122 public StandardGPRegression() 117 123 : base() { 118 119 124 PunishmentFactor = 10.0; 125 MaxBestValidationSolutionAge = 15; 120 126 } 121 127 … … 156 162 evaluatedSolutionsStorer.Code = "Output.Data = Input.Data;"; 157 163 164 ProgrammableOperator resetBestSolutionAge = new ProgrammableOperator(); 165 resetBestSolutionAge.RemoveVariable("Result"); 166 resetBestSolutionAge.AddVariableInfo( 167 new VariableInfo("BestValidationSolutionAge", "Age of best validation solution", typeof(IntData), VariableKind.In | VariableKind.Out)); 168 resetBestSolutionAge.Code = "BestValidationSolutionAge.Data = 0;"; 169 158 170 seq.AddSubOperator(evaluatedSolutionsStorer); 171 seq.AddSubOperator(resetBestSolutionAge); 159 172 160 173 op.OperatorGraph.AddOperator(seq); … … 167 180 VariableInjector injector = base.CreateGlobalInjector(); 168 181 injector.AddVariable(new HeuristicLab.Core.Variable("PunishmentFactor", new DoubleData())); 182 injector.AddVariable(new HeuristicLab.Core.Variable("BestValidationSolutionAge", new IntData())); 183 injector.AddVariable(new HeuristicLab.Core.Variable("MaxBestValidationSolutionAge", new IntData())); 169 184 return injector; 170 185 } … … 197 212 } 198 213 214 protected override IOperator CreateTerminationCondition() { 215 CombinedOperator terminationCritertion = new CombinedOperator(); 216 terminationCritertion.Name = "TerminationCondition"; 217 GreaterThanComparator bestSolutionAge = new GreaterThanComparator(); 218 bestSolutionAge.GetVariableInfo("LeftSide").ActualName = "BestValidationSolutionAge"; 219 bestSolutionAge.GetVariableInfo("RightSide").ActualName = "MaxBestValidationSolutionAge"; 220 bestSolutionAge.GetVariableInfo("Result").ActualName = "TerminationCriterion"; 221 222 IOperator combinedTerminationCriterion = AlgorithmBase.CombineTerminationCriterions(base.CreateTerminationCondition(), bestSolutionAge); 223 224 terminationCritertion.OperatorGraph.AddOperator(combinedTerminationCriterion); 225 terminationCritertion.OperatorGraph.InitialOperator = combinedTerminationCriterion; 226 return terminationCritertion; 227 } 228 229 199 230 protected override IOperator CreatePostProcessingOperator() { 200 231 CombinedOperator op = new CombinedOperator();
Note: See TracChangeset
for help on using the changeset viewer.