List of usage examples for org.apache.commons.math3.distribution UniformIntegerDistribution UniformIntegerDistribution
public UniformIntegerDistribution(int lower, int upper) throws NumberIsTooLargeException
From source file:com.metawiring.load.generators.NamedNumberGenerator.java
public NamedNumberGenerator(int popsize) { this.popsize = popsize; distribution = new UniformIntegerDistribution(1, this.popsize + 1); }
From source file:com.metawiring.load.generators.MapGenerator.java
public MapGenerator(String paramFile, int sizeDistribution) { this.sizeDistribution = new UniformIntegerDistribution(0, sizeDistribution - 1); this.paramGenerator = new LineExtractGenerator(paramFile); }
From source file:com.metawiring.load.generators.MapStringGenerator.java
public MapStringGenerator(String paramFile, int sizeDistribution) { this.sizeDistribution = new UniformIntegerDistribution(0, sizeDistribution - 1); this.paramGenerator = new LineExtractGenerator(paramFile); }
From source file:it.cnr.isti.smartfed.papers.qbrokage.ApplicationGenerator.java
public ApplicationGenerator() { ramAmount = new UniformIntegerDistribution(512, 1024 * 16); bwAmount = new UniformIntegerDistribution(10 * 1024, 10 * 1024 * 1024); diskAmount = new UniformIntegerDistribution(4096, 10 * 1024 * 1024); // 10TB max coreAmount = new UniformIntegerDistribution(1, 8); mipsAmount = new UniformIntegerDistribution(1000, 25000); }
From source file:com.github.rinde.rinsim.util.StochasticSuppliersTest.java
@Test public void testUniform() { final RandomGenerator rng = new MersenneTwister(123L); final StochasticSupplier<Integer> sup = uniformInt(2, 10); final IntegerDistribution id = new UniformIntegerDistribution(2, 10); final Multiset<Integer> ms = TreeMultiset.create(); for (int i = 0; i < 1000; i++) { ms.add(sup.get(rng.nextLong())); }//from ww w. j a v a 2 s . c o m final List<Integer> observations = newArrayList(); final List<Double> expectations = newArrayList(); for (final Multiset.Entry<Integer> entry : ms.entrySet()) { observations.add(entry.getCount()); expectations.add(id.probability(entry.getElement())); } assertTrue(chiSquare(expectations, observations, .01)); }
From source file:com.vmware.photon.controller.rootscheduler.simulator.PlacementSimulatorTest.java
@BeforeClass public void setUpClass() throws Throwable { cloudStore = TestEnvironment.create(1); // There are 10 datastores. // TODO(mmutsuzaki) Allow the user to define datastore sizes. int numDatastores = 10; CloudStoreLoader.loadDatastores(cloudStore, numDatastores); int numHosts = 100; // 50% of the hosts have 4 CPUs and 8 GB of memory. // 30% of the hosts have 8 CPUs and 16 GB of memory. // 20% of the hosts have 16 CPUs and 32 GB of memory. Map<CloudStoreLoader.HostConfiguration, Double> hostConfigurations = ImmutableMap.of( new CloudStoreLoader.HostConfiguration(4, 8 * 1024), 0.5, new CloudStoreLoader.HostConfiguration(8, 16 * 1024), 0.3, new CloudStoreLoader.HostConfiguration(16, 32 * 1024), 0.2); // Each host has 4 datastores. IntegerDistribution datastoreDistribution = new UniformIntegerDistribution(4, 4); CloudStoreLoader.loadHosts(cloudStore, numHosts, hostConfigurations, numDatastores, datastoreDistribution); }
From source file:it.cnr.isti.smartfed.papers.qbrokage.DatacenterGenerator.java
public DatacenterGenerator() { costPerMem = new UniformRealDistribution(0.01, 0.10); costPerSto = new UniformRealDistribution(0.0002, 0.0020); costPerSec = new UniformRealDistribution(0.10, 0.80); //not used, see below costPerBw = new UniformRealDistribution(0.001, 0.05); ramAmount = new UniformIntegerDistribution(512, 1024 * 16); bwAmount = new UniformIntegerDistribution(10 * 1024, 10 * 1024 * 1024); stoAmount = new UniformIntegerDistribution(4096, 10 * 1024 * 1024); // 10TB max coreAmount = new UniformIntegerDistribution(1, 8); mipsAmount = new UniformIntegerDistribution(1000, 25000); }
From source file:it.cnr.isti.smartfed.papers.qbrokage.BrokageLockin.java
public DatacenterGeneratorCost() { costPerMem = new UniformRealDistribution(0.01, 0.10); costPerSto = new UniformRealDistribution(0.0002, 0.0020); costPerSec = new UniformRealDistribution(0.10, 0.80); //not used, see below costPerBw = new UniformRealDistribution(0.001, 0.05); ramAmount = new UniformIntegerDistribution(512, 1024 * 16); bwAmount = new UniformIntegerDistribution(10 * 1024, 10 * 1024 * 1024); stoAmount = new UniformIntegerDistribution(4096, 10 * 1024 * 1024); // 10TB max coreAmount = new UniformIntegerDistribution(1, 8); mipsAmount = new UniformIntegerDistribution(1000, 25000); this.seed = 1; }
From source file:com.wormsim.utils.Utils.java
/** * Returns the distribution associated with the specified string. See the * handbook for details of what is accepted. Or the code... * * @param str The string representing a distribution * * @return The distribution/* www . jav a2 s . co m*/ */ public static IntegerDistribution readIntegerDistribution(String str) { if (str.matches("[0-9]+(.[0-9]*)?")) { // I.E. a number return new EnumeratedIntegerDistribution(new int[] { Integer.valueOf(str) }); } else { int index = str.indexOf('('); String prefix = str.substring(0, index - 1).toLowerCase(Locale.ROOT); switch (prefix) { case "b": case "binom": case "binomial": { int comma_index = str.indexOf(',', index); return new BinomialDistribution(Integer.valueOf(str.substring(index, comma_index - 1)), Double.valueOf(str.substring(comma_index).trim())); } case "u": case "uni": case "uniform": { int comma_index = str.indexOf(',', index); return new UniformIntegerDistribution(Integer.valueOf(str.substring(index, comma_index - 1)), Integer.valueOf(str.substring(comma_index).trim())); } default: { throw new IllegalArgumentException( "Unrecognised distribution form, see handbook for details. " + "Provided \"" + str + "\"."); } } } }
From source file:fr.inria.atlanmod.instantiator.neoEMF.GenericMetamodelConfig.java
@Override public IntegerDistribution getResourceSizeDistribution() { IntegerDistribution distribution = distributions.get(metamodelResource); if (distribution == null) { distribution = new UniformIntegerDistribution(elementsRange.getMinimum(), elementsRange.getMaximum()); distribution.reseedRandomGenerator(random.nextLong()); distributions.put(metamodelResource, distribution); }/*w ww . jav a 2 s.co m*/ return distribution; }