Changeset 7303 for branches/gp-crossover
- Timestamp:
- 01/10/12 15:23:39 (13 years ago)
- Location:
- branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs
r7119 r7303 37 37 public class MultiSymbolicDataAnalysisExpressionCrossover<T> : StochasticMultiBranch<ISymbolicDataAnalysisExpressionCrossover<T>>, 38 38 ISymbolicDataAnalysisExpressionCrossover<T>, 39 ISymbolicExpressionTreeSizeConstraintOperator, 40 ISymbolicExpressionTreeGrammarBasedOperator where T : class, IDataAnalysisProblemData {39 ISymbolicExpressionTreeSizeConstraintOperator, 40 ISymbolicExpressionTreeGrammarBasedOperator where T : class, IDataAnalysisProblemData { 41 41 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 42 42 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; … … 49 49 50 50 public override bool CanChangeName { 51 get { return false; }51 get { return true; } 52 52 } 53 53 protected override bool CreateChildOperation { … … 97 97 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover.")); 98 98 99 var list = new List<ISymbolicDataAnalysisExpressionCrossover<T>>(); 100 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicDataAnalysisExpressionCrossover<T>))) { 101 if (this.GetType().Assembly != type.Assembly) continue; 102 if (typeof(IMultiOperator<ISymbolicDataAnalysisExpressionCrossover<T>>).IsAssignableFrom(type)) 103 continue; 104 list.Add((ISymbolicDataAnalysisExpressionCrossover<T>)Activator.CreateInstance(type)); 105 } 99 var list = (from type in ApplicationManager.Manager.GetTypes(typeof(ISymbolicDataAnalysisExpressionCrossover<T>)) 100 where this.GetType().Assembly == type.Assembly 101 where !typeof(IMultiOperator<ISymbolicDataAnalysisExpressionCrossover<T>>).IsAssignableFrom(type) 102 select (ISymbolicDataAnalysisExpressionCrossover<T>)Activator.CreateInstance(type)).ToList(); 103 106 104 var checkedItemList = new CheckedItemList<ISymbolicDataAnalysisExpressionCrossover<T>>(); 107 105 checkedItemList.AddRange(list.OrderBy(op => op.Name)); 108 106 Operators = checkedItemList.AsReadOnly(); 109 107 Operators_ItemsAdded(this, new CollectionItemsChangedEventArgs<IndexedItem<ISymbolicDataAnalysisExpressionCrossover<T>>>(Operators.CheckedItems)); 110 108 Name = "MultiCrossover"; 111 109 } 112 110 -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs
r7193 r7303 39 39 public SymbolicDataAnalysisExpressionContextAwareCrossover() 40 40 : base() { 41 Name = "ContextAwareCrossover"; 41 42 } 42 43 public override IDeepCloneable Clone(Cloner cloner) { -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionCrossover.cs
r7193 r7303 43 43 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 44 44 45 public override bool CanChangeName { get { return false; } }45 public override bool CanChangeName { get { return true; } } 46 46 47 47 #region Parameter properties -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs
r7193 r7303 60 60 DepthRangeParameter.ValidValues.Add(new StringValue(Enum.GetName(typeof(Ranges), Ranges.Standard))); 61 61 DepthRangeParameter.ValidValues.Add(new StringValue(Enum.GetName(typeof(Ranges), Ranges.Lowlevel))); 62 Name = "DepthConstrainedCrossover"; 62 63 } 63 64 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionDepthConstrainedCrossover<T>(this, cloner); } … … 88 89 int depth = parent0.Root.GetDepth(); 89 90 var depthRange = new DoubleRange(); 91 const int depthOffset = 2; // skip the first 2 levels (root + startNode) 90 92 switch ((int)Enum.Parse(typeof(Ranges), mode)) { 91 93 case (int)Ranges.HighLevel: 92 depthRange.Start = 0;93 depthRange.End = Math.Round(depth * 0.25);94 depthRange.Start = depthOffset; // skip the first 2 levels (root + startNode) 95 depthRange.End = depthRange.Start + Math.Round(depth * 0.25); 94 96 break; 95 97 case (int)Ranges.Standard: 96 depthRange.Start = Math.Round(depth * 0.25);97 depthRange.End = Math.Round(depth * 0.75);98 depthRange.Start = depthOffset + Math.Round(depth * 0.25); 99 depthRange.End = depthRange.Start + Math.Round(depth * 0.5); 98 100 break; 99 101 case (int)Ranges.Lowlevel: 100 depthRange.Start = Math.Round(depth * 0.75);101 depthRange.End = depth;102 depthRange.Start = depthOffset + Math.Round(depth * 0.75); 103 depthRange.End = Math.Max(depthRange.Start, depth); 102 104 break; 103 105 } … … 110 112 select new CutPoint(n, s)); 111 113 }); 114 115 if (crossoverPoints0.Count == 0) 116 throw new Exception("No crossover points available in the first parent"); 117 112 118 CutPoint crossoverPoint0 = crossoverPoints0.SelectRandom(random); 113 119 int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child); -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs
r7193 r7303 39 39 public SymbolicDataAnalysisExpressionDeterministicBestCrossover() 40 40 : base() { 41 Name = "DeterministicBestCrossover"; 41 42 } 42 43 public override IDeepCloneable Clone(Cloner cloner) { -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs
r7193 r7303 36 36 private SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover(SymbolicDataAnalysisExpressionCrossover<T> original, Cloner cloner) 37 37 : base(original, cloner) { } 38 public SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover() : base() { } 38 public SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover() 39 : base() { 40 Name = "ProbabilisticFunctionalCrossover"; 41 } 39 42 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover<T>(this, cloner); } 40 43 -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs
r7193 r7303 53 53 : base() { 54 54 Parameters.Add(new ValueLookupParameter<DoubleRange>(SemanticSimilarityRangeParameterName, "Semantic similarity interval.", new DoubleRange(0.0001, 10))); 55 Name = "SemanticSimilarityCrossover"; 55 56 } 56 57 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionSemanticSimilarityCrossover<T>(this, cloner); } -
branches/gp-crossover/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSizefairCrossover.cs
r7193 r7303 12 12 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicDataAnalysisExpressionSizefairCrossover<T>(this, cloner); } 13 13 14 public override bool CanChangeName { 15 get { return true; } 16 } 17 14 18 public SymbolicDataAnalysisExpressionSizefairCrossover() 15 19 : base() { 16 20 SymbolicDataAnalysisEvaluationPartitionParameter.Hidden = true; 21 Name = "SizeFairCrossover"; 17 22 } 18 23 }
Note: See TracChangeset
for help on using the changeset viewer.