Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/27/20 18:12:39 (4 years ago)
Author:
abeham
Message:

#2521 WIP refactoring:

  1. Introduce nicer type IResultDefinition for API users to avoid complex IParameter interface (hide ActualValue)
  2. Change result parameter to contexts (need quality and solution): only implemented for BinaryVectorProblem
Location:
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorMultiObjectiveProblem.cs

    r17230 r17522  
    3333  [StorableType("11916b0f-4c34-4ece-acae-e28d11211b43")]
    3434  public abstract class IntegerVectorMultiObjectiveProblem : MultiObjectiveProblem<IntegerVectorEncoding, IntegerVector> {
     35    [Storable] protected IResultParameter<ParetoFrontScatterPlot<IntegerVector>> BestResultParameter { get; private set; }
     36    public IResultDefinition<ParetoFrontScatterPlot<IntegerVector>> BestResult { get { return BestResultParameter; } }
     37
    3538    public int Length {
    3639      get { return Encoding.Length; }
     
    4750    protected IntegerVectorMultiObjectiveProblem(IntegerVectorMultiObjectiveProblem original, Cloner cloner)
    4851      : base(original, cloner) {
     52      BestResultParameter = cloner.Clone(original.BestResultParameter);
    4953      RegisterEventHandlers();
    5054    }
     
    5357    protected IntegerVectorMultiObjectiveProblem(IntegerVectorEncoding encoding) : base(encoding) {
    5458      EncodingParameter.ReadOnly = true;
     59      Parameters.Add(BestResultParameter = new ResultParameter<ParetoFrontScatterPlot<IntegerVector>>("Best Pareto Front", "The best Pareto front found."));
    5560
    5661      Operators.Add(new HammingSimilarityCalculator());
     
    6671      var fronts = DominationCalculator.CalculateAllParetoFrontsIndices(individuals, qualities, Maximization);
    6772      var plot = new ParetoFrontScatterPlot<IntegerVector>(fronts, individuals, qualities, Objectives, BestKnownFront);
    68       results.AddOrUpdateResult("Pareto Front Scatter Plot", plot);
     73
     74      BestResultParameter.ActualValue = plot;
    6975    }
    7076
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorProblem.cs

    r16950 r17522  
    3434  [StorableType("c6081457-a3de-45ce-9f47-e0eb1c851bd2")]
    3535  public abstract class IntegerVectorProblem : SingleObjectiveProblem<IntegerVectorEncoding, IntegerVector> {
     36    [Storable] protected IResultParameter<IntegerVector> BestResultParameter { get; private set; }
     37    public IResultDefinition<IntegerVector> BestResult { get => BestResultParameter; }
     38
    3639    public int Length {
    3740      get { return Encoding.Length; }
     
    4851    protected IntegerVectorProblem(IntegerVectorProblem original, Cloner cloner)
    4952      : base(original, cloner) {
     53      BestResultParameter = cloner.Clone(original.BestResultParameter);
    5054      RegisterEventHandlers();
    5155    }
     
    5458    protected IntegerVectorProblem(IntegerVectorEncoding encoding) : base(encoding) {
    5559      EncodingParameter.ReadOnly = true;
     60      Parameters.Add(BestResultParameter = new ResultParameter<IntegerVector>("Best Solution", "The best solution."));
    5661
    5762      Operators.Add(new HammingSimilarityCalculator());
Note: See TracChangeset for help on using the changeset viewer.