Line | |
---|
1 | using System;
|
---|
2 | using HEAL.Attic;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
5 |
|
---|
6 | namespace 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 | // actual fitness of solution as given by Problem
|
---|
15 | public double[] Fitness { get; set; }
|
---|
16 |
|
---|
17 | // normalized fitness used in selection process (in order to not overwrite the original Fitness)
|
---|
18 | public double[] ConvertedFitness { get; set; }
|
---|
19 |
|
---|
20 | public Solution(RealVector chromosome)
|
---|
21 | {
|
---|
22 | Chromosome = chromosome;
|
---|
23 | }
|
---|
24 |
|
---|
25 | public Solution(Solution solution, Cloner cloner)
|
---|
26 | {
|
---|
27 | Chromosome = cloner.Clone(solution.Chromosome);
|
---|
28 | if (solution.Fitness != null)
|
---|
29 | {
|
---|
30 | Fitness = new double[solution.Fitness.Length];
|
---|
31 | Array.Copy(solution.Fitness, Fitness, solution.Fitness.Length);
|
---|
32 | }
|
---|
33 | if (solution.ConvertedFitness != null)
|
---|
34 | {
|
---|
35 | ConvertedFitness = new double[solution.ConvertedFitness.Length];
|
---|
36 | Array.Copy(solution.ConvertedFitness, ConvertedFitness, solution.ConvertedFitness.Length);
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | public IDeepCloneable Clone(Cloner cloner)
|
---|
41 | {
|
---|
42 | return new Solution(this, cloner);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public object Clone()
|
---|
46 | {
|
---|
47 | return new Cloner().Clone(this);
|
---|
48 | }
|
---|
49 | }
|
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.