Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/15 12:02:20 (9 years ago)
Author:
mkommend
Message:

#2320: Merged r12422, r12423, r12424, r12480, r12481 and r12482 into stable.

Location:
stable
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs

    r12009 r12706  
    3535namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3636  [Item("MultiSymbolicDataAnalysisExpressionCrossover", "Randomly selects and applies one of its crossovers every time it is called.")]
     37  [StorableClass]
    3738  public class MultiSymbolicDataAnalysisExpressionCrossover<T> : StochasticMultiBranch<ISymbolicExpressionTreeCrossover>,
    3839    ISymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData {
    3940    private const string ParentsParameterName = "Parents";
    40     private const string ChildParameterName = "Child";
     41    private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree";
    4142    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
    4243    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
     
    6263      get { return (ScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[ParentsParameterName]; }
    6364    }
    64     public ILookupParameter<ISymbolicExpressionTree> ChildParameter {
    65       get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[ChildParameterName]; }
     65    public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
     66      get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    6667    }
    6768    public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
     
    99100      Parameters.Add(new ValueLookupParameter<IntRange>(SymbolicDataAnalysisEvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated."));
    100101      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed."));
    101       Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover."));
     102      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The child symbolic expression tree resulting from the crossover."));
    102103
    103104      EvaluatorParameter.Hidden = true;
     
    111112
    112113      SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator";
     114    }
     115
     116    [StorableHook(HookType.AfterDeserialization)]
     117    private void AfterDeserialization() {
     118      // BackwardsCompatibility3.3
     119      #region Backwards compatible code, remove with 3.4
     120      if (!Parameters.ContainsKey(SymbolicExpressionTreeParameterName))
     121        Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied."));
     122      #endregion
    113123    }
    114124
     
    155165    private void ParameterizeCrossovers() {
    156166      foreach (ISymbolicExpressionTreeCrossover op in Operators) {
    157         op.ChildParameter.ActualName = ChildParameter.Name;
     167        op.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name;
    158168        op.ParentsParameter.ActualName = ParentsParameter.Name;
    159169      }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs

    r12009 r12706  
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Random;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    6869          possibleChildren.Add(n);
    6970      });
    70       var selectedChild = possibleChildren.SelectRandom(random);
     71
     72      var selectedChild = possibleChildren.SampleRandom(random);
    7173      var crossoverPoints = new List<CutPoint>();
    7274      var qualities = new List<Tuple<CutPoint, double>>();
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs

    r12009 r12706  
    2929using HeuristicLab.Parameters;
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     31using HeuristicLab.Random;
    3132
    3233namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    115116        throw new Exception("No crossover points available in the first parent");
    116117
    117       var crossoverPoint0 = crossoverPoints0.SelectRandom(random);
    118 
     118      var crossoverPoint0 = crossoverPoints0.SampleRandom(random);
    119119      int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
    120120      int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
     
    126126                             select s).ToList();
    127127      if (allowedBranches.Count == 0) return parent0;
    128       var selectedBranch = allowedBranches.SelectRandom(random);
     128
     129      var selectedBranch = allowedBranches.SampleRandom(random);
    129130      Swap(crossoverPoint0, selectedBranch);
    130131      return parent0;
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs

    r12009 r12706  
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Random;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    6768          crossoverPoints0.Add(new CutPoint(n.Parent, n));
    6869      });
    69       CutPoint crossoverPoint0 = crossoverPoints0.SelectRandom(random);
     70
     71      CutPoint crossoverPoint0 = crossoverPoints0.SampleRandom(random);
    7072      int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
    7173      int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs

    r12009 r12706  
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Random;
    2930
    3031namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    6970        }
    7071      });
    71       var crossoverPoint0 = crossoverPoints0.SelectRandom(random);
     72
     73      var crossoverPoint0 = crossoverPoints0.SampleRandom(random);
    7274      int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
    7375      int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
     
    137139          weights[i] /= sum;
    138140
     141#pragma warning disable 612, 618
    139142        selectedBranch = allowedBranches.SelectRandom(weights, random);
     143#pragma warning restore 612, 618
    140144      }
    141145      Swap(crossoverPoint0, selectedBranch);
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs

    r12009 r12706  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Random;
    3031
    3132namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    8182          crossoverPoints0.Add(new CutPoint(n.Parent, n));
    8283      });
    83       var crossoverPoint0 = crossoverPoints0.SelectRandom(random);
     84
     85      var crossoverPoint0 = crossoverPoints0.SampleRandom(random);
    8486      int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child);
    8587      int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength();
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r12281 r12706  
    321321      foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
    322322        op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    323         op.ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     323        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
    324324      }
    325325      foreach (var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) {
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableConditionTreeNode.cs

    r12009 r12706  
    7474      base.ResetLocalParameters(random);
    7575      threshold = NormalDistributedRandom.NextDouble(random, Symbol.ThresholdInitializerMu, Symbol.ThresholdInitializerSigma);
     76
     77#pragma warning disable 612, 618
    7678      variableName = Symbol.VariableNames.SelectRandom(random);
     79#pragma warning restore 612, 618
     80
    7781      slope = NormalDistributedRandom.NextDouble(random, Symbol.SlopeInitializerMu, Symbol.SlopeInitializerSigma);
    7882    }
     
    8286      double x = NormalDistributedRandom.NextDouble(random, Symbol.ThresholdManipulatorMu, Symbol.ThresholdManipulatorSigma);
    8387      threshold = threshold + x * shakingFactor;
     88
     89#pragma warning disable 612, 618
    8490      variableName = Symbol.VariableNames.SelectRandom(random);
     91#pragma warning restore 612, 618
     92
    8593      x = NormalDistributedRandom.NextDouble(random, Symbol.SlopeManipulatorMu, Symbol.SlopeManipulatorSigma);
    8694      slope = slope + x * shakingFactor;
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNode.cs

    r12009 r12706  
    6161      base.ResetLocalParameters(random);
    6262      weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
     63
     64#pragma warning disable 612, 618
    6365      variableName = Symbol.VariableNames.SelectRandom(random);
     66#pragma warning restore 612, 618
    6467    }
    6568
     
    7073        double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma);
    7174        weight = weight + x * shakingFactor;
    72       } else {       
     75      } else {
    7376        double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);
    7477        weight = weight * x;
    7578      }
     79#pragma warning disable 612, 618
    7680      variableName = Symbol.VariableNames.SelectRandom(random);
     81#pragma warning restore 612, 618
    7782    }
    7883
Note: See TracChangeset for help on using the changeset viewer.