#region License Information /* HeuristicLab * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Linq; using HEAL.Attic; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.RealVectorEncoding; using HeuristicLab.Problems.DataAnalysis; // ReSharper disable once CheckNamespace namespace HeuristicLab.Algorithms.EGO { [StorableType("a9a7c704-6620-4129-9da3-74d590c8422a")] [Item("ExpectedImprovementMeassure", "Extension of the Expected Improvement to a weighted version by ANDRAS SÓBESTER , STEPHEN J. LEARY and ANDY J. KEANE in \n On the Design of Optimization Strategies Based on Global Response Surface Approximation Models")] public sealed class ExpectedImprovement : ExpectedImprovementBase { #region Constructors, Serialization and Cloning [StorableConstructor] private ExpectedImprovement(StorableConstructorFlag deserializing) : base(deserializing) { } private ExpectedImprovement(ExpectedImprovement original, Cloner cloner) : base(original, cloner) { } public ExpectedImprovement() { } public override IDeepCloneable Clone(Cloner cloner) { return new ExpectedImprovement(this, cloner); } #endregion public override double Evaluate(RealVector vector) { var model = RegressionSolution.Model as IConfidenceRegressionModel; var yhat = model.GetEstimation(vector); var s = Math.Sqrt(model.GetVariance(vector)); return GetEstimatedImprovement(BestFitness, yhat, s, ExploitationWeight, ExpensiveMaximization); } protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) { return GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization); } protected override double FindBestFitness(IConfidenceRegressionSolution solution) { return ExpensiveMaximization ? solution.ProblemData.TargetVariableTrainingValues.Max() : solution.ProblemData.TargetVariableTrainingValues.Min(); } } }