1  #region License Information


2  /* HeuristicLab


3  * Copyright (C) 20022010 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 


22  using HeuristicLab.Core;


23  using HeuristicLab.Data;


24  using HeuristicLab.Encodings.RealVectorEncoding;


25  using HeuristicLab.Parameters;


26  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;


27 


28  namespace HeuristicLab.Problems.TestFunctions {


29  [Item("SphereAdditiveMoveEvaluator", "Class for evaluating an additive move on the Sphere function.")]


30  [StorableClass]


31  public class SphereAdditiveMoveEvaluator : AdditiveMoveEvaluator, ISphereMoveEvaluator {


32  /// <summary>


33  /// The parameter C modifies the steepness of the objective function y = C * X^Alpha. Default is C = 1.


34  /// </summary>


35  public ValueParameter<DoubleValue> CParameter {


36  get { return (ValueParameter<DoubleValue>)Parameters["C"]; }


37  }


38  /// <summary>


39  /// The parameter Alpha modifies the steepness of the objective function y = C * X^Alpha. Default is Alpha = 2.


40  /// </summary>


41  public ValueParameter<DoubleValue> AlphaParameter {


42  get { return (ValueParameter<DoubleValue>)Parameters["Alpha"]; }


43  }


44  /// <summary>


45  /// The parameter C modifies the steepness of the objective function y = C * X^Alpha. Default is C = 1.


46  /// </summary>


47  public DoubleValue C {


48  get { return CParameter.Value; }


49  set { if (value != null) CParameter.Value = value; }


50  }


51  /// <summary>


52  /// The parameter Alpha modifies the steepness of the objective function y = C * X^Alpha. Default is Alpha = 2.


53  /// </summary>


54  public DoubleValue Alpha {


55  get { return AlphaParameter.Value; }


56  set { if (value != null) AlphaParameter.Value = value; }


57  }


58 


59  public override System.Type EvaluatorType {


60  get { return typeof(SphereEvaluator); }


61  }


62 


63  public SphereAdditiveMoveEvaluator() {


64  Parameters.Add(new ValueParameter<DoubleValue>("C", "The parameter C modifies the steepness of the objective function y = C * X^Alpha. Default is C = 1.", new DoubleValue(1)));


65  Parameters.Add(new ValueParameter<DoubleValue>("Alpha", "The parameter Alpha modifies the steepness of the objective function y = C * X^Alpha. Default is Alpha = 2.", new DoubleValue(2)));


66  }


67 


68  protected override double Evaluate(double quality, RealVector point, AdditiveMove move) {


69  RealVectorAdditiveMoveWrapper wrapper = new RealVectorAdditiveMoveWrapper(move, point);


70  return SphereEvaluator.Apply(wrapper, C.Value, Alpha.Value);


71  }


72  }


73  }

