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;
|
---|
8 |
|
---|
9 | [StorableClass]
|
---|
10 | public class ErcOptions : ParameterizedNamedItem, IReadOnlyErcOptions {
|
---|
11 | public const string ProbabilityParameterName = "Probability";
|
---|
12 | public const string IntegerParameterName = "Integer";
|
---|
13 | public const string FloatParameterName = "Float";
|
---|
14 | public const string CharParameterName = "Char";
|
---|
15 | public const string BooleanParameterName = "Boolean";
|
---|
16 | public const string StringParameterName = "String";
|
---|
17 | public const string NameParameterName = "Name";
|
---|
18 | public const string IntegerVectorParameterName = "IntegerVector";
|
---|
19 | public const string FloatVectorParameterName = "FloatVector";
|
---|
20 | public const string StringVectorParameterName = "StringVector";
|
---|
21 |
|
---|
22 | public ErcOptions() {
|
---|
23 | Name = "ERC Options";
|
---|
24 |
|
---|
25 | 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 | }
|
---|
36 |
|
---|
37 | [StorableConstructor]
|
---|
38 | public ErcOptions(bool deserializing) : base(deserializing) { }
|
---|
39 |
|
---|
40 | public ErcOptions(ErcOptions origin, Cloner cloner) : base(origin, cloner) { }
|
---|
41 |
|
---|
42 | public IValueParameter<PercentValue> ErcProbabilityParameter
|
---|
43 | {
|
---|
44 | get { return (IValueParameter<PercentValue>)Parameters[ProbabilityParameterName]; }
|
---|
45 | }
|
---|
46 |
|
---|
47 | public double ErcProbability
|
---|
48 | {
|
---|
49 | get { return ErcProbabilityParameter.Value.Value; }
|
---|
50 | set { ErcProbabilityParameter.Value.Value = value; }
|
---|
51 | }
|
---|
52 |
|
---|
53 | public IValueParameter<IntegerErcOptions> IntegerErcOptionsParameter
|
---|
54 | {
|
---|
55 | get { return (IValueParameter<IntegerErcOptions>)Parameters[IntegerParameterName]; }
|
---|
56 | }
|
---|
57 |
|
---|
58 | public IntegerErcOptions IntegerErcOptions
|
---|
59 | {
|
---|
60 | get { return this.IntegerErcOptionsParameter.Value; }
|
---|
61 | set { this.IntegerErcOptionsParameter.Value = value; }
|
---|
62 | }
|
---|
63 |
|
---|
64 | IReadOnlyIntegerErcOptions IReadOnlyErcOptions.IntegerErcOptions
|
---|
65 | {
|
---|
66 | get { return IntegerErcOptions; }
|
---|
67 | }
|
---|
68 |
|
---|
69 | public IValueParameter<FloatErcOptions> FloatErcOptionsParameter
|
---|
70 | {
|
---|
71 | get { return (IValueParameter<FloatErcOptions>)Parameters[FloatParameterName]; }
|
---|
72 | }
|
---|
73 |
|
---|
74 | public FloatErcOptions FloatErcOptions
|
---|
75 | {
|
---|
76 | get { return this.FloatErcOptionsParameter.Value; }
|
---|
77 | set { this.FloatErcOptionsParameter.Value = value; }
|
---|
78 | }
|
---|
79 |
|
---|
80 | IReadOnlyFloatErcOptions IReadOnlyErcOptions.FloatErcOptions
|
---|
81 | {
|
---|
82 | get { return FloatErcOptions; }
|
---|
83 | }
|
---|
84 |
|
---|
85 | /// <summary>
|
---|
86 | /// Integer represents ASCII value
|
---|
87 | /// </summary>
|
---|
88 | public IValueParameter<CharErcOptions> CharErcOptionsParameter
|
---|
89 | {
|
---|
90 | get { return (IValueParameter<CharErcOptions>)Parameters[CharParameterName]; }
|
---|
91 | }
|
---|
92 |
|
---|
93 | public CharErcOptions CharErcOptions
|
---|
94 | {
|
---|
95 | get { return CharErcOptionsParameter.Value; }
|
---|
96 | set { CharErcOptionsParameter.Value = value; }
|
---|
97 | }
|
---|
98 |
|
---|
99 | IReadOnlyCharErcOptions IReadOnlyErcOptions.CharErcOptions
|
---|
100 | {
|
---|
101 | get { return CharErcOptions; }
|
---|
102 | }
|
---|
103 |
|
---|
104 | public IValueParameter<BooleanErcOptions> BooleanErcOptionsParameter
|
---|
105 | {
|
---|
106 | get { return (IValueParameter<BooleanErcOptions>)Parameters[BooleanParameterName]; }
|
---|
107 | }
|
---|
108 |
|
---|
109 | public BooleanErcOptions BooleanErcOptions
|
---|
110 | {
|
---|
111 | get { return BooleanErcOptionsParameter.Value; }
|
---|
112 | set { BooleanErcOptionsParameter.Value = value; }
|
---|
113 | }
|
---|
114 |
|
---|
115 | IReadOnlyBooleanErcOptions IReadOnlyErcOptions.BooleanErcOptions
|
---|
116 | {
|
---|
117 | get { return BooleanErcOptions; }
|
---|
118 | }
|
---|
119 |
|
---|
120 | public IValueParameter<StringErcOptions> StringErcOptionsParameter
|
---|
121 | {
|
---|
122 | get { return (IValueParameter<StringErcOptions>)Parameters[StringParameterName]; }
|
---|
123 | }
|
---|
124 |
|
---|
125 | public StringErcOptions StringErcOptions
|
---|
126 | {
|
---|
127 | get { return StringErcOptionsParameter.Value; }
|
---|
128 | set { StringErcOptionsParameter.Value = value; }
|
---|
129 | }
|
---|
130 |
|
---|
131 | IReadOnlyStringErcOptions IReadOnlyErcOptions.StringErcOptions
|
---|
132 | {
|
---|
133 | get { return StringErcOptions; }
|
---|
134 | }
|
---|
135 |
|
---|
136 | public IValueParameter<NameErcOptions> NameParameter
|
---|
137 | {
|
---|
138 | get { return (IValueParameter<NameErcOptions>)Parameters[NameParameterName]; }
|
---|
139 | }
|
---|
140 |
|
---|
141 | public NameErcOptions NameErcOptions
|
---|
142 | {
|
---|
143 | get { return NameParameter.Value; }
|
---|
144 | set { NameParameter.Value = value; }
|
---|
145 | }
|
---|
146 |
|
---|
147 | IReadOnlyNameErcOptions IReadOnlyErcOptions.NameErcOptions
|
---|
148 | {
|
---|
149 | get { return NameErcOptions; }
|
---|
150 | }
|
---|
151 |
|
---|
152 | public IValueParameter<IntegerVectorErcOptions> IntegerVectorParameter
|
---|
153 | {
|
---|
154 | get { return (IValueParameter<IntegerVectorErcOptions>)Parameters[IntegerVectorParameterName]; }
|
---|
155 | }
|
---|
156 |
|
---|
157 | public IntegerVectorErcOptions IntegerVectorErcOptions
|
---|
158 | {
|
---|
159 | get { return IntegerVectorParameter.Value; }
|
---|
160 | set { IntegerVectorParameter.Value = value; }
|
---|
161 | }
|
---|
162 |
|
---|
163 | IReadOnlyVectorErcOptions<int> IReadOnlyErcOptions.IntegerVectorErcOptions
|
---|
164 | {
|
---|
165 | get { return IntegerVectorErcOptions; }
|
---|
166 | }
|
---|
167 |
|
---|
168 | public IValueParameter<StringVectorErcOptions> StringVectorParameter
|
---|
169 | {
|
---|
170 | get { return (IValueParameter<StringVectorErcOptions>)Parameters[StringVectorParameterName]; }
|
---|
171 | }
|
---|
172 |
|
---|
173 | public StringVectorErcOptions StringVectorErcOptions
|
---|
174 | {
|
---|
175 | get { return StringVectorParameter.Value; }
|
---|
176 | set { StringVectorParameter.Value = value; }
|
---|
177 | }
|
---|
178 |
|
---|
179 | IReadOnlyVectorErcOptions<string> IReadOnlyErcOptions.StringVectorErcOptions
|
---|
180 | {
|
---|
181 | get { return StringVectorErcOptions; }
|
---|
182 | }
|
---|
183 |
|
---|
184 | public IValueParameter<FloatVectorErcOptions> FloatVectorParameter
|
---|
185 | {
|
---|
186 | get { return (IValueParameter<FloatVectorErcOptions>)Parameters[FloatVectorParameterName]; }
|
---|
187 | }
|
---|
188 |
|
---|
189 | public FloatVectorErcOptions FloatVectorErcOptions
|
---|
190 | {
|
---|
191 | get { return FloatVectorParameter.Value; }
|
---|
192 | set { FloatVectorParameter.Value = value; }
|
---|
193 | }
|
---|
194 |
|
---|
195 | IReadOnlyVectorErcOptions<double> IReadOnlyErcOptions.FloatVectorErcOptions
|
---|
196 | {
|
---|
197 | get { return FloatVectorErcOptions; }
|
---|
198 | }
|
---|
199 |
|
---|
200 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
201 | return new ErcOptions(this, cloner);
|
---|
202 | }
|
---|
203 | }
|
---|
204 | }
|
---|