Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc/NameErcOptions.cs @ 14875

Last change on this file since 14875 was 14875, checked in by pkimmesw, 7 years ago

#2665 BenchmarkSuite, all examples, partially tested, VectorExpressions added

File size: 1.7 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Base.Erc {
2
3  using HeuristicLab.Common;
4  using HeuristicLab.Core;
5  using HeuristicLab.Data;
6  using HeuristicLab.Parameters;
7  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
8  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Interfaces;
9
10  [StorableClass]
11  public class NameErcOptions : StringErcOptions, IReadOnlyNameErcOptions {
12    private const string NewNameProbabilityParameterName = "New name probability";
13
14    public NameErcOptions() : this(false) {
15    }
16
17    public NameErcOptions(params string[] constants)
18      : base(constants) {
19      Parameters.Add(new FixedValueParameter<PercentValue>(NewNameProbabilityParameterName));
20    }
21
22    [StorableConstructor]
23    public NameErcOptions(bool deserializing) : base(deserializing) { }
24
25    public NameErcOptions(NameErcOptions origin, Cloner cloner) : base(origin, cloner) { }
26
27    /// <summary>
28    ///     The probability that the selection of the ephemeral
29    ///     random NAME constant for inclusion in randomly generated code will produce a new name
30    ///     (rather than a name that was previously generated).
31    /// </summary>
32    public IValueParameter<PercentValue> NewNameProbabilityParameter
33    {
34      get { return (IValueParameter<PercentValue>)Parameters[NewNameProbabilityParameterName]; }
35    }
36
37    public double NewNameProbability
38    {
39      get { return NewNameProbabilityParameter.Value.Value; }
40      set { NewNameProbabilityParameter.Value.Value = value; }
41    }
42
43    public override IDeepCloneable Clone(Cloner cloner) {
44      return new NameErcOptions(this, cloner);
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.