[15771] | 1 | namespace HeuristicLab.Problems.ProgramSynthesis { |
---|
[14777] | 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]
|
---|
[14834] | 9 | public class DataBounds : ParameterizedNamedItem {
|
---|
[14777] | 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) {
|
---|
[14834] | 18 | Parameters.Add(new FixedValueParameter<IntRange>(TrainingParameterName, new IntRange(trainingStart, trainingEnd)));
|
---|
| 19 | Parameters.Add(new FixedValueParameter<IntRange>(TestParameterName, new IntRange(testStart, testEnd)));
|
---|
[14777] | 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 | {
|
---|
[14834] | 31 | get { return (IValueParameter<IntRange>)Parameters[TrainingParameterName]; }
|
---|
[14777] | 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 | {
|
---|
[14834] | 42 | get { return (IValueParameter<IntRange>)Parameters[TestParameterName]; }
|
---|
[14777] | 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 | }
|
---|