Last change
on this file since 11247 was
9565,
checked in by melkaref, 12 years ago
|
Robocode Plugin code without Mutation Operators
|
File size:
1.3 KB
|
Rev | Line | |
---|
[9565] | 1 | using System;
|
---|
| 2 | using HeuristicLab.Common;
|
---|
| 3 | using HeuristicLab.Core;
|
---|
| 4 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
| 5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Problems.Robocode
|
---|
| 8 | {
|
---|
| 9 | [StorableClass]
|
---|
| 10 | public class ConstantTreeNode : SymbolicExpressionTreeTerminalNode
|
---|
| 11 | {
|
---|
| 12 | private int value;
|
---|
| 13 | [Storable]
|
---|
| 14 | public int Value
|
---|
| 15 | {
|
---|
| 16 | get { return value; }
|
---|
| 17 | private set { this.value = value; }
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | [StorableConstructor]
|
---|
| 21 | private ConstantTreeNode(bool deserializing) : base(deserializing) { }
|
---|
| 22 | private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
|
---|
| 23 | : base(original, cloner)
|
---|
| 24 | {
|
---|
| 25 | this.value = original.value;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | public ConstantTreeNode()
|
---|
| 29 | : base(new Constant())
|
---|
| 30 | {
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public override IDeepCloneable Clone(Cloner cloner)
|
---|
| 34 | {
|
---|
| 35 | return new ConstantTreeNode(this, cloner);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public override bool HasLocalParameters
|
---|
| 39 | {
|
---|
| 40 | get { return true; }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | public override void ResetLocalParameters(IRandom random)
|
---|
| 44 | {
|
---|
| 45 | value = random.Next(-360, 360);
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.