Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/24/22 20:33:45 (3 years ago)
Author:
gkronber
Message:

#3136: reintegrated structure-template GP branch into trunk

Location:
trunk
Files:
26 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs

    r18174 r18220  
    199199        var tanh = (ISymbolicExpressionTreeNode)branch.Clone();
    200200        return Product(fxp, Subtract(CreateNumber(1.0), Square(tanh)));
     201      }
     202      if (branch.Symbol is SubFunctionSymbol) {
     203        return Derive(branch.GetSubtree(0), variableName);
    201204      }
    202205      throw new NotSupportedException(string.Format("Symbol {0} is not supported.", branch.Symbol));
     
    285288          !(n.Symbol is Cosine) &&
    286289          !(n.Symbol is Tangent) &&
    287           !(n.Symbol is StartSymbol)
     290          !(n.Symbol is StartSymbol) &&
     291          !(n.Symbol is SubFunctionSymbol)
    288292        select n).Any();
    289293      return !containsUnknownSymbol;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r18132 r18220  
    106106      out ParametricFunctionGradient func_grad) {
    107107
     108      return TryConvertToAutoDiff(tree, makeVariableWeightsVariable, addLinearScalingTerms, Enumerable.Empty<ISymbolicExpressionTreeNode>(),
     109        out parameters, out initialParamValues, out func, out func_grad);
     110    }
     111
     112    public static bool TryConvertToAutoDiff(ISymbolicExpressionTree tree, bool makeVariableWeightsVariable, bool addLinearScalingTerms, IEnumerable<ISymbolicExpressionTreeNode> excludedNodes,
     113      out List<DataForVariable> parameters, out double[] initialParamValues,
     114      out ParametricFunction func,
     115      out ParametricFunctionGradient func_grad) {
     116
    108117      // use a transformator object which holds the state (variable list, parameter list, ...) for recursive transformation of the tree
    109       var transformator = new TreeToAutoDiffTermConverter(makeVariableWeightsVariable, addLinearScalingTerms);
     118      var transformator = new TreeToAutoDiffTermConverter(makeVariableWeightsVariable, addLinearScalingTerms, excludedNodes);
    110119      AutoDiff.Term term;
    111120      try {
     
    134143    private readonly bool makeVariableWeightsVariable;
    135144    private readonly bool addLinearScalingTerms;
    136 
    137     private TreeToAutoDiffTermConverter(bool makeVariableWeightsVariable, bool addLinearScalingTerms) {
     145    private readonly HashSet<ISymbolicExpressionTreeNode> excludedNodes;
     146
     147    private TreeToAutoDiffTermConverter(bool makeVariableWeightsVariable, bool addLinearScalingTerms, IEnumerable<ISymbolicExpressionTreeNode> excludedNodes) {
    138148      this.makeVariableWeightsVariable = makeVariableWeightsVariable;
    139149      this.addLinearScalingTerms = addLinearScalingTerms;
     150      this.excludedNodes = new HashSet<ISymbolicExpressionTreeNode>(excludedNodes);
     151
    140152      this.initialParamValues = new List<double>();
    141153      this.parameters = new Dictionary<DataForVariable, AutoDiff.Variable>();
     
    161173        var par = FindOrCreateParameter(parameters, varNode.VariableName, varValue);
    162174
    163         if (makeVariableWeightsVariable) {
     175        if (makeVariableWeightsVariable && !excludedNodes.Contains(node)) {
    164176          initialParamValues.Add(varNode.Weight);
    165177          var w = new AutoDiff.Variable();
     
    176188          var par = FindOrCreateParameter(parameters, factorVarNode.VariableName, variableValue);
    177189
    178           initialParamValues.Add(factorVarNode.GetValue(variableValue));
    179           var wVar = new AutoDiff.Variable();
    180           variables.Add(wVar);
    181 
    182           products.Add(AutoDiff.TermBuilder.Product(wVar, par));
     190          if (makeVariableWeightsVariable && !excludedNodes.Contains(node)) {
     191            initialParamValues.Add(factorVarNode.GetValue(variableValue));
     192            var wVar = new AutoDiff.Variable();
     193            variables.Add(wVar);
     194
     195            products.Add(AutoDiff.TermBuilder.Product(wVar, par));
     196          } else {
     197            var weight = factorVarNode.GetValue(variableValue);
     198            products.Add(weight * par);
     199          }
     200
    183201        }
    184202        return AutoDiff.TermBuilder.Sum(products);
     
    188206        var par = FindOrCreateParameter(parameters, varNode.VariableName, string.Empty, varNode.Lag);
    189207
    190         if (makeVariableWeightsVariable) {
     208        if (makeVariableWeightsVariable && !excludedNodes.Contains(node)) {
    191209          initialParamValues.Add(varNode.Weight);
    192210          var w = new AutoDiff.Variable();
     
    305323          return t * alpha + beta;
    306324        } else return ConvertToAutoDiff(node.GetSubtree(0));
     325      }
     326      if (node.Symbol is SubFunctionSymbol) {
     327        return ConvertToAutoDiff(node.GetSubtree(0));
    307328      }
    308329      throw new ConversionException();
     
    353374          !(n.Symbol is Cube) &&
    354375          !(n.Symbol is CubeRoot) &&
    355           !(n.Symbol is Power)
     376          !(n.Symbol is Power) &&
     377          !(n.Symbol is SubFunctionSymbol)
    356378        select n).Any();
    357379      return !containsUnknownSymbol;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs

    r18211 r18220  
    3535    ///  Performs some basic re-writing steps to simplify the code for formatting. Tree is changed.
    3636    ///  Removes single-argument +, * which have no effect
     37    ///  Removes SubFunctions (no effect)
    3738    ///  Replaces variables with coefficients by an explicitly multiplication
    3839    ///  Replaces single-argument / with 1 / (..)
     
    5758        mul.AddSubtree(num);
    5859        mul.AddSubtree(varTreeNode);
     60      } else if (n.Symbol is SubFunctionSymbol) {
     61        parent.ReplaceSubtree(n, n.GetSubtree(0));
    5962      } else if (n.SubtreeCount == 1 && (n.Symbol is Addition || n.Symbol is Multiplication || n.Symbol is And || n.Symbol is Or || n.Symbol is Xor)) {
    6063        // single-argument addition or multiplication has no effect -> remove
     
    8184        }
    8285        parent.InsertSubtree(childIdx, newChild);
    83       } else if (n.SubtreeCount == 2 && n.GetSubtree(1).SubtreeCount == 2 && 
    84                  IsAssocOp(n.Symbol) && IsOperator(n.GetSubtree(1).Symbol) && 
     86      } else if (n.SubtreeCount == 2 && n.GetSubtree(1).SubtreeCount == 2 &&
     87                 IsAssocOp(n.Symbol) && IsOperator(n.GetSubtree(1).Symbol) &&
    8588                 Priority(n.Symbol) == Priority(n.GetSubtree(1).Symbol)) {
    8689        // f(x) <op> (g(x) <op> h(x))) is the same as  (f(x) <op> g(x)) <op> h(x) for associative <op>
     
    104107                                          NumberFormatInfo numberFormat, string formatString, List<KeyValuePair<string, double>> parameters = null) {
    105108      // This method assumes that the tree has been converted to binary and left-assoc form (see ConvertToBinaryLeftAssocRec).
    106       // An exception is thrown if the tree has a different shape.
    107 
    108109      if (node.SubtreeCount == 0) {
    109110        // no subtrees
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionCSharpFormatter.cs

    r18132 r18220  
    155155          FormatRecursively(node.GetSubtree(1), strBuilder);
    156156          strBuilder.Append(" , 2) ) )");
     157        } else if (node.Symbol is SubFunctionSymbol) {
     158          FormatRecursively(node.GetSubtree(0), strBuilder);
    157159        } else {
    158160          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for C# symbolic expression tree formatter.");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs

    r18132 r18220  
    310310        stringBuilder.Append(FormatRecursively(node.GetSubtree(1)));
    311311        stringBuilder.Append("), 1.0, -1.0)");
     312      } else if (symbol is SubFunctionSymbol) {
     313        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    312314      } else {
    313315        throw new NotImplementedException("Excel export of " + node.Symbol + " is not implemented.");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

    r18132 r18220  
    279279        paramIdx++;
    280280        strBuilder.Append(@" \left( " + p + @"\cdot ");
     281      } else if (node.Symbol is SubFunctionSymbol) {
     282        // to nothing, skip symbol
    281283      } else {
    282284        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    387389        paramIdx++;
    388390        strBuilder.Append(@" +  \left( 1 - " + p + @" \right) \cdot ");
     391      } else if (node.Symbol is SubFunctionSymbol) {
     392        throw new InvalidOperationException();
    389393      } else {
    390394        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    511515      } else if (node.Symbol is VariableCondition) {
    512516        strBuilder.Append(@"\right) ");
     517      } else if (node.Symbol is SubFunctionSymbol) {
    513518      } else {
    514519        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs

    r18132 r18220  
    388388        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    389389        currentLag -= laggedNode.Lag;
     390      } else if (symbol is SubFunctionSymbol) {
     391        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    390392      } else {
    391393        stringBuilder.Append("ERROR");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMathematicaFormatter.cs

    r18132 r18220  
    122122        } else if (node.Symbol is Root) {
    123123          FormatRoot(node, strBuilder);
     124        } else if (node.Symbol is SubFunctionSymbol) {
     125          FormatRecursively(node.GetSubtree(0), strBuilder);
    124126        } else {
    125127          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " is not supported.");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionPythonFormatter.cs

    r18132 r18220  
    204204      else if (node is INumericTreeNode)
    205205        FormatNumericTreeNode(node, strBuilder);
     206      else if (symbol is SubFunctionSymbol)
     207        FormatRecursively(node.GetSubtree(0), strBuilder);
    206208      else
    207209        throw new NotSupportedException("Formatting of symbol: " + symbol + " not supported for Python symbolic expression tree formatter.");
     
    228230
    229231    private static void FormatNumericTreeNode(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
    230       var symbol = node.Symbol;
    231       if (node is INumericTreeNode numNode) {
    232         strBuilder.Append(numNode.Value.ToString("g17", CultureInfo.InvariantCulture));
    233       } else {
    234         throw new NotSupportedException("Formatting of symbol: " + symbol + " not supported for Python symbolic expression tree formatter.");
    235       }
     232      var numNode = node as INumericTreeNode;
     233      strBuilder.Append(numNode.Value.ToString("g17", CultureInfo.InvariantCulture));
    236234    }
    237235
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionSmalltalkFormatter.cs

    r18132 r18220  
    184184      } else if (symbol is BinaryFactorVariable || symbol is FactorVariable) {
    185185        stringBuilder.Append("factor variables are not supported");
     186      } else if (symbol is SubFunctionSymbol) {
     187        stringBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    186188      } else {
    187189        stringBuilder.Append("(");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/TSQLExpressionFormatter.cs

    r18132 r18220  
    157157        } else if (node.Symbol is Root) {
    158158          FormatRoot(level, node, strBuilder);
     159        } else if (node.Symbol is SubFunctionSymbol) {
     160          FormatRecursively(level, node.GetSubtree(0), strBuilder);
    159161        } else {
    160162          throw new NotSupportedException("Formatting of symbol: " + node.Symbol + " not supported for TSQL symbolic expression tree formatter.");
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs

    r18132 r18220  
    3030  [Item("TypeCoherentExpressionGrammar", "Represents a grammar for functional expressions in which special syntactic constraints are enforced so that boolean and real-valued expressions are not mixed.")]
    3131  public class TypeCoherentExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
    32     private const string ArithmeticFunctionsName = "Arithmetic Functions";
    33     private const string TrigonometricFunctionsName = "Trigonometric Functions";
    34     private const string ExponentialFunctionsName = "Exponential and Logarithmic Functions";
    35     private const string RealValuedSymbolsName = "Real Valued Symbols";
    36     private const string TerminalsName = "Terminals";
    37     private const string PowerFunctionsName = "Power Functions";
    38     private const string ConditionsName = "Conditions";
    39     private const string ComparisonsName = "Comparisons";
    40     private const string BooleanOperatorsName = "Boolean Operators";
    41     private const string ConditionalSymbolsName = "ConditionalSymbols";
    42     private const string SpecialFunctionsName = "Special Functions";
    43     private const string TimeSeriesSymbolsName = "Time Series Symbols";
     32    public const string ArithmeticFunctionsName = "Arithmetic Functions";
     33    public const string TrigonometricFunctionsName = "Trigonometric Functions";
     34    public const string ExponentialFunctionsName = "Exponential and Logarithmic Functions";
     35    public const string RealValuedSymbolsName = "Real Valued Symbols";
     36    public const string TerminalsName = "Terminals";
     37    public const string PowerFunctionsName = "Power Functions";
     38    public const string ConditionsName = "Conditions";
     39    public const string ComparisonsName = "Comparisons";
     40    public const string BooleanOperatorsName = "Boolean Operators";
     41    public const string ConditionalSymbolsName = "ConditionalSymbols";
     42    public const string SpecialFunctionsName = "Special Functions";
     43    public const string TimeSeriesSymbolsName = "Time Series Symbols";
    4444
    4545    [StorableConstructor]
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r18210 r18220  
    188188    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs" />
    189189    <Compile Include="IntervalUtil.cs" />
     190    <Compile Include="LinearScaling.cs" />
    190191    <Compile Include="Selectors\DiversitySelector.cs" />
     192    <Compile Include="StructureTemplate\StructureTemplate.cs" />
     193    <Compile Include="StructureTemplate\SubFunction.cs" />
    191194    <Compile Include="SymbolicDataAnalysisExpressionTreeAverageSimilarityCalculator.cs" />
    192195    <Compile Include="SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs" />
     
    256259    <Compile Include="Symbols\Constant.cs" />
    257260    <Compile Include="Symbols\ConstantTreeNode.cs" />
     261    <Compile Include="Symbols\SubFunctionSymbol.cs" />
     262    <Compile Include="Symbols\SubFunctionTreeNode.cs" />
    258263    <Compile Include="Symbols\VariableBase.cs" />
    259264    <Compile Include="Symbols\VariableTreeNodeBase.cs" />
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs

    r18171 r18220  
    8282    internal static readonly BidirectionalLookup<string, ISymbol>
    8383      knownSymbols = new BidirectionalLookup<string, ISymbol>(StringComparer.InvariantCulture, new SymbolComparer());
     84    internal static readonly SubFunctionSymbol subFunctionSymbol = new SubFunctionSymbol();
    8485
    8586    private Number number = new Number();
     
    328329
    329330    private ISymbol GetSymbol(string tok) {
    330       var symb = knownSymbols.GetByFirst(tok).FirstOrDefault();
    331       if (symb == null) throw new ArgumentException(string.Format("Unknown token {0} found.", tok));
    332       return symb;
     331      if (knownSymbols.ContainsFirst(tok))
     332        return knownSymbols.GetByFirst(tok).FirstOrDefault();
     333      else
     334        return subFunctionSymbol;
    333335    }
    334336
     
    581583      if (funcNode.Symbol is LaggedVariable) {
    582584        ParseLaggedVariable(tokens, funcNode);
     585      } else if (funcNode.Symbol is SubFunctionSymbol) { // SubFunction
     586        var subFunction = funcNode as SubFunctionTreeNode;
     587        subFunction.Name = idTok.strVal;
     588        // input arguments
     589        var args = ParseArgList(tokens);
     590        IList<string> arguments = new List<string>();
     591        foreach (var arg in args)
     592          if (arg is VariableTreeNode varTreeNode)
     593            arguments.Add(varTreeNode.VariableName);
     594        subFunction.Arguments = arguments;
    583595      } else {
    584596        // functions
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs

    r18143 r18220  
    172172          Expect(Token.EQ, tokens);
    173173          var initValToken = tokens.Dequeue();
    174           if(initValToken.Symbol == TokenSymbol.CONSTANT) {
     174          if (initValToken.Symbol == TokenSymbol.CONSTANT) {
    175175            t.Value = initValToken.DoubleValue;
    176176          } else {
     
    289289      if (token.Symbol != TokenSymbol.SYMB &&
    290290          token.Symbol != TokenSymbol.LBRACKET &&  // LBRACKET and RBRACKET are used for <num=..> and as LT, GT operators
    291           token.Symbol != TokenSymbol.RBRACKET 
     291          token.Symbol != TokenSymbol.RBRACKET
    292292          ) throw new FormatException("Expected function symbol, but got: " + token.StringValue);
    293293      return knownSymbols[token.StringValue].CreateTreeNode();
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalArithBoundsEstimator.cs

    r18132 r18220  
    248248
    249249            break;
     250          }
     251        case OpCodes.SubFunction: {
     252            result = Evaluate(instructions, ref instructionCounter, nodeIntervals, variableIntervals);
     253          break;
    250254          }
    251255        default:
     
    344348          !(n.Symbol is Power) &&
    345349          !(n.Symbol is Absolute) &&
    346           !(n.Symbol is AnalyticQuotient)
     350          !(n.Symbol is AnalyticQuotient) &&
     351          !(n.Symbol is SubFunctionSymbol)
    347352        select n).Any();
    348353      return !containsUnknownSymbols;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs

    r18160 r18220  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Linq;
    2524using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2625
     
    7978    CubeRoot = 51,
    8079    Tanh = 52,
     80    SubFunction = 53,
    8181    Constant = 54
    8282  };
     
    8484    // constants for API compatibility only
    8585    public const byte Add = (byte)OpCode.Add;
    86     public const byte Sub =(byte)OpCode.Sub;
    87     public const byte Mul =(byte)OpCode.Mul;
    88     public const byte Div =(byte)OpCode.Div;
    89     public const byte Sin =(byte)OpCode.Sin;
    90     public const byte Cos =(byte)OpCode.Cos;
    91     public const byte Tan =(byte)OpCode.Tan;
    92     public const byte Log =(byte)OpCode.Log;
     86    public const byte Sub = (byte)OpCode.Sub;
     87    public const byte Mul = (byte)OpCode.Mul;
     88    public const byte Div = (byte)OpCode.Div;
     89    public const byte Sin = (byte)OpCode.Sin;
     90    public const byte Cos = (byte)OpCode.Cos;
     91    public const byte Tan = (byte)OpCode.Tan;
     92    public const byte Log = (byte)OpCode.Log;
    9393    public const byte Exp = (byte)OpCode.Exp;
    9494    public const byte IfThenElse = (byte)OpCode.IfThenElse;
     
    103103    public const byte LagVariable = (byte)OpCode.LagVariable;
    104104    public const byte Number = (byte)OpCode.Number;
    105     public const byte Constant = (byte) OpCode.Constant;
     105    public const byte Constant = (byte)OpCode.Constant;
    106106    public const byte Arg = (byte)OpCode.Arg;
    107107    public const byte Power = (byte)OpCode.Power;
     
    136136    public const byte CubeRoot = (byte)OpCode.CubeRoot;
    137137    public const byte Tanh = (byte)OpCode.Tanh;
    138 
     138    public const byte SubFunction = (byte)OpCode.SubFunction;
    139139
    140140    private static Dictionary<Type, byte> symbolToOpcode = new Dictionary<Type, byte>() {
    141        { typeof(Addition), OpCodes.Add },
     141      { typeof(Addition), OpCodes.Add },
    142142      { typeof(Subtraction), OpCodes.Sub },
    143143      { typeof(Multiplication), OpCodes.Mul },
     
    192192      { typeof(AnalyticQuotient), OpCodes.AnalyticQuotient },
    193193      { typeof(Cube), OpCodes.Cube },
    194       { typeof(CubeRoot), OpCodes.CubeRoot }
     194      { typeof(CubeRoot), OpCodes.CubeRoot },
     195      { typeof(SubFunctionSymbol), OpCodes.SubFunction }
    195196    };
    196197
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs

    r18132 r18220  
    662662              );
    663663          }
     664        case OpCodes.SubFunction: {
     665          return MakeExpr(node.GetSubtree(0), variableIndices, row, columns);
     666        }
    664667        default:
    665668          throw new NotSupportedException("Unsupported symbol: " + node.Symbol);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs

    r18132 r18220  
    182182              break;
    183183            }
     184
    184185          case OpCodes.Tanh: {
    185186              Tanh(instr.buf, code[c].buf);
    186187              break;
    187188            }
     189
    188190          case OpCodes.Absolute: {
    189191              Absolute(instr.buf, code[c].buf);
     
    194196              Load(instr.buf, code[c].buf);
    195197              AnalyticQuotient(instr.buf, code[c + 1].buf);
     198              break;
     199            }
     200
     201          case OpCodes.SubFunction: {
     202              Load(instr.buf, code[c].buf);
    196203              break;
    197204            }
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r18132 r18220  
    724724                                            " is not supported by the SymbolicDataAnalysisTreeILEmittingInterpreter");
    725725          }
     726        case OpCodes.SubFunction: {
     727          CompileInstructions(il, state, ds);
     728          return;
     729        }
    726730        default:
    727731          throw new NotSupportedException("Interpretation of symbol " + currentInstr.dynamicNode.Symbol.Name +
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r18132 r18220  
    529529            }
    530530          }
     531        case OpCodes.SubFunction: {
     532            return Evaluate(dataset, ref row, state);
     533          }
    531534        default:
    532535          throw new NotSupportedException();
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r18132 r18220  
    388388          state.Reset();
    389389          instr.value = interpreter.Evaluate(dataset, ref row, state);
     390        } else if (instr.opCode == OpCodes.SubFunction) {
     391          instr.value = code[instr.childIndex].value;
    390392        } else {
    391393          var errorText = string.Format("The {0} symbol is not supported by the linear interpreter. To support this symbol, please use the SymbolicDataAnalysisExpressionTreeInterpreter.", instr.dynamicNode.Symbol.Name);
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs

    r18160 r18220  
    122122      (byte)OpCode.Cube,
    123123      (byte)OpCode.Absolute,
    124       (byte)OpCode.AnalyticQuotient
     124      (byte)OpCode.AnalyticQuotient,
     125      (byte)OpCode.SubFunction
    125126    };
    126127
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeNodeComparer.cs

    r18132 r18220  
    2222using System;
    2323using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    24 using HEAL.Attic;
    2524
    2625namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    27   [StorableType("eabf848e-d10c-499e-8c48-c771232ede0e")]
    2826  // this comparer considers that a < b if the type of a is "greater" than the type of b, for example:
    2927  // - A function node is "greater" than a terminal node
Note: See TracChangeset for help on using the changeset viewer.