Free cookie consent management tool by TermsFeed Policy Generator

source: branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/InfillCriteria/ExpectedImprovement.cs @ 15870

Last change on this file since 15870 was 15064, checked in by bwerth, 8 years ago

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

File size: 2.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Linq;
24using HeuristicLab.Common;
25using HeuristicLab.Core;
26using HeuristicLab.Encodings.RealVectorEncoding;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28using HeuristicLab.Problems.DataAnalysis;
29
30// ReSharper disable once CheckNamespace
31namespace HeuristicLab.Algorithms.EGO {
32
33  [StorableClass]
34  [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")]
35  public sealed class ExpectedImprovement : ExpectedImprovementBase {
36    #region Constructors, Serialization and Cloning
37    [StorableConstructor]
38    private ExpectedImprovement(bool deserializing) : base(deserializing) { }
39    private ExpectedImprovement(ExpectedImprovement original, Cloner cloner) : base(original, cloner) { }
40    public ExpectedImprovement() { }
41    public override IDeepCloneable Clone(Cloner cloner) {
42      return new ExpectedImprovement(this, cloner);
43    }
44    #endregion
45
46    public override double Evaluate(RealVector vector) {
47      var model = RegressionSolution.Model as IConfidenceRegressionModel;
48      var yhat = model.GetEstimation(vector);
49      var s = Math.Sqrt(model.GetVariance(vector));
50      return GetEstimatedImprovement(BestFitness, yhat, s, ExploitationWeight, ExpensiveMaximization);
51    }
52
53    protected override double Evaluate(RealVector vector, double estimatedFitness, double estimatedStandardDeviation) {
54      return GetEstimatedImprovement(BestFitness, estimatedFitness, estimatedStandardDeviation, ExploitationWeight, ExpensiveMaximization);
55    }
56
57    protected override double FindBestFitness(IConfidenceRegressionSolution solution) {
58      return ExpensiveMaximization ? solution.ProblemData.TargetVariableTrainingValues.Max() : solution.ProblemData.TargetVariableTrainingValues.Min();
59    }
60  }
61}
Note: See TracBrowser for help on using the repository browser.