Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4227


Ignore:
Timestamp:
08/16/10 11:24:14 (14 years ago)
Author:
gkronber
Message:

Added significant improvement check to dynamic operator equalization. #1142

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/Operators/DynOpEqComparator.cs

    r4224 r4227  
    7777    public ILookupParameter<DoubleValue> BestValidationQualityParameter {
    7878      get { return (ILookupParameter<DoubleValue>)Parameters["Best solution quality (validation)"]; }
     79    }
     80    public IValueLookupParameter<DoubleValue> CRaiseParameter {
     81      get { return (IValueLookupParameter<DoubleValue>)Parameters["CRaise"]; }
    7982    }
    8083
     
    9598      Parameters.Add(new LookupParameter<DoubleValue>("Current best validation quality"));
    9699      Parameters.Add(new LookupParameter<DoubleValue>("Best solution quality (validation)"));
     100      Parameters.Add(new ValueLookupParameter<DoubleValue>("CRaise", "Necessary quality improvement per bin to allow extensions.", new DoubleValue(0.005)));
    97101    }
    98102
     
    110114          #endregion
    111115          if (!Exists(bin)) {
    112 
    113116            if (AntiOverfitParameter.ActualValue.Value) {
    114117              // reject more complex solutions if the current validation quality is worse than the best so far
     
    138141        double bestValidationQuality = BestValidationQualityParameter.ActualValue.Value;
    139142        return maximization ? currentValidationQuality < bestValidationQuality : currentValidationQuality > bestValidationQuality;
    140       } else 
     143      } else
    141144        return false;
    142145    }
     
    150153      if (Exists(binIndex)) {
    151154        //if (IsNotFull(binIndex) /*||
    152           //NewBestOfBin(solutionQuality, binIndex)*/) {       
     155        //NewBestOfBin(solutionQuality, binIndex)*/) {       
    153156        AddToBin(solutionQuality, binIndex);
    154           accept = true;
     157        accept = true;
     158        UpdateBestQuality(solutionQuality);
    155159        //}
    156       } else if (NewBestOfRun(solutionQuality)) {
     160      } else if (NewBestOfRun(solutionQuality) && SignificantImprovement(solutionQuality, binIndex)) {
    157161        CreateNewBin(binIndex);
    158162        AddToBin(solutionQuality, binIndex);
    159163        accept = true;
     164        UpdateBestQuality(solutionQuality);
    160165      }
    161166      return accept;
     167    }
     168
     169    private void UpdateBestQuality(double solutionQuality) {
     170      bool maximization = MaximizationParameter.ActualValue.Value;
     171      double bestQuality = BestQualityParameter.ActualValue.Value;
     172      if ((maximization && bestQuality < solutionQuality) ||
     173         (!maximization && solutionQuality < bestQuality))
     174        BestQualityParameter.ActualValue.Value = solutionQuality;
     175    }
     176
     177    private bool SignificantImprovement(double solutionQuality, int newIndex) {
     178      var binCapacities = BinCapacityParameter.ActualValue;
     179      int binDiff = newIndex - binCapacities.Count + 1;
     180      double bestQuality = BestQualityParameter.ActualValue.Value;
     181      bool maximization = MaximizationParameter.ActualValue.Value;
     182
     183      double relativeQuality = maximization ? solutionQuality / bestQuality - 1 : bestQuality / solutionQuality - 1;
     184      return relativeQuality >= binDiff * CRaiseParameter.ActualValue.Value;
    162185    }
    163186
Note: See TracChangeset for help on using the changeset viewer.