Rev | Line | |
---|
[17557] | 1 | using System;
|
---|
| 2 | using HEAL.Attic;
|
---|
| 3 | using HeuristicLab.Common;
|
---|
| 4 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
| 5 |
|
---|
| 6 | namespace HeuristicLab.Algorithms.NSGA3
|
---|
| 7 | {
|
---|
[17618] | 8 | [StorableType("D35C9D79-77DF-4CF3-AB44-FCCC00E44C5F")]
|
---|
[17657] | 9 | public class Solution : IDeepCloneable
|
---|
[17557] | 10 | {
|
---|
| 11 | // Chromosome
|
---|
| 12 | public RealVector Chromosome { get; set; }
|
---|
| 13 |
|
---|
[17692] | 14 | // actual fitness of solution as given by Problem
|
---|
[17557] | 15 | public double[] Fitness { get; set; }
|
---|
| 16 |
|
---|
[17692] | 17 | // normalized fitness used in selection process (in order to not overwrite the original Fitness)
|
---|
| 18 | public double[] ConvertedFitness { get; set; }
|
---|
| 19 |
|
---|
[17657] | 20 | public Solution(RealVector chromosome)
|
---|
[17557] | 21 | {
|
---|
[17657] | 22 | Chromosome = chromosome;
|
---|
[17557] | 23 | }
|
---|
| 24 |
|
---|
[17657] | 25 | public Solution(Solution solution, Cloner cloner)
|
---|
[17557] | 26 | {
|
---|
[17657] | 27 | Chromosome = cloner.Clone(solution.Chromosome);
|
---|
[17692] | 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 | }
|
---|
[17557] | 38 | }
|
---|
| 39 |
|
---|
[17657] | 40 | public IDeepCloneable Clone(Cloner cloner)
|
---|
[17557] | 41 | {
|
---|
[17657] | 42 | return new Solution(this, cloner);
|
---|
[17557] | 43 | }
|
---|
| 44 |
|
---|
[17657] | 45 | public object Clone()
|
---|
[17557] | 46 | {
|
---|
[17657] | 47 | return new Cloner().Clone(this);
|
---|
[17557] | 48 | }
|
---|
| 49 | }
|
---|
| 50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.