Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/10 15:59:37 (14 years ago)
Author:
abeham
Message:

Updated RealVector encoding to use a double matrix as bounds #929

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVector.cs

    r3054 r3123  
    5656      }
    5757    }
     58
     59    public virtual void Randomize(IRandom random, int startIndex, int length, DoubleMatrix bounds) {
     60      if (length > 0) {
     61        for (int i = startIndex; i < startIndex + length; i++) {
     62          double min = bounds[i % bounds.Rows, 0];
     63          double max = bounds[i % bounds.Rows, 1];
     64          array[i] = min + (max - min) * random.NextDouble();
     65        }
     66        OnReset();
     67      }
     68    }
     69
    5870    public void Randomize(IRandom random, double min, double max) {
    5971      Randomize(random, 0, Length, min, max);
    6072    }
     73
     74    public void Randomize(IRandom random, DoubleMatrix bounds) {
     75      Randomize(random, 0, Length, bounds);
     76    }
     77
    6178  }
    6279}
Note: See TracChangeset for help on using the changeset viewer.