Free cookie consent management tool by TermsFeed Policy Generator

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

#3052: Merged r17413 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic

  • 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.