Ignore:
Timestamp:
11/25/15 23:24:01 (4 years ago)
Author:
abeham
Message:

#2521:

  • Adapted single-objective test function problem to new problem infrastructure
  • Added additional interfaces to RealVectorEncoding
  • Fixed IParticleUpdater interface (must implement IStochasticOperator if it contains a Random parameter)
Location:
branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Functions
Files:
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Functions/Multinormal.cs

    r13393 r13403  
    3030using HeuristicLab.Parameters;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.Random;
    3233
    3334namespace HeuristicLab.Problems.TestFunctions.Evaluators {
    34   [Item("MultinormalFunction", "Evaluates a random multinormal function on a given point.")]
     35  [Item("Multinormal", "Evaluates a random multinormal function on a given point.")]
    3536  [StorableClass]
    36   public class MultinormalEvaluator : SingleObjectiveTestFunctionProblemEvaluator {
    37     public override string FunctionName { get { return "Multinormal"; } }
     37  public class Multinormal : SingleObjectiveTestFunction {
    3838
    3939    private ItemList<RealVector> centers {
     
    4545      set { Parameters["s^2s"].ActualValue = value; }
    4646    }
    47     private static System.Random Random = new System.Random();
     47
     48    public IRandom Random {
     49      get { return ((ValueParameter<IRandom>)Parameters["Random"]).Value; }
     50      set { ((ValueParameter<IRandom>)Parameters["Random"]).Value = value; }
     51    }
    4852
    4953    private Dictionary<int, List<RealVector>> stdCenters;
     
    8791
    8892    [StorableConstructor]
    89     protected MultinormalEvaluator(bool deserializing) : base(deserializing) { }
    90     protected MultinormalEvaluator(MultinormalEvaluator original, Cloner cloner) : base(original, cloner) { }
    91     public MultinormalEvaluator() {
     93    protected Multinormal(bool deserializing) : base(deserializing) { }
     94    protected Multinormal(Multinormal original, Cloner cloner) : base(original, cloner) { }
     95    public Multinormal() {
    9296      Parameters.Add(new ValueParameter<ItemList<RealVector>>("Centers", "Centers of normal distributions"));
    9397      Parameters.Add(new ValueParameter<RealVector>("s^2s", "sigma^2 of normal distributions"));
    94       Parameters.Add(new LookupParameter<IRandom>("Random", "Random number generator"));
     98      Parameters.Add(new ValueParameter<IRandom>("Random", "The random number generator that will make random instances", new MersenneTwister(0)));
    9599      centers = new ItemList<RealVector>();
    96100      s_2s = new RealVector();
     
    98102
    99103    public override IDeepCloneable Clone(Cloner cloner) {
    100       return new MultinormalEvaluator(this, cloner);
     104      return new Multinormal(this, cloner);
    101105    }
    102106
Note: See TracChangeset for help on using the changeset viewer.