Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Problems.GeneticProgramming/3.3/ArtificialAnt/Trail.cs @ 13656

Last change on this file since 13656 was 13656, checked in by ascheibe, 8 years ago

#2582 created branch for Hive Web Job Manager

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