MultiStartUnivariateOptimizer extends UnivariateOptimizer { @Override public UnivariatePointValuePair optimize(OptimizationData... optData) { optimData = optData; return super.optimize(optData); } MultiStartUnivariateOptimizer(final UnivariateOptimizer optimizer,
                                         final int starts,
                                         final RandomGenerator generator); @Override int getEvaluations(); UnivariatePointValuePair[] getOptima(); @Override UnivariatePointValuePair optimize(OptimizationData... optData);  }
@Test(expected=MathIllegalStateException.class) public void testMissingMaxEval() { UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); JDKRandomGenerator g = new JDKRandomGenerator(); g.setSeed(44428400075l); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 10, g); optimizer.optimize(new UnivariateObjectiveFunction(new Sin()), GoalType.MINIMIZE, new SearchInterval(-1, 1)); }
@Test(expected=MathIllegalStateException.class) public void testMissingSearchInterval() { UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); JDKRandomGenerator g = new JDKRandomGenerator(); g.setSeed(44428400075l); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 10, g); optimizer.optimize(new MaxEval(300), new UnivariateObjectiveFunction(new Sin()), GoalType.MINIMIZE); }