Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/Solution.cs @ 17688

Last change on this file since 17688 was 17657, checked in by dleko, 4 years ago

#2825 Implement recombination.

File size: 1.0 KB
Line 
1using System;
2using HEAL.Attic;
3using HeuristicLab.Common;
4using HeuristicLab.Encodings.RealVectorEncoding;
5
6namespace HeuristicLab.Algorithms.NSGA3
7{
8    [StorableType("D35C9D79-77DF-4CF3-AB44-FCCC00E44C5F")]
9    public class Solution : IDeepCloneable
10    {
11        // Chromosome
12        public RealVector Chromosome { get; set; }
13
14        // Fitness
15        public double[] Fitness { get; set; }
16
17        public Solution(RealVector chromosome)
18        {
19            Chromosome = chromosome;
20        }
21
22        public Solution(Solution solution, Cloner cloner)
23        {
24            Chromosome = cloner.Clone(solution.Chromosome);
25            Fitness = new double[solution.Fitness.Length];
26            Array.Copy(solution.Fitness, Fitness, solution.Fitness.Length);
27        }
28
29        public IDeepCloneable Clone(Cloner cloner)
30        {
31            return new Solution(this, cloner);
32        }
33
34        public object Clone()
35        {
36            return new Cloner().Clone(this);
37        }
38    }
39}
Note: See TracBrowser for help on using the repository browser.