Changeset 13220 for branches/DataAnalysis.ComplexityAnalyzer
- Timestamp:
- 11/17/15 15:45:55 (9 years ago)
- Location:
- branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer.cs
r12130 r13220 41 41 private const string TrainingBestSolutionQualitiesParameterName = "Best training solution qualities"; 42 42 private const string UpdateAlwaysParameterName = "Always update best solutions"; 43 44 43 private const string TrainingBestSolutionParameterName = "Best training solution"; 45 private const string TrainingBestSolutionQualityParameterName = "Best training solution quality";46 private const string TrainingBestSolutionGenerationParameterName = "Best training solution generation";47 44 48 45 #region parameter properties … … 58 55 #endregion 59 56 #region properties 60 p ublicItemList<T> TrainingBestSolutions {57 private ItemList<T> TrainingBestSolutions { 61 58 get { return TrainingBestSolutionsParameter.ActualValue; } 62 59 set { TrainingBestSolutionsParameter.ActualValue = value; } 63 60 } 64 p ublicItemList<DoubleArray> TrainingBestSolutionQualities {61 private ItemList<DoubleArray> TrainingBestSolutionQualities { 65 62 get { return TrainingBestSolutionQualitiesParameter.ActualValue; } 66 63 set { TrainingBestSolutionQualitiesParameter.ActualValue = value; } 67 64 } 68 public BoolValue UpdateAlways { 69 get { return UpdateAlwaysParameter.Value; } 65 public bool UpdateAlways { 66 get { return UpdateAlwaysParameter.Value.Value; } 67 set { UpdateAlwaysParameter.Value.Value = value; } 70 68 } 71 69 #endregion … … 106 104 //if the pareto front of best solutions shall be updated regardless of the quality, the list initialized empty to discard old solutions 107 105 List<double[]> trainingBestQualities; 108 if (UpdateAlways .Value) {106 if (UpdateAlways) { 109 107 trainingBestQualities = new List<double[]>(); 110 108 } else { … … 144 142 } 145 143 146 var sortedNonDominatedSolutions = nonDominatedSolutions.OrderByDescending(x => x.Qualities[0]); 144 //assumes the the first objective is always the accuracy 145 var sortedNonDominatedSolutions = maximization[0] 146 ? nonDominatedSolutions.OrderByDescending(x => x.Qualities[0]) 147 : nonDominatedSolutions.OrderBy(x => x.Qualities[0]); 147 148 var trainingBestSolution = sortedNonDominatedSolutions.Select(s => s.Solution).First(); 148 149 results[TrainingBestSolutionParameterName].Value = trainingBestSolution; -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r13213 r13220 182 182 </ItemGroup> 183 183 <ItemGroup> 184 <Compile Include="Analyzers\SymbolicDataAnalysisModelComplexityAnalyzer.cs" /> 184 <Compile Include="SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs" /> 185 <Compile Include="SymbolicDataAnalysisModelComplexityCalculator.cs" /> 185 186 <Compile Include="Analyzers\SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs" /> 186 187 <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs" /> … … 249 250 <Compile Include="SymbolicDataAnalysisProblem.cs" /> 250 251 <Compile Include="SymbolicDataAnalysisSolutionImpactValuesCalculator.cs" /> 251 <Compile Include="SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs" />252 252 <Compile Include="Symbols\Addition.cs" /> 253 253 <Compile Include="Symbols\And.cs" /> -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplificationOperator.cs
r12849 r13220 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 public class SymbolicDataAnalysisExpressionTreeSimplificationOperator : SingleSuccessorOperator { 30 [Item("SymbolicExpressionTreeSimplificationOperator", "Simplfies symbolic expression trees encoding a mathematical formula.")] 31 [StorableClass] 32 public class SymbolicDataAnalysisExpressionTreeSimplificationOperator : SingleSuccessorOperator, ISymbolicExpressionTreeOperator { 31 33 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 32 34 … … 46 48 47 49 public SymbolicDataAnalysisExpressionTreeSimplificationOperator() { 48 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree to be simplified."));50 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree to simplify.")); 49 51 } 50 52 -
branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModelComplexityCalculator.cs
r13219 r13220 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 28 public class SymbolicDataAnalysisModelComplexityAnalyzer { 29 public static double CalculateComplexity(ISymbolicExpressionTreeNode node) { 28 public static class SymbolicDataAnalysisModelComplexityCalculator { 29 public static double CalculateComplexity(ISymbolicExpressionTree tree) { 30 return CalculateComplexity(tree.Root); 31 } 32 public static double CalculateComplexity(ISymbolicExpressionTreeNode treeNode) { 33 var node = treeNode; 34 if (node.Symbol is ProgramRootSymbol) node = node.GetSubtree(0); 35 if (node.Symbol is StartSymbol) node = node.GetSubtree(0); 36 30 37 switch (OpCodes.MapSymbolToOpCode(node)) { 31 38 case OpCodes.Constant: { … … 61 68 for (int i = 0; i < node.SubtreeCount; i++) { 62 69 var nodeComplexity = CalculateComplexity(node.GetSubtree(i)); 63 complexity *= nodeComplexity + 1;70 complexity *= nodeComplexity + 1; 64 71 } 65 72 return complexity;
Note: See TracChangeset
for help on using the changeset viewer.