Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/06/20 17:46:44 (5 years ago)
Author:
mkommend
Message:

#3052: Merged r17413 into stable.

Location:
stable
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs

    r17181 r17498  
    2121
    2222using System.Collections.Generic;
     23using HEAL.Attic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    26 using HEAL.Attic;
    2727using HeuristicLab.PluginInfrastructure;
    2828
     
    3131  [StorableType("FCBA02B7-5D29-42F5-A64C-A60AD8EA475D")]
    3232  [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")]
    33   public class ArithmeticExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
     33  public class ArithmeticExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
    3434
    3535    [StorableConstructor]
     
    5656      var factorVariableSymbol = new FactorVariable();
    5757
    58       var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol, binFactorVariableSymbol, factorVariableSymbol};
     58      var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol, binFactorVariableSymbol, factorVariableSymbol };
    5959      var functionSymbols = new List<Symbol>() { add, sub, mul, div };
    6060
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs

    r17181 r17498  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3030  [StorableType("44B0829C-1CB5-4BE9-9514-BBA54FAB2912")]
    3131  [Item("FullFunctionalExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")]
    32   public class FullFunctionalExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
     32  public class FullFunctionalExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
    3333    [StorableConstructor]
    3434    protected FullFunctionalExpressionGrammar(StorableConstructorFlag _) : base(_) { }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs

    r17181 r17498  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HEAL.Attic;
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2929  [StorableType("36A22322-0627-4E25-A468-F2A788AF6D46")]
    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.")]
    31   public class TypeCoherentExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
     31  public class TypeCoherentExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {
    3232    private const string ArithmeticFunctionsName = "Arithmetic Functions";
    3333    private const string TrigonometricFunctionsName = "Trigonometric Functions";
     
    117117      #region group symbol declaration
    118118      var arithmeticSymbols = new GroupSymbol(ArithmeticFunctionsName, new List<ISymbol>() { add, sub, mul, div, mean });
    119       var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan, tanh});
    120       var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log});
     119      var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan, tanh });
     120      var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log });
    121121      var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { abs, airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi,
    122122        fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral, analyticalQuotient});
     
    149149      SetSubtreeCount(cubeRoot, 1, 1);
    150150      SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1);
    151       foreach(var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient})) {
     151      foreach (var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient })) {
    152152        SetSubtreeCount(sy, 1, 1);
    153153      }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r17140 r17498  
    155155    <Compile Include="Formatters\SymbolicDataAnalysisExpressionMathematicaFormatter.cs" />
    156156    <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" />
     157    <Compile Include="Grammars\DataAnalysisGrammar.cs" />
    157158    <Compile Include="Hashing\HashExtensions.cs" />
    158159    <Compile Include="Hashing\HashUtil.cs" />
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisGrammar.cs

    r17181 r17498  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    23 using HEAL.Attic;
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2626  [StorableType("5b0720d7-b1f0-4c2f-893e-cd2549e20e9e")]
    2727  public interface ISymbolicDataAnalysisGrammar : ISymbolicExpressionGrammar {
     28    void ConfigureVariableSymbols(IDataAnalysisProblemData problemData);
    2829  }
    2930}
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r17181 r17498  
    2424using System.Drawing;
    2525using System.Linq;
     26using HEAL.Attic;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Common.Resources;
     
    3132using HeuristicLab.Optimization;
    3233using HeuristicLab.Parameters;
    33 using HEAL.Attic;
    3434using HeuristicLab.PluginInfrastructure;
    3535using HeuristicLab.Problems.Instances;
     
    210210    protected virtual void UpdateGrammar() {
    211211      var problemData = ProblemData;
    212       var ds = problemData.Dataset;
    213212      var grammar = SymbolicExpressionTreeGrammar;
     213
    214214      grammar.MaximumFunctionArguments = MaximumFunctionArguments.Value;
    215215      grammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value;
    216       foreach (var varSymbol in grammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableBase>()) {
    217         if (!varSymbol.Fixed) {
    218           varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<double>(x));
    219           varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<double>(x));
    220         }
    221       }
    222       foreach (var factorSymbol in grammar.Symbols.OfType<BinaryFactorVariable>()) {
    223         if (!factorSymbol.Fixed) {
    224           factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x));
    225           factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<string>(x));
    226           factorSymbol.VariableValues = factorSymbol.VariableNames
    227             .ToDictionary(varName => varName, varName => ds.GetStringValues(varName).Distinct().ToList());
    228         }
    229       }
    230       foreach (var factorSymbol in grammar.Symbols.OfType<FactorVariable>()) {
    231         if (!factorSymbol.Fixed) {
    232           factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x));
    233           factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<string>(x));
    234           factorSymbol.VariableValues = factorSymbol.VariableNames
    235             .ToDictionary(varName => varName,
    236             varName => ds.GetStringValues(varName).Distinct()
    237             .Select((n, i) => Tuple.Create(n, i))
    238             .ToDictionary(tup => tup.Item1, tup => tup.Item2));
    239         }
    240       }
     216
     217      grammar.ConfigureVariableSymbols(problemData);
    241218    }
    242219
Note: See TracChangeset for help on using the changeset viewer.