- Timestamp:
- 01/29/20 16:20:28 (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs
r17180 r17413 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 -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs
r17180 r17413 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(_) { } -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r17180 r17413 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"; … … 117 117 #region group symbol declaration 118 118 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 }); 121 121 var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { abs, airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, 122 122 fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral, analyticalQuotient}); … … 149 149 SetSubtreeCount(cubeRoot, 1, 1); 150 150 SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1); 151 foreach (var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient})) {151 foreach (var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient })) { 152 152 SetSubtreeCount(sy, 1, 1); 153 153 } -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r17344 r17413 156 156 <Compile Include="Formatters\SymbolicDataAnalysisExpressionMathematicaFormatter.cs" /> 157 157 <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" /> 158 <Compile Include="Grammars\DataAnalysisGrammar.cs" /> 158 159 <Compile Include="Hashing\HashExtensions.cs" /> 159 160 <Compile Include="Hashing\HashUtil.cs" /> -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisGrammar.cs
r17180 r17413 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 } -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r17180 r17413 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; … … 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 -
trunk/HeuristicLab.Problems.ExternalEvaluation.GP/3.5/ExternalEvaluationExpressionGrammar.cs
r17180 r17413 21 21 22 22 using System.Collections.Generic; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using H EAL.Attic;26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 27 using HeuristicLab.Problems.DataAnalysis.Symbolic; 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;28 28 29 29 namespace HeuristicLab.Problems.ExternalEvaluation.GP { 30 30 [StorableType("747A7784-EF15-4CEF-A621-79A9071A69F5")] 31 31 [Item("ExternalEvaluationExpressionGrammar", "Represents a grammar for functional expressions using all available functions.")] 32 public class ExternalEvaluationExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {32 public class ExternalEvaluationExpressionGrammar : DataAnalysisGrammar { 33 33 [Storable] 34 34 private HeuristicLab.Problems.DataAnalysis.Symbolic.Variable variableSymbol; … … 45 45 } 46 46 47 private void Initialize() { 47 private void Initialize() { 48 48 var add = new Addition(); 49 49 var sub = new Subtraction(); -
trunk/HeuristicLab.Problems.GrammaticalEvolution/3.4/SymbolicRegression/GESymbolicExpressionGrammar.cs
r17180 r17413 25 25 using System.Collections.Generic; 26 26 using System.Linq; 27 using HEAL.Attic; 27 28 using HeuristicLab.Common; 28 29 using HeuristicLab.Core; 29 30 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 30 using HEAL.Attic;31 31 using HeuristicLab.Problems.DataAnalysis.Symbolic; 32 32 using HeuristicLab.Random; … … 35 35 [StorableType("73D43A23-02FF-4BD8-9834-55D8A90E0FCE")] 36 36 [Item("GESymbolicExpressionGrammar", "Represents a grammar for functional expressions for grammatical evolution.")] 37 public class GESymbolicExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {37 public class GESymbolicExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar { 38 38 [StorableConstructor] 39 39 protected GESymbolicExpressionGrammar(StorableConstructorFlag _) : base(_) { }
Note: See TracChangeset
for help on using the changeset viewer.