Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/02/12 00:29:39 (12 years ago)
Author:
abeham
Message:

#1775: added branch of plugin and new operators

Location:
branches/IntegerVectorEncoding/HeuristicLab.Encodings.IntegerVectorEncoding
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/IntegerVectorEncoding/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCreator.cs

    r7259 r7681  
    4747      get { return (IValueLookupParameter<IntValue>)Parameters["Length"]; }
    4848    }
    49     public IValueLookupParameter<IntValue> MinimumParameter {
    50       get { return (IValueLookupParameter<IntValue>)Parameters["Minimum"]; }
    51     }
    52     public IValueLookupParameter<IntValue> MaximumParameter {
    53       get { return (IValueLookupParameter<IntValue>)Parameters["Maximum"]; }
     49    public IValueLookupParameter<IntMatrix> BoundsParameter {
     50      get { return (IValueLookupParameter<IntMatrix>)Parameters["Bounds"]; }
    5451    }
    5552
     
    6259      Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The vector which should be manipulated."));
    6360      Parameters.Add(new ValueLookupParameter<IntValue>("Length", "The length of the vector."));
    64       Parameters.Add(new ValueLookupParameter<IntValue>("Minimum", "The inclusive lower bound for each element in the vector."));
    65       Parameters.Add(new ValueLookupParameter<IntValue>("Maximum", "The exclusive upper bound for each element in the vector."));
     61      Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "The bounds matrix can contain one row for each dimension with three columns specifying minimum (inclusive), maximum (exclusive), and step size. If less rows are given the matrix is cycled."));
    6662    }
    6763
     64    // BackwardsCompatibility3.3
     65    #region Backwards compatible code, remove with 3.4
     66    [StorableHook(HookType.AfterDeserialization)]
     67    private void AfterDeserialization() {
     68      if (!Parameters.ContainsKey("Bounds")) {
     69        Parameters.Remove("Minimum");
     70        Parameters.Remove("Maximum");
     71        Parameters.Add(new ValueLookupParameter<IntMatrix>("Bounds", "The bounds matrix can contain one row for each dimension with three columns specifying minimum (inclusive), maximum (inclusive), and step size. If less rows are given the matrix is cycled."));
     72      }
     73    }
     74    #endregion
     75
    6876    public sealed override IOperation Apply() {
    69       IntegerVectorParameter.ActualValue = Create(RandomParameter.ActualValue, LengthParameter.ActualValue, MinimumParameter.ActualValue, MaximumParameter.ActualValue);
     77      IntegerVectorParameter.ActualValue = Create(RandomParameter.ActualValue, LengthParameter.ActualValue, BoundsParameter.ActualValue);
    7078      return base.Apply();
    7179    }
    7280
    73     protected abstract IntegerVector Create(IRandom random, IntValue length, IntValue minimum, IntValue maximum);
     81    protected abstract IntegerVector Create(IRandom random, IntValue length, IntMatrix bounds);
    7482  }
    7583}
Note: See TracChangeset for help on using the changeset viewer.