1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2015 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 |
|
---|
22 | using System;
|
---|
23 | using System.Drawing;
|
---|
24 | using HeuristicLab.Common;
|
---|
25 | using HeuristicLab.Core;
|
---|
26 | using HeuristicLab.Data;
|
---|
27 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
29 |
|
---|
30 | namespace HeuristicLab.Problems.ArtificialAnt {
|
---|
31 | /// <summary>
|
---|
32 | /// Represents a trail of an artificial ant which can be visualized in the GUI.
|
---|
33 | /// </summary>
|
---|
34 | [Item("AntTrail", "Represents a trail of an artificial ant which can be visualized in the GUI.")]
|
---|
35 | [StorableClass]
|
---|
36 | public sealed class AntTrail : Item {
|
---|
37 | public static new Image StaticItemImage {
|
---|
38 | get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
|
---|
39 | }
|
---|
40 | [Storable]
|
---|
41 | public ISymbolicExpressionTree SymbolicExpressionTree { get; private set; }
|
---|
42 | [Storable]
|
---|
43 | public BoolMatrix World { get; private set; }
|
---|
44 | [Storable]
|
---|
45 | public int MaxTimeSteps { get; private set; }
|
---|
46 | [Storable]
|
---|
47 | public double Quality { get; private set; }
|
---|
48 |
|
---|
49 | public AntTrail(BoolMatrix world, ISymbolicExpressionTree expression, int maxTimeSteps, double quality) {
|
---|
50 | this.World = world;
|
---|
51 | this.SymbolicExpressionTree = expression;
|
---|
52 | this.MaxTimeSteps = maxTimeSteps;
|
---|
53 | this.Quality = quality;
|
---|
54 | }
|
---|
55 |
|
---|
56 | [StorableConstructor]
|
---|
57 | private AntTrail(bool deserializing) : base(deserializing) { }
|
---|
58 | [StorableHook(HookType.AfterDeserialization)]
|
---|
59 | private void AfterDeserialization() { }
|
---|
60 |
|
---|
61 | private AntTrail(AntTrail 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 AntTrail(this, cloner);
|
---|
71 | }
|
---|
72 | }
|
---|
73 | }
|
---|