Changeset 17606 for branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs
- Timestamp:
- 06/17/20 16:22:18 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs
r17180 r17606 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 27 28 using DoubleVector = MathNet.Numerics.LinearAlgebra.Vector<double>; 29 28 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 29 31 public class SymbolicExpressionImporter { 30 32 private const string VARSTART = "VAR"; 31 33 private const string LAGGEDVARSTART = "LAGVARIABLE"; 34 private const string VECVARSTART = "VEC"; 32 35 private const string INTEGRALSTART = "INTEG"; 33 36 private const string DEFUNSTART = "DEFUN"; … … 70 73 {"EXPINT", new ExponentialIntegralEi()}, 71 74 {"AQ", new AnalyticQuotient() }, 72 {"MEAN", new Average()},75 //{"MEAN", new Average()}, 73 76 {"IF", new IfThenElse()}, 74 77 {">", new GreaterThan()}, … … 82 85 {"MAIN", new StartSymbol()}, 83 86 {"FACTOR", new FactorVariable() }, 84 {"BINFACTOR", new BinaryFactorVariable()} 87 {"BINFACTOR", new BinaryFactorVariable()}, 88 {"SUM", new Sum() }, 89 {"MEAN", new Mean()}, 90 {"LENGTH", new Length()}, 91 {"STDEV", new StandardDeviation()}, 92 {"VAR", new Variance()} 85 93 }; 86 94 87 95 Constant constant = new Constant(); 88 Variable variable = new Variable() ;96 Variable variable = new Variable() { VariableDataType = typeof(double) }; 89 97 LaggedVariable laggedVariable = new LaggedVariable(); 98 Variable vectorVariable = new Variable() { VariableDataType = typeof(DoubleVector) }; 90 99 Defun defun = new Defun(); 91 100 TimeLag timeLag = new TimeLag(); … … 129 138 } else if (tokens.Peek().StringValue.StartsWith(LAGGEDVARSTART)) { 130 139 tree = ParseLaggedVariable(tokens); 140 } else if (tokens.Peek().StringValue.StartsWith(VECVARSTART)) { 141 tree = ParseVectorVariable(tokens); 131 142 } else if (tokens.Peek().StringValue.StartsWith(TIMELAGSTART)) { 132 143 tree = ParseTimeLag(tokens); … … 216 227 } 217 228 229 private ISymbolicExpressionTreeNode ParseVectorVariable(Queue<Token> tokens) { 230 Token varTok = tokens.Dequeue(); 231 Debug.Assert(varTok.StringValue == "VECTORVARIABLE"); 232 VariableTreeNode t = (VariableTreeNode)vectorVariable.CreateTreeNode(); 233 t.Weight = tokens.Dequeue().DoubleValue; 234 t.VariableName = tokens.Dequeue().StringValue; 235 return t; 236 } 237 218 238 private ISymbolicExpressionTreeNode ParseFactor(Queue<Token> tokens) { 219 239 Token tok = tokens.Dequeue();
Note: See TracChangeset
for help on using the changeset viewer.