Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/Problem/DataBounds.cs @ 16724

Last change on this file since 16724 was 15771, checked in by bburlacu, 7 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

File size: 1.7 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis {
2  using HeuristicLab.Common;
3  using HeuristicLab.Core;
4  using HeuristicLab.Data;
5  using HeuristicLab.Parameters;
6  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7
8  [StorableClass]
9  public class DataBounds : ParameterizedNamedItem {
10
11    private const string TrainingParameterName = "Training";
12    private const string TestParameterName = "Test";
13
14    public DataBounds() : this(0, 0, 0, 0) {
15    }
16
17    public DataBounds(int trainingStart, int trainingEnd, int testStart, int testEnd) {
18      Parameters.Add(new FixedValueParameter<IntRange>(TrainingParameterName, new IntRange(trainingStart, trainingEnd)));
19      Parameters.Add(new FixedValueParameter<IntRange>(TestParameterName, new IntRange(testStart, testEnd)));
20    }
21
22    [StorableConstructor]
23    public DataBounds(bool deserializing) : base(deserializing) {
24    }
25
26    public DataBounds(DataBounds origin, Cloner cloner) : base(origin, cloner) {
27    }
28
29    public IValueParameter<IntRange> TrainingParameter
30    {
31      get { return (IValueParameter<IntRange>)Parameters[TrainingParameterName]; }
32    }
33
34    public IntRange TrainingRange
35    {
36      get { return TrainingParameter.Value; }
37      set { TrainingParameter.Value = value; }
38    }
39
40    public IValueParameter<IntRange> TestParameter
41    {
42      get { return (IValueParameter<IntRange>)Parameters[TestParameterName]; }
43    }
44
45    public IntRange TestRange
46    {
47      get { return TestParameter.Value; }
48      set { TestParameter.Value = value; }
49    }
50
51    public override IDeepCloneable Clone(Cloner cloner) {
52      return new DataBounds(this, cloner);
53    }
54  }
55}
Note: See TracBrowser for help on using the repository browser.