本文整理汇总了Java中org.apache.commons.math.analysis.MultivariateRealFunction.value方法的典型用法代码示例。如果您正苦于以下问题:Java MultivariateRealFunction.value方法的具体用法?Java MultivariateRealFunction.value怎么用?Java MultivariateRealFunction.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.analysis.MultivariateRealFunction
的用法示例。
在下文中一共展示了MultivariateRealFunction.value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.apache.commons.math.analysis.MultivariateRealFunction; //导入方法依赖的package包/类
/**
* Evaluate all the non-evaluated points of the simplex.
*
* @param evaluationFunction Evaluation function.
* @param comparator Comparator to use to sort simplex vertices from best to worst.
* @throws org.apache.commons.math.exception.TooManyEvaluationsException
* if the maximal number of evaluations is exceeded.
* @throws MathUserException if evaluation function throws one
*/
public void evaluate(final MultivariateRealFunction evaluationFunction,
final Comparator<RealPointValuePair> comparator)
throws MathUserException {
// Evaluate the objective function at all non-evaluated simplex points.
for (int i = 0; i < simplex.length; i++) {
final RealPointValuePair vertex = simplex[i];
final double[] point = vertex.getPointRef();
if (Double.isNaN(vertex.getValue())) {
simplex[i] = new RealPointValuePair(point, evaluationFunction.value(point), false);
}
}
// Sort the simplex from best to worst.
Arrays.sort(simplex, comparator);
}