- Timestamp:
- 08/16/10 10:00:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/DynamicDepthLimitComparator.cs
r4193 r4223 81 81 82 82 public override IOperation Apply() { 83 if (ResultParameter.ActualValue.Value) { 83 if (ResultParameter.ActualValue == null || ResultParameter.ActualValue.Value) { 84 ResultParameter.ActualValue = new BoolValue(true); 84 85 double leftQuality = LeftSideParameter.ActualValue.Value; 85 ItemArray<DoubleValue> rightQualities = RightSideParameter.ActualValue;86 87 if (rightQualities.Length < 1) throw new InvalidOperationException(Name + ": No subscopes found.");88 86 bool maximization = MaximizationParameter.ActualValue.Value; 89 90 int bestParentIndex;91 double bestParentQuality;92 93 if (maximization)94 bestParentQuality = rightQualities.Max(x => x.Value);95 else96 bestParentQuality = rightQualities.Min(x => x.Value);97 bestParentIndex = rightQualities.FindIndex(x => x.Value == bestParentQuality);98 87 99 88 SymbolicExpressionTree tree = SymbolicExpressionTreeParameter.ActualValue; … … 102 91 double cLower = CLowerParameter.Value.Value; 103 92 double bestQuality = BestQualityParameter.ActualValue.Value; 104 double qualityPercentageChange = maximization ? -(bestQuality / leftQuality - 1) : (bestQuality / leftQuality - 1);93 double relativeQuality = maximization ? (leftQuality - bestQuality) / leftQuality : (bestQuality - leftQuality) / leftQuality; 105 94 if (tree.Height <= ddl) { 106 95 // height is smaller than ddl => check improvement and reduce ddl 107 if ( qualityPercentageChange>= (ddl - tree.Height) * cLower) {108 ddl = Math.Max(tree.Height, InitialDepthLimitParameter. Value.Value);96 if (relativeQuality >= (ddl - tree.Height) * cLower) { 97 ddl = Math.Max(tree.Height, InitialDepthLimitParameter.ActualValue.Value); 109 98 } 110 99 } else { 111 100 // height is larger than dll => check improvement and increase ddl 112 if ( qualityPercentageChange>= (tree.Height - ddl) * cRaise) {101 if (relativeQuality >= (tree.Height - ddl) * cRaise) { 113 102 ddl = tree.Height; 114 103 } else { 115 // height is larger but no improv ment => reject104 // height is larger but no improvement => reject 116 105 ResultParameter.ActualValue.Value = false; 117 106 } 118 107 } 108 109 // update best quality 110 if (relativeQuality > 0 && ResultParameter.ActualValue.Value) 111 BestQualityParameter.ActualValue.Value = leftQuality; 119 112 120 113 DynamicDepthLimitParameter.ActualValue.Value = ddl;
Note: See TracChangeset
for help on using the changeset viewer.