Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Solution.cs @ 9567

Last change on this file since 9567 was 9565, checked in by melkaref, 11 years ago

Robocode Plugin code without Mutation Operators

File size: 2.0 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
4using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
5
6namespace HeuristicLab.Problems.Robocode
7{
8    [StorableClass]
9    public sealed class Solution : NamedItem
10    {
11        //private int moves;
12        //[Storable]
13        //public int Moves
14        //{
15        //    get { return moves; }
16        //    private set { this.moves = value; }
17        //}
18        //private int shots;
19        //[Storable]
20        //public int Shots
21        //{
22        //    get { return shots; }
23        //    private set { this.shots = value; }
24        //}
25        private ISymbolicExpressionTree tree;
26        [Storable]
27        public ISymbolicExpressionTree Tree
28        {
29            get { return tree; }
30            private set { this.tree = value; }
31        }
32
33        private double quality;
34        [Storable]
35        public double Quality
36        {
37            get { return quality; }
38            private set { this.quality = value; }
39        }
40
41        [StorableConstructor]
42        private Solution(bool deserializing) : base(deserializing) { }
43        private Solution(Solution original, Cloner cloner)
44            : base(original, cloner)
45        {
46            //this.moves = original.moves;
47            //this.shots = original.shots;
48            this.tree = cloner.Clone(tree);
49        }
50
51        public Solution(ISymbolicExpressionTree tree, double quality)// int moves, int shots)
52            : base("Solution", "A tank program.")
53        {
54            this.tree = tree;
55            this.quality = quality;
56            //this.moves = moves;
57            //this.shots = shots;
58        }
59        [StorableHook(HookType.AfterDeserialization)]
60        private void AfterDeserialization()
61        {
62        }
63        public override IDeepCloneable Clone(Cloner cloner)
64        {
65            return new Solution(this, cloner);
66        }
67    }
68}
Note: See TracBrowser for help on using the repository browser.