Changeset 17434 for branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
- Timestamp:
- 02/11/20 13:36:02 (5 years ago)
- Location:
- branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/1772_HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r16130 r17434 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2018Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using System.Drawing; 25 25 using System.Linq; 26 using HEAL.Attic; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Common.Resources; … … 31 32 using HeuristicLab.Optimization; 32 33 using HeuristicLab.Parameters; 33 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;34 34 using HeuristicLab.PluginInfrastructure; 35 35 using HeuristicLab.Problems.Instances; 36 36 37 37 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 38 [Storable Class]38 [StorableType("59935E69-C4A5-480E-8FFB-D9669DE9BFD4")] 39 39 public abstract class SymbolicDataAnalysisProblem<T, U, V> : HeuristicOptimizationProblem<U, V>, IDataAnalysisProblem<T>, ISymbolicDataAnalysisProblem, IStorableContent, 40 40 IProblemInstanceConsumer<T>, IProblemInstanceExporter<T> … … 157 157 158 158 [StorableConstructor] 159 protected SymbolicDataAnalysisProblem( bool deserializing) : base(deserializing) { }159 protected SymbolicDataAnalysisProblem(StorableConstructorFlag _) : base(_) { } 160 160 [StorableHook(HookType.AfterDeserialization)] 161 161 private void AfterDeserialization() { … … 210 210 protected virtual void UpdateGrammar() { 211 211 var problemData = ProblemData; 212 var ds = problemData.Dataset;213 212 var grammar = SymbolicExpressionTreeGrammar; 213 214 214 grammar.MaximumFunctionArguments = MaximumFunctionArguments.Value; 215 215 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); 241 218 } 242 219
Note: See TracChangeset
for help on using the changeset viewer.