Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/15 13:28:37 (10 years ago)
Author:
abeham
Message:

#2174:

  • Some refactorings and bug fixes
  • Renamed (Binary|Integer|Real)Encoding to (Binary|Integer|Real)VectorEncoding
  • Improved error messages when compiling programmable problems
Location:
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings
Files:
3 moved

Legend:

Unmodified
Added
Removed
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/BinaryVectorEncoding.cs

    r11879 r11885  
    3232
    3333namespace HeuristicLab.Problems.Programmable {
    34   [Item("BinaryEncoding", "Describes a binary vector encoding.")]
     34  [Item("BinaryVectorEncoding", "Describes a binary vector encoding.")]
    3535  [StorableClass]
    36   public sealed class BinaryEncoding : Encoding<IBinaryVectorCreator> {
     36  public sealed class BinaryVectorEncoding : Encoding<IBinaryVectorCreator> {
    3737    #region Encoding Parameters
    3838    [Storable]
     
    5959
    6060    [StorableConstructor]
    61     private BinaryEncoding(bool deserializing) : base(deserializing) { }
     61    private BinaryVectorEncoding(bool deserializing) : base(deserializing) { }
    6262    [StorableHook(HookType.AfterDeserialization)]
    6363    private void AfterDeserialization() {
     
    6565      DiscoverOperators();
    6666    }
    67     public override IDeepCloneable Clone(Cloner cloner) { return new BinaryEncoding(this, cloner); }
    68     private BinaryEncoding(BinaryEncoding original, Cloner cloner)
     67    public override IDeepCloneable Clone(Cloner cloner) { return new BinaryVectorEncoding(this, cloner); }
     68    private BinaryVectorEncoding(BinaryVectorEncoding original, Cloner cloner)
    6969      : base(original, cloner) {
    7070      lengthParameter = cloner.Clone(original.lengthParameter);
     
    7272    }
    7373
    74     public BinaryEncoding() : this("BinaryVector", 10) { }
    75     public BinaryEncoding(int length) : this("BinaryVector", length) { }
    76     public BinaryEncoding(string name, int length)
     74    public BinaryVectorEncoding() : this("BinaryVector", 10) { }
     75    public BinaryVectorEncoding(int length) : this("BinaryVector", length) { }
     76    public BinaryVectorEncoding(string name, int length)
    7777      : base(name) {
    7878      lengthParameter = new FixedValueParameter<IntValue>(Name + ".Length", new IntValue(length));
     
    9898    #region Operator Discovery
    9999    private static readonly IEnumerable<Type> encodingSpecificOperatorTypes;
    100     static BinaryEncoding() {
     100    static BinaryVectorEncoding() {
    101101      encodingSpecificOperatorTypes = new List<Type>() {
    102102        typeof (IBinaryVectorOperator),
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/IntegerVectorEncoding.cs

    r11879 r11885  
    3333
    3434namespace HeuristicLab.Problems.Programmable {
    35   [Item("IntegerEncoding", "Describes an integer vector encoding.")]
     35  [Item("IntegerVectorEncoding", "Describes an integer vector encoding.")]
    3636  [StorableClass]
    37   public sealed class IntegerEncoding : Encoding<IIntegerVectorCreator> {
     37  public sealed class IntegerVectorEncoding : Encoding<IIntegerVectorCreator> {
    3838    #region Encoding Parameters
    3939    [Storable]
     
    7979
    8080    [StorableConstructor]
    81     private IntegerEncoding(bool deserializing) : base(deserializing) { }
     81    private IntegerVectorEncoding(bool deserializing) : base(deserializing) { }
    8282    [StorableHook(HookType.AfterDeserialization)]
    8383    private void AfterDeserialization() {
     
    8686    }
    8787
    88     private IntegerEncoding(IntegerEncoding original, Cloner cloner)
     88    private IntegerVectorEncoding(IntegerVectorEncoding original, Cloner cloner)
    8989      : base(original, cloner) {
    9090      lengthParameter = cloner.Clone(original.lengthParameter);
     
    9292      RegisterParameterEvents();
    9393    }
    94     public override IDeepCloneable Clone(Cloner cloner) { return new IntegerEncoding(this, cloner); }
    95 
    96 
    97     public IntegerEncoding() : this("IntegerVector", 10) { }
    98     public IntegerEncoding(int length) : this("integerVector", length) { }
    99     public IntegerEncoding(string name, int length, int min = int.MinValue, int max = int.MaxValue, int? step = null)
     94    public override IDeepCloneable Clone(Cloner cloner) { return new IntegerVectorEncoding(this, cloner); }
     95
     96
     97    public IntegerVectorEncoding() : this("IntegerVector", 10) { }
     98    public IntegerVectorEncoding(int length) : this("integerVector", length) { }
     99    public IntegerVectorEncoding(string name, int length, int min = int.MinValue, int max = int.MaxValue, int? step = null)
    100100      : base(name) {
    101101      if (min >= max) throw new ArgumentException("min must be less than max", "min");
     
    116116      DiscoverOperators();
    117117    }
    118     public IntegerEncoding(string name, int length, IList<int> min, IList<int> max, IList<int> step = null)
     118    public IntegerVectorEncoding(string name, int length, IList<int> min, IList<int> max, IList<int> step = null)
    119119      : base(name) {
    120120      if (min.Count == 0) throw new ArgumentException("Bounds must be given for the integer parameters.");
     
    163163    #region Operator Discovery
    164164    private static readonly IEnumerable<Type> encodingSpecificOperatorTypes;
    165     static IntegerEncoding() {
     165    static IntegerVectorEncoding() {
    166166      encodingSpecificOperatorTypes = new List<Type>() {
    167167        typeof (IIntegerVectorOperator),
  • branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Encodings/RealVectorEncoding.cs

    r11879 r11885  
    3333
    3434namespace HeuristicLab.Problems.Programmable {
    35   [Item("RealEncoding", "Describes a real vector encoding.")]
     35  [Item("RealVectorEncoding", "Describes a real vector encoding.")]
    3636  [StorableClass]
    37   public sealed class RealEncoding : Encoding<IRealVectorCreator> {
     37  public sealed class RealVectorEncoding : Encoding<IRealVectorCreator> {
    3838    #region Encoding Parameters
    3939    [Storable]
     
    7878
    7979    [StorableConstructor]
    80     private RealEncoding(bool deserializing) : base(deserializing) { }
     80    private RealVectorEncoding(bool deserializing) : base(deserializing) { }
    8181    [StorableHook(HookType.AfterDeserialization)]
    8282    private void AfterDeserialization() {
     
    8585    }
    8686
    87     public override IDeepCloneable Clone(Cloner cloner) { return new RealEncoding(this, cloner); }
    88     private RealEncoding(RealEncoding original, Cloner cloner)
     87    public override IDeepCloneable Clone(Cloner cloner) { return new RealVectorEncoding(this, cloner); }
     88    private RealVectorEncoding(RealVectorEncoding original, Cloner cloner)
    8989      : base(original, cloner) {
    9090      lengthParameter = cloner.Clone(original.lengthParameter);
     
    9393    }
    9494
    95     public RealEncoding() : this("RealVector", 10) { }
    96     public RealEncoding(int length) : this("RealVector", length) { }
    97     public RealEncoding(string name, int length, double min = double.MinValue, double max = double.MaxValue)
     95    public RealVectorEncoding() : this("RealVector", 10) { }
     96    public RealVectorEncoding(int length) : this("RealVector", length) { }
     97    public RealVectorEncoding(string name, int length, double min = double.MinValue, double max = double.MaxValue)
    9898      : base(name) {
    9999      if (min >= max) throw new ArgumentException("min must be less than max", "min");
     
    113113    }
    114114
    115     public RealEncoding(string name, int length, IList<double> min, IList<double> max)
     115    public RealVectorEncoding(string name, int length, IList<double> min, IList<double> max)
    116116      : base(name) {
    117117      if (min.Count == 0) throw new ArgumentException("Bounds must be given for the real parameters.");
     
    156156    #region Operator Discovery
    157157    private static readonly IEnumerable<Type> encodingSpecificOperatorTypes;
    158     static RealEncoding() {
     158    static RealVectorEncoding() {
    159159      encodingSpecificOperatorTypes = new List<Type>() {
    160160          typeof (IRealVectorOperator),
Note: See TracChangeset for help on using the changeset viewer.