Changeset 12547
- Timestamp:
- 06/30/15 12:32:08 (9 years ago)
- Location:
- branches/DataAnalysis.ComplexityAnalyzer
- Files:
-
- 30 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
-
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 merged: 12358,12422,12461,12504,12509
- Property svn:mergeinfo changed
-
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveProblem.cs
r12130 r12547 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 31 [Item("Symbolic Regression Problem (multi 31 [Item("Symbolic Regression Problem (multi-objective)", "Represents a multi objective symbolic regression problem.")] 32 32 [StorableClass] 33 [Creatable( "Problems")]33 [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 110)] 34 34 public class SymbolicRegressionMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IRegressionProblemData, ISymbolicRegressionMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem { 35 35 private const double PunishmentFactor = 10; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r12130 r12547 202 202 int info; 203 203 204 Dataset ds = problemData.Dataset;204 IDataset ds = problemData.Dataset; 205 205 double[,] x = new double[rows.Count(), variableNames.Count]; 206 206 int row = 0; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs
r12130 r12547 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 30 [Item("Symbolic Regression Problem (single 30 [Item("Symbolic Regression Problem (single-objective)", "Represents a single objective symbolic regression problem.")] 31 31 [StorableClass] 32 [Creatable( "Problems")]32 [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 100)] 33 33 public class SymbolicRegressionSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IRegressionProblemData, ISymbolicRegressionSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem { 34 34 private const double PunishmentFactor = 10; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs
r12130 r12547 47 47 } 48 48 49 public IEnumerable<double> GetEstimatedValues( Dataset dataset, IEnumerable<int> rows) {49 public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 50 50 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows) 51 51 .LimitToRange(LowerEstimationLimit, UpperEstimationLimit); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPhenotypicDiversityAnalyzer.cs
r12130 r12547 35 35 [StorableClass] 36 36 public class SymbolicRegressionPhenotypicDiversityAnalyzer : PopulationSimilarityAnalyzer, 37 ISymbolicDataAnalysisBoundedOperator, ISymbolicDataAnalysisInterpreterOperator, ISymbolicExpressionTree Operator {37 ISymbolicDataAnalysisBoundedOperator, ISymbolicDataAnalysisInterpreterOperator, ISymbolicExpressionTreeAnalyzer { 38 38 #region parameter names 39 39 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs
r12214 r12547 31 31 [StorableClass] 32 32 public sealed class SymbolicRegressionPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer { 33 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";34 33 private const string PruningOperatorParameterName = "PruningOperator"; 35 p rivate SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner)36 : base(original, cloner) {34 public IValueParameter<SymbolicRegressionPruningOperator> PruningOperatorParameter { 35 get { return (IValueParameter<SymbolicRegressionPruningOperator>)Parameters[PruningOperatorParameterName]; } 37 36 } 38 public override IDeepCloneable Clone(Cloner cloner) { 39 return new SymbolicRegressionPruningAnalyzer(this, cloner); 37 38 protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator { 39 get { return PruningOperatorParameter.Value; } 40 40 } 41 42 private SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner) : base(original, cloner) { } 43 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicRegressionPruningAnalyzer(this, cloner); } 41 44 42 45 [StorableConstructor] … … 44 47 45 48 public SymbolicRegressionPruningAnalyzer() { 46 Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicRegressionSolutionImpactValuesCalculator())); 47 Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 49 Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 48 50 } 49 51 } -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs
r12214 r12547 53 53 protected override double Evaluate(IDataAnalysisModel model) { 54 54 var regressionModel = (IRegressionModel)model; 55 var regressionProblemData = (IRegressionProblemData)ProblemData ;56 var rows = Enumerable.Range(FitnessCalculationPartition .Start, FitnessCalculationPartition.Size);55 var regressionProblemData = (IRegressionProblemData)ProblemDataParameter.ActualValue; 56 var rows = Enumerable.Range(FitnessCalculationPartitionParameter.ActualValue.Start, FitnessCalculationPartitionParameter.ActualValue.Size); 57 57 return Evaluate(regressionModel, regressionProblemData, rows); 58 58 } … … 71 71 var clonedTree = (ISymbolicExpressionTree)tree.Clone(); 72 72 var model = new SymbolicRegressionModel(clonedTree, interpreter, estimationLimits.Lower, estimationLimits.Upper); 73 var nodes = clonedTree. IterateNodesPrefix().ToList();73 var nodes = clonedTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); // skip the nodes corresponding to the ProgramRootSymbol and the StartSymbol 74 74 double quality = Evaluate(model, problemData, rows); 75 75 … … 81 81 impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, quality); 82 82 83 if (pruneOnlyZeroImpactNodes) { 84 if (!impactValue.IsAlmost(0.0)) continue; 85 } else if (nodeImpactThreshold < impactValue) { 86 continue; 87 } 83 if (pruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue; 84 if (!pruneOnlyZeroImpactNodes && impactValue > nodeImpactThreshold) continue; 88 85 89 86 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode(); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisModelComplexityAnalyzer.cs
r12187 r12547 53 53 for (int i = 0; i < node.SubtreeCount; i++) { 54 54 var nodeComplexity = CalculateComplexity(node.GetSubtree(i)); 55 complexity *= nodeComplexity > 2 ? nodeComplexity : 2;55 complexity *= nodeComplexity + 1; 56 56 } 57 57 return complexity; … … 61 61 for (int i = 0; i < node.SubtreeCount; i++) { 62 62 var nodeComplexity = CalculateComplexity(node.GetSubtree(i)); 63 complexity *= nodeComplexity > 2 ? nodeComplexity : 2;63 complexity *= nodeComplexity +1; 64 64 } 65 65 return complexity; … … 75 75 case OpCodes.Tan: { 76 76 double complexity = CalculateComplexity(node.GetSubtree(0)); 77 return Math.Pow(2.0, complexity); ;77 return Math.Pow(2.0, complexity); 78 78 } 79 79 case OpCodes.Exp: { -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs
r12130 r12547 45 45 private const string TotalNumberOfPrunedSubtreesParameterName = "Number of pruned subtrees"; 46 46 private const string TotalNumberOfPrunedTreesParameterName = "Number of pruned trees"; 47 private const string TotalNumberOfPrunedNodesParameterName = "Number of pruned nodes"; 47 48 private const string RandomParameterName = "Random"; 48 private const string PruneOnlyZeroImpactNodesParameterName = "PruneOnlyZeroImpactNodes";49 private const string NodeImpactThresholdParameterName = "ImpactThreshold";50 private const string PruningOperatorParameterName = "PruningOperator";51 49 private const string ResultsParameterName = "Results"; 52 50 private const string PopulationSizeParameterName = "PopulationSize"; … … 54 52 55 53 #region private members 54 private DataReducer prunedNodesReducer; 56 55 private DataReducer prunedSubtreesReducer; 57 56 private DataReducer prunedTreesReducer; … … 61 60 62 61 #region parameter properties 63 public IValueParameter<SymbolicDataAnalysisExpressionPruningOperator> PruningOperatorParameter {64 get { return (IValueParameter<SymbolicDataAnalysisExpressionPruningOperator>)Parameters[PruningOperatorParameterName]; }65 }66 public IFixedValueParameter<BoolValue> PruneOnlyZeroImpactNodesParameter {67 get { return (IFixedValueParameter<BoolValue>)Parameters[PruneOnlyZeroImpactNodesParameterName]; }68 }69 public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter {70 get { return (IFixedValueParameter<DoubleValue>)Parameters[NodeImpactThresholdParameterName]; }71 }72 62 public ILookupParameter<IRandom> RandomParameter { 73 63 get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; } … … 91 81 92 82 #region properties 93 protected SymbolicDataAnalysisExpressionPruningOperator PruningOperator { get { return PruningOperatorParameter.Value; }}83 protected abstract SymbolicDataAnalysisExpressionPruningOperator PruningOperator { get; } 94 84 protected int UpdateInterval { get { return UpdateIntervalParameter.Value.Value; } } 95 85 … … 112 102 get { return PruningProbabilityParameter.Value.Value; } 113 103 set { PruningProbabilityParameter.Value.Value = value; } 114 }115 116 protected bool PruneOnlyZeroImpactNodes {117 get { return PruneOnlyZeroImpactNodesParameter.Value.Value; }118 set { PruneOnlyZeroImpactNodesParameter.Value.Value = value; }119 }120 protected double NodeImpactThreshold {121 get { return NodeImpactThresholdParameter.Value.Value; }122 set { NodeImpactThresholdParameter.Value.Value = value; }123 104 } 124 105 #endregion … … 140 121 protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(SymbolicDataAnalysisSingleObjectivePruningAnalyzer original, Cloner cloner) 141 122 : base(original, cloner) { 123 if (original.prunedNodesReducer != null) 124 this.prunedNodesReducer = (DataReducer)original.prunedNodesReducer.Clone(); 142 125 if (original.prunedSubtreesReducer != null) 143 126 this.prunedSubtreesReducer = (DataReducer)original.prunedSubtreesReducer.Clone(); … … 197 180 Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The random number generator.")); 198 181 Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The problem data.")); 199 Parameters.Add(new FixedValueParameter<DoubleValue>(NodeImpactThresholdParameterName, "The impact threshold below which an individual should be pruned.", new DoubleValue(0.0)));200 Parameters.Add(new FixedValueParameter<BoolValue>(PruneOnlyZeroImpactNodesParameterName, "Switch to determine of only zero impact individuals should be pruned.", new BoolValue(false)));201 182 Parameters.Add(new LookupParameter<IntValue>(PopulationSizeParameterName, "The population of individuals.")); 202 183 #endregion … … 250 231 UpdateCounter = 0; 251 232 252 if (pruned SubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); }233 if (prunedNodesReducer == null || prunedSubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); } 253 234 254 235 var prune = CreatePruningOperation(); 236 var reducePrunedNodes = ExecutionContext.CreateChildOperation(prunedNodesReducer); 255 237 var reducePrunedSubtrees = ExecutionContext.CreateChildOperation(prunedSubtreesReducer); 256 238 var reducePrunedTrees = ExecutionContext.CreateChildOperation(prunedTreesReducer); … … 258 240 var collectResults = ExecutionContext.CreateChildOperation(resultsCollector); 259 241 260 return new OperationCollection { prune, reducePruned Subtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() };242 return new OperationCollection { prune, reducePrunedNodes, reducePrunedSubtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() }; 261 243 } 262 244 263 245 private void InitializeOperators() { 246 prunedNodesReducer = new DataReducer(); 247 prunedNodesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedNodesParameter.ActualName; 248 prunedNodesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); // sum all the pruned subtrees parameter values 249 prunedNodesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); // asign the sum to the target parameter 250 prunedNodesReducer.TargetParameter.ActualName = TotalNumberOfPrunedNodesParameterName; 251 264 252 prunedSubtreesReducer = new DataReducer(); 265 253 prunedSubtreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedSubtreesParameter.ActualName; … … 275 263 276 264 valuesCollector = new DataTableValuesCollector(); 265 valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedNodesParameterName)); 277 266 valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedSubtreesParameterName)); 278 267 valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedTreesParameterName)); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/MultiSymbolicDataAnalysisExpressionCrossover.cs
r12130 r12547 35 35 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 36 36 [Item("MultiSymbolicDataAnalysisExpressionCrossover", "Randomly selects and applies one of its crossovers every time it is called.")] 37 [StorableClass] 37 38 public class MultiSymbolicDataAnalysisExpressionCrossover<T> : StochasticMultiBranch<ISymbolicExpressionTreeCrossover>, 38 39 ISymbolicDataAnalysisExpressionCrossover<T> where T : class, IDataAnalysisProblemData { 39 40 private const string ParentsParameterName = "Parents"; 40 private const string ChildParameterName = "Child";41 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 41 42 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 42 43 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; … … 62 63 get { return (ScopeTreeLookupParameter<ISymbolicExpressionTree>)Parameters[ParentsParameterName]; } 63 64 } 64 public ILookupParameter<ISymbolicExpressionTree> ChildParameter {65 get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[ ChildParameterName]; }65 public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter { 66 get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; } 66 67 } 67 68 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter { … … 99 100 Parameters.Add(new ValueLookupParameter<IntRange>(SymbolicDataAnalysisEvaluationPartitionParameterName, "The start index of the dataset partition on which the symbolic data analysis solution should be evaluated.")); 100 101 Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed.")); 101 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>( ChildParameterName, "The child symbolic expression tree resulting from the crossover."));102 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The child symbolic expression tree resulting from the crossover.")); 102 103 103 104 EvaluatorParameter.Hidden = true; … … 111 112 112 113 SelectedOperatorParameter.ActualName = "SelectedCrossoverOperator"; 114 } 115 116 [StorableHook(HookType.AfterDeserialization)] 117 private void AfterDeserialization() { 118 // BackwardsCompatibility3.3 119 #region Backwards compatible code, remove with 3.4 120 if (!Parameters.ContainsKey(SymbolicExpressionTreeParameterName)) 121 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree on which the operator should be applied.")); 122 #endregion 113 123 } 114 124 … … 155 165 private void ParameterizeCrossovers() { 156 166 foreach (ISymbolicExpressionTreeCrossover op in Operators) { 157 op. ChildParameter.ActualName = ChildParameter.Name;167 op.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name; 158 168 op.ParentsParameter.ActualName = ParentsParameter.Name; 159 169 } -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionContextAwareCrossover.cs
r12130 r12547 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Random; 29 30 30 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 68 69 possibleChildren.Add(n); 69 70 }); 70 var selectedChild = possibleChildren.SelectRandom(random); 71 72 var selectedChild = possibleChildren.SampleRandom(random); 71 73 var crossoverPoints = new List<CutPoint>(); 72 74 var qualities = new List<Tuple<CutPoint, double>>(); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDepthConstrainedCrossover.cs
r12130 r12547 29 29 using HeuristicLab.Parameters; 30 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Random; 31 32 32 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 115 116 throw new Exception("No crossover points available in the first parent"); 116 117 117 var crossoverPoint0 = crossoverPoints0.SelectRandom(random); 118 118 var crossoverPoint0 = crossoverPoints0.SampleRandom(random); 119 119 int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child); 120 120 int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength(); … … 126 126 select s).ToList(); 127 127 if (allowedBranches.Count == 0) return parent0; 128 var selectedBranch = allowedBranches.SelectRandom(random); 128 129 var selectedBranch = allowedBranches.SampleRandom(random); 129 130 Swap(crossoverPoint0, selectedBranch); 130 131 return parent0; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionDeterministicBestCrossover.cs
r12130 r12547 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Random; 29 30 30 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 67 68 crossoverPoints0.Add(new CutPoint(n.Parent, n)); 68 69 }); 69 CutPoint crossoverPoint0 = crossoverPoints0.SelectRandom(random); 70 71 CutPoint crossoverPoint0 = crossoverPoints0.SampleRandom(random); 70 72 int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child); 71 73 int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength(); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionProbabilisticFunctionalCrossover.cs
r12130 r12547 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Random; 29 30 30 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 69 70 } 70 71 }); 71 var crossoverPoint0 = crossoverPoints0.SelectRandom(random); 72 73 var crossoverPoint0 = crossoverPoints0.SampleRandom(random); 72 74 int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child); 73 75 int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength(); … … 137 139 weights[i] /= sum; 138 140 141 #pragma warning disable 612, 618 139 142 selectedBranch = allowedBranches.SelectRandom(weights, random); 143 #pragma warning restore 612, 618 140 144 } 141 145 Swap(crossoverPoint0, selectedBranch); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Crossovers/SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs
r12130 r12547 28 28 using HeuristicLab.Parameters; 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Random; 30 31 31 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 81 82 crossoverPoints0.Add(new CutPoint(n.Parent, n)); 82 83 }); 83 var crossoverPoint0 = crossoverPoints0.SelectRandom(random); 84 85 var crossoverPoint0 = crossoverPoints0.SampleRandom(random); 84 86 int level = parent0.Root.GetBranchLevel(crossoverPoint0.Child); 85 87 int length = parent0.Root.GetLength() - crossoverPoint0.Child.GetLength(); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionExcelFormatter.cs
r12130 r12547 71 71 } 72 72 73 public string Format(ISymbolicExpressionTree symbolicExpressionTree, Dataset dataset) {73 public string Format(ISymbolicExpressionTree symbolicExpressionTree, IDataset dataset) { 74 74 var stringBuilder = new StringBuilder(); 75 75 if (dataset != null) CalculateVariableMapping(symbolicExpressionTree, dataset); … … 85 85 } 86 86 87 private void CalculateVariableMapping(ISymbolicExpressionTree tree, Dataset dataset) {87 private void CalculateVariableMapping(ISymbolicExpressionTree tree, IDataset dataset) { 88 88 int columnIndex = 0; 89 89 int inputIndex = 0; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r12130 r12547 198 198 <SubType>Code</SubType> 199 199 </Compile> 200 <Compile Include="Formatters\SymbolicDataAnalysisExpressionCSharpFormatter.cs" /> 200 201 <Compile Include="Importer\SymbolicExpressionImporter.cs" /> 201 202 <Compile Include="Importer\Token.cs" /> -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisExpressionTreeInterpreter.cs
r12130 r12547 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 28 28 public interface ISymbolicDataAnalysisExpressionTreeInterpreter : INamedItem, IStatefulItem { 29 IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows);29 IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows); 30 30 IntValue EvaluatedSolutions { get; set; } 31 31 } -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r12130 r12547 138 138 #endregion 139 139 140 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {140 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) { 141 141 if (CheckExpressionsWithIntervalArithmetic.Value) 142 142 throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter."); … … 161 161 } 162 162 163 private InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset) {163 private InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, IDataset dataset) { 164 164 Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode); 165 165 Dictionary<string, int> doubleVariableNames = dataset.DoubleVariables.Select((x, i) => new { x, i }).ToDictionary(e => e.x, e => e.i); … … 182 182 } 183 183 184 private void CompileInstructions(ILGenerator il, InterpreterState state, Dataset ds) {184 private void CompileInstructions(ILGenerator il, InterpreterState state, IDataset ds) { 185 185 Instruction currentInstr = state.NextInstruction(); 186 186 int nArgs = currentInstr.nArguments; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r12130 r12547 95 95 #endregion 96 96 97 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {97 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) { 98 98 if (CheckExpressionsWithIntervalArithmetic.Value) 99 99 throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter."); … … 111 111 } 112 112 113 private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, Dataset dataset) {113 private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, IDataset dataset) { 114 114 Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode); 115 115 int necessaryArgStackSize = 0; … … 132 132 133 133 134 public virtual double Evaluate( Dataset dataset, ref int row, InterpreterState state) {134 public virtual double Evaluate(IDataset dataset, ref int row, InterpreterState state) { 135 135 Instruction currentInstr = state.NextInstruction(); 136 136 switch (currentInstr.opCode) { -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r12130 r12547 102 102 #endregion 103 103 104 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, Dataset dataset, IEnumerable<int> rows) {104 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) { 105 105 if (CheckExpressionsWithIntervalArithmetic.Value) 106 106 throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter."); … … 115 115 } 116 116 117 private double Evaluate( Dataset dataset, int row, LinearInstruction[] code) {117 private double Evaluate(IDataset dataset, int row, LinearInstruction[] code) { 118 118 for (int i = code.Length - 1; i >= 0; --i) { 119 119 if (code[i].skip) continue; … … 352 352 } 353 353 354 public static void PrepareInstructions(LinearInstruction[] code, Dataset dataset) {354 public static void PrepareInstructions(LinearInstruction[] code, IDataset dataset) { 355 355 for (int i = 0; i != code.Length; ++i) { 356 356 var instr = code[i]; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
r12214 r12547 34 34 [StorableClass] 35 35 [Item("SymbolicExpressionTreePruningOperator", "An operator that replaces introns with constant values in a symbolic expression tree.")] 36 public abstract class SymbolicDataAnalysisExpressionPruningOperator : SingleSuccessorOperator {36 public abstract class SymbolicDataAnalysisExpressionPruningOperator : SingleSuccessorOperator, ISymbolicExpressionTreeOperator { 37 37 #region parameter names 38 38 private const string ProblemDataParameterName = "ProblemData"; … … 41 41 private const string PrunedSubtreesParameterName = "PrunedSubtrees"; 42 42 private const string PrunedTreesParameterName = "PrunedTrees"; 43 private const string PrunedNodesParameterName = "PrunedNodes"; 43 44 private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition"; 44 45 private const string NodeImpactThresholdParameterName = "ImpactThreshold"; … … 72 73 get { return (ILookupParameter<IntValue>)Parameters[PrunedTreesParameterName]; } 73 74 } 75 public ILookupParameter<IntValue> PrunedNodesParameter { 76 get { return (ILookupParameter<IntValue>)Parameters[PrunedNodesParameterName]; } 77 } 74 78 public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter { 75 79 get { return (IFixedValueParameter<DoubleValue>)Parameters[NodeImpactThresholdParameterName]; } … … 87 91 88 92 #region properties 89 protected IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } } 90 protected ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactValuesCalculator { get { return ImpactValuesCalculatorParameter.Value; } } 91 protected IntRange FitnessCalculationPartition { get { return FitnessCalculationPartitionParameter.ActualValue; } } 92 protected bool PruneOnlyZeroImpactNodes { 93 public ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactValuesCalculator { 94 get { return ImpactValuesCalculatorParameter.Value; } 95 set { ImpactValuesCalculatorParameter.Value = value; } 96 } 97 public bool PruneOnlyZeroImpactNodes { 93 98 get { return PruneOnlyZeroImpactNodesParameter.Value.Value; } 94 99 set { PruneOnlyZeroImpactNodesParameter.Value.Value = value; } 95 100 } 96 p rotecteddouble NodeImpactThreshold {101 public double NodeImpactThreshold { 97 102 get { return NodeImpactThresholdParameter.Value.Value; } 98 103 set { NodeImpactThresholdParameter.Value.Value = value; } 99 104 } 100 protected ISymbolicExpressionTree SymbolicExpressionTree { get { return SymbolicExpressionTreeParameter.ActualValue; } }101 protected DoubleValue Quality { get { return QualityParameter.ActualValue; } }102 protected DoubleLimit EstimationLimits { get { return EstimationLimitsParameter.ActualValue; } }103 protected ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get { return InterpreterParameter.ActualValue; } }104 105 #endregion 105 106 … … 114 115 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisModel>(SymbolicDataAnalysisModelParameterName)); 115 116 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName)); 117 Parameters.Add(new LookupParameter<IntValue>(PrunedNodesParameterName, "A counter of how many nodes were pruned.")); 116 118 Parameters.Add(new LookupParameter<IntValue>(PrunedSubtreesParameterName, "A counter of how many subtrees were replaced.")); 117 119 Parameters.Add(new LookupParameter<IntValue>(PrunedTreesParameterName, "A counter of how many trees were pruned.")); … … 131 133 132 134 public override IOperation Apply() { 133 var model = CreateModel(SymbolicExpressionTree, Interpreter, ProblemData, EstimationLimits); 134 var nodes = SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); 135 var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size); 135 var tree = SymbolicExpressionTreeParameter.ActualValue; 136 var problemData = ProblemDataParameter.ActualValue; 137 var fitnessCalculationPartition = FitnessCalculationPartitionParameter.ActualValue; 138 var estimationLimits = EstimationLimitsParameter.ActualValue; 139 var interpreter = InterpreterParameter.ActualValue; 140 141 var model = CreateModel(tree, interpreter, problemData, estimationLimits); 142 var nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); 143 var rows = Enumerable.Range(fitnessCalculationPartition.Start, fitnessCalculationPartition.Size); 136 144 var prunedSubtrees = 0; 137 145 var prunedTrees = 0; 146 var prunedNodes = 0; 138 147 139 148 double quality = Evaluate(model); … … 144 153 145 154 double impactValue, replacementValue; 146 ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, ProblemData, rows, out impactValue, out replacementValue, quality);155 ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, quality); 147 156 148 if (PruneOnlyZeroImpactNodes) { 149 if (!impactValue.IsAlmost(0.0)) continue; 150 } else if (NodeImpactThreshold < impactValue) { 151 continue; 152 } 157 if (PruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue; 158 if (!PruneOnlyZeroImpactNodes && impactValue > NodeImpactThreshold) continue; 153 159 154 160 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode(); 155 161 constantNode.Value = replacementValue; 156 162 163 var length = node.GetLength(); 157 164 ReplaceWithConstant(node, constantNode); 158 i += node.GetLength()- 1; // skip subtrees under the node that was folded165 i += length - 1; // skip subtrees under the node that was folded 159 166 160 167 quality -= impactValue; 161 162 168 prunedSubtrees++; 169 prunedNodes += length; 163 170 } 164 171 … … 166 173 PrunedSubtreesParameter.ActualValue = new IntValue(prunedSubtrees); 167 174 PrunedTreesParameter.ActualValue = new IntValue(prunedTrees); 175 PrunedNodesParameter.ActualValue = new IntValue(prunedNodes); 176 QualityParameter.ActualValue.Value = quality; 168 177 169 178 return base.Apply(); 170 }171 172 public ISymbolicExpressionTree Prune(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) {173 var model = CreateModel((ISymbolicExpressionTree)tree.Clone(), Interpreter, ProblemData, EstimationLimits);174 var nodes = SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList();175 var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);176 177 double quality = Evaluate(model);178 179 for (int i = 0; i < nodes.Count; ++i) {180 var node = nodes[i];181 if (node is ConstantTreeNode) continue;182 183 double impactValue, replacementValue;184 ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, ProblemData, rows, out impactValue, out replacementValue, quality);185 186 if (PruneOnlyZeroImpactNodes) {187 if (!impactValue.IsAlmost(0.0)) continue;188 } else if (NodeImpactThreshold < impactValue) {189 continue;190 }191 192 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();193 constantNode.Value = replacementValue;194 195 ReplaceWithConstant(node, constantNode);196 i += node.GetLength() - 1; // skip subtrees under the node that was folded197 198 quality -= impactValue;199 }200 return model.SymbolicExpressionTree;201 179 } 202 180 -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs
r12233 r12547 287 287 // make sum(x0..xn) / n 288 288 var sum = original.Subtrees 289 .Select( x => GetSimplifiedTree(x))290 .Aggregate( (a, b) => MakeSum(a, b));289 .Select(GetSimplifiedTree) 290 .Aggregate(MakeSum); 291 291 return MakeFraction(sum, MakeConstant(original.Subtrees.Count())); 292 292 } … … 299 299 // simplify expressions x0..xn 300 300 // make multiplication (x0 * 1/(x1 * x1 * .. * xn)) 301 var simplifiedTrees = original.Subtrees.Select(GetSimplifiedTree).ToArray(); 301 var first = original.GetSubtree(0); 302 var second = original.GetSubtree(1); 303 var remaining = original.Subtrees.Skip(2); 302 304 return 303 MakeProduct( simplifiedTrees.First(), Invert(simplifiedTrees.Skip(1).Aggregate(MakeProduct)));305 MakeProduct(GetSimplifiedTree(first), Invert(remaining.Aggregate(GetSimplifiedTree(second), (a, b) => MakeProduct(a, GetSimplifiedTree(b))))); 304 306 } 305 307 } … … 310 312 } else { 311 313 return original.Subtrees 312 .Select(GetSimplifiedTree) .ToArray()314 .Select(GetSimplifiedTree) 313 315 .Aggregate(MakeProduct); 314 316 } … … 321 323 // simplify expressions x0..xn 322 324 // make addition (x0,-x1..-xn) 323 var simplifiedTrees = original.Subtrees.Select(GetSimplifiedTree).ToArray(); 324 return simplifiedTrees.Take(1) 325 .Concat(simplifiedTrees.Skip(1).Select(Negate)) 326 .Aggregate(MakeSum); 325 var first = original.Subtrees.First(); 326 var remaining = original.Subtrees.Skip(1); 327 return remaining.Aggregate(GetSimplifiedTree(first), (a, b) => MakeSum(a, Negate(GetSimplifiedTree(b)))); 327 328 } 328 329 } … … 335 336 // make addition (x0..xn) 336 337 return original.Subtrees 337 .Select(GetSimplifiedTree) .ToArray()338 .Select(GetSimplifiedTree) 338 339 .Aggregate(MakeSum); 339 340 } … … 345 346 private ISymbolicExpressionTreeNode SimplifyOr(ISymbolicExpressionTreeNode original) { 346 347 return original.Subtrees 347 .Select( x => GetSimplifiedTree(x))348 .Aggregate( (a, b) => MakeOr(a, b));348 .Select(GetSimplifiedTree) 349 .Aggregate(MakeOr); 349 350 } 350 351 private ISymbolicExpressionTreeNode SimplifyAnd(ISymbolicExpressionTreeNode original) { 351 352 return original.Subtrees 352 .Select( x => GetSimplifiedTree(x))353 .Aggregate( (a, b) => MakeAnd(a, b));353 .Select(GetSimplifiedTree) 354 .Aggregate(MakeAnd); 354 355 } 355 356 private ISymbolicExpressionTreeNode SimplifyLessThan(ISymbolicExpressionTreeNode original) { … … 831 832 private void MergeVariablesInSum(ISymbolicExpressionTreeNode sum) { 832 833 var subtrees = new List<ISymbolicExpressionTreeNode>(sum.Subtrees); 833 while (sum.Subtrees. Count() > 0) sum.RemoveSubtree(0);834 while (sum.Subtrees.Any()) sum.RemoveSubtree(0); 834 835 var groupedVarNodes = from node in subtrees.OfType<VariableTreeNode>() 835 836 let lag = (node is LaggedVariableTreeNode) ? ((LaggedVariableTreeNode)node).Lag : 0 … … 949 950 private void MergeVariablesAndConstantsInProduct(ISymbolicExpressionTreeNode prod) { 950 951 var subtrees = new List<ISymbolicExpressionTreeNode>(prod.Subtrees); 951 while (prod.Subtrees. Count() > 0) prod.RemoveSubtree(0);952 while (prod.Subtrees.Any()) prod.RemoveSubtree(0); 952 953 var groupedVarNodes = from node in subtrees.OfType<VariableTreeNode>() 953 954 let lag = (node is LaggedVariableTreeNode) ? ((LaggedVariableTreeNode)node).Lag : 0 … … 1004 1005 } else if (IsAddition(x)) { 1005 1006 // (x0 + x1 + .. + xn) * -1 => (-x0 + -x1 + .. + -xn) 1006 List<ISymbolicExpressionTreeNode>subtrees = new List<ISymbolicExpressionTreeNode>(x.Subtrees);1007 while (x.Subtrees. Count() > 0) x.RemoveSubtree(0);1007 var subtrees = new List<ISymbolicExpressionTreeNode>(x.Subtrees); 1008 while (x.Subtrees.Any()) x.RemoveSubtree(0); 1008 1009 foreach (var subtree in subtrees) { 1009 1010 x.AddSubtree(Negate(subtree)); -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r12130 r12547 321 321 foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) { 322 322 op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 323 op. ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;323 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 324 324 } 325 325 foreach (var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) { -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionImpactValuesCalculator.cs
r12130 r12547 41 41 42 42 protected static double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 43 Dataset dataset, IEnumerable<int> rows) {43 IDataset dataset, IEnumerable<int> rows) { 44 44 //optimization: constant nodes return always the same value 45 45 ConstantTreeNode constantNode = node as ConstantTreeNode; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableConditionTreeNode.cs
r12130 r12547 74 74 base.ResetLocalParameters(random); 75 75 threshold = NormalDistributedRandom.NextDouble(random, Symbol.ThresholdInitializerMu, Symbol.ThresholdInitializerSigma); 76 77 #pragma warning disable 612, 618 76 78 variableName = Symbol.VariableNames.SelectRandom(random); 79 #pragma warning restore 612, 618 80 77 81 slope = NormalDistributedRandom.NextDouble(random, Symbol.SlopeInitializerMu, Symbol.SlopeInitializerSigma); 78 82 } … … 82 86 double x = NormalDistributedRandom.NextDouble(random, Symbol.ThresholdManipulatorMu, Symbol.ThresholdManipulatorSigma); 83 87 threshold = threshold + x * shakingFactor; 88 89 #pragma warning disable 612, 618 84 90 variableName = Symbol.VariableNames.SelectRandom(random); 91 #pragma warning restore 612, 618 92 85 93 x = NormalDistributedRandom.NextDouble(random, Symbol.SlopeManipulatorMu, Symbol.SlopeManipulatorSigma); 86 94 slope = slope + x * shakingFactor; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNode.cs
r12130 r12547 61 61 base.ResetLocalParameters(random); 62 62 weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma); 63 64 #pragma warning disable 612, 618 63 65 variableName = Symbol.VariableNames.SelectRandom(random); 66 #pragma warning restore 612, 618 64 67 } 65 68 … … 70 73 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, Symbol.WeightManipulatorSigma); 71 74 weight = weight + x * shakingFactor; 72 } else { 75 } else { 73 76 double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma); 74 77 weight = weight * x; 75 78 } 79 #pragma warning disable 612, 618 76 80 variableName = Symbol.VariableNames.SelectRandom(random); 81 #pragma warning restore 612, 618 77 82 } 78 83
Note: See TracChangeset
for help on using the changeset viewer.