- Timestamp:
- 10/05/11 21:55:55 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 3 deleted
- 39 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP
- Property svn:ignore
-
old new 1 *.docstates 2 *.psess 1 3 *.resharper 2 4 *.suo 5 *.vsp 3 6 Google.ProtocolBuffers-0.9.1.dll 7 HeuristicLab 3.3.5.1.ReSharper.user 8 HeuristicLab 3.3.6.0.ReSharper.user 4 9 HeuristicLab.4.5.resharper.user 5 10 HeuristicLab.resharper.user … … 8 13 _ReSharper.HeuristicLab 9 14 _ReSharper.HeuristicLab 3.3 15 _ReSharper.HeuristicLab.ExtLibs 16 bin 10 17 protoc.exe 11 HeuristicLab 3.3.5.1.ReSharper.user 12 *.psess 13 *.vsp 14 *.docstates 18 HeuristicLab.ExtLibs.6.0.ReSharper.user
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic
-
Property
svn:ignore
set to
bin
-
Property
svn:ignore
set to
-
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Property svn:ignore
-
old new 4 4 obj 5 5 *.vs10x 6 Plugin.cs
-
- Property svn:ignore
-
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs
r6503 r6878 70 70 71 71 protected override Allele[] CalculateAlleles(ISymbolicExpressionTree solution) { 72 List<Allele> alleles = new List<Allele>(); 73 74 foreach (var subtree in GetAllSubtreesOfDepth(solution, AlleleTreeDepth)) { 75 alleles.Add(GetAlleleFromSubtreeOfDepth(subtree, AlleleTreeDepth)); 76 } 77 return alleles.ToArray(); 72 return GetAllSubtreesOfDepth(solution, AlleleTreeDepth) 73 .AsParallel() 74 .Select(t => GetAlleleFromSubtreeOfDepth(t, AlleleTreeDepth)) 75 .ToArray(); 78 76 } 79 77 … … 87 85 StringBuilder builder = new StringBuilder(); 88 86 builder.Append("(" + tree.ToString()); 89 for (int i = 0; i < tree.Subtree sCount; i++) {87 for (int i = 0; i < tree.SubtreeCount; i++) { 90 88 builder.Append(" " + GetTextualRepresentationFromSubtreeOfDepth(tree.GetSubtree(i), d - 1)); 91 89 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer.cs
r5907 r6878 93 93 IList<int> nonDominatedIndexes = new List<int>(); 94 94 ISymbolicExpressionTree[] tree = SymbolicExpressionTree.ToArray(); 95 List<double[]> qualities = new List<double[]>();96 95 bool[] maximization = Maximization.ToArray(); 97 96 List<double[]> newNonDominatedQualities = new List<double[]>(); 98 97 var evaluator = EvaluatorParameter.ActualValue; 98 var problemData = ProblemDataParameter.ActualValue; 99 99 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator); 100 101 var qualities = tree 102 .AsParallel() 103 .Select(t => evaluator.Evaluate(childContext, t, problemData, rows)) 104 .ToArray(); 100 105 for (int i = 0; i < tree.Length; i++) { 101 qualities.Add(evaluator.Evaluate(childContext, tree[i], ProblemDataParameter.ActualValue, rows)); // qualities[i] = ...102 106 if (IsNonDominated(qualities[i], trainingBestQualities, maximization) && 103 107 IsNonDominated(qualities[i], qualities, maximization)) { -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer.cs
r5907 r6878 76 76 ISymbolicExpressionTree bestTree = null; 77 77 ISymbolicExpressionTree[] tree = SymbolicExpressionTree.ToArray(); 78 double[] quality = new double[tree.Length];79 78 var evaluator = EvaluatorParameter.ActualValue; 79 var problemData = ProblemDataParameter.ActualValue; 80 80 IEnumerable<int> rows = GenerateRowsToEvaluate(); 81 81 if (!rows.Any()) return base.Apply(); 82 82 83 83 IExecutionContext childContext = (IExecutionContext)ExecutionContext.CreateChildOperation(evaluator); 84 var quality = tree 85 .AsParallel() 86 .Select(t => evaluator.Evaluate(childContext, t, problemData, rows)) 87 .ToArray(); 88 84 89 for (int i = 0; i < tree.Length; i++) { 85 quality[i] = evaluator.Evaluate(childContext, tree[i], ProblemDataParameter.ActualValue, rows);86 90 if (IsBetter(quality[i], bestQuality, Maximization.Value)) { 87 91 bestQuality = quality[i]; -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs
r5924 r6878 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 79 80 ItemArray<ISymbolicExpressionTree> expressions = SymbolicExpressionTreeParameter.ActualValue; 80 81 ResultCollection results = ResultCollection; 81 DoubleMatrix impacts;82 82 DataTable datatable; 83 83 if (VariableFrequenciesParameter.ActualValue == null) { … … 85 85 datatable.VisualProperties.XAxisTitle = "Generation"; 86 86 datatable.VisualProperties.YAxisTitle = "Relative Variable Frequency"; 87 impacts = new DoubleMatrix();88 87 VariableFrequenciesParameter.ActualValue = datatable; 89 VariableImpactsParameter.ActualValue = impacts;90 88 results.Add(new Result("Variable frequencies", "Relative frequency of variable references aggregated over the whole population.", datatable)); 91 results.Add(new Result("Variable impacts", "The relative variable relevance calculated as the average relative variable frequency over the whole run.", impacts)); 92 } 93 94 impacts = VariableImpactsParameter.ActualValue; 89 results.Add(new Result("Variable impacts", "The relative variable relevance calculated as the average relative variable frequency over the whole run.", new DoubleMatrix())); 90 } 91 95 92 datatable = VariableFrequenciesParameter.ActualValue; 96 93 // all rows must have the same number of values so we can just take the first … … 104 101 datatable.Rows.Add(row); 105 102 } 106 datatable.Rows[pair.Key].Values.Add( pair.Value);103 datatable.Rows[pair.Key].Values.Add(Math.Round(pair.Value, 3)); 107 104 } 108 105 … … 116 113 .OrderByDescending(p => p.Impact) 117 114 .ToList(); 118 var matrix = (IStringConvertibleMatrix)impacts; 115 var impacts = new DoubleMatrix(); 116 var matrix = impacts as IStringConvertibleMatrix; 119 117 matrix.Rows = orderedImpacts.Count; 120 118 matrix.RowNames = orderedImpacts.Select(x => x.Name); … … 126 124 } 127 125 126 VariableImpactsParameter.ActualValue = impacts; 127 results["Variable impacts"].Value = impacts; 128 128 return base.Apply(); 129 129 } 130 130 131 131 public static IEnumerable<KeyValuePair<string, double>> CalculateVariableFrequencies(IEnumerable<ISymbolicExpressionTree> trees, bool aggregateLaggedVariables = true) { 132 Dictionary<string, double> variableFrequencies = new Dictionary<string, double>(); 133 int totalNumberOfSymbols = 0; 134 135 foreach (var tree in trees) { 136 var variableReferences = GetVariableReferences(tree, aggregateLaggedVariables); 137 foreach (var pair in variableReferences) { 138 totalNumberOfSymbols += pair.Value; 139 if (variableFrequencies.ContainsKey(pair.Key)) { 140 variableFrequencies[pair.Key] += pair.Value; 141 } else { 142 variableFrequencies.Add(pair.Key, pair.Value); 143 } 144 } 145 } 132 133 var variableFrequencies = trees 134 .AsParallel() 135 .SelectMany(t => GetVariableReferences(t, aggregateLaggedVariables)) 136 .GroupBy(pair => pair.Key, pair => pair.Value) 137 .ToDictionary(g => g.Key, g => (double)g.Sum()); 138 139 double totalNumberOfSymbols = variableFrequencies.Values.Sum(); 146 140 147 141 foreach (var pair in variableFrequencies) -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r5817 r6878 73 73 FormatBegin(node, strBuilder); 74 74 75 if (node.Subtree sCount > 0) {75 if (node.SubtreeCount > 0) { 76 76 strBuilder.Append(FormatRecursively(node.GetSubtree(0))); 77 77 } … … 91 91 strBuilder.Append(@" \left( "); 92 92 } else if (node.Symbol is Subtraction) { 93 if (node.Subtree sCount == 1) {93 if (node.SubtreeCount == 1) { 94 94 strBuilder.Append(@"- \left("); 95 95 } else { … … 98 98 } else if (node.Symbol is Multiplication) { 99 99 } else if (node.Symbol is Division) { 100 if (node.Subtree sCount == 1) {100 if (node.SubtreeCount == 1) { 101 101 strBuilder.Append(@" \cfrac{1}{"); 102 102 } else { … … 105 105 } else if (node.Symbol is Average) { 106 106 // skip output of (1/1) if only one subtree 107 if (node.Subtree sCount > 1) {108 strBuilder.Append(@" \cfrac{1}{" + node.Subtree sCount + @"}");107 if (node.SubtreeCount > 1) { 108 strBuilder.Append(@" \cfrac{1}{" + node.SubtreeCount + @"}"); 109 109 } 110 110 strBuilder.Append(@" \left("); … … 246 246 } else if (node.Symbol is Division) { 247 247 strBuilder.Append("} "); 248 if (node.Subtree sCount > 1)248 if (node.SubtreeCount > 1) 249 249 strBuilder.Append("{1} "); 250 for (int i = 1; i < node.Subtree sCount; i++) {250 for (int i = 1; i < node.SubtreeCount; i++) { 251 251 strBuilder.Append(" } "); 252 252 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionMATLABFormatter.cs
r5809 r6878 106 106 107 107 if (symbol is Addition) { 108 for (int i = 0; i < node.Subtree sCount; i++) {108 for (int i = 0; i < node.SubtreeCount; i++) { 109 109 if (i > 0) stringBuilder.Append("+"); 110 110 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); … … 112 112 } else if (symbol is And) { 113 113 stringBuilder.Append("(("); 114 for (int i = 0; i < node.Subtree sCount; i++) {114 for (int i = 0; i < node.SubtreeCount; i++) { 115 115 if (i > 0) stringBuilder.Append("&"); 116 116 stringBuilder.Append("(("); … … 121 121 } else if (symbol is Average) { 122 122 stringBuilder.Append("(1/"); 123 stringBuilder.Append(node.Subtree sCount);123 stringBuilder.Append(node.SubtreeCount); 124 124 stringBuilder.Append(")*("); 125 for (int i = 0; i < node.Subtree sCount; i++) {125 for (int i = 0; i < node.SubtreeCount; i++) { 126 126 if (i > 0) stringBuilder.Append("+"); 127 127 stringBuilder.Append("("); … … 138 138 stringBuilder.Append(")"); 139 139 } else if (symbol is Division) { 140 if (node.Subtree sCount == 1) {140 if (node.SubtreeCount == 1) { 141 141 stringBuilder.Append("1/"); 142 142 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); … … 144 144 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 145 145 stringBuilder.Append("/("); 146 for (int i = 1; i < node.Subtree sCount; i++) {146 for (int i = 1; i < node.SubtreeCount; i++) { 147 147 if (i > 1) stringBuilder.Append("*"); 148 148 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); … … 187 187 stringBuilder.Append(")"); 188 188 } else if (symbol is Multiplication) { 189 for (int i = 0; i < node.Subtree sCount; i++) {189 for (int i = 0; i < node.SubtreeCount; i++) { 190 190 if (i > 0) stringBuilder.Append("*"); 191 191 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); … … 197 197 } else if (symbol is Or) { 198 198 stringBuilder.Append("(("); 199 for (int i = 0; i < node.Subtree sCount; i++) {199 for (int i = 0; i < node.SubtreeCount; i++) { 200 200 if (i > 0) stringBuilder.Append("|"); 201 201 stringBuilder.Append("(("); … … 209 209 stringBuilder.Append(")"); 210 210 } else if (symbol is Subtraction) { 211 if (node.Subtree sCount == 1) {211 if (node.SubtreeCount == 1) { 212 212 stringBuilder.Append("-1*"); 213 213 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 214 214 } else { 215 215 stringBuilder.Append(FormatRecursively(node.GetSubtree(0))); 216 for (int i = 1; i < node.Subtree sCount; i++) {216 for (int i = 1; i < node.SubtreeCount; i++) { 217 217 stringBuilder.Append("-"); 218 218 stringBuilder.Append(FormatRecursively(node.GetSubtree(i))); -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs
r5809 r6878 25 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.PluginInfrastructure; 27 28 28 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 [NonDiscoverableType] 29 31 [StorableClass] 30 32 [Item("ArithmeticExpressionGrammar", "Represents a grammar for functional expressions using only arithmetic operations.")] -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r5809 r6878 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 31 public class TypeCoherentExpressionGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar { 32 private const string ArithmeticFunctionsName = "Arithmetic Functions"; 33 private const string TrigonometricFunctionsName = "Trigonometric Functions"; 34 private const string ExponentialFunctionsName = "Exponential and Logarithmic Functions"; 35 private const string RealValuedSymbolsName = "Real Valued Symbols"; 36 private const string TerminalsName = "Terminals"; 37 private const string PowerFunctionsName = "Power Functions"; 38 private const string ConditionsName = "Conditions"; 39 private const string ComparisonsName = "Comparisons"; 40 private const string BooleanOperatorsName = "Boolean Operators"; 41 private const string ConditionalSymbolsName = "ConditionalSymbols"; 42 private const string TimeSeriesSymbolsName = "Time Series Symbols"; 32 43 33 44 [StorableConstructor] … … 43 54 44 55 private void Initialize() { 56 #region symbol declaration 45 57 var add = new Addition(); 46 58 var sub = new Subtraction(); … … 53 65 var log = new Logarithm(); 54 66 var pow = new Power(); 55 pow.InitialFrequency = 0.0;56 67 var root = new Root(); 57 root.InitialFrequency = 0.0;58 68 var exp = new Exponential(); 59 69 var @if = new IfThenElse(); … … 63 73 var or = new Or(); 64 74 var not = new Not(); 75 var variableCondition = new VariableCondition(); 65 76 66 77 var timeLag = new TimeLag(); 67 timeLag.InitialFrequency = 0.0;68 78 var integral = new Integral(); 69 integral.InitialFrequency = 0.0;70 79 var derivative = new Derivative(); 71 derivative.InitialFrequency = 0.0;72 var variableCondition = new VariableCondition();73 variableCondition.InitialFrequency = 0.0;74 80 75 81 var constant = new Constant(); 76 82 constant.MinValue = -20; 77 83 constant.MaxValue = 20; 78 var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();84 var variableSymbol = new Variable(); 79 85 var laggedVariable = new LaggedVariable(); 80 81 laggedVariable.InitialFrequency = 0.0; 82 mean.InitialFrequency = 0.0; 83 84 /* 85 * Start = RealValueExpression 86 * 87 * RealValueExpression = 88 * "Variable" | 89 * "Constant" | 90 * BinaryOperator RealValueExpression RealValueExpression | 91 * UnaryOperator RealValueExpression | 92 * "IF" BooleanExpression RealValueExpression RealValueExpression | 93 * "VariableCondition" RealValueExpression RealValueExpression 94 * 95 * BinaryOperator = 96 * "+" | "-" | "*" | "/" | "Power" 97 * 98 * UnaryOperator = 99 * "Sin" | "Cos" | "Tan" | "Log" | "Exp" 100 * 101 * BooleanExpression = 102 * "AND" BooleanExpression BooleanExpression | 103 * "OR" BooleanExpression BooleanExpression | 104 * "NOT" BooleanExpression | 105 * ">" RealValueExpression RealValueExpression | 106 * "<" RealValueExpression RealValueExpression 107 */ 108 109 var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition }; 110 111 var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, timeLag, integral, derivative }; 112 var binaryFunctionSymbols = new List<Symbol>() { add, sub, mul, div, mean, pow, root, variableCondition }; 113 114 var unaryBooleanFunctionSymbols = new List<Symbol>() { not }; 115 var binaryBooleanFunctionSymbols = new List<Symbol>() { or, and }; 116 var relationalFunctionSymbols = new List<Symbol>() { gt, lt }; 117 var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable }; 118 var realValuedSymbols = unaryFunctionSymbols.Concat(binaryFunctionSymbols).Concat(terminalSymbols).Concat(new List<Symbol>() { @if }); 119 var booleanSymbols = unaryBooleanFunctionSymbols.Concat(binaryBooleanFunctionSymbols).Concat(relationalFunctionSymbols); 120 121 foreach (var symb in allSymbols) 122 AddSymbol(symb); 123 124 foreach (var unaryFun in unaryFunctionSymbols.Concat(unaryBooleanFunctionSymbols)) { 125 SetSubtreeCount(unaryFun, 1, 1); 126 } 127 foreach (var binaryFun in binaryFunctionSymbols.Concat(binaryBooleanFunctionSymbols).Concat(relationalFunctionSymbols)) { 128 SetSubtreeCount(binaryFun, 2, 2); 129 } 130 131 foreach (var terminalSymbol in terminalSymbols) { 132 SetSubtreeCount(terminalSymbol, 0, 0); 133 } 86 #endregion 87 88 #region group symbol declaration 89 var arithmeticSymbols = new GroupSymbol(ArithmeticFunctionsName, new List<ISymbol>() { add, sub, mul, div, mean }); 90 var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan }); 91 var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log }); 92 var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, variableSymbol }); 93 var realValuedSymbols = new GroupSymbol(RealValuedSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, terminalSymbols }); 94 95 var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { pow, root }); 96 97 var conditionSymbols = new GroupSymbol(ConditionsName, new List<ISymbol> { @if, variableCondition }); 98 var comparisonSymbols = new GroupSymbol(ComparisonsName, new List<ISymbol> { gt, lt }); 99 var booleanOperationSymbols = new GroupSymbol(BooleanOperatorsName, new List<ISymbol> { and, or, not }); 100 var conditionalSymbols = new GroupSymbol(ConditionalSymbolsName, new List<ISymbol> { conditionSymbols, comparisonSymbols, booleanOperationSymbols }); 101 102 var timeSeriesSymbols = new GroupSymbol(TimeSeriesSymbolsName, new List<ISymbol> { timeLag, integral, derivative, laggedVariable }); 103 #endregion 104 105 AddSymbol(realValuedSymbols); 106 AddSymbol(powerSymbols); 107 AddSymbol(conditionalSymbols); 108 AddSymbol(timeSeriesSymbols); 109 110 #region subtree count configuration 111 SetSubtreeCount(arithmeticSymbols, 2, 2); 112 SetSubtreeCount(trigonometricSymbols, 1, 1); 113 SetSubtreeCount(powerSymbols, 2, 2); 114 SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1); 115 SetSubtreeCount(terminalSymbols, 0, 0); 134 116 135 117 SetSubtreeCount(@if, 3, 3); 136 137 138 // allow only real-valued expressions as child of the start symbol 139 foreach (var symb in realValuedSymbols) { 140 AddAllowedChildSymbol(StartSymbol, symb); 141 AddAllowedChildSymbol(DefunSymbol, symb); 142 } 143 144 foreach (var symb in unaryFunctionSymbols) { 145 foreach (var childSymb in realValuedSymbols) { 146 AddAllowedChildSymbol(symb, childSymb); 147 } 148 } 149 150 foreach (var symb in binaryFunctionSymbols) { 151 foreach (var childSymb in realValuedSymbols) { 152 AddAllowedChildSymbol(symb, childSymb); 153 } 154 } 155 156 foreach (var childSymb in booleanSymbols) { 157 AddAllowedChildSymbol(@if, childSymb, 0); 158 } 159 foreach (var childSymb in realValuedSymbols) { 160 AddAllowedChildSymbol(@if, childSymb, 1); 161 AddAllowedChildSymbol(@if, childSymb, 2); 162 } 163 164 foreach (var symb in relationalFunctionSymbols) { 165 foreach (var childSymb in realValuedSymbols) { 166 AddAllowedChildSymbol(symb, childSymb); 167 } 168 } 169 foreach (var symb in binaryBooleanFunctionSymbols) { 170 foreach (var childSymb in booleanSymbols) { 171 AddAllowedChildSymbol(symb, childSymb); 172 } 173 } 174 foreach (var symb in unaryBooleanFunctionSymbols) { 175 foreach (var childSymb in booleanSymbols) { 176 AddAllowedChildSymbol(symb, childSymb); 177 } 178 } 118 SetSubtreeCount(variableCondition, 2, 2); 119 SetSubtreeCount(comparisonSymbols, 2, 2); 120 SetSubtreeCount(and, 2, 2); 121 SetSubtreeCount(or, 2, 2); 122 SetSubtreeCount(not, 1, 1); 123 124 SetSubtreeCount(timeLag, 1, 1); 125 SetSubtreeCount(integral, 1, 1); 126 SetSubtreeCount(derivative, 1, 1); 127 SetSubtreeCount(laggedVariable, 0, 0); 128 #endregion 129 130 #region allowed child symbols configuration 131 AddAllowedChildSymbol(StartSymbol, realValuedSymbols); 132 AddAllowedChildSymbol(DefunSymbol, realValuedSymbols); 133 134 AddAllowedChildSymbol(realValuedSymbols, realValuedSymbols); 135 AddAllowedChildSymbol(realValuedSymbols, powerSymbols); 136 AddAllowedChildSymbol(realValuedSymbols, conditionSymbols); 137 AddAllowedChildSymbol(realValuedSymbols, timeSeriesSymbols); 138 139 AddAllowedChildSymbol(powerSymbols, variableSymbol, 0); 140 AddAllowedChildSymbol(powerSymbols, constant, 1); 141 142 AddAllowedChildSymbol(@if, comparisonSymbols, 0); 143 AddAllowedChildSymbol(@if, booleanOperationSymbols, 0); 144 AddAllowedChildSymbol(@if, conditionSymbols, 1); 145 AddAllowedChildSymbol(@if, realValuedSymbols, 1); 146 AddAllowedChildSymbol(@if, powerSymbols, 1); 147 AddAllowedChildSymbol(@if, timeSeriesSymbols, 1); 148 AddAllowedChildSymbol(@if, conditionSymbols, 2); 149 AddAllowedChildSymbol(@if, realValuedSymbols, 2); 150 AddAllowedChildSymbol(@if, powerSymbols, 2); 151 AddAllowedChildSymbol(@if, timeSeriesSymbols, 2); 152 153 AddAllowedChildSymbol(booleanOperationSymbols, comparisonSymbols); 154 AddAllowedChildSymbol(comparisonSymbols, realValuedSymbols); 155 AddAllowedChildSymbol(comparisonSymbols, powerSymbols); 156 AddAllowedChildSymbol(comparisonSymbols, conditionSymbols); 157 AddAllowedChildSymbol(comparisonSymbols, timeSeriesSymbols); 158 159 AddAllowedChildSymbol(variableCondition, realValuedSymbols); 160 AddAllowedChildSymbol(variableCondition, powerSymbols); 161 AddAllowedChildSymbol(variableCondition, conditionSymbols); 162 AddAllowedChildSymbol(variableCondition, timeSeriesSymbols); 163 164 165 AddAllowedChildSymbol(timeLag, realValuedSymbols); 166 AddAllowedChildSymbol(timeLag, powerSymbols); 167 AddAllowedChildSymbol(timeLag, conditionSymbols); 168 169 AddAllowedChildSymbol(integral, realValuedSymbols); 170 AddAllowedChildSymbol(integral, powerSymbols); 171 AddAllowedChildSymbol(integral, conditionSymbols); 172 173 AddAllowedChildSymbol(derivative, realValuedSymbols); 174 AddAllowedChildSymbol(derivative, powerSymbols); 175 AddAllowedChildSymbol(derivative, conditionSymbols); 176 #endregion 177 } 178 179 public void ConfigureAsDefaultRegressionGrammar() { 180 Symbols.Where(s => s is Average).First().Enabled = false; 181 Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false; 182 Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false; 183 Symbols.Where(s => s.Name == ConditionalSymbolsName).First().Enabled = false; 184 Symbols.Where(s => s.Name == TimeSeriesSymbolsName).First().Enabled = false; 185 } 186 187 public void ConfigureAsDefaultClassificationGrammar() { 188 Symbols.Where(s => s is Average).First().Enabled = false; 189 Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false; 190 Symbols.Where(s => s.Name == ExponentialFunctionsName).First().Enabled = false; 191 Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false; 192 Symbols.Where(s => s.Name == TimeSeriesSymbolsName).First().Enabled = false; 193 } 194 195 public void ConfigureAsDefaultTimeSeriesPrognosisGrammar() { 196 Symbols.Where(s => s is Variable).First().Enabled = false; 197 Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false; 198 Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false; 199 Symbols.Where(s => s.Name == ConditionalSymbolsName).First().Enabled = false; 179 200 } 180 201 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r6135 r6878 41 41 <DebugType>full</DebugType> 42 42 <Optimize>false</Optimize> 43 <OutputPath> bin\Debug\</OutputPath>43 <OutputPath>$(SolutionDir)\bin\</OutputPath> 44 44 <DefineConstants>DEBUG;TRACE</DefineConstants> 45 45 <ErrorReport>prompt</ErrorReport> … … 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath> bin\Release\</OutputPath>52 <OutputPath>$(SolutionDir)\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> … … 58 58 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> 59 59 <DebugSymbols>true</DebugSymbols> 60 <OutputPath> bin\x64\Debug\</OutputPath>60 <OutputPath>$(SolutionDir)\bin\</OutputPath> 61 61 <DefineConstants>DEBUG;TRACE</DefineConstants> 62 62 <DebugType>full</DebugType> … … 66 66 </PropertyGroup> 67 67 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 68 <OutputPath> bin\x64\Release\</OutputPath>68 <OutputPath>$(SolutionDir)\bin\</OutputPath> 69 69 <DefineConstants>TRACE</DefineConstants> 70 70 <Optimize>true</Optimize> … … 76 76 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 77 77 <DebugSymbols>true</DebugSymbols> 78 <OutputPath> bin\x86\Debug\</OutputPath>78 <OutputPath>$(SolutionDir)\bin\</OutputPath> 79 79 <DefineConstants>DEBUG;TRACE</DefineConstants> 80 80 <DebugType>full</DebugType> … … 84 84 </PropertyGroup> 85 85 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 86 <OutputPath> bin\x86\Release\</OutputPath>86 <OutputPath>$(SolutionDir)\bin\</OutputPath> 87 87 <DefineConstants>TRACE</DefineConstants> 88 88 <Optimize>true</Optimize> … … 121 121 <Compile Include="Analyzers\SymbolicDataAnalysisVariableFrequencyAnalyzer.cs" /> 122 122 <Compile Include="Analyzers\SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs" /> 123 <Compile Include="Plugin.cs" /> 124 <Compile Include="SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs" /> 123 125 <Compile Include="Formatters\SymbolicDataAnalysisExpressionLatexFormatter.cs" /> 124 126 <Compile Include="Formatters\SymbolicDataAnalysisExpressionMATLABFormatter.cs" /> … … 175 177 <Compile Include="Symbols\VariableTreeNode.cs" /> 176 178 <None Include="HeuristicLab.snk" /> 177 <None Include=" HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs.frame" />178 <None Include="Properties\AssemblyInfo. frame" />179 <None Include="Plugin.cs.frame" /> 180 <None Include="Properties\AssemblyInfo.cs.frame" /> 179 181 <Compile Include="Evaluators\SymbolicDataAnalysisMultiObjectiveEvaluator.cs" /> 180 182 <Compile Include="Evaluators\SymbolicDataAnalysisSingleObjectiveEvaluator.cs" /> 181 183 <Compile Include="Evaluators\SymbolicDataAnalysisEvaluator.cs" /> 182 <Compile Include="HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs" />183 184 <Compile Include="Interfaces\ISymbolicDataAnalysisInterpreterOperator.cs" /> 184 185 <Compile Include="Interfaces\ISymbolicDataAnalysisMultiObjectiveEvaluator.cs" /> … … 195 196 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 196 197 <Name>HeuristicLab.Analysis-3.3</Name> 198 <Private>False</Private> 197 199 </ProjectReference> 198 200 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 199 201 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 200 202 <Name>HeuristicLab.Collections-3.3</Name> 203 <Private>False</Private> 201 204 </ProjectReference> 202 205 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 203 206 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 204 207 <Name>HeuristicLab.Common.Resources-3.3</Name> 208 <Private>False</Private> 205 209 </ProjectReference> 206 210 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 207 211 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> 208 212 <Name>HeuristicLab.Common-3.3</Name> 213 <Private>False</Private> 209 214 </ProjectReference> 210 215 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 211 216 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> 212 217 <Name>HeuristicLab.Core-3.3</Name> 218 <Private>False</Private> 213 219 </ProjectReference> 214 220 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 215 221 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 216 222 <Name>HeuristicLab.Data-3.3</Name> 223 <Private>False</Private> 217 224 </ProjectReference> 218 225 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 219 226 <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project> 220 227 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name> 221 </ProjectReference> 222 <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.ALGLIB\3.1.0\ALGLIB-3.1.0\ALGLIB-3.1.0.csproj"> 223 <Project>{FC841674-62A7-4055-BE91-E41944B6C606}</Project> 224 <Name>ALGLIB-3.1.0</Name> 225 </ProjectReference> 226 <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.ALGLIB\3.1.0\HeuristicLab.ALGLIB-3.1.0\HeuristicLab.ALGLIB-3.1.0.csproj"> 227 <Project>{DE69A359-A5B8-4D3D-BA8D-D5780D7F96D6}</Project> 228 <Name>HeuristicLab.ALGLIB-3.1.0 %28HeuristicLab.ExtLibs\HeuristicLab.ALGLIB\HeuristicLab.ALGLIB-3.1.0\HeuristicLab.ALGLIB-3.1.0%29</Name> 228 <Private>False</Private> 229 229 </ProjectReference> 230 230 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 231 231 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 232 232 <Name>HeuristicLab.Operators-3.3</Name> 233 <Private>False</Private> 233 234 </ProjectReference> 234 235 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 235 236 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 236 237 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 238 <Private>False</Private> 237 239 </ProjectReference> 238 240 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 239 241 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 240 242 <Name>HeuristicLab.Optimization-3.3</Name> 243 <Private>False</Private> 241 244 </ProjectReference> 242 245 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 243 246 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 244 247 <Name>HeuristicLab.Parameters-3.3</Name> 248 <Private>False</Private> 245 249 </ProjectReference> 246 250 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 247 251 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> 248 252 <Name>HeuristicLab.Persistence-3.3</Name> 253 <Private>False</Private> 249 254 </ProjectReference> 250 255 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 251 256 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 252 257 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 258 <Private>False</Private> 253 259 </ProjectReference> 254 260 <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj"> 255 261 <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project> 256 262 <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name> 263 <Private>False</Private> 257 264 </ProjectReference> 258 265 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 259 266 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project> 260 267 <Name>HeuristicLab.Random-3.3</Name> 268 <Private>False</Private> 261 269 </ProjectReference> 262 270 </ItemGroup> … … 294 302 295 303 call PreBuildEvent.cmd 296 SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs"</PreBuildEvent>304 </PreBuildEvent> 297 305 </PropertyGroup> 298 306 </Project> -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r5987 r6878 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 26 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HeuristicLab.Parameters; 27 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Data;29 using HeuristicLab.Parameters;30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 208 208 if (instr.opCode == OpCodes.Variable) { 209 209 var variableTreeNode = instr.dynamicNode as VariableTreeNode; 210 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName);210 instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName); 211 211 code[i] = instr; 212 212 } else if (instr.opCode == OpCodes.LagVariable) { 213 var variableTreeNode = instr.dynamicNode as LaggedVariableTreeNode;214 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName);213 var laggedVariableTreeNode = instr.dynamicNode as LaggedVariableTreeNode; 214 instr.iArg0 = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName); 215 215 code[i] = instr; 216 216 } else if (instr.opCode == OpCodes.VariableCondition) { 217 217 var variableConditionTreeNode = instr.dynamicNode as VariableConditionTreeNode; 218 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableConditionTreeNode.VariableName);218 instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName); 219 219 } else if (instr.opCode == OpCodes.Call) { 220 220 necessaryArgStackSize += instr.nArguments + 1; … … 308 308 double result = Evaluate(dataset, ref row, state); 309 309 for (int i = 1; i < currentInstr.nArguments; i++) { 310 if (result <= 0.0) SkipInstructions(state);310 if (result > 0.0) result = Evaluate(dataset, ref row, state); 311 311 else { 312 result = Evaluate(dataset, ref row,state);312 SkipInstructions(state); 313 313 } 314 314 } 315 return result <= 0.0 ? -1.0 :1.0;315 return result > 0.0 ? 1.0 : -1.0; 316 316 } 317 317 case OpCodes.OR: { 318 318 double result = Evaluate(dataset, ref row, state); 319 319 for (int i = 1; i < currentInstr.nArguments; i++) { 320 if (result > 0.0) SkipInstructions(state);320 if (result <= 0.0) result = Evaluate(dataset, ref row, state); 321 321 else { 322 result = Evaluate(dataset, ref row,state);322 SkipInstructions(state); 323 323 } 324 324 } … … 390 390 int savedPc = state.ProgramCounter; 391 391 // set pc to start of function 392 state.ProgramCounter = currentInstr.iArg0;392 state.ProgramCounter = (ushort)currentInstr.iArg0; 393 393 // evaluate the function 394 394 double v = Evaluate(dataset, ref row, state); … … 402 402 } 403 403 case OpCodes.Arg: { 404 return state.GetStackFrameValue( currentInstr.iArg0);404 return state.GetStackFrameValue((ushort)currentInstr.iArg0); 405 405 } 406 406 case OpCodes.Variable: { 407 407 if (row < 0 || row >= dataset.Rows) 408 408 return double.NaN; 409 var variableTreeNode = currentInstr.dynamicNode as VariableTreeNode;410 return dataset[row, currentInstr.iArg0] * variableTreeNode.Weight;409 var variableTreeNode = (VariableTreeNode)currentInstr.dynamicNode; 410 return ((IList<double>)currentInstr.iArg0)[row] * variableTreeNode.Weight; 411 411 } 412 412 case OpCodes.LagVariable: { 413 var laggedVariableTreeNode = currentInstr.dynamicNode as LaggedVariableTreeNode;413 var laggedVariableTreeNode = (LaggedVariableTreeNode)currentInstr.dynamicNode; 414 414 int actualRow = row + laggedVariableTreeNode.Lag; 415 415 if (actualRow < 0 || actualRow >= dataset.Rows) 416 416 return double.NaN; 417 return dataset[actualRow, currentInstr.iArg0] * laggedVariableTreeNode.Weight;417 return ((IList<double>)currentInstr.iArg0)[actualRow] * laggedVariableTreeNode.Weight; 418 418 } 419 419 case OpCodes.Constant: { … … 428 428 return double.NaN; 429 429 var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode; 430 double variableValue = dataset[row, currentInstr.iArg0];430 double variableValue = ((IList<double>)currentInstr.iArg0)[row]; 431 431 double x = variableValue - variableConditionTreeNode.Threshold; 432 432 double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x)); -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs
r5936 r6878 64 64 private ISymbolicExpressionTreeNode MacroExpand(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode node, IList<ISymbolicExpressionTreeNode> argumentTrees) { 65 65 List<ISymbolicExpressionTreeNode> subtrees = new List<ISymbolicExpressionTreeNode>(node.Subtrees); 66 while (node.Subtree sCount > 0) node.RemoveSubtree(0);66 while (node.SubtreeCount > 0) node.RemoveSubtree(0); 67 67 if (node.Symbol is InvokeFunction) { 68 68 var invokeSym = node.Symbol as InvokeFunction; … … 538 538 } else if (IsExp(node)) { 539 539 return node.GetSubtree(0); 540 } else if (IsMultiplication(node)) {541 return node.Subtrees.Select(s => MakeLog(s)).Aggregate((x, y) => MakeSum(x, y));542 } else if (IsDivision(node)) {543 var subtractionNode = subSymbol.CreateTreeNode();544 foreach (var subtree in node.Subtrees) {545 subtractionNode.AddSubtree(MakeLog(subtree));546 }547 return subtractionNode;548 540 } else { 549 541 var logNode = logSymbol.CreateTreeNode(); … … 901 893 // x0 * x1 * .. * xn * -1 => x0 * x1 * .. * -xn 902 894 var lastSubTree = x.Subtrees.Last(); 903 x.RemoveSubtree(x.Subtree sCount - 1);895 x.RemoveSubtree(x.SubtreeCount - 1); 904 896 x.AddSubtree(Negate(lastSubTree)); // last is maybe a constant, prefer to negate the constant 905 897 } else { -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r6533 r6878 190 190 SymbolicExpressionTreeGrammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value; 191 191 foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Variable>()) { 192 varSymbol.VariableNames = ProblemData.AllowedInputVariables;192 if (!varSymbol.Fixed) varSymbol.VariableNames = ProblemData.AllowedInputVariables; 193 193 } 194 194 foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableCondition>()) { 195 varSymbol.VariableNames = ProblemData.AllowedInputVariables;195 if (!varSymbol.Fixed) varSymbol.VariableNames = ProblemData.AllowedInputVariables; 196 196 } 197 197 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Addition.cs
r5809 r6878 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;26 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 27 27 [StorableClass] 28 28 [Item("Addition", "Symbol that represents the + operator.")] 29 29 public sealed class Addition : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Addition(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/And.cs
r5809 r6878 28 28 [Item("And", "Symbol that represents the boolean AND operator.")] 29 29 public sealed class And : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private And(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Average.cs
r5809 r6878 28 28 [Item("Average", "Symbol that represents the average (arithmetic mean) function.")] 29 29 public sealed class Average : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Average(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Constant.cs
r5809 r6878 88 88 } 89 89 90 private const int minimumArity = 0; 91 private const int maximumArity = 0; 92 93 public override int MinimumArity { 94 get { return minimumArity; } 95 } 96 public override int MaximumArity { 97 get { return maximumArity; } 98 } 90 99 #endregion 100 91 101 [StorableConstructor] 92 102 private Constant(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Cosine.cs
r5809 r6878 28 28 [Item("Cosine", "Symbol that represents the cosine function.")] 29 29 public sealed class Cosine : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Cosine(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Derivative.cs
r5809 r6878 28 28 [Item("Derivative", "Represents the derivative over the specified subtree.")] 29 29 public sealed class Derivative : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Derivative(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Division.cs
r5809 r6878 28 28 [Item("Division", "Symbol that represents the / operator.")] 29 29 public sealed class Division : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Division(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Exponential.cs
r5809 r6878 28 28 [Item("Exponential", "Symbol that represents the exponential function.")] 29 29 public sealed class Exponential : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Exponential(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/GreaterThan.cs
r5809 r6878 28 28 [Item("GreaterThan", "Symbol that represents a greater than relation.")] 29 29 public sealed class GreaterThan : Symbol { 30 private const int minimumArity = 2; 31 private const int maximumArity = 2; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private GreaterThan(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/IfThenElse.cs
r5809 r6878 28 28 [Item("IfThenElse", "Symbol that represents a conditional operator.")] 29 29 public sealed class IfThenElse : Symbol { 30 private const int minimumArity = 3; 31 private const int maximumArity = 3; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private IfThenElse(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Integral.cs
r5809 r6878 27 27 [Item("Integral", "Represents the integral over the specified subtree.")] 28 28 public sealed class Integral : LaggedSymbol { 29 private const int minimumArity = 1; 30 private const int maximumArity = 1; 31 32 public override int MinimumArity { 33 get { return minimumArity; } 34 } 35 public override int MaximumArity { 36 get { return maximumArity; } 37 } 38 29 39 [StorableConstructor] 30 40 private Integral(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/LessThan.cs
r5809 r6878 28 28 [Item("LessThan", "Symbol that represents a less than relation.")] 29 29 public sealed class LessThan : Symbol { 30 private const int minimumArity = 2; 31 private const int maximumArity = 2; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private LessThan(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Logarithm.cs
r5809 r6878 28 28 [Item("Logarithm", "Symbol that represents the logarithm function.")] 29 29 public sealed class Logarithm : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Logarithm(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Multiplication.cs
r5809 r6878 28 28 [Item("Multiplication", "Symbol that represents the * operator.")] 29 29 public sealed class Multiplication : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Multiplication(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Not.cs
r5809 r6878 28 28 [Item("Not", "Symbol that represents the boolean NOT operator.")] 29 29 public sealed class Not : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Not(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Or.cs
r5809 r6878 28 28 [Item("Or", "Symbol that represents the boolean OR operator.")] 29 29 public sealed class Or : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Or(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Power.cs
r5809 r6878 28 28 [Item("Power", "Symbol that represents the power function.")] 29 29 public sealed class Power : Symbol { 30 private const int minimumArity = 2; 31 private const int maximumArity = 2; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Power(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Root.cs
r5809 r6878 28 28 [Item("Root", "Symbol that represents the n-th root function.")] 29 29 public sealed class Root : Symbol { 30 private const int minimumArity = 2; 31 private const int maximumArity = 2; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Root(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Sine.cs
r5809 r6878 28 28 [Item("Sine", "Symbol that represents the sine function.")] 29 29 public sealed class Sine : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Sine(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Subtraction.cs
r5809 r6878 28 28 [Item("Subtraction", "Symbol that represents the - operator.")] 29 29 public sealed class Subtraction : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = byte.MaxValue; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Subtraction(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Tangent.cs
r5809 r6878 28 28 [Item("Tangent", "Symbol that represents the tangent trigonometric function.")] 29 29 public sealed class Tangent : Symbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private Tangent(bool deserializing) : base(deserializing) { } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TimeLag.cs
r5809 r6878 28 28 [Item("TimeLag", "Represents a symblol whose evaluation is shifted.")] 29 29 public sealed class TimeLag : LaggedSymbol { 30 private const int minimumArity = 1; 31 private const int maximumArity = 1; 32 33 public override int MinimumArity { 34 get { return minimumArity; } 35 } 36 public override int MaximumArity { 37 get { return maximumArity; } 38 } 39 30 40 [StorableConstructor] 31 41 private TimeLag(bool deserializing) : base(deserializing) { } … … 33 43 public override IDeepCloneable Clone(Cloner cloner) { return new TimeLag(this, cloner); } 34 44 35 public TimeLag() : base("TimeLag", "Represents a symb lol whose evaluation is shifted.") { }45 public TimeLag() : base("TimeLag", "Represents a symbol whose evaluation is shifted.") { } 36 46 } 37 47 } -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs
r5809 r6878 100 100 } 101 101 } 102 103 private const int minimumArity = 0; 104 private const int maximumArity = 0; 105 106 public override int MinimumArity { 107 get { return minimumArity; } 108 } 109 public override int MaximumArity { 110 get { return maximumArity; } 111 } 102 112 #endregion 113 103 114 [StorableConstructor] 104 115 protected Variable(bool deserializing) … … 126 137 } 127 138 139 protected override void OnChanged(EventArgs e) { 140 if (@Fixed) { 141 weightManipulatorMu = 1; 142 weightManipulatorSigma = 0; 143 weightMu = 1; 144 weightSigma = 0; 145 multiplicativeWeightManipulatorSigma = 0; 146 } 147 base.OnChanged(e); 148 } 149 128 150 public override ISymbolicExpressionTreeNode CreateTreeNode() { 129 151 return new VariableTreeNode(this); -
branches/GeneralizedQAP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs
r5809 r6878 138 138 } 139 139 } 140 141 private const int minimumArity = 2; 142 private const int maximumArity = 2; 143 144 public override int MinimumArity { 145 get { return minimumArity; } 146 } 147 public override int MaximumArity { 148 get { return maximumArity; } 149 } 140 150 #endregion 141 151
Note: See TracChangeset
for help on using the changeset viewer.