当前位置: 首页>>代码示例>>Java>>正文


Java ExponentialDistribution类代码示例

本文整理汇总了Java中org.apache.commons.math3.distribution.ExponentialDistribution的典型用法代码示例。如果您正苦于以下问题:Java ExponentialDistribution类的具体用法?Java ExponentialDistribution怎么用?Java ExponentialDistribution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExponentialDistribution类属于org.apache.commons.math3.distribution包,在下文中一共展示了ExponentialDistribution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateVMsRandom

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
public void generateVMsRandom(int totalVmNum) {
	int vmCount = 0;
	double lastStartTime = 0;
	
	double startMean = 1800; // sec = 30min
	double durScale=14400; // sec = 4 hours
	double durShape=1.2;
	
	Random rVmNum = new Random(seed);
	ExponentialDistribution rStartTime = new ExponentialDistribution(new Well19937c(seed), startMean, ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);	
	ParetoDistribution rDuration = new ParetoDistribution(new Well19937c(seed), durScale, durShape);
	
	while(vmCount < totalVmNum) {
		int vmsInGroup = rVmNum.nextInt(4)+2;
		double duration = Math.floor(rDuration.sample());
		
		vmGenerator.generateVMGroup(vmsInGroup, lastStartTime, lastStartTime+duration, null);
		lastStartTime += Math.floor(rStartTime.sample());
		
		vmCount += vmsInGroup;
		
	}
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:24,代码来源:VMRequestRandomGenerator.java

示例2: generateVMs

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
public List<VMSpec> generateVMs(int totalVmNum) {
	double lastStartTime = 0;
	
	double startMean = 1800; // sec = 30min
	double durScale=14400; // sec = 4 hours
	double durShape=1.2;
	
	Random rVmNum = new Random(seed);
	ExponentialDistribution rStartTime = new ExponentialDistribution(new Well19937c(seed), startMean, ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);	
	ParetoDistribution rDuration = new ParetoDistribution(new Well19937c(seed), durScale, durShape);
	
	List<VMSpec> vms = new ArrayList<VMSpec>();

	while(this.vmId < totalVmNum) {
		int vmsInGroup = rVmNum.nextInt(4)+2;
		double duration = Math.floor(rDuration.sample());
		
		vms.addAll(generateVMGroup(vmsInGroup, lastStartTime, lastStartTime+duration));
		lastStartTime += Math.floor(rStartTime.sample());
	}
	
	return vms;
}
 
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:24,代码来源:VMRequestGenerator.java

示例3: getFactory

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
@Override
public DistributionFactory getFactory(List<String> params)
{
    if (params.size() != 1)
        throw new IllegalArgumentException("Invalid parameter list for gaussian distribution: " + params);
    try
    {
        String[] bounds = params.get(0).split("\\.\\.+");
        final long min = parseLong(bounds[0]);
        final long max = parseLong(bounds[1]);
        if (min == max)
            return new FixedFactory(min);
        ExponentialDistribution findBounds = new ExponentialDistribution(1d);
        // max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
        // over entire range, but this results in overly skewed distribution, so take sqrt
        final double mean = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
        return new ExpFactory(min, max, mean);
    } catch (Exception ignore)
    {
        throw new IllegalArgumentException("Invalid parameter list for uniform distribution: " + params);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:OptionDistribution.java

示例4: generateVMsRandom

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
public void generateVMsRandom(int totalVmNum) {
	int vmCount = 0;
	double lastStartTime = 0;
	
	double startMean = 1800; // sec = 30min
	double durScale=14400; // sec = 4 hours
	double durShape=1.2;
	
	Random rVmNum = new Random(seed);
	ExponentialDistribution rStartTime = new ExponentialDistribution(new Well19937c(seed), startMean, ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);	
	ParetoDistribution rDuration = new ParetoDistribution(new Well19937c(seed), durScale, durShape);
	
	int vmGroup=0;
	while(vmCount < totalVmNum) {
		int vmsInGroup = rVmNum.nextInt(4)+2;
		double duration = Math.floor(rDuration.sample());
		
		vmGenerator.generateVMGroup(vmsInGroup, lastStartTime, lastStartTime+duration, null, vmGroup, -1);
		lastStartTime += Math.floor(rStartTime.sample());
		
		vmCount += vmsInGroup;
		vmGroup++;			
	}
}
 
开发者ID:jayjmin,项目名称:cloudsimsdn,代码行数:25,代码来源:VMRequestRandomGenerator.java

示例5: getExponential

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
@Override
public RandomNumberDistribution<Double> getExponential(
		final RandomNumberStream rng, final Number mean)
{
	final RealDistribution dist = new ExponentialDistribution(
			RandomNumberStream.Util.asCommonsRandomGenerator(rng),
			mean.doubleValue());
	return new RandomNumberDistribution<Double>()
	{
		@Override
		public Double draw()
		{
			return dist.sample();
		}
	};
}
 
开发者ID:krevelen,项目名称:coala,代码行数:17,代码来源:RandomDistributionFactoryImpl.java

示例6: getFactory

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
@Override
public DistributionFactory getFactory(List<String> params)
{
    if (params.size() != 1)
        throw new IllegalArgumentException("Invalid parameter list for gaussian distribution: " + params);
    try
    {
        String[] bounds = params.get(0).split("\\.\\.+");
        final long min = parseLong(bounds[0]);
        final long max = parseLong(bounds[1]);
        ExponentialDistribution findBounds = new ExponentialDistribution(1d);
        // max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
        // over entire range, but this results in overly skewed distribution, so take sqrt
        final double mean = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
        return new ExpFactory(min, max, mean);
    } catch (Exception e)
    {
        throw new IllegalArgumentException("Invalid parameter list for uniform distribution: " + params);
    }
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:21,代码来源:OptionDistribution.java

示例7: computeSCMOSWeights

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
private static void computeSCMOSWeights(double[] weights, double[] noise)
{
	// Per observation read noise.
	weights = new double[size * size];
	RandomGenerator randomGenerator = new Well19937c(42);
	ExponentialDistribution ed = new ExponentialDistribution(randomGenerator, variance,
			ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
	for (int i = 0; i < weights.length; i++)
	{
		double pixelVariance = ed.sample();
		double pixelGain = Math.max(0.1, gain + randomGenerator.nextGaussian() * gainSD);
		// weights = var / g^2
		weights[i] = pixelVariance / (pixelGain * pixelGain);
	}
	// Convert to standard deviation for simulation
	noise = new double[weights.length];
	for (int i = 0; i < weights.length; i++)
		noise[i] = Math.sqrt(weights[i]);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:20,代码来源:BaseFunctionSolverTest.java

示例8: SCMOSLikelihoodWrapperTest

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
public SCMOSLikelihoodWrapperTest()
{
	int n = maxx * maxx;
	var = new float[n];
	g = new float[n];
	o = new float[n];
	sd = new float[n];
	RandomGenerator rg = new Well19937c(30051977);
	PoissonDistribution pd = new PoissonDistribution(rg, O, PoissonDistribution.DEFAULT_EPSILON,
			PoissonDistribution.DEFAULT_MAX_ITERATIONS);
	ExponentialDistribution ed = new ExponentialDistribution(rg, VAR,
			ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
	for (int i = 0; i < n; i++)
	{
		o[i] = (float) pd.sample();
		var[i] = (float) ed.sample();
		sd[i] = (float) Math.sqrt(var[i]);
		g[i] = (float) (G + rg.nextGaussian() * G_SD);
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:21,代码来源:SCMOSLikelihoodWrapperTest.java

示例9: getFactory

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
@Override
public DistributionFactory getFactory(List<String> params)
{
    if (params.size() != 1)
        throw new IllegalArgumentException("Invalid parameter list for gaussian distribution: " + params);
    try
    {
        String[] bounds = params.get(0).split("\\.\\.+");
        final long min = Long.parseLong(bounds[0]);
        final long max = Long.parseLong(bounds[1]);
        ExponentialDistribution findBounds = new ExponentialDistribution(1d);
        // max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
        // over entire range, but this results in overly skewed distribution, so take sqrt
        final double mean = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
        return new ExpFactory(min, max, mean);
    } catch (Exception _)
    {
        throw new IllegalArgumentException("Invalid parameter list for uniform distribution: " + params);
    }
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:21,代码来源:OptionDistribution.java

示例10: IATGen

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param distribution Distribution as String
 * @param para1 Parameter 1
 * @param para2 Parameter 2 (only needed when applicable)
 */
public IATGen(String distribution, double para1, double para2) {

    logger.trace("Distribution selected: {} with Parameters {} & {}", distribution, para1, para2);

    switch (distribution) {
        case "ChiSquared":
            this.distri = new ChiSquaredDistribution(para1);
            break;
        case "Exponential":
            this.distri = new ExponentialDistribution(para1);
            break;
        case "Gamma":
            this.distri = new GammaDistribution(para1, para2);
            break;
        case "Poisson":
            this.intDistri = new PoissonDistribution(para1, para2);
            break;
        default:
            this.distri = new NormalDistribution(para1, para2);
            break;
    }
}
 
开发者ID:lsinfo3,项目名称:ofcprobe,代码行数:30,代码来源:IATGen.java

示例11: EdgeTask

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
public EdgeTask(int _mobileDeviceId, APP_TYPES _taskType, double _startTime, ExponentialDistribution[][] expRngList) {
   	mobileDeviceId=_mobileDeviceId;
   	startTime=_startTime;
   	taskType=_taskType;
   	
   	inputFileSize = (long)expRngList[_taskType.ordinal()][0].sample();
   	outputFileSize =(long)expRngList[_taskType.ordinal()][1].sample();
   	length = (long)expRngList[_taskType.ordinal()][2].sample();
   	
   	pesNumber = (int)SimSettings.getInstance().getTaskLookUpTable()[_taskType.ordinal()][8];
}
 
开发者ID:CagataySonmez,项目名称:EdgeCloudSim,代码行数:12,代码来源:EdgeTask.java

示例12: setUp

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
@Setup
public void setUp() {
    exponentialDistribution = new ExponentialDistribution(
            new ThreadLocalRandomGenerator(),
            1.0,
            ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}
 
开发者ID:komiya-atsushi,项目名称:fast-rng-java,代码行数:8,代码来源:ExponentialBenchmark.java

示例13: testGoodnessOfFitByTwoLevelTesting

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
private void testGoodnessOfFitByTwoLevelTesting(final ExponentialRNG exponentialRNG, final double theta) {
    TwoLevelTester tester = new TwoLevelTester(N, K);
    TwoLevelTester.RealRng rng = new TwoLevelTester.RealRng() {
        @Override
        public double generate(Random random) {
            return exponentialRNG.generate(random, theta);
        }
    };
    ExponentialDistribution distribution = new ExponentialDistribution(theta);
    tester.test(rng, distribution);
}
 
开发者ID:komiya-atsushi,项目名称:fast-rng-java,代码行数:12,代码来源:ExponentialRNGTest.java

示例14: SliceSampler

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
/**
 * Creates a new sampler, given a random number generator, a continuous, univariate, unimodal, unnormalized
 * log probability density function, hard limits on the random variable, and a step width.
 * @param rng      random number generator
 * @param logPDF   continuous, univariate, unimodal log probability density function (up to additive constant)
 * @param xMin     minimum allowed value of the random variable
 * @param xMax     maximum allowed value of the random variable
 * @param width    step width for slice expansion
 */
public SliceSampler(final RandomGenerator rng, final Function<Double, Double> logPDF,
                    final double xMin, final double xMax, final double width) {
    Utils.nonNull(rng);
    Utils.nonNull(logPDF);
    Utils.validateArg(xMin < xMax, "Maximum bound must be greater than minimum bound.");
    ParamUtils.isPositive(width, "Slice-sampling width must be positive.");
    this.rng = rng;
    this.logPDF = logPDF;
    this.xMin = xMin;
    this.xMax = xMax;
    this.width = width;
    exponentialDistribution = new ExponentialDistribution(rng, 1.);
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:23,代码来源:SliceSampler.java

示例15: filter1IsSameAsFilter2

import org.apache.commons.math3.distribution.ExponentialDistribution; //导入依赖的package包/类
private void filter1IsSameAsFilter2(GFilter f1, GFilter f2, boolean weighted, double tolerance)
{
	Random rand = new Random(-30051976);
	float[] data = createData(rand, size, size);
	float[] w = null;
	if (weighted)
	{
		ExponentialDistribution ed = new ExponentialDistribution(rand, 57,
				ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);

		w = new float[data.length];
		for (int i = 0; i < w.length; i++)
		{
			w[i] = (float) (1.0 / Math.max(0.01, ed.sample()));
			//w[i] = (float) (1.0 / Math.max(0.01, rand.nextGaussian() * 0.2 + 2));
			//w[i] = 0.5f;
		}
		f1.setWeights(w);
		f2.setWeights(w);
	}

	for (double sigma : sigmas)
	{
		float[] e = data.clone();
		f2.run(e, sigma);
		float[] o = data.clone();
		f1.run(o, sigma);

		double max = 0;
		for (int i = 0; i < e.length; i++)
		{
			double d = DoubleEquality.relativeError(e[i], o[i]);
			if (max < d)
				max = d;
		}

		System.out.printf("%s vs %s w=%b @ %.1f = %g\n", f1.getName(), f2.getName(), weighted, sigma, max);
		Assert.assertTrue(max < tolerance);
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:41,代码来源:GaussianFilterTest.java


注:本文中的org.apache.commons.math3.distribution.ExponentialDistribution类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。