Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/23/20 16:21:55 (4 years ago)
Author:
abeham
Message:

#2521:

  • Moving solution creator parameter from problems to algorithms (breaking wiring in some HeuristicOptimizationProblems)
  • Disallowing evaluator or encoding changes in encoding-specific base problems (to avoid confusion in derived problems whether this needs to be handled or not)
  • Added private set to ReferenceParameter property (serialization)
Location:
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationMultiObjectiveProblem.cs

    r17620 r17695  
    2222#endregion
    2323
     24using System;
    2425using System.Linq;
    2526using HEAL.Attic;
     
    6465    protected PermutationMultiObjectiveProblem(PermutationEncoding encoding) : base(encoding) {
    6566      EncodingParameter.ReadOnly = true;
     67      EvaluatorParameter.ReadOnly = true;
    6668      Parameters.Add(DimensionRefParameter = new ReferenceParameter<IntValue>("Dimension", "The dimension of the permutation problem.", Encoding.LengthParameter));
    6769      Parameters.Add(PermutationTypeRefParameter = new ReferenceParameter<EnumValue<PermutationTypes>>("Type", "The type of the permutation.", Encoding.PermutationTypeParameter));
     
    8082      var plot = new ParetoFrontScatterPlot<Permutation>(fronts, individuals, qualities, Objectives, BestKnownFront);
    8183      results.AddOrUpdateResult("Pareto Front Scatter Plot", plot);
     84    }
     85
     86    protected override sealed void OnEvaluatorChanged() {
     87      throw new InvalidOperationException("Evaluator may not change!");
     88    }
     89
     90    protected override sealed void OnEncodingChanged() {
     91      throw new InvalidOperationException("Encoding may not change!");
    8292    }
    8393
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationProblem.cs

    r17620 r17695  
    2222#endregion
    2323
     24using System;
    2425using System.Linq;
    2526using HEAL.Attic;
     
    6566    protected PermutationProblem(PermutationEncoding encoding) : base(encoding) {
    6667      EncodingParameter.ReadOnly = true;
     68      EvaluatorParameter.ReadOnly = true;
    6769      Parameters.Add(DimensionRefParameter = new ReferenceParameter<IntValue>("Dimension", "The dimension of the permutation problem.", Encoding.LengthParameter));
    6870      Parameters.Add(PermutationTypeRefParameter = new ReferenceParameter<EnumValue<PermutationTypes>>("Type", "The type of the permutation.", Encoding.PermutationTypeParameter));
     
    8183      var best = GetBestSolution(permutations, qualities);
    8284      results.AddOrUpdateResult("Best Solution", (IItem)best.Item1.Clone());
     85    }
     86
     87    protected override sealed void OnEvaluatorChanged() {
     88      throw new InvalidOperationException("Evaluator may not change!");
     89    }
     90
     91    protected override sealed void OnEncodingChanged() {
     92      throw new InvalidOperationException("Encoding may not change!");
    8393    }
    8494
Note: See TracChangeset for help on using the changeset viewer.