Changeset 10263 for branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveEvaluator.cs
- Timestamp:
- 12/20/13 16:17:52 (11 years ago)
- Location:
- branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution
- Property svn:ignore
-
old new 2 2 *.Settings 3 3 Plugin.cs 4 *.user 5 bin
-
- Property svn:ignore
-
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveEvaluator.cs
r10075 r10263 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Encodings.IntegerVectorEncoding; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Parameters; 23 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 29 using HeuristicLab.Problems.DataAnalysis; … … 27 32 namespace HeuristicLab.Problems.GrammaticalEvolution { 28 33 [StorableClass] 29 public abstractclass GESymbolicRegressionSingleObjectiveEvaluator : GESymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>,34 public class GESymbolicRegressionSingleObjectiveEvaluator : GESymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>, 30 35 IGESymbolicRegressionSingleObjectiveEvaluator { 36 37 public const string EvaluatorParameterName = "Evaluator"; 38 public IValueParameter<ISymbolicRegressionSingleObjectiveEvaluator> EvaluatorParameter { 39 get { return (IValueParameter<ISymbolicRegressionSingleObjectiveEvaluator>)Parameters[EvaluatorParameterName]; } 40 } 41 42 private ISymbolicRegressionSingleObjectiveEvaluator Evaluator { 43 get { return EvaluatorParameter.Value; } 44 } 45 31 46 [StorableConstructor] 32 47 protected GESymbolicRegressionSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { } 33 48 protected GESymbolicRegressionSingleObjectiveEvaluator(GESymbolicRegressionSingleObjectiveEvaluator original, Cloner cloner) : base(original, cloner) { } 34 protected GESymbolicRegressionSingleObjectiveEvaluator() : base() { } 49 public GESymbolicRegressionSingleObjectiveEvaluator() 50 : base() { 51 Parameters.Add(new ValueParameter<ISymbolicRegressionSingleObjectiveEvaluator>(EvaluatorParameterName, "The symbolic regression evaluator that should be used to assess the quality of trees.", new SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator())); 52 } 53 54 public override IDeepCloneable Clone(Cloner cloner) { 55 return new GESymbolicRegressionSingleObjectiveEvaluator(this, cloner); 56 } 57 58 public override bool Maximization { 59 get { return Evaluator.Maximization; } 60 } 61 62 public override IOperation Apply() { 63 var genotype = IntegerVectorParameter.ActualValue; 64 65 // translate to phenotype 66 var tree = GenotypeToPhenotypeMapperParameter.ActualValue.Map( 67 SymbolicExpressionTreeGrammarParameter.ActualValue, 68 genotype 69 ); 70 SymbolicExpressionTreeParameter.ActualValue = tree; // write to scope for analyzers 71 72 // create operation for evaluation 73 var evalOp = ExecutionContext.CreateChildOperation(Evaluator); 74 var successorOp = base.Apply(); 75 76 return new OperationCollection(evalOp, successorOp); 77 } 35 78 } 36 79 }
Note: See TracChangeset
for help on using the changeset viewer.