Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/20/20 12:33:24 (4 years ago)
Author:
dleko
Message:

#2825 The list of Reference Points are now a storable field in the NSGA3 class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/ReferencePoint.cs

    r17558 r17615  
    11using System.Collections.Generic;
     2using HEAL.Attic;
     3using HeuristicLab.Common;
    24
    35namespace HeuristicLab.Algorithms.NSGA3
     
    911     */
    1012
    11     internal class ReferencePoint
     13    [StorableType("96DCBD85-7C8B-4546-B6F5-FB4AE0DF7158")]
     14    internal class ReferencePoint : IDeepCloneable
    1215    {
     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
    1328        public ReferencePoint(int numberOfDimensions)
    1429        {
    15             NumberOfDimensions = numberOfDimensions;
    16             Values = new double[NumberOfDimensions];
     30            Values = new double[numberOfDimensions];
    1731        }
    1832
    1933        public ReferencePoint(ReferencePoint other)
    2034        {
    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++)
    2437                Values[i] = other.Values[i];
    2538        }
    2639
    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        }
    2845
    29         public double[] Values { get; }
     46        public object Clone()
     47        {
     48            return new Cloner().Clone(this);
     49        }
    3050
    3151        // todo: use this (for optimization)
     
    4363        }
    4464
     65        // maybe todo: move this to another class?
    4566        /// <summary>
    4667        /// Generate reference points that are evenly distributed over a hyperplane with dimensions
Note: See TracChangeset for help on using the changeset viewer.