Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/28/17 22:52:08 (8 years ago)
Author:
pkimmesw
Message:

#2665 Dynamic ErcValues, Separate Push from BenchmarkSuite Push

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  
    11namespace 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;
    84
    95  [StorableClass]
    10   public abstract class ErcOption : ParameterizedNamedItem, IReadOnlyErcOption {
    11     private const string IsEnabledParameterName = "IsEnabled";
     6  public abstract class ErcOption<T> : ErcOptionConvertible<T, T> {
     7    protected ErcOption() : this(false, new IWeightedErcValueItem<T>[0]) { }
    128
    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) {
    1515    }
    1616
    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) {
    3119    }
    3220  }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis.Base/Erc/ErcOptions.cs

    r14875 r14897  
    11namespace 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;
    817
    918  [StorableClass]
     
    2433
    2534      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));
    3544    }
    3645
     
    5160    }
    5261
     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
    5372    public IValueParameter<IntegerErcOptions> IntegerErcOptionsParameter
    5473    {
     
    6281    }
    6382
    64     IReadOnlyIntegerErcOptions IReadOnlyErcOptions.IntegerErcOptions
    65     {
    66       get { return IntegerErcOptions; }
    67     }
    68 
    6983    public IValueParameter<FloatErcOptions> FloatErcOptionsParameter
    7084    {
     
    7690      get { return this.FloatErcOptionsParameter.Value; }
    7791      set { this.FloatErcOptionsParameter.Value = value; }
    78     }
    79 
    80     IReadOnlyFloatErcOptions IReadOnlyErcOptions.FloatErcOptions
    81     {
    82       get { return FloatErcOptions; }
    8392    }
    8493
     
    97106    }
    98107
    99     IReadOnlyCharErcOptions IReadOnlyErcOptions.CharErcOptions
    100     {
    101       get { return CharErcOptions; }
    102     }
    103 
    104108    public IValueParameter<BooleanErcOptions> BooleanErcOptionsParameter
    105109    {
     
    111115      get { return BooleanErcOptionsParameter.Value; }
    112116      set { BooleanErcOptionsParameter.Value = value; }
    113     }
    114 
    115     IReadOnlyBooleanErcOptions IReadOnlyErcOptions.BooleanErcOptions
    116     {
    117       get { return BooleanErcOptions; }
    118117    }
    119118
     
    129128    }
    130129
    131     IReadOnlyStringErcOptions IReadOnlyErcOptions.StringErcOptions
     130    public IValueParameter<StringErcOptions> NameParameter
    132131    {
    133       get { return StringErcOptions; }
     132      get { return (IValueParameter<StringErcOptions>)Parameters[NameParameterName]; }
    134133    }
    135134
    136     public IValueParameter<NameErcOptions> NameParameter
    137     {
    138       get { return (IValueParameter<NameErcOptions>)Parameters[NameParameterName]; }
    139     }
    140 
    141     public NameErcOptions NameErcOptions
     135    public StringErcOptions NameErcOptions
    142136    {
    143137      get { return NameParameter.Value; }
    144138      set { NameParameter.Value = value; }
    145     }
    146 
    147     IReadOnlyNameErcOptions IReadOnlyErcOptions.NameErcOptions
    148     {
    149       get { return NameErcOptions; }
    150139    }
    151140
     
    161150    }
    162151
    163     IReadOnlyVectorErcOptions<int> IReadOnlyErcOptions.IntegerVectorErcOptions
    164     {
    165       get { return IntegerVectorErcOptions; }
    166     }
    167 
    168152    public IValueParameter<StringVectorErcOptions> StringVectorParameter
    169153    {
     
    175159      get { return StringVectorParameter.Value; }
    176160      set { StringVectorParameter.Value = value; }
    177     }
    178 
    179     IReadOnlyVectorErcOptions<string> IReadOnlyErcOptions.StringVectorErcOptions
    180     {
    181       get { return StringVectorErcOptions; }
    182161    }
    183162
     
    193172    }
    194173
    195     IReadOnlyVectorErcOptions<double> IReadOnlyErcOptions.FloatVectorErcOptions
    196     {
    197       get { return FloatVectorErcOptions; }
    198     }
    199 
    200174    public override IDeepCloneable Clone(Cloner cloner) {
    201175      return new ErcOptions(this, cloner);
Note: See TracChangeset for help on using the changeset viewer.