Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/18/20 18:55:08 (4 years ago)
Author:
abeham
Message:

#2521: worked on refactoring, worked a lot on binary encoding / problems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/OneMaxProblem.cs

    r17382 r17544  
    2020#endregion
    2121
    22 using System;
    2322using System.Linq;
    2423using System.Threading;
     
    2625using HeuristicLab.Common;
    2726using HeuristicLab.Core;
     27using HeuristicLab.Data;
    2828using HeuristicLab.Encodings.BinaryVectorEncoding;
    2929using HeuristicLab.Optimization;
     
    3737    public OneMaxProblem() : base() {
    3838      Maximization = true;
    39       Encoding.Length = 10;
    40       BestKnownQuality = Encoding.Length;
    41     }
    42 
    43     [StorableConstructor]
    44     protected OneMaxProblem(StorableConstructorFlag _) : base(_) { }
    45 
    46     protected OneMaxProblem(OneMaxProblem original, Cloner cloner) : base(original, cloner) { }
    47     public override IDeepCloneable Clone(Cloner cloner) {
    48       return new OneMaxProblem(this, cloner);
     39      DimensionRefParameter.ForceValue(new IntValue(10, @readonly: false));
     40      BestKnownQuality = Dimension;
    4941    }
    5042
     
    5446    }
    5547
    56     protected override void LengthParameter_ValueChanged(object sender, EventArgs e) {
    57       base.LengthParameter_ValueChanged(sender, e);
    58       BestKnownQuality = Length;
     48    [StorableConstructor]
     49    protected OneMaxProblem(StorableConstructorFlag _) : base(_) { }
     50    protected OneMaxProblem(OneMaxProblem original, Cloner cloner) : base(original, cloner) { }
     51    public override IDeepCloneable Clone(Cloner cloner) {
     52      return new OneMaxProblem(this, cloner);
     53    }
     54
     55    protected override void DimensionOnChanged() {
     56      base.DimensionOnChanged();
     57      BestKnownQuality = Dimension;
    5958    }
    6059  }
Note: See TracChangeset for help on using the changeset viewer.