Changeset 17545
- Timestamp:
- 05/19/20 09:59:57 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorEncoding.cs
r17544 r17545 67 67 public BinaryVectorEncoding(string name, int length) 68 68 : base(name) { 69 Parameters.Add(LengthParameter = new ValueParameter<IntValue>(Name + ".Length", new IntValue(length , @readonly: true)) { ReadOnly = true });69 Parameters.Add(LengthParameter = new ValueParameter<IntValue>(Name + ".Length", new IntValue(length)) { ReadOnly = true }); 70 70 71 71 SolutionCreator = new RandomBinaryVectorCreator(); -
branches/2521_ProblemRefactoring/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/BinaryVectorMultiObjectiveProblem.cs
r17544 r17545 20 20 #endregion 21 21 22 using System;23 22 using System.Linq; 24 23 using HEAL.Attic; … … 36 35 public IResultDefinition<ParetoFrontScatterPlot<BinaryVector>> BestResult { get { return BestResultParameter; } } 37 36 [Storable] protected ReferenceParameter<IntValue> DimensionRefParameter { get; private set; } 38 public IValueParameter<IntValue> DimensionParameter => DimensionRefParameter;39 37 40 38 public int Dimension { 41 get { return DimensionRefParameter.Value.Value; }42 set { DimensionRefParameter.Value.Value= value; }39 get { return Encoding.Length; } 40 set { Encoding.Length = value; } 43 41 } 44 42 … … 92 90 93 91 private void RegisterEventHandlers() { 94 DimensionRefParameter.Value.ValueChanged += DimensionParameter_Value_ValueChanged; 95 } 96 97 private void DimensionParameter_Value_ValueChanged(object sender, EventArgs e) { 98 DimensionOnChanged(); 92 Encoding.PropertyChanged += (sender, args) => { 93 if (args.PropertyName == nameof(Encoding.Length)) 94 DimensionOnChanged(); 95 }; 99 96 } 100 97 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/DeceptiveTrapProblem.cs
r17544 r17545 58 58 Parameters.Add(TrapSizeParameter = new FixedValueParameter<IntValue>("Trap Size", "", new IntValue(7))); 59 59 Parameters.Add(NumberOfTrapsParameter = new FixedValueParameter<IntValue>("Number of Traps", "", new IntValue(7))); 60 Dimension = TrapSize * NumberOfTraps;60 DimensionRefParameter.ForceValue(new IntValue(TrapSize * NumberOfTraps, @readonly: true)); 61 61 62 62 RegisterEventHandlers(); -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/HIFFProblem.cs
r17544 r17545 27 27 using HeuristicLab.Common; 28 28 using HeuristicLab.Core; 29 using HeuristicLab.Data;30 29 using HeuristicLab.Encodings.BinaryVectorEncoding; 31 30 using HeuristicLab.Optimization; … … 39 38 public HIFFProblem() : base() { 40 39 Maximization = true; 41 Dimension RefParameter.ForceValue(new IntValue(64, @readonly: false));40 Dimension = 64; 42 41 } 43 42 -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Binary/3.3/OneMaxProblem.cs
r17544 r17545 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data;28 27 using HeuristicLab.Encodings.BinaryVectorEncoding; 29 28 using HeuristicLab.Optimization; … … 37 36 public OneMaxProblem() : base() { 38 37 Maximization = true; 39 Dimension RefParameter.ForceValue(new IntValue(10, @readonly: false));38 Dimension = 10; 40 39 BestKnownQuality = Dimension; 41 40 } -
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
r17544 r17545 91 91 Parameters.Add(new OptionalValueParameter<BinaryVector>("BestKnownSolution", "The best known solution of this Knapsack instance.")); 92 92 93 Dimension = Weights.Length;93 DimensionRefParameter.ForceValue(new IntValue(Weights.Length, @readonly: true)); 94 94 InitializeRandomKnapsackInstance(); 95 95
Note: See TracChangeset
for help on using the changeset viewer.