[12911] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[17180] | 3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[12911] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using HeuristicLab.Common;
|
---|
| 23 | using HeuristicLab.Core;
|
---|
| 24 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
[16565] | 25 | using HEAL.Attic;
|
---|
[12911] | 26 |
|
---|
| 27 | namespace HeuristicLab.Problems.GeneticProgramming.LawnMower {
|
---|
[16565] | 28 | [StorableType("99ADBE85-803D-4463-8BF2-5F825E14F7BD")]
|
---|
[12911] | 29 | public sealed class Solution : NamedItem {
|
---|
| 30 | [Storable]
|
---|
| 31 | public int Width { get; private set; }
|
---|
| 32 | [Storable]
|
---|
| 33 | public int Length { get; private set; }
|
---|
| 34 | [Storable]
|
---|
| 35 | public ISymbolicExpressionTree Tree { get; private set; }
|
---|
| 36 | [Storable]
|
---|
| 37 | public double Quality { get; private set; }
|
---|
| 38 |
|
---|
[13269] | 39 | #region item cloning and persistence
|
---|
[12911] | 40 | [StorableConstructor]
|
---|
[16565] | 41 | private Solution(StorableConstructorFlag _) : base(_) { }
|
---|
[13267] | 42 | [StorableHook(HookType.AfterDeserialization)]
|
---|
| 43 | private void AfterDeserialization() { }
|
---|
| 44 |
|
---|
[12911] | 45 | private Solution(Solution original, Cloner cloner)
|
---|
| 46 | : base(original, cloner) {
|
---|
| 47 | this.Length = original.Length;
|
---|
| 48 | this.Width = original.Width;
|
---|
| 49 | this.Tree = cloner.Clone(original.Tree);
|
---|
| 50 | this.Quality = original.Quality;
|
---|
| 51 | }
|
---|
[13267] | 52 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 53 | return new Solution(this, cloner);
|
---|
| 54 | }
|
---|
[13269] | 55 | #endregion
|
---|
[12911] | 56 |
|
---|
| 57 | public Solution(ISymbolicExpressionTree tree, int length, int width, double quality)
|
---|
| 58 | : base("Solution", "A lawn mower solution.") {
|
---|
| 59 | this.Tree = tree;
|
---|
| 60 | this.Length = length;
|
---|
| 61 | this.Width = width;
|
---|
| 62 | this.Quality = quality;
|
---|
| 63 | }
|
---|
| 64 | }
|
---|
| 65 | }
|
---|