Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/17/12 15:05:11 (13 years ago)
Author:
abeham
Message:

#1775: reintegrated branch

Location:
trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding

  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Creators/UniformRandomIntegerVectorCreator.cs

    r7259 r8019  
    4949    /// <param name="max">The maximum value of the sampling range for each vector element (exclusive).</param>
    5050    /// <returns>The newly created integer vector.</returns>
    51     public static IntegerVector Apply(IRandom random, int length, int min, int max) {
    52       int[] result = new int[length];
    53       for (int i = 0; i < length; i++)
    54         result[i] = random.Next(min, max);
    55       return new IntegerVector(result);
     51    public static IntegerVector Apply(IRandom random, int length, IntMatrix bounds) {
     52      var result = new IntegerVector(length);
     53      result.Randomize(random, bounds);
     54      return result;
    5655    }
    5756
     
    6160    /// <param name="random">The pseudo random number generator to use.</param>
    6261    /// <param name="length">The length of the int vector.</param>
    63     /// <param name="minimum">The minimum value of the sampling range for each vector element (inclusive).</param>
    64     /// <param name="maximum">The maximum value of the sampling range for each vector element (exclusive).</param>
     62    /// <param name="bounds">Contains in each row for each dimension minimum (inclusive), maximum (inclusive), and step size.</param>
    6563    /// <returns>The newly created int vector.</returns>
    66     protected override IntegerVector Create(IRandom random, IntValue length, IntValue minimum, IntValue maximum) {
    67       return Apply(random, length.Value, minimum.Value, maximum.Value);
     64    protected override IntegerVector Create(IRandom random, IntValue length, IntMatrix bounds) {
     65      return Apply(random, length.Value, bounds);
    6866    }
    6967  }
Note: See TracChangeset for help on using the changeset viewer.