Changeset 2337
- Timestamp:
- 09/07/09 13:03:29 (15 years ago)
- Location:
- branches/gp-algorithms-refactoring-#720/sources/HeuristicLab.GP.StructureIdentification/3.3
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gp-algorithms-refactoring-#720/sources/HeuristicLab.GP.StructureIdentification/3.3/HeuristicLab.GP.StructureIdentification-3.3.csproj
r2335 r2337 84 84 <Compile Include="BaseClasses\FunctionTreeBase.cs" /> 85 85 <Compile Include="BaseClasses\TreeEvaluatorBase.cs" /> 86 <Compile Include="IStructureIdentificationAlgorithm.cs" /> 86 87 <Compile Include="HL3TreeEvaluatorInjector.cs" /> 87 88 <Compile Include="HL2TreeEvaluatorInjector.cs" /> -
branches/gp-algorithms-refactoring-#720/sources/HeuristicLab.GP.StructureIdentification/3.3/OffspringSelectionGP.cs
r2335 r2337 35 35 public override string Name { get { return "OffspringSelectionGP - StructureIdentification"; } } 36 36 37 public HeuristicLab.DataAnalysis.Dataset Dataset { 38 get { 39 throw new NotImplementedException(); 40 } 41 set { 42 throw new NotImplementedException(); 43 } 44 } 45 46 public int TargetVariable { 47 get { 48 throw new NotImplementedException(); 49 } 50 set { 51 throw new NotImplementedException(); 52 } 53 } 54 55 public IAnalyzerModel Model { 56 get { throw new NotImplementedException(); } 57 } 58 37 59 public virtual double PunishmentFactor { 38 60 get { return GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data; } … … 46 68 47 69 protected override IOperator CreateFunctionLibraryInjector() { 48 CombinedOperator op = new CombinedOperator(); 49 op.Name = "FunctionLibraryInjector"; 50 SequentialProcessor seq = new SequentialProcessor(); 51 seq.AddSubOperator(new FunctionLibraryInjector()); 52 seq.AddSubOperator(new HL2TreeEvaluatorInjector()); 53 op.OperatorGraph.AddOperator(seq); 54 op.OperatorGraph.InitialOperator = seq; 55 return op; 70 return DefaultStructureIdentificationAlgorithmOperators.CreateFunctionLibraryInjector(); 56 71 } 57 72 58 73 protected override IOperator CreateProblemInjector() { 59 return newProblemInjector();74 return DefaultStructureIdentificationAlgorithmOperators.CreateProblemInjector(); 60 75 } 61 76 62 77 protected override IOperator CreateInitialPopulationEvaluator() { 63 MeanSquaredErrorEvaluator eval = new MeanSquaredErrorEvaluator(); 64 eval.Name = "Evaluator"; 65 eval.GetVariableInfo("MSE").ActualName = "Quality"; 66 eval.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 67 eval.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 68 return eval; 78 return DefaultStructureIdentificationAlgorithmOperators.CreateInitialPopulationEvaluator(); 69 79 } 70 80 71 81 protected override IOperator CreateEvaluationOperator() { 72 return CreateInitialPopulationEvaluator();82 return DefaultStructureIdentificationAlgorithmOperators.CreateEvaluator(); 73 83 } 74 84 75 85 76 86 protected override IOperator CreateGenerationStepHook() { 77 CombinedOperator op = new CombinedOperator(); 78 SequentialProcessor seq = new SequentialProcessor(); 79 UniformSequentialSubScopesProcessor subScopesProc = new UniformSequentialSubScopesProcessor(); 80 SequentialProcessor individualProc = new SequentialProcessor(); 81 MeanSquaredErrorEvaluator validationEvaluator = new MeanSquaredErrorEvaluator(); 82 validationEvaluator.Name = "ValidationEvaluator"; 83 validationEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality"; 84 validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart"; 85 validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd"; 86 87 individualProc.AddSubOperator(validationEvaluator); 88 89 BestSolutionStorer solutionStorer = new BestSolutionStorer(); 90 solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution"; 91 solutionStorer.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 92 93 BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator(); 94 validationQualityCalculator.Name = "BestAverageWorstValidationQualityCalculator"; 95 validationQualityCalculator.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 96 validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality"; 97 validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality"; 98 validationQualityCalculator.GetVariableInfo("WorstQuality").ActualName = "WorstValidationQuality"; 99 100 subScopesProc.AddSubOperator(individualProc); 101 102 seq.AddSubOperator(subScopesProc); 103 seq.AddSubOperator(solutionStorer); 104 seq.AddSubOperator(validationQualityCalculator); 105 106 op.OperatorGraph.AddOperator(seq); 107 op.OperatorGraph.InitialOperator = seq; 108 return op; 87 return DefaultStructureIdentificationAlgorithmOperators.CreateGenerationStepHook(); 109 88 } 110 89 -
branches/gp-algorithms-refactoring-#720/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGP.cs
r2335 r2337 31 31 32 32 namespace HeuristicLab.GP.StructureIdentification { 33 public class StandardGP : HeuristicLab.GP.Algorithms.StandardGP {33 public class StandardGP : HeuristicLab.GP.Algorithms.StandardGP, IAlgorithm { 34 34 35 35 public override string Name { get { return "StandardGP - StructureIdentification"; } } 36 37 public HeuristicLab.DataAnalysis.Dataset Dataset { 38 get { 39 throw new NotImplementedException(); 40 } 41 set { 42 throw new NotImplementedException(); 43 } 44 } 45 46 public int TargetVariable { 47 get { 48 throw new NotImplementedException(); 49 } 50 set { 51 throw new NotImplementedException(); 52 } 53 } 54 55 public IAnalyzerModel Model { 56 get { throw new NotImplementedException(); } 57 } 58 36 59 public virtual double PunishmentFactor { 37 60 get { return GetVariableInjector().GetVariable("PunishmentFactor").GetValue<DoubleData>().Data; } … … 46 69 47 70 protected override IOperator CreateFunctionLibraryInjector() { 48 CombinedOperator op = new CombinedOperator(); 49 op.Name = "FunctionLibraryInjector"; 50 SequentialProcessor seq = new SequentialProcessor(); 51 seq.AddSubOperator(new FunctionLibraryInjector()); 52 seq.AddSubOperator(new HL2TreeEvaluatorInjector()); 53 op.OperatorGraph.AddOperator(seq); 54 op.OperatorGraph.InitialOperator = seq; 55 return op; 71 return DefaultStructureIdentificationAlgorithmOperators.CreateFunctionLibraryInjector(); 56 72 } 57 73 58 74 protected override IOperator CreateProblemInjector() { 59 return newProblemInjector();75 return DefaultStructureIdentificationAlgorithmOperators.CreateProblemInjector(); 60 76 } 61 77 62 78 protected override IOperator CreateInitialPopulationEvaluator() { 63 MeanSquaredErrorEvaluator eval = new MeanSquaredErrorEvaluator(); 64 eval.Name = "Evaluator"; 65 eval.GetVariableInfo("MSE").ActualName = "Quality"; 66 eval.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 67 eval.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 68 return eval; 79 return DefaultStructureIdentificationAlgorithmOperators.CreateInitialPopulationEvaluator(); 69 80 } 70 81 71 82 protected override IOperator CreateEvaluationOperator() { 72 return CreateInitialPopulationEvaluator();83 return DefaultStructureIdentificationAlgorithmOperators.CreateEvaluator(); 73 84 } 74 85 75 86 76 87 protected override IOperator CreateGenerationStepHook() { 77 CombinedOperator op = new CombinedOperator(); 78 SequentialProcessor seq = new SequentialProcessor(); 79 UniformSequentialSubScopesProcessor subScopesProc = new UniformSequentialSubScopesProcessor(); 80 SequentialProcessor individualProc = new SequentialProcessor(); 81 MeanSquaredErrorEvaluator validationEvaluator = new MeanSquaredErrorEvaluator(); 82 validationEvaluator.Name = "ValidationEvaluator"; 83 validationEvaluator.GetVariableInfo("MSE").ActualName = "ValidationQuality"; 84 validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart"; 85 validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd"; 86 87 individualProc.AddSubOperator(validationEvaluator); 88 89 BestSolutionStorer solutionStorer = new BestSolutionStorer(); 90 solutionStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution"; 91 solutionStorer.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 92 93 BestAverageWorstQualityCalculator validationQualityCalculator = new BestAverageWorstQualityCalculator(); 94 validationQualityCalculator.Name = "BestAverageWorstValidationQualityCalculator"; 95 validationQualityCalculator.GetVariableInfo("Quality").ActualName = "ValidationQuality"; 96 validationQualityCalculator.GetVariableInfo("BestQuality").ActualName = "BestValidationQuality"; 97 validationQualityCalculator.GetVariableInfo("AverageQuality").ActualName = "AverageValidationQuality"; 98 validationQualityCalculator.GetVariableInfo("WorstQuality").ActualName = "WorstValidationQuality"; 99 100 subScopesProc.AddSubOperator(individualProc); 101 102 seq.AddSubOperator(subScopesProc); 103 seq.AddSubOperator(solutionStorer); 104 seq.AddSubOperator(validationQualityCalculator); 105 106 op.OperatorGraph.AddOperator(seq); 107 op.OperatorGraph.InitialOperator = seq; 108 return op; 88 return DefaultStructureIdentificationAlgorithmOperators.CreateGenerationStepHook(); 109 89 } 110 90
Note: See TracChangeset
for help on using the changeset viewer.