Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2521_ProblemRefactoring/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Trail.cs @ 16692

Last change on this file since 16692 was 16692, checked in by abeham, 6 years ago

#2521: merged trunk changes up to r15681 into branch (removal of trunk/sources)

File size: 2.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
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
22using System.Drawing;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Data;
26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.GeneticProgramming.ArtificialAnt {
30  /// <summary>
31  /// Represents a trail of an artificial ant which can be visualized in the GUI.
32  /// </summary>
33  [Item("AntTrail", "Represents a trail of an artificial ant which can be visualized in the GUI.")]
34  [StorableClass]
35  public sealed class Solution : Item {
36    public static new Image StaticItemImage {
37      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
38    }
39    [Storable]
40    public ISymbolicExpressionTree SymbolicExpressionTree { get; private set; }
41    [Storable]
42    public BoolMatrix World { get; private set; }
43    [Storable]
44    public int MaxTimeSteps { get; private set; }
45    [Storable]
46    public double Quality { get; private set; }
47
48    public Solution(BoolMatrix world, ISymbolicExpressionTree expression, int maxTimeSteps, double quality) {
49      this.World = world;
50      this.SymbolicExpressionTree = expression;
51      this.MaxTimeSteps = maxTimeSteps;
52      this.Quality = quality;
53    }
54
55    #region item cloning and persistence
56    [StorableConstructor]
57    private Solution(bool deserializing) : base(deserializing) { }
58    [StorableHook(HookType.AfterDeserialization)]
59    private void AfterDeserialization() { }
60
61    private Solution(Solution original, Cloner cloner)
62      : base(original, cloner) {
63      SymbolicExpressionTree = cloner.Clone(original.SymbolicExpressionTree);
64      World = cloner.Clone(original.World);
65      MaxTimeSteps = original.MaxTimeSteps;
66      Quality = original.Quality;
67    }
68
69    public override IDeepCloneable Clone(Cloner cloner) {
70      return new Solution(this, cloner);
71    }
72    #endregion
73  }
74}
Note: See TracBrowser for help on using the repository browser.