Changeset 14897 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc
- Timestamp:
- 04/28/17 22:52:08 (8 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc
- Files:
-
- 33 added
- 10 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc/ErcOption.cs
r14875 r14897 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Base.Erc { 2 using Base.Erc.Interfaces; 3 using Common; 4 using Core; 5 using Data; 6 using Parameters; 7 using Persistence.Default.CompositeSerializers.Storable; 2 using HeuristicLab.Common; 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 4 9 5 [StorableClass] 10 public abstract class ErcOption : ParameterizedNamedItem, IReadOnlyErcOption{11 pr ivate const string IsEnabledParameterName = "IsEnabled";6 public abstract class ErcOption<T> : ErcOptionConvertible<T, T> { 7 protected ErcOption() : this(false, new IWeightedErcValueItem<T>[0]) { } 12 8 13 protected ErcOption() { 14 Parameters.Add(new FixedValueParameter<BoolValue>(IsEnabledParameterName)); 9 protected ErcOption(bool isEnabled, params IWeightedErcValueItem<T>[] values) 10 : base(x => x, isEnabled, values) { } 11 12 [StorableConstructor] 13 protected ErcOption(bool deserializing) 14 : base(deserializing) { 15 15 } 16 16 17 [StorableConstructor] 18 protected ErcOption(bool deserializing) : base(deserializing) { } 19 20 protected ErcOption(ErcOption origin, Cloner cloner) : base(origin, cloner) { } 21 22 public IValueParameter<BoolValue> IsEnabledParameter 23 { 24 get { return (IValueParameter<BoolValue>)Parameters[IsEnabledParameterName]; } 25 } 26 27 public bool IsEnabled 28 { 29 get { return IsEnabledParameter.Value.Value; } 30 set { IsEnabledParameter.Value.Value = value; } 17 protected ErcOption(ErcOptionConvertible<T, T> origin, Cloner cloner) 18 : base(origin, cloner) { 31 19 } 32 20 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc/ErcOptions.cs
r14875 r14897 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Base.Erc { 2 using HeuristicLab.Common; 3 using HeuristicLab.Core; 4 using HeuristicLab.Data; 5 using HeuristicLab.Parameters; 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 7 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Interfaces; 2 using System.Collections.Generic; 3 4 using Boolean; 5 using Char; 6 using Common; 7 using Core; 8 using Data; 9 using Float; 10 using FloatVector; 11 using Integer; 12 using IntegerVector; 13 using Parameters; 14 using Persistence.Default.CompositeSerializers.Storable; 15 using String; 16 using StringVector; 8 17 9 18 [StorableClass] … … 24 33 25 34 Parameters.Add(new FixedValueParameter<PercentValue>(ProbabilityParameterName)); 26 Parameters.Add(new FixedValueParameter<IntegerErcOptions>(IntegerParameterName));27 Parameters.Add(new FixedValueParameter<FloatErcOptions>(FloatParameterName));28 Parameters.Add(new FixedValueParameter<CharErcOptions>(CharParameterName));29 Parameters.Add(new FixedValueParameter<BooleanErcOptions>(BooleanParameterName));30 Parameters.Add(new FixedValueParameter<StringErcOptions>(StringParameterName));31 Parameters.Add(new FixedValueParameter<NameErcOptions>(NameParameterName));32 Parameters.Add(new FixedValueParameter<IntegerVectorErcOptions>(IntegerVectorParameterName));33 Parameters.Add(new FixedValueParameter<FloatVectorErcOptions>(FloatVectorParameterName));34 Parameters.Add(new FixedValueParameter<StringVectorErcOptions>(StringVectorParameterName));35 Parameters.Add(new ValueParameter<IntegerErcOptions>(IntegerParameterName)); 36 Parameters.Add(new ValueParameter<FloatErcOptions>(FloatParameterName)); 37 Parameters.Add(new ValueParameter<BooleanErcOptions>(BooleanParameterName)); 38 Parameters.Add(new ValueParameter<StringErcOptions>(StringParameterName)); 39 Parameters.Add(new ValueParameter<CharErcOptions>(CharParameterName)); 40 Parameters.Add(new ValueParameter<StringErcOptions>(NameParameterName)); 41 Parameters.Add(new ValueParameter<IntegerVectorErcOptions>(IntegerVectorParameterName)); 42 Parameters.Add(new ValueParameter<FloatVectorErcOptions>(FloatVectorParameterName)); 43 Parameters.Add(new ValueParameter<StringVectorErcOptions>(StringVectorParameterName)); 35 44 } 36 45 … … 51 60 } 52 61 62 IErcValueItem<int> IReadOnlyErcOptions.IntegerErcOptions { get { return IntegerErcOptions; } } 63 IErcValueItem<double> IReadOnlyErcOptions.FloatErcOptions { get { return FloatErcOptions; } } 64 IErcValueItem<bool> IReadOnlyErcOptions.BooleanErcOptions { get { return BooleanErcOptions; } } 65 IErcValueItem<char> IReadOnlyErcOptions.CharErcOptions { get { return CharErcOptions; } } 66 IErcValueItem<string> IReadOnlyErcOptions.StringErcOptions { get { return StringErcOptions; } } 67 IErcValueItem<string> IReadOnlyErcOptions.NameErcOptions { get { return NameErcOptions; } } 68 IErcValueItem<IReadOnlyList<int>> IReadOnlyErcOptions.IntegerVectorErcOptions { get { return IntegerVectorErcOptions; } } 69 IErcValueItem<IReadOnlyList<double>> IReadOnlyErcOptions.FloatVectorErcOptions { get { return FloatVectorErcOptions; } } 70 IErcValueItem<IReadOnlyList<string>> IReadOnlyErcOptions.StringVectorErcOptions { get { return StringVectorErcOptions; } } 71 53 72 public IValueParameter<IntegerErcOptions> IntegerErcOptionsParameter 54 73 { … … 62 81 } 63 82 64 IReadOnlyIntegerErcOptions IReadOnlyErcOptions.IntegerErcOptions65 {66 get { return IntegerErcOptions; }67 }68 69 83 public IValueParameter<FloatErcOptions> FloatErcOptionsParameter 70 84 { … … 76 90 get { return this.FloatErcOptionsParameter.Value; } 77 91 set { this.FloatErcOptionsParameter.Value = value; } 78 }79 80 IReadOnlyFloatErcOptions IReadOnlyErcOptions.FloatErcOptions81 {82 get { return FloatErcOptions; }83 92 } 84 93 … … 97 106 } 98 107 99 IReadOnlyCharErcOptions IReadOnlyErcOptions.CharErcOptions100 {101 get { return CharErcOptions; }102 }103 104 108 public IValueParameter<BooleanErcOptions> BooleanErcOptionsParameter 105 109 { … … 111 115 get { return BooleanErcOptionsParameter.Value; } 112 116 set { BooleanErcOptionsParameter.Value = value; } 113 }114 115 IReadOnlyBooleanErcOptions IReadOnlyErcOptions.BooleanErcOptions116 {117 get { return BooleanErcOptions; }118 117 } 119 118 … … 129 128 } 130 129 131 IReadOnlyStringErcOptions IReadOnlyErcOptions.StringErcOptions130 public IValueParameter<StringErcOptions> NameParameter 132 131 { 133 get { return StringErcOptions; }132 get { return (IValueParameter<StringErcOptions>)Parameters[NameParameterName]; } 134 133 } 135 134 136 public IValueParameter<NameErcOptions> NameParameter 137 { 138 get { return (IValueParameter<NameErcOptions>)Parameters[NameParameterName]; } 139 } 140 141 public NameErcOptions NameErcOptions 135 public StringErcOptions NameErcOptions 142 136 { 143 137 get { return NameParameter.Value; } 144 138 set { NameParameter.Value = value; } 145 }146 147 IReadOnlyNameErcOptions IReadOnlyErcOptions.NameErcOptions148 {149 get { return NameErcOptions; }150 139 } 151 140 … … 161 150 } 162 151 163 IReadOnlyVectorErcOptions<int> IReadOnlyErcOptions.IntegerVectorErcOptions164 {165 get { return IntegerVectorErcOptions; }166 }167 168 152 public IValueParameter<StringVectorErcOptions> StringVectorParameter 169 153 { … … 175 159 get { return StringVectorParameter.Value; } 176 160 set { StringVectorParameter.Value = value; } 177 }178 179 IReadOnlyVectorErcOptions<string> IReadOnlyErcOptions.StringVectorErcOptions180 {181 get { return StringVectorErcOptions; }182 161 } 183 162 … … 193 172 } 194 173 195 IReadOnlyVectorErcOptions<double> IReadOnlyErcOptions.FloatVectorErcOptions196 {197 get { return FloatVectorErcOptions; }198 }199 200 174 public override IDeepCloneable Clone(Cloner cloner) { 201 175 return new ErcOptions(this, cloner);
Note: See TracChangeset
for help on using the changeset viewer.