- Timestamp:
- 06/20/20 12:33:24 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/ReferencePoint.cs
r17558 r17615 1 1 using System.Collections.Generic; 2 using HEAL.Attic; 3 using HeuristicLab.Common; 2 4 3 5 namespace HeuristicLab.Algorithms.NSGA3 … … 9 11 */ 10 12 11 internal class ReferencePoint 13 [StorableType("96DCBD85-7C8B-4546-B6F5-FB4AE0DF7158")] 14 internal class ReferencePoint : IDeepCloneable 12 15 { 16 #region Storable Properties 17 18 public double[] Values { get; } 19 20 #endregion Storable Properties 21 22 #region Properties 23 24 public int NumberOfDimensions => Values.Length; 25 26 #endregion Properties 27 13 28 public ReferencePoint(int numberOfDimensions) 14 29 { 15 NumberOfDimensions = numberOfDimensions; 16 Values = new double[NumberOfDimensions]; 30 Values = new double[numberOfDimensions]; 17 31 } 18 32 19 33 public ReferencePoint(ReferencePoint other) 20 34 { 21 NumberOfDimensions = other.NumberOfDimensions; 22 Values = new double[NumberOfDimensions]; 23 for (int i = 0; i < NumberOfDimensions; i++) 35 Values = new double[other.NumberOfDimensions]; 36 for (int i = 0; i < other.NumberOfDimensions; i++) 24 37 Values[i] = other.Values[i]; 25 38 } 26 39 27 public int NumberOfDimensions { get; } 40 public IDeepCloneable Clone(Cloner cloner) 41 { 42 // no cloner is required to copy a Reference Point 43 return new ReferencePoint(this); 44 } 28 45 29 public double[] Values { get; } 46 public object Clone() 47 { 48 return new Cloner().Clone(this); 49 } 30 50 31 51 // todo: use this (for optimization) … … 43 63 } 44 64 65 // maybe todo: move this to another class? 45 66 /// <summary> 46 67 /// Generate reference points that are evenly distributed over a hyperplane with dimensions
Note: See TracChangeset
for help on using the changeset viewer.