コード例 #1
0
  /**
   * Set the RBF components to random values.
   *
   * @param min Minimum random value.
   * @param max Max random value.
   * @param t The type of RBF to use.
   */
  public void randomizeRBFCentersAndWidths(final double min, final double max, final RBFEnum t) {
    final int dimensions = getInputCount();
    final double[] centers = new double[dimensions];

    for (int i = 0; i < dimensions; i++) {
      centers[i] = RangeRandomizer.randomize(min, max);
    }

    for (int i = 0; i < this.flat.getRBF().length; i++) {
      setRBFFunction(i, t, centers, RangeRandomizer.randomize(min, max));
    }
  }
コード例 #2
0
 public static double[] generate(int size, double low, double high) {
   double[] result = new double[size];
   for (int i = 0; i < result.length; i++) {
     result[i] = RangeRandomizer.randomize(low, high);
   }
   return result;
 }
コード例 #3
0
 public static double[] distort(double[] d, double distort) {
   double[] result = new double[d.length];
   for (int i = 0; i < d.length; i++) {
     double pct = RangeRandomizer.randomize(0, distort) - (distort / 2);
     pct += 1.0;
     result[i] = d[i] * pct;
   }
   return result;
 }
コード例 #4
0
  @Override
  public void randomize() {
    int countPer = (sourceUniverse.getCellFactory().size() * 3) + 1;
    double[] d = new double[countPer * this.ruleCount * 2];

    for (int i = 0; i < this.physics.length; i++) {
      d[i] = RangeRandomizer.randomize(-1, 1);
    }

    setPhysics(d);
  }