Changeset 7119
- Timestamp:
- 12/04/11 23:41:25 (13 years ago)
- Location:
- branches/gp-crossover
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gp-crossover/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs
r7035 r7119 28 28 using HeuristicLab.Parameters; 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.PluginInfrastructure; 30 31 31 32 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { … … 37 38 /// </summary> 38 39 [Item("SubtreeCrossover", "An operator which performs subtree swapping crossover.")] 40 [NonDiscoverableType] 39 41 [StorableClass] 40 public sealedclass SubtreeCrossover : SymbolicExpressionTreeCrossover, ISymbolicExpressionTreeSizeConstraintOperator {42 public class SubtreeCrossover : SymbolicExpressionTreeCrossover, ISymbolicExpressionTreeSizeConstraintOperator { 41 43 private const string InternalCrossoverPointProbabilityParameterName = "InternalCrossoverPointProbability"; 42 44 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 43 45 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 46 private const string SymbolicDataAnalysisEvaluationPartitionParameterName = "EvaluationPartition"; 47 44 48 #region Parameter Properties 45 49 public IValueLookupParameter<PercentValue> InternalCrossoverPointProbabilityParameter { … … 51 55 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter { 52 56 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; } 57 } 58 public IValueLookupParameter<IntRange> SymbolicDataAnalysisEvaluationPartitionParameter { 59 get { return (IValueLookupParameter<IntRange>)Parameters[SymbolicDataAnalysisEvaluationPartitionParameterName]; } 53 60 } 54 61 #endregion … … 65 72 #endregion 66 73 [StorableConstructor] 67 pr ivateSubtreeCrossover(bool deserializing) : base(deserializing) { }68 pr ivateSubtreeCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { }74 protected SubtreeCrossover(bool deserializing) : base(deserializing) { } 75 protected SubtreeCrossover(SubtreeCrossover original, Cloner cloner) : base(original, cloner) { } 69 76 public SubtreeCrossover() 70 77 : base() { … … 72 79 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); 73 80 Parameters.Add(new ValueLookupParameter<PercentValue>(InternalCrossoverPointProbabilityParameterName, "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9))); 81 Parameters.Add(new ValueLookupParameter<IntRange>(SymbolicDataAnalysisEvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated.")); 74 82 } 75 83 … … 82 90 return Cross(random, parent0, parent1, InternalCrossoverPointProbability.Value, 83 91 MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value); 92 } 93 94 public ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) { 95 return Cross(random, parent0, parent1); 84 96 } 85 97 -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs
r7109 r7119 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 33 33 34 [Item("ContextAwareCrossover", "A crossoveroperator which deterministically choses the best insertion point for a randomly selected node.")]34 [Item("ContextAwareCrossover", "An operator which deterministically choses the best insertion point for a randomly selected node.")] 35 35 public sealed class SymbolicDataAnalysisExpressionContextAwareCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData { 36 36 [StorableConstructor] … … 54 54 return Cross(random, parent0, parent1, this.ExecutionContext, evaluator, problemData, rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value); 55 55 } 56 57 public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) { 58 return Cross(random, parent0, parent1); 59 } 60 56 61 /// <summary> 57 62 /// Takes two parent individuals P0 and P1. -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs
r7089 r7119 111 111 if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random); 112 112 113 //if (node.Symbol.Name == startSymbol.Name) {114 // rootNode.AddSubtree(node);115 //} else {116 // var startNode = new SymbolicExpressionTreeTopLevelNode(startSymbol);117 // if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random);118 119 // startNode.AddSubtree(node);120 // rootNode.AddSubtree(startNode);121 //}122 113 var startNode = new SymbolicExpressionTreeTopLevelNode(startSymbol); 123 114 if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random); … … 153 144 return rows.Where(i => i < testPartitionStart || testPartitionEnd <= i); 154 145 } 146 147 protected abstract override ISymbolicExpressionTree Cross(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1); 148 public abstract ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1); 155 149 } 156 150 } -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs
r7089 r7119 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 33 33 34 [Item("DepthConstrainedCrossover", "An operator which performs subtree swapping only withina specific depth range.")]34 [Item("DepthConstrainedCrossover", "An operator which performs subtree swapping restricted to a specific depth range.")] 35 35 public sealed class SymbolicDataAnalysisExpressionDepthConstrainedCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData { 36 36 [StorableConstructor] … … 46 46 T problemData = ProblemDataParameter.ActualValue; 47 47 return Cross(random, parent0, parent1, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value); 48 } 49 50 public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) { 51 return Cross(random, parent0, parent1); 48 52 } 49 53 -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs
r7110 r7119 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 33 33 34 [Item("DeterministicBestCrossover", "An operator which performs subtree swapping in a deterministic way : it chooses the child from the second parent who would produce the best result if replaced in the first parent")]34 [Item("DeterministicBestCrossover", "An operator which performs subtree swapping in a deterministic way, by choosing the best subtree to be swapped in a certain position.")] 35 35 public sealed class SymbolicDataAnalysisExpressionDeterministicBestCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData { 36 36 [StorableConstructor] … … 53 53 54 54 return Cross(random, parent0, parent1, this.ExecutionContext, evaluator, problemData, rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value); 55 } 56 57 public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) { 58 return Cross(random, parent0, parent1); 55 59 } 56 60 /// <summary> -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs
r7105 r7119 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 33 33 34 [Item("ProbabilisticFunctionalCrossover", "An operator which performs subtree swapping based on behavioral similarity")]34 [Item("ProbabilisticFunctionalCrossover", "An operator which performs subtree swapping based on the behavioral similarity between subtrees.")] 35 35 public sealed class SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData { 36 36 [StorableConstructor] … … 48 48 return Cross(random, parent0, parent1, interpreter, problemData, 49 49 rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value); 50 } 51 52 public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) { 53 return Cross(random, parent0, parent1); 50 54 } 51 55 -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs
r7106 r7119 33 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 34 34 35 [Item("SemanticSimilarityCrossover", "An operator which performs subtree swapping based on semantic similarity.")]35 [Item("SemanticSimilarityCrossover", "An operator which performs subtree swapping based on the semantic similarity between subtrees.")] 36 36 public sealed class SymbolicDataAnalysisExpressionSemanticSimilarityCrossover<T> : SymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData { 37 37 private const string SemanticSimilarityLowerBoundParameterName = "SemanticSimilarityLowerBound"; … … 76 76 return Cross(random, parent0, parent1, interpreter, problemData, rows, MaximumSymbolicExpressionTreeDepth.Value, MaximumSymbolicExpressionTreeLength.Value, SemanticSimilarityLowerBoundParameter.Value.Value, SemanticSimilarityUpperBoundParameter.Value.Value); 77 77 } 78 79 public override ISymbolicExpressionTree Crossover(IRandom random, ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) { 80 return Cross(random, parent0, parent1); 81 } 82 78 83 /// <summary> 79 84 /// Takes two parent individuals P0 and P1. … … 157 162 } 158 163 } 159 160 164 } 161 165 }
Note: See TracChangeset
for help on using the changeset viewer.