Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/25/15 23:24:01 (9 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)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Problems.TestFunctions/3.3/Analyzers/BestSingleObjectiveTestFunctionSolutionAnalyzer.cs

    r12012 r13403  
    4444      get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; }
    4545    }
    46     public ScopeTreeLookupParameter<RealVector> RealVectorParameter {
    47       get { return (ScopeTreeLookupParameter<RealVector>)Parameters["RealVector"]; }
     46    public IScopeTreeLookupParameter<RealVector> RealVectorsParameter {
     47      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVectors"]; }
    4848    }
    49     ILookupParameter IBestSingleObjectiveTestFunctionSolutionAnalyzer.RealVectorParameter {
    50       get { return RealVectorParameter; }
    51     }
    52     public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
    53       get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
    54     }
    55     ILookupParameter IBestSingleObjectiveTestFunctionSolutionAnalyzer.QualityParameter {
    56       get { return QualityParameter; }
     49    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
     50      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
    5751    }
    5852    public ILookupParameter<SingleObjectiveTestFunctionSolution> BestSolutionParameter {
     
    6862      get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
    6963    }
    70     public IValueLookupParameter<ISingleObjectiveTestFunctionProblemEvaluator> EvaluatorParameter {
    71       get { return (IValueLookupParameter<ISingleObjectiveTestFunctionProblemEvaluator>)Parameters["Evaluator"]; }
     64    public IValueLookupParameter<ISingleObjectiveTestFunction> TestFunctionParameter {
     65      get { return (IValueLookupParameter<ISingleObjectiveTestFunction>)Parameters["TestFunction"]; }
    7266    }
    73     public ILookupParameter<DoubleMatrix> BoundsParameter {
    74       get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
     67    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
     68      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
    7569    }
    7670
     
    8175      : base() {
    8276      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
    83       Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector", "The SingleObjectiveTestFunction solutions from which the best solution should be visualized."));
     77      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVectors", "The SingleObjectiveTestFunction solutions from which the best solution should be visualized."));
    8478      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the SingleObjectiveTestFunction solutions which should be visualized."));
    8579      Parameters.Add(new LookupParameter<SingleObjectiveTestFunctionSolution>("BestSolution", "The best SingleObjectiveTestFunction solution."));
     
    8781      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution."));
    8882      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the SingleObjectiveTestFunction solution should be stored."));
    89       Parameters.Add(new ValueLookupParameter<ISingleObjectiveTestFunctionProblemEvaluator>("Evaluator", "The evaluator with which the solution is evaluated."));
    90       Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function."));
     83      Parameters.Add(new ValueLookupParameter<ISingleObjectiveTestFunction>("TestFunction", "The evaluator with which the solution is evaluated."));
     84      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The bounds of the function."));
    9185
    9286      MaximizationParameter.Hidden = true;
    93       RealVectorParameter.Hidden = true;
     87      RealVectorsParameter.Hidden = true;
    9488      QualityParameter.Hidden = true;
    9589      BestSolutionParameter.Hidden = true;
     
    9791      BestKnownQualityParameter.Hidden = true;
    9892      ResultsParameter.Hidden = true;
    99       EvaluatorParameter.Hidden = true;
     93      TestFunctionParameter.Hidden = true;
    10094      BoundsParameter.Hidden = true;
    101     }
    102 
    103     /// <summary>
    104     /// This method can simply be removed when the plugin version is > 3.3
    105     /// </summary>
    106     [StorableHook(HookType.AfterDeserialization)]
    107     private void AfterDeserialization() {
    108       // BackwardsCompatibility3.3
    109       // Bounds are introduced in 3.3.0.3894
    110       if (!Parameters.ContainsKey("Bounds"))
    111         Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The bounds of the function."));
    11295    }
    11396
     
    117100
    118101    public override IOperation Apply() {
    119       ItemArray<RealVector> realVectors = RealVectorParameter.ActualValue;
     102      ItemArray<RealVector> realVectors = RealVectorsParameter.ActualValue;
    120103      ItemArray<DoubleValue> qualities = QualityParameter.ActualValue;
    121104      bool max = MaximizationParameter.ActualValue.Value;
     
    140123        solution = new SingleObjectiveTestFunctionSolution((RealVector)realVectors[i].Clone(),
    141124                                                           (DoubleValue)qualities[i].Clone(),
    142                                                            EvaluatorParameter.ActualValue);
     125                                                           TestFunctionParameter.ActualValue);
    143126        solution.Population = realVectors[i].Length == 2
    144127          ? new ItemArray<RealVector>(realVectors.Select(x => x.Clone()).Cast<RealVector>())
Note: See TracChangeset for help on using the changeset viewer.