Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/26/17 09:10:56 (7 years ago)
Author:
bwerth
Message:

#2745 implemented EGO as EngineAlgorithm + some simplifications in the IInfillCriterion interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/AugmentedExpectedImprovement.cs

    r14818 r15064  
    3535  [StorableClass]
    3636  [Item("AugmentedExpectedImprovement", "Noisy InfillCriterion, Extension of the Expected Improvement as described in\n Global optimization of stochastic black-box systems via sequential kriging meta-models.\r\nHuang, D., Allen, T., Notz, W., Zeng, N.")]
    37   public class AugmentedExpectedImprovement : ExpectedImprovement {
    38 
    39 
     37  public class AugmentedExpectedImprovement : ExpectedImprovementBase {
    4038
    4139    #region Parameternames
    42 
    4340    public const string AlphaParameterName = "Alpha";
    44 
    4541    #endregion
    4642
    4743    #region Parameters
    48 
    4944    public IValueParameter<DoubleValue> AlphaParameter => Parameters[AlphaParameterName] as IValueParameter<DoubleValue>;
    50 
    5145    #endregion
    5246
    5347    #region Properties
    54 
    5548    public double Alpha => AlphaParameter.Value.Value;
    5649    [Storable]
    5750    private double Tau;
    58 
    5951    #endregion
    6052
    61 
    62     #region HL-Constructors, Serialization and Cloning
     53    #region Constructors, Serialization and Cloning
    6354    [StorableConstructor]
    64     private AugmentedExpectedImprovement(bool deserializing) : base(deserializing) { }
    65 
    66     private AugmentedExpectedImprovement(AugmentedExpectedImprovement original, Cloner cloner) : base(original, cloner) {
     55    protected AugmentedExpectedImprovement(bool deserializing) : base(deserializing) { }
     56    protected AugmentedExpectedImprovement(AugmentedExpectedImprovement original, Cloner cloner) : base(original, cloner) {
    6757      Tau = original.Tau;
    6858    }
    69 
    7059    public AugmentedExpectedImprovement() {
    7160      Parameters.Add(new ValueParameter<DoubleValue>(AlphaParameterName, "The Alpha value specifiying the robustness of the \"effective best solution\". Recommended value is 1", new DoubleValue(1.0)));
    72 
    7361    }
    7462    public override IDeepCloneable Clone(Cloner cloner) {
     
    8270    }
    8371
    84     protected override void Initialize() {
    85       if (ExpensiveMaximization) throw new NotImplementedException("AugmentedExpectedImprovement for maximization not yet implemented");
    86       var solution = RegressionSolution as IConfidenceRegressionSolution;
    87       if (solution == null) throw new ArgumentException("can not calculate Augmented EI without a regression solution providing confidence values");
     72    protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) {
     73      var d = GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization);
     74      return d * (1 - Tau / Math.Sqrt(estimatedStandardDeviation * estimatedStandardDeviation + Tau * Tau));
     75    }
    8876
     77    protected override double FindBestFitness(IConfidenceRegressionSolution solution) {
    8978      Tau = RegressionSolution.EstimatedTrainingValues.Zip(RegressionSolution.ProblemData.TargetVariableTrainingValues, (d, d1) => Math.Abs(d - d1)).Average();
    90       var xss = new RealVector(Encoding.Length);
     79      var bestSolution = new RealVector(Encoding.Length);
    9180      var xssIndex = solution.EstimatedTrainingValues.Zip(solution.EstimatedTrainingValues, (m, s2) => m + Alpha * Math.Sqrt(s2)).ArgMin(x => x);
    9281      var i = solution.ProblemData.TrainingIndices.ToArray()[xssIndex];
    93       for (var j = 0; j < Encoding.Length; j++) xss[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j);
    94 
    95       YMin = RegressionSolution.Model.GetEstimation(xss);
     82      for (var j = 0; j < Encoding.Length; j++) bestSolution[j] = solution.ProblemData.Dataset.GetDoubleValue(i, j);
     83      return RegressionSolution.Model.GetEstimation(bestSolution);
    9684    }
    9785  }
Note: See TracChangeset for help on using the changeset viewer.