Package org.jamesii.core.math.random.distributions

Examples of org.jamesii.core.math.random.distributions.UniformDistribution


   *          the random number generator to be used
   */
  public UniformNode(IRandom rng) {
    super();
    random = rng;
    distrib = new UniformDistribution(random);
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public <N extends INode> N calc(IEnvironment<?> cEnv) {

    distrib =
        new UniformDistribution(random,
            ((ValueNode<Double>) lowerB.calc(cEnv)).getValue(),
            ((ValueNode<Double>) upperB.calc(cEnv)).getValue());

    return (N) new ValueNode<>(distrib.getRandomNumber());
  }
View Full Code Here

      double v1 = bounds.get(i).getFirstValue().doubleValue();
      double v2 = bounds.get(i).getSecondValue().doubleValue();
      double lowBorder = Math.min(v1, v2);
      double upBorder = Math.max(v1, v2);
      distributions[i] =
          new UniformDistribution(generator, lowBorder, upBorder);
    }
    return distributions;
  }
View Full Code Here

   *
   * @return the test data
   */
  private Double[][] generateTestData() {
    Double[][] result = new Double[4][500];
    UniformDistribution udist =
        new UniformDistribution(SimSystem.getRNGGenerator().getNextRNG(), 0, 10);
    for (int i = 0; i < result[0].length; i++) {
      result[0][i] = (double) i;
      for (int j = 1; j < result.length; j++) {
        result[j][i] = udist.getRandomNumber() * j + j * (double) (i * i);
      }
    }
    return result;
  }
View Full Code Here

   *          the random number generator to be used
   */
  public StochSearchPortfolioSelector(int sampleSize, IRandom rng) {
    iterations = sampleSize;
    random = rng;
    uDist = new UniformDistribution(random);
  }
View Full Code Here

    int maxSize =
        Math.max(genome1WithoutDuplicates.size(),
            genome2WithoutDuplicates.size());

    int crossoverPoint =
        (int) (new UniformDistribution(getRNG(), 0, maxSize)).getRandomNumber();
    Pair<List<Integer>, List<Integer>> crossedGenome =
        recombineGenomes(crossoverPoint, maxSize, genome1WithoutDuplicates,
            genome2WithoutDuplicates);
    newGenome1.addAll(crossedGenome.getFirstValue());
    newGenome2.addAll(crossedGenome.getSecondValue());
View Full Code Here

   */
  @Override
  public void generateRandomGenome(int length, int portfolioSize) {
    int remainingPortfolioSize = portfolioSize;
    boolean[] newGenome = new boolean[length];
    UniformDistribution randomPosition =
        new UniformDistribution(getRNG(), 0, newGenome.length);
    while (remainingPortfolioSize > 0) {
      int position = (int) randomPosition.getRandomNumber();
      if (!newGenome[position]) {
        newGenome[position] = true;
        remainingPortfolioSize--;
      }
    }
View Full Code Here

   * @return a pair of new individuals
   */
  @Override
  public Pair<IIndividual, IIndividual> recombine(IIndividual partner) {
    int crossoverPoint =
        (int) (new UniformDistribution(getRNG(), 0, genome.length))
            .getRandomNumber();
    Pair<boolean[], boolean[]> newGenomes =
        recombineGenomes(crossoverPoint, genome,
            partner.getBooleanRepresentation());
    return new Pair<IIndividual, IIndividual>(new BooleanIndividual(
View Full Code Here

      numOfAlgo = (int) (991 * rng.nextDouble() + 10);
    }
    if (numOfProb == 0) {
      numOfProb = (int) (991 * rng.nextDouble() + 10);
    }
    UniformDistribution u =
        new UniformDistribution(rng, minPerformance, maxPerformance + 1);
    Double[][] matrix = new Double[numOfAlgo][numOfProb];
    for (Double[] mat : matrix) {
      for (int i = 0; i < mat.length; i++) {
        mat[i] = u.getRandomNumber();
      }
    }
    return matrix;
  }
View Full Code Here

  /**
   * Test simple rejection with a second set of time series generated with a
   * lower variance.
   */
  public void testSimpleRejectionWithUniformDistributions() {
    testWithRandomData(true, new UniformDistribution(SimSystem
        .getRNGGenerator().getNextRNG(), INTERVAL_SHIFT_FOR_TESINTG, 1.),
        new UniformDistribution(SimSystem.getRNGGenerator().getNextRNG(), .0,
            1 - INTERVAL_SHIFT_FOR_TESINTG));
  }
View Full Code Here

TOP

Related Classes of org.jamesii.core.math.random.distributions.UniformDistribution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.