Package org.apache.commons.math.optimization.direct

Examples of org.apache.commons.math.optimization.direct.NelderMead


    MultivariateRealClosure g = new MultivariateRealClosure(context, rho, fn) ;

    if(method.equals("Nelder-Mead")) {

      NelderMead optimizer = new NelderMead();
      try {
        RealPointValuePair res = optimizer.optimize(g, GoalType.MINIMIZE, par.toDoubleArray());
        ListVector.Builder result = new ListVector.Builder();
        result.add(new DoubleArrayVector(res.getPoint()));
        result.add(new DoubleArrayVector(res.getValue()));
        result.add(new IntArrayVector(IntVector.NA, IntVector.NA));
        result.add(new IntArrayVector(0));
View Full Code Here


  @Test
  public void testRosenbrock() throws Exception {

    Rosenbrock rosenbrock = new Rosenbrock();
    NelderMead underlying = new NelderMead();
    underlying.setStartConfiguration(new double[][] {
                                         { -1.21.0 }, { 0.9, 1.2 } , 3.5, -2.3 }
                                     });
    JDKRandomGenerator g = new JDKRandomGenerator();
    g.setSeed(16069223052l);
    RandomVectorGenerator generator =
View Full Code Here

  @Test
  public void testRosenbrock()
    throws FunctionEvaluationException, ConvergenceException {

    Rosenbrock rosenbrock = new Rosenbrock();
    NelderMead underlying = new NelderMead();
    underlying.setStartConfiguration(new double[][] {
                                         { -1.21.0 }, { 0.9, 1.2 } , 3.5, -2.3 }
                                     });
    JDKRandomGenerator g = new JDKRandomGenerator();
    g.setSeed(16069223052l);
    RandomVectorGenerator generator =
View Full Code Here

   */
  @Override
  public DoubleMatrix1D minimize(final Function1D<DoubleMatrix1D, Double> function, final DoubleMatrix1D startPosition) {
    Validate.notNull(function, "function");
    Validate.notNull(startPosition, "start position");
    final MultivariateRealOptimizer optimizer = new NelderMead();
    final MultivariateRealFunction commonsFunction = CommonsMathWrapper.wrapMultivariate(function);
    try {
      return new DoubleMatrix1D(CommonsMathWrapper.unwrap(optimizer.optimize(commonsFunction, MINIMIZER, startPosition.getData())));
    } catch (final ConvergenceException e) {
      throw new MathException(e);
    } catch (final FunctionEvaluationException e) {
      throw new MathException(e);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.math.optimization.direct.NelderMead

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.