Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/19 15:21:54 (5 years ago)
Author:
abeham
Message:

#2521: Added and modified encoding-specific abstract base classes

File:
1 edited

Legend:

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

    r16876 r16948  
    2828using HeuristicLab.Common;
    2929using HeuristicLab.Core;
    30 using HeuristicLab.Data;
    3130using HeuristicLab.Optimization;
    32 using HeuristicLab.Parameters;
    3331
    3432namespace HeuristicLab.Encodings.BinaryVectorEncoding {
     
    3836      get { return Encoding.Length; }
    3937      set { Encoding.Length = value; }
    40     }
    41 
    42     private IFixedValueParameter<IntValue> LengthParameter {
    43       get { return (IFixedValueParameter<IntValue>)Parameters["Length"]; }
    4438    }
    4539
     
    5650    }
    5751
    58     protected BinaryVectorMultiObjectiveProblem() : base(new BinaryVectorEncoding()) {
    59       var lengthParameter = new FixedValueParameter<IntValue>("Length", "The length of the BinaryVector.", new IntValue(10));
    60       Parameters.Add(lengthParameter);
    61       Encoding.LengthParameter = lengthParameter;
     52    protected BinaryVectorMultiObjectiveProblem() : this(new BinaryVectorEncoding() { Length = 10 }) { }
     53    protected BinaryVectorMultiObjectiveProblem(BinaryVectorEncoding encoding) : base(encoding) {
     54      EncodingParameter.ReadOnly = true;
    6255
    6356      Operators.Add(new HammingSimilarityCalculator());
     
    7568    protected override void OnEncodingChanged() {
    7669      base.OnEncodingChanged();
    77       Encoding.LengthParameter = LengthParameter;
    7870      Parameterize();
    7971    }
     
    8779
    8880    private void RegisterEventHandlers() {
    89       LengthParameter.Value.ValueChanged += LengthParameter_ValueChanged;
     81      Encoding.LengthParameter.Value.ValueChanged += LengthParameter_ValueChanged;
    9082    }
    9183
Note: See TracChangeset for help on using the changeset viewer.