- Timestamp:
- 02/28/20 10:43:50 (5 years ago)
- Location:
- branches/3040_VectorBasedGP
- Files:
-
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP
- Property svn:mergeinfo changed
/trunk (added) merged: 17376-17378,17380,17384-17386,17402,17413,17421-17423,17426-17428,17430,17437,17441,17445,17450
- Property svn:mergeinfo changed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic (added) merged: 17402,17413
- Property svn:mergeinfo changed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs
r17180 r17456 21 21 22 22 using System.Collections.Generic; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 using HEAL.Attic;27 27 using HeuristicLab.PluginInfrastructure; 28 28 … … 31 31 [StorableType("FCBA02B7-5D29-42F5-A64C-A60AD8EA475D")] 32 32 [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")] 33 public class ArithmeticExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {33 public class ArithmeticExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar { 34 34 35 35 [StorableConstructor] … … 56 56 var factorVariableSymbol = new FactorVariable(); 57 57 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 }; 59 59 var functionSymbols = new List<Symbol>() { add, sub, mul, div }; 60 60 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs
r17180 r17456 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 30 [StorableType("44B0829C-1CB5-4BE9-9514-BBA54FAB2912")] 31 31 [Item("FullFunctionalExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")] 32 public class FullFunctionalExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {32 public class FullFunctionalExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar { 33 33 [StorableConstructor] 34 34 protected FullFunctionalExpressionGrammar(StorableConstructorFlag _) : base(_) { } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r17455 r17456 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HEAL.Attic;28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 29 29 [StorableType("36A22322-0627-4E25-A468-F2A788AF6D46")] 30 30 [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 { 32 32 private const string ArithmeticFunctionsName = "Arithmetic Functions"; 33 33 private const string TrigonometricFunctionsName = "Trigonometric Functions"; -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r17455 r17456 160 160 <Compile Include="Formatters\SymbolicDataAnalysisExpressionMathematicaFormatter.cs" /> 161 161 <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" /> 162 <Compile Include="Grammars\DataAnalysisGrammar.cs" /> 162 163 <Compile Include="Hashing\HashExtensions.cs" /> 163 164 <Compile Include="Hashing\HashUtil.cs" /> -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisGrammar.cs
r17180 r17456 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 23 using HEAL.Attic;24 24 25 25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 26 26 [StorableType("5b0720d7-b1f0-4c2f-893e-cd2549e20e9e")] 27 27 public interface ISymbolicDataAnalysisGrammar : ISymbolicExpressionGrammar { 28 void ConfigureVariableSymbols(IDataAnalysisProblemData problemData); 28 29 } 29 30 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs
r16768 r17456 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using System.Linq; … … 181 202 182 203 [ThreadStatic] 183 private Dictionary<string, double[]> cachedData;204 private static Dictionary<string, double[]> cachedData; 184 205 185 206 [ThreadStatic] 186 private IDataset dataset;207 private static IDataset cachedDataset; 187 208 188 209 private void InitCache(IDataset dataset) { 189 this.dataset = dataset;210 cachedDataset = dataset; 190 211 cachedData = new Dictionary<string, double[]>(); 191 212 foreach (var v in dataset.DoubleVariables) { … … 196 217 public void InitializeState() { 197 218 cachedData = null; 198 dataset = null;219 cachedDataset = null; 199 220 EvaluatedSolutions = 0; 200 221 } 201 222 202 223 private double[] GetValues(ISymbolicExpressionTree tree, IDataset dataset, int[] rows) { 203 if (cachedData == null || this.dataset != dataset) {224 if (cachedData == null || cachedDataset != dataset) { 204 225 InitCache(dataset); 205 226 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeNativeInterpreter.cs
r17180 r17456 99 99 100 100 [ThreadStatic] 101 private IDataset dataset;101 private static IDataset cachedDataset; 102 102 103 103 private static readonly HashSet<byte> supportedOpCodes = new HashSet<byte>() { … … 127 127 if (!rows.Any()) return Enumerable.Empty<double>(); 128 128 129 if (cachedData == null || this.dataset != dataset) {129 if (cachedData == null || cachedDataset != dataset) { 130 130 InitCache(dataset); 131 131 } … … 152 152 153 153 private void InitCache(IDataset dataset) { 154 this.dataset = dataset;154 cachedDataset = dataset; 155 155 156 156 // free handles to old data … … 178 178 cachedData = null; 179 179 } 180 dataset = null;180 cachedDataset = null; 181 181 EvaluatedSolutions = 0; 182 182 } -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r17455 r17456 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 HEAL.Attic;34 34 using HeuristicLab.PluginInfrastructure; 35 35 using HeuristicLab.Problems.Instances; … … 212 212 protected virtual void UpdateGrammar() { 213 213 var problemData = ProblemData; 214 var ds = problemData.Dataset;215 214 var grammar = SymbolicExpressionTreeGrammar; 215 216 216 grammar.MaximumFunctionArguments = MaximumFunctionArguments.Value; 217 217 grammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value; 218 foreach (var varSymbol in grammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableBase>()) { 219 if (!varSymbol.Fixed) { 220 varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<double>(x)); 221 varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<double>(x)); 222 } 223 } 224 foreach (var factorSymbol in grammar.Symbols.OfType<BinaryFactorVariable>()) { 225 if (!factorSymbol.Fixed) { 226 factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x)); 227 factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<string>(x)); 228 factorSymbol.VariableValues = factorSymbol.VariableNames 229 .ToDictionary(varName => varName, varName => ds.GetStringValues(varName).Distinct().ToList()); 230 } 231 } 232 foreach (var factorSymbol in grammar.Symbols.OfType<FactorVariable>()) { 233 if (!factorSymbol.Fixed) { 234 factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x)); 235 factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<string>(x)); 236 factorSymbol.VariableValues = factorSymbol.VariableNames 237 .ToDictionary(varName => varName, 238 varName => ds.GetStringValues(varName).Distinct() 239 .Select((n, i) => Tuple.Create(n, i)) 240 .ToDictionary(tup => tup.Item1, tup => tup.Item2)); 241 } 242 } 218 219 grammar.ConfigureVariableSymbols(problemData); 243 220 } 244 221
Note: See TracChangeset
for help on using the changeset viewer.