Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/15/20 17:09:10 (4 years ago)
Author:
abeham
Message:

#2521: worked on refactoring

  • add results to problem base classes
  • fix external evaluation problem
  • Add result descriptions
Location:
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorMultiObjectiveProblem.cs

    r17695 r17747  
    3333  [StorableType("b64caac0-a23a-401a-bb7e-ffa3e22b80ea")]
    3434  public abstract class BinaryVectorMultiObjectiveProblem : MultiObjectiveProblem<BinaryVectorEncoding, BinaryVector> {
    35     [Storable] protected IResultParameter<ParetoFrontScatterPlot<BinaryVector>> BestResultParameter { get; private set; }
    3635    [Storable] protected ReferenceParameter<IntValue> DimensionRefParameter { get; private set; }
     36    [Storable] public IResult<ParetoFrontScatterPlot<BinaryVector>> BestParetoFrontResult { get; private set; }
    3737
    3838    public int Dimension {
    3939      get { return DimensionRefParameter.Value.Value; }
    4040      protected set { DimensionRefParameter.Value.Value = value; }
     41    }
     42
     43    protected ParetoFrontScatterPlot<BinaryVector> BestParetoFront {
     44      get => BestParetoFrontResult.Value;
     45      set => BestParetoFrontResult.Value = value;
    4146    }
    4247
     
    5055    protected BinaryVectorMultiObjectiveProblem(BinaryVectorMultiObjectiveProblem original, Cloner cloner)
    5156      : base(original, cloner) {
    52       BestResultParameter = cloner.Clone(original.BestResultParameter);
    5357      DimensionRefParameter = cloner.Clone(original.DimensionRefParameter);
     58      BestParetoFrontResult = cloner.Clone(original.BestParetoFrontResult);
     59
    5460      RegisterEventHandlers();
    5561    }
     
    5965      EncodingParameter.ReadOnly = true;
    6066      EvaluatorParameter.ReadOnly = true;
    61       Parameters.Add(BestResultParameter = new ResultParameter<ParetoFrontScatterPlot<BinaryVector>>("Best Pareto Front", "The best Pareto front found."));
    6267      Parameters.Add(DimensionRefParameter = new ReferenceParameter<IntValue>("Dimension", "The dimension of the binary vector problem.", Encoding.LengthParameter));
     68      Results.Add(BestParetoFrontResult = new Result<ParetoFrontScatterPlot<BinaryVector>>("Best Pareto Front", "The best Pareto front found so far."));
    6369
    6470      Operators.Add(new HammingSimilarityCalculator());
     
    7581      var plot = new ParetoFrontScatterPlot<BinaryVector>(fronts, individuals, qualities, Objectives, BestKnownFront);
    7682
    77       BestResultParameter.ActualValue = plot;
     83      BestParetoFront = plot;
    7884    }
    7985
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorProblem.cs

    r17745 r17747  
    3737    [Storable] public IResult<ISingleObjectiveSolutionContext<BinaryVector>> BestSolutionResult { get; private set; }
    3838
    39     private ISingleObjectiveSolutionContext<BinaryVector> BestSolution {
    40       get => BestSolutionResult.Value;
    41       set => BestSolutionResult.Value = value;
    42     }
    43 
    4439    public int Dimension {
    4540      get { return DimensionRefParameter.Value.Value; }
    4641      protected set { DimensionRefParameter.Value.Value = value; }
     42    }
     43
     44    protected ISingleObjectiveSolutionContext<BinaryVector> BestSolution {
     45      get => BestSolutionResult.Value;
     46      set => BestSolutionResult.Value = value;
    4747    }
    4848
     
    6666      EvaluatorParameter.ReadOnly = true;
    6767      Parameters.Add(DimensionRefParameter = new ReferenceParameter<IntValue>("Dimension", "The dimension of the binary vector problem.", Encoding.LengthParameter));
    68       Results.Add(BestSolutionResult = new Result<ISingleObjectiveSolutionContext<BinaryVector>>("Best Solution"));
     68      Results.Add(BestSolutionResult = new Result<ISingleObjectiveSolutionContext<BinaryVector>>("Best Solution", "The best solution found so far."));
    6969
    7070      Operators.Add(new HammingSimilarityCalculator());
Note: See TracChangeset for help on using the changeset viewer.