当前位置: 首页>>代码示例>>C#>>正文


C# ISymbolicExpressionTreeNode.Clone方法代码示例

本文整理汇总了C#中ISymbolicExpressionTreeNode.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbolicExpressionTreeNode.Clone方法的具体用法?C# ISymbolicExpressionTreeNode.Clone怎么用?C# ISymbolicExpressionTreeNode.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISymbolicExpressionTreeNode的用法示例。


在下文中一共展示了ISymbolicExpressionTreeNode.Clone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalculateReplacementValue

    protected static double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
      IDataset dataset, IEnumerable<int> rows) {
      //optimization: constant nodes return always the same value
      ConstantTreeNode constantNode = node as ConstantTreeNode;
      if (constantNode != null) return constantNode.Value;

      var rootSymbol = new ProgramRootSymbol().CreateTreeNode();
      var startSymbol = new StartSymbol().CreateTreeNode();
      rootSymbol.AddSubtree(startSymbol);
      startSymbol.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());

      var tempTree = new SymbolicExpressionTree(rootSymbol);
      // clone ADFs of source tree
      for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
      }
      return interpreter.GetSymbolicExpressionTreeValues(tempTree, dataset, rows).Median();
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:18,代码来源:SymbolicDataAnalysisSolutionImpactValuesCalculator.cs

示例2: MakeIntegral

 private ISymbolicExpressionTreeNode MakeIntegral(ISymbolicExpressionTreeNode subtree, int lag) {
   if (lag == 0) return subtree;
   else if (lag == -1 || lag == 1) {
     return MakeSum(subtree, AddLagToDynamicNodes((ISymbolicExpressionTreeNode)subtree.Clone(), lag));
   } else {
     var node = (LaggedTreeNode)integralSymbol.CreateTreeNode();
     node.Lag = lag;
     node.AddSubtree(subtree);
     return node;
   }
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:11,代码来源:SymbolicDataAnalysisExpressionTreeSimplifier.cs

示例3: GetSimplifiedTree

 /// <summary>
 /// Creates a new simplified tree
 /// </summary>
 /// <param name="original"></param>
 /// <returns></returns>
 public ISymbolicExpressionTreeNode GetSimplifiedTree(ISymbolicExpressionTreeNode original) {
   if (IsConstant(original) || IsVariable(original)) {
     return (ISymbolicExpressionTreeNode)original.Clone();
   } else if (IsAddition(original)) {
     return SimplifyAddition(original);
   } else if (IsSubtraction(original)) {
     return SimplifySubtraction(original);
   } else if (IsMultiplication(original)) {
     return SimplifyMultiplication(original);
   } else if (IsDivision(original)) {
     return SimplifyDivision(original);
   } else if (IsAverage(original)) {
     return SimplifyAverage(original);
   } else if (IsLog(original)) {
     return SimplifyLog(original);
   } else if (IsExp(original)) {
     return SimplifyExp(original);
   } else if (IsSquare(original)) {
     return SimplifySquare(original);
   } else if (IsSquareRoot(original)) {
     return SimplifySquareRoot(original);
   } else if (IsPower(original)) {
     return SimplifyPower(original);
   } else if (IsRoot(original)) {
     return SimplifyRoot(original);
   } else if (IsSine(original)) {
     return SimplifySine(original);
   } else if (IsCosine(original)) {
     return SimplifyCosine(original);
   } else if (IsTangent(original)) {
     return SimplifyTangent(original);
   } else if (IsIfThenElse(original)) {
     return SimplifyIfThenElse(original);
   } else if (IsGreaterThan(original)) {
     return SimplifyGreaterThan(original);
   } else if (IsLessThan(original)) {
     return SimplifyLessThan(original);
   } else if (IsAnd(original)) {
     return SimplifyAnd(original);
   } else if (IsOr(original)) {
     return SimplifyOr(original);
   } else if (IsNot(original)) {
     return SimplifyNot(original);
   } else if (IsTimeLag(original)) {
     return SimplifyTimeLag(original);
   } else if (IsIntegral(original)) {
     return SimplifyIntegral(original);
   } else {
     return SimplifyAny(original);
   }
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:56,代码来源:SymbolicDataAnalysisExpressionTreeSimplifier.cs

示例4: SimplifyAny

 private ISymbolicExpressionTreeNode SimplifyAny(ISymbolicExpressionTreeNode original) {
   // can't simplify this function but simplify all subtrees 
   List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(original.Subtrees);
   while (original.Subtrees.Count() > 0) original.RemoveSubtree(0);
   var clone = (SymbolicExpressionTreeNode)original.Clone();
   List<ISymbolicExpressionTreeNode> simplifiedSubtrees = new List<ISymbolicExpressionTreeNode>();
   foreach (var subtree in subtrees) {
     simplifiedSubtrees.Add(GetSimplifiedTree(subtree));
     original.AddSubtree(subtree);
   }
   foreach (var simplifiedSubtree in simplifiedSubtrees) {
     clone.AddSubtree(simplifiedSubtree);
   }
   if (simplifiedSubtrees.TrueForAll(t => IsConstant(t))) {
     SimplifyConstantExpression(clone);
   }
   return clone;
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:18,代码来源:SymbolicDataAnalysisExpressionTreeSimplifier.cs

示例5: CalculateReplacementValue

    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
      // remove old ADFs
      while (tempTree.Root.SubtreeCount > 1) tempTree.Root.RemoveSubtree(1);
      // clone ADFs of source tree
      for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) {
        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
      }
      var start = tempTree.Root.GetSubtree(0);
      while (start.SubtreeCount > 0) start.RemoveSubtree(0);
      start.AddSubtree((ISymbolicExpressionTreeNode)node.Clone());
      var interpreter = Content.Model.Interpreter;
      var rows = Content.ProblemData.TrainingIndices;
      var allPrognosedValues = interpreter.GetSymbolicExpressionTreeValues(tempTree, Content.ProblemData.Dataset, rows);

      return allPrognosedValues.Median();
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:16,代码来源:InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs


注:本文中的ISymbolicExpressionTreeNode.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。