本文整理汇总了Java中org.apache.commons.math.optimization.direct.NelderMead.setStartConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java NelderMead.setStartConfiguration方法的具体用法?Java NelderMead.setStartConfiguration怎么用?Java NelderMead.setStartConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.optimization.direct.NelderMead
的用法示例。
在下文中一共展示了NelderMead.setStartConfiguration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRosenbrock
import org.apache.commons.math.optimization.direct.NelderMead; //导入方法依赖的package包/类
@Test
public void testRosenbrock()
throws FunctionEvaluationException, ConvergenceException {
Rosenbrock rosenbrock = new Rosenbrock();
NelderMead underlying = new NelderMead();
underlying.setStartConfiguration(new double[][] {
{ -1.2, 1.0 }, { 0.9, 1.2 } , { 3.5, -2.3 }
});
JDKRandomGenerator g = new JDKRandomGenerator();
g.setSeed(16069223052l);
RandomVectorGenerator generator =
new UncorrelatedRandomVectorGenerator(2, new GaussianRandomGenerator(g));
MultiStartMultivariateRealOptimizer optimizer =
new MultiStartMultivariateRealOptimizer(underlying, 10, generator);
optimizer.setConvergenceChecker(new SimpleScalarValueChecker(-1, 1.0e-3));
optimizer.setMaxIterations(100);
RealPointValuePair optimum =
optimizer.optimize(rosenbrock, GoalType.MINIMIZE, new double[] { -1.2, 1.0 });
assertEquals(rosenbrock.getCount(), optimizer.getEvaluations());
assertTrue(optimizer.getEvaluations() > 20);
assertTrue(optimizer.getEvaluations() < 250);
assertTrue(optimum.getValue() < 8.0e-4);
}