本文整理汇总了Java中org.apache.commons.math3.random.HaltonSequenceGenerator类的典型用法代码示例。如果您正苦于以下问题:Java HaltonSequenceGenerator类的具体用法?Java HaltonSequenceGenerator怎么用?Java HaltonSequenceGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HaltonSequenceGenerator类属于org.apache.commons.math3.random包,在下文中一共展示了HaltonSequenceGenerator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGenerator
import org.apache.commons.math3.random.HaltonSequenceGenerator; //导入依赖的package包/类
private static RandomVectorGenerator createGenerator(RandomVectorGenerator[] generator, int size)
{
// Create the generator
if (generator == null)
generator = new RandomVectorGenerator[1];
RandomVectorGenerator g = generator[0];
if (g == null || g.nextVector().length != size)
{
generator[0] = g = new HaltonSequenceGenerator(size);
}
return g;
}
示例2: UniformDistribution
import org.apache.commons.math3.random.HaltonSequenceGenerator; //导入依赖的package包/类
/**
* Create a new uniform distribution using a Halton sequence
*
* @param min
* The minimum bounds for the distribution
* @param max
* The maximum bounds for the distribution
* @param seed
* Start at the i-th point in the Halton sequence
*/
public UniformDistribution(double[] min, double[] max, int seed)
{
//HaltonSequenceGenerator randomVectorGenerator = new HaltonSequenceGenerator(3);
// The Halton sequence based on the prime of 2 does not provide great variety in the
// lesser significant digits when simulating a 512x512 pixel image. This is not suitable for
// PSF fitting since we require variation to at least 3 decimal places.
HaltonSequenceGenerator randomVectorGenerator = new HaltonSequenceGenerator(3, new int[] { 3, 5, 7 }, null);
randomVectorGenerator.skipTo(Math.abs(seed));
init(min, max, randomVectorGenerator);
}
示例3: score
import org.apache.commons.math3.random.HaltonSequenceGenerator; //导入依赖的package包/类
/**
* Score random samples from the search space and return the top fraction.
*
* @param <T>
* the type of comparable score
* @param dimensions
* the dimensions
* @param scoreFunction
* the score function
* @param samples
* the samples
* @param fraction
* the fraction
* @param generator
* the generator
* @return the score results
*/
private <T extends Comparable<T>> SearchResult<T>[] score(Dimension[] dimensions,
FullScoreFunction<T> scoreFunction, int samples, double fraction, HaltonSequenceGenerator[] generator)
{
searchSpace = sample(dimensions, samples, generator);
// Score
SearchResult<T>[] scores = scoreFunction.score(searchSpace);
// Get the top fraction
int size = (int) Math.ceil(scores.length * fraction);
return scoreFunction.cut(scores, size);
}