• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MaxEval类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.math3.optim.MaxEval的典型用法代码示例。如果您正苦于以下问题:Java MaxEval类的具体用法?Java MaxEval怎么用?Java MaxEval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MaxEval类属于org.apache.commons.math3.optim包,在下文中一共展示了MaxEval类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: applyToNetwork

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Override
public double applyToNetwork(final MixedClearingNetwork network) {
   Preconditions.checkNotNull(network);
   final int dimension = network.getNumberOfEdges();
   
   final ResidualCostFunction aggregateCostFunction =
      super.getResidualScalarCostFunction(network);
   final RealVector
      start = new ArrayRealVector(network.getNumberOfEdges());
   start.set(1.0);                                       // Initial rate guess.
   
   final BOBYQAOptimizer optimizer = new BOBYQAOptimizer(2*dimension + 1, 1.2, 1.e-8);
   final PointValuePair result = optimizer.optimize(
      new MaxEval(maximumEvaluations),
      new ObjectiveFunction(aggregateCostFunction),
      GoalType.MINIMIZE,
      new SimpleBounds(new double[dimension], ArrayUtil.ones(dimension)),
      new InitialGuess(start.toArray())
      );
   
   final double residualCost = result.getValue();
   System.out.println("Network cleared: residual cost: " + residualCost + ".");
   
   return residualCost;
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:26,代码来源:BoundedQuadraticEstimationClearingAlgorithm.java


示例2: optimizeUni

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
public double optimizeUni() throws Exception {
	double maxLh=0;
	
	BrentOptimizer optimizer = new BrentOptimizer(1e-6, 1e-12);
       UnivariatePointValuePair optimum =
               optimizer.optimize(new UnivariateObjectiveFunction(this),
                                  new MaxEval(100),
                                  GoalType.MAXIMIZE,
                                  new SearchInterval(pfBoundsLower[0],pfBoundsUpper[0])); 
	
	
	//double point = optimum.getPoint();
	//System.out.print("--> "+paramName+": "+paramValue+" point= "+point);		
	//System.out.print(" ");
	//System.out.println("value = "+ optimum.getValue());
	maxLh = optimum.getValue();	
	optPoint[0] = optimum.getPoint();
	return maxLh;
}
 
开发者ID:mrc-ide,项目名称:PhyDyn,代码行数:20,代码来源:PhyDynSlice.java


示例3: findOptimum

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Override
public TreeMap<Double, TariffSpecification> findOptimum(TariffUtilityEstimate tariffUtilityEstimate,
    int NUM_RATES, int numEval) {
  
  double[] startingVertex = new double[NUM_RATES]; // start from the fixed-rate tariff's offset
  Arrays.fill(startingVertex, 0.0);
  
  PowellOptimizer optimizer = new PowellOptimizer(1e-3, 5);
  
  // needed since one optimization found positive 
  // charges (paying customer to consume...)
  double[][] boundaries = createBoundaries(NUM_RATES);
 
  final PointValuePair optimum
      = optimizer.optimize(
          new MaxEval(numEval),
          //new ObjectiveFunction(new MultivariateFunctionMappingAdapter(tariffUtilityEstimate, boundaries[0], boundaries[1])),
          new ObjectiveFunction(new OptimizerWrapperApacheObjective(tariffUtilityEstimate)),
          GoalType.MAXIMIZE,
          new InitialGuess(startingVertex)
          );
          
  TreeMap<Double, TariffSpecification> eval2TOUTariff = new TreeMap<Double, TariffSpecification>();
  eval2TOUTariff.put(optimum.getValue(), tariffUtilityEstimate.getCorrespondingSpec(optimum.getKey()));
  return eval2TOUTariff;
}
 
开发者ID:LARG,项目名称:TacTex,代码行数:27,代码来源:OptimizerWrapperApachePowell.java


示例4: optimize

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
/**
 * Optimizes parameters using the Nelder-Mead Method
 * @param initialGuess initial guess / state required for Nelder-Mead-Method
 * @param costFunction which defines that the Mean Squared Error has to be minimized
 * @return the optimized values
 */
private static double[] optimize(double[] initialGuess, MultivariateFunctionMappingAdapter costFunction) {
    double[] result;

    SimplexOptimizer optimizer = new SimplexOptimizer(simplexRelativeThreshold, simplexAbsoluteThreshold);

    PointValuePair unBoundedResult = optimizer.optimize(
            GoalType.MINIMIZE,
            new MaxIter(MAX_ALLOWED_NUMBER_OF_ITERATION),
            new MaxEval(MAX_ALLOWED_NUMBER_OF_EVALUATION),
            new InitialGuess(initialGuess),
            new ObjectiveFunction(costFunction),
            new NelderMeadSimplex(initialGuess.length));

    result = costFunction.unboundedToBounded(unBoundedResult.getPoint());
    return result;
}
 
开发者ID:lidox,项目名称:reaction-test,代码行数:23,代码来源:NelderMeadOptimizer.java


示例5: optimize

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
/**
 * Optimizes the circuit to the given ys vector
 * 
 * @param ys
 *            complex scattering parameters to which the model is optimized
 */
public void optimize(Complex[] ys) {
	// shorten parameters to optimize
	shortParameters = MCUtil.shortenParam(circuitType, parameters);
	errorFunction = new MCErrorSum(ys, this);
	optimum = null;
	try {
		optimum = optimizer.optimize(new MaxEval(10000), new ObjectiveFunction(errorFunction), GoalType.MINIMIZE,
				new InitialGuess(shortParameters), new NelderMeadSimplex(optStep));
		parameters = MCUtil.topo2Param(circuitType, optimum.getPoint());
	} catch (TooManyEvaluationsException ex) {
		// This exception can be ignored. If max eval is reached, the recent
		// parameters are stored
		// and no null pointer can appear
		parameters = new double[] { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
	}
	// save new parameters
}
 
开发者ID:noah95,项目名称:ezrlc,代码行数:24,代码来源:MCEqCircuit.java


示例6: testSinMin

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testSinMin() {
    UnivariateFunction f = new Sin();
    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(f),
                       GoalType.MINIMIZE,
                       new SearchInterval(-100.0, 100.0));
    UnivariatePointValuePair[] optima = optimizer.getOptima();
    for (int i = 1; i < optima.length; ++i) {
        double d = (optima[i].getPoint() - optima[i-1].getPoint()) / (2 * FastMath.PI);
        Assert.assertTrue(FastMath.abs(d - FastMath.rint(d)) < 1.0e-8);
        Assert.assertEquals(-1.0, f.value(optima[i].getPoint()), 1.0e-10);
        Assert.assertEquals(f.value(optima[i].getPoint()), optima[i].getValue(), 1.0e-10);
    }
    Assert.assertTrue(optimizer.getEvaluations() > 200);
    Assert.assertTrue(optimizer.getEvaluations() < 300);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:22,代码来源:MultiStartUnivariateOptimizerTest.java


示例7: testQuinticMin

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testQuinticMin() {
    // The quintic function has zeros at 0, +-0.5 and +-1.
    // The function has extrema (first derivative is zero) at 0.27195613 and 0.82221643,
    UnivariateFunction f = new QuinticFunction();
    UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14);
    JDKRandomGenerator g = new JDKRandomGenerator();
    g.setSeed(4312000053L);
    MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 5, g);

    UnivariatePointValuePair optimum
        = optimizer.optimize(new MaxEval(300),
                             new UnivariateObjectiveFunction(f),
                             GoalType.MINIMIZE,
                             new SearchInterval(-0.3, -0.2));
    Assert.assertEquals(-0.27195613, optimum.getPoint(), 1e-9);
    Assert.assertEquals(-0.0443342695, optimum.getValue(), 1e-9);

    UnivariatePointValuePair[] optima = optimizer.getOptima();
    for (int i = 0; i < optima.length; ++i) {
        Assert.assertEquals(f.value(optima[i].getPoint()), optima[i].getValue(), 1e-9);
    }
    Assert.assertTrue(optimizer.getEvaluations() >= 50);
    Assert.assertTrue(optimizer.getEvaluations() <= 100);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:MultiStartUnivariateOptimizerTest.java


示例8: testSinMin

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testSinMin() {
    UnivariateFunction f = new Sin();
    UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
    Assert.assertEquals(3 * Math.PI / 2, optimizer.optimize(new MaxEval(200),
                                                            new UnivariateObjectiveFunction(f),
                                                            GoalType.MINIMIZE,
                                                            new SearchInterval(4, 5)).getPoint(), 1e-8);
    Assert.assertTrue(optimizer.getEvaluations() <= 50);
    Assert.assertEquals(200, optimizer.getMaxEvaluations());
    Assert.assertEquals(3 * Math.PI / 2, optimizer.optimize(new MaxEval(200),
                                                            new UnivariateObjectiveFunction(f),
                                                            GoalType.MINIMIZE,
                                                            new SearchInterval(1, 5)).getPoint(), 1e-8);
    Assert.assertTrue(optimizer.getEvaluations() <= 100);
    Assert.assertTrue(optimizer.getEvaluations() >= 15);
    try {
        optimizer.optimize(new MaxEval(10),
                           new UnivariateObjectiveFunction(f),
                           GoalType.MINIMIZE,
                           new SearchInterval(4, 5));
        Assert.fail("an exception should have been thrown");
    } catch (TooManyEvaluationsException fee) {
        // expected
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:27,代码来源:BrentOptimizerTest.java


示例9: testQuinticMin

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testQuinticMin() {
    // The function has local minima at -0.27195613 and 0.82221643.
    UnivariateFunction f = new QuinticFunction();
    UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
    Assert.assertEquals(-0.27195613, optimizer.optimize(new MaxEval(200),
                                                        new UnivariateObjectiveFunction(f),
                                                        GoalType.MINIMIZE,
                                                        new SearchInterval(-0.3, -0.2)).getPoint(), 1.0e-8);
    Assert.assertEquals( 0.82221643, optimizer.optimize(new MaxEval(200),
                                                        new UnivariateObjectiveFunction(f),
                                                        GoalType.MINIMIZE,
                                                        new SearchInterval(0.3,  0.9)).getPoint(), 1.0e-8);
    Assert.assertTrue(optimizer.getEvaluations() <= 50);

    // search in a large interval
    Assert.assertEquals(-0.27195613, optimizer.optimize(new MaxEval(200),
                                                        new UnivariateObjectiveFunction(f),
                                                        GoalType.MINIMIZE,
                                                        new SearchInterval(-1.0, 0.2)).getPoint(), 1.0e-8);
    Assert.assertTrue(optimizer.getEvaluations() <= 50);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:BrentOptimizerTest.java


示例10: testQuinticMax

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testQuinticMax() {
    // The quintic function has zeros at 0, +-0.5 and +-1.
    // The function has a local maximum at 0.27195613.
    UnivariateFunction f = new QuinticFunction();
    UnivariateOptimizer optimizer = new BrentOptimizer(1e-12, 1e-14);
    Assert.assertEquals(0.27195613, optimizer.optimize(new MaxEval(100),
                                                       new UnivariateObjectiveFunction(f),
                                                       GoalType.MAXIMIZE,
                                                       new SearchInterval(0.2, 0.3)).getPoint(), 1e-8);
    try {
        optimizer.optimize(new MaxEval(5),
                           new UnivariateObjectiveFunction(f),
                           GoalType.MAXIMIZE,
                           new SearchInterval(0.2, 0.3));
        Assert.fail("an exception should have been thrown");
    } catch (TooManyEvaluationsException miee) {
        // expected
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:21,代码来源:BrentOptimizerTest.java


示例11: testMinEndpoints

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testMinEndpoints() {
    UnivariateFunction f = new Sin();
    UnivariateOptimizer optimizer = new BrentOptimizer(1e-8, 1e-14);

    // endpoint is minimum
    double result = optimizer.optimize(new MaxEval(50),
                                       new UnivariateObjectiveFunction(f),
                                       GoalType.MINIMIZE,
                                       new SearchInterval(3 * Math.PI / 2, 5)).getPoint();
    Assert.assertEquals(3 * Math.PI / 2, result, 1e-6);

    result = optimizer.optimize(new MaxEval(50),
                                new UnivariateObjectiveFunction(f),
                                GoalType.MINIMIZE,
                                new SearchInterval(4, 3 * Math.PI / 2)).getPoint();
    Assert.assertEquals(3 * Math.PI / 2, result, 1e-6);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:BrentOptimizerTest.java


示例12: testMath832

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testMath832() {
    final UnivariateFunction f = new UnivariateFunction() {
            public double value(double x) {
                final double sqrtX = FastMath.sqrt(x);
                final double a = 1e2 * sqrtX;
                final double b = 1e6 / x;
                final double c = 1e4 / sqrtX;

                return a + b + c;
            }
        };

    UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-8);
    final double result = optimizer.optimize(new MaxEval(1483),
                                             new UnivariateObjectiveFunction(f),
                                             GoalType.MINIMIZE,
                                             new SearchInterval(Double.MIN_VALUE,
                                                                Double.MAX_VALUE)).getPoint();

    Assert.assertEquals(804.9355825, result, 1e-6);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:BrentOptimizerTest.java


示例13: testNoOptimum

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
/**
 * Test demonstrating that the user exception is finally thrown if none
 * of the runs succeed.
 */
@Test(expected=TestException.class)
public void testNoOptimum() {
    JacobianMultivariateVectorOptimizer underlyingOptimizer
        = new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-6, 1e-6));
    JDKRandomGenerator g = new JDKRandomGenerator();
    g.setSeed(12373523445l);
    RandomVectorGenerator generator
        = new UncorrelatedRandomVectorGenerator(1, new GaussianRandomGenerator(g));
    MultiStartMultivariateVectorOptimizer optimizer
        = new MultiStartMultivariateVectorOptimizer(underlyingOptimizer, 10, generator);
    optimizer.optimize(new MaxEval(100),
                       new Target(new double[] { 0 }),
                       new Weight(new double[] { 1 }),
                       new InitialGuess(new double[] { 0 }),
                       new ModelFunction(new MultivariateVectorFunction() {
                               public double[] value(double[] point) {
                                   throw new TestException();
                               }
                           }));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:25,代码来源:MultiStartMultivariateVectorOptimizerTest.java


示例14: testGetChiSquare

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testGetChiSquare() throws IOException {
    final StatisticalReferenceDataset dataset
        = StatisticalReferenceDatasetFactory.createKirby2();
    final AbstractLeastSquaresOptimizer optimizer = createOptimizer();
    final double[] a = dataset.getParameters();
    final double[] y = dataset.getData()[1];
    final double[] w = new double[y.length];
    Arrays.fill(w, 1.0);

    StatisticalReferenceDataset.LeastSquaresProblem problem
        = dataset.getLeastSquaresProblem();

    optimizer.optimize(new MaxEval(1),
                       problem.getModelFunction(),
                       problem.getModelFunctionJacobian(),
                       new Target(y),
                       new Weight(w),
                       new InitialGuess(a));
    final double expected = dataset.getResidualSumOfSquares();
    final double actual = optimizer.getChiSquare();
    Assert.assertEquals(dataset.getName(), expected, actual,
                        1E-11 * expected);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:25,代码来源:AbstractLeastSquaresOptimizerTest.java


示例15: testMaxEvaluations

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test(expected=TooManyEvaluationsException.class)
public void testMaxEvaluations() throws Exception {
    CircleVectorial circle = new CircleVectorial();
    circle.addPoint( 30.0,  68.0);
    circle.addPoint( 50.0,  -6.0);
    circle.addPoint(110.0, -20.0);
    circle.addPoint( 35.0,  15.0);
    circle.addPoint( 45.0,  97.0);

    GaussNewtonOptimizer optimizer
        = new GaussNewtonOptimizer(new SimpleVectorValueChecker(1e-30, 1e-30));

    optimizer.optimize(new MaxEval(100),
                       circle.getModelFunction(),
                       circle.getModelFunctionJacobian(),
                       new Target(new double[] { 0, 0, 0, 0, 0 }),
                       new Weight(new double[] { 1, 1, 1, 1, 1 }),
                       new InitialGuess(new double[] { 98.680, 47.345 }));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:20,代码来源:GaussNewtonOptimizerTest.java


示例16: testNonInvertible

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Override
@Test(expected=SingularMatrixException.class)
public void testNonInvertible() {
    /*
     * Overrides the method from parent class, since the default singularity
     * threshold (1e-14) does not trigger the expected exception.
     */
    LinearProblem problem = new LinearProblem(new double[][] {
            {  1, 2, -3 },
            {  2, 1,  3 },
            { -3, 0, -9 }
    }, new double[] { 1, 1, 1 });

    AbstractLeastSquaresOptimizer optimizer = createOptimizer();
    PointVectorValuePair optimum
        = optimizer.optimize(new MaxEval(100),
                             problem.getModelFunction(),
                             problem.getModelFunctionJacobian(),
                             problem.getTarget(),
                             new Weight(new double[] { 1, 1, 1 }),
                             new InitialGuess(new double[] { 0, 0, 0 }));
    Assert.assertTrue(FastMath.sqrt(optimizer.getTargetSize()) * optimizer.getRMS() > 0.6);

    optimizer.computeCovariances(optimum.getPoint(), 1.5e-14);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:LevenbergMarquardtOptimizerTest.java


示例17: testTrivial

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testTrivial() {
    LinearProblem problem
        = new LinearProblem(new double[][] { { 2 } }, new double[] { 3 });
    AbstractLeastSquaresOptimizer optimizer = createOptimizer();
    PointVectorValuePair optimum =
        optimizer.optimize(new MaxEval(100),
                           problem.getModelFunction(),
                           problem.getModelFunctionJacobian(),
                           problem.getTarget(),
                           new Weight(new double[] { 1 }),
                           new InitialGuess(new double[] { 0 }));
    Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
    Assert.assertEquals(1.5, optimum.getPoint()[0], 1e-10);
    Assert.assertEquals(3.0, optimum.getValue()[0], 1e-10);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:17,代码来源:AbstractLeastSquaresOptimizerAbstractTest.java


示例18: testQRColumnsPermutation

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testQRColumnsPermutation() {

    LinearProblem problem
        = new LinearProblem(new double[][] { { 1, -1 }, { 0, 2 }, { 1, -2 } },
                            new double[] { 4, 6, 1 });

    AbstractLeastSquaresOptimizer optimizer = createOptimizer();
    PointVectorValuePair optimum =
        optimizer.optimize(new MaxEval(100),
                           problem.getModelFunction(),
                           problem.getModelFunctionJacobian(),
                           problem.getTarget(),
                           new Weight(new double[] { 1, 1, 1 }),
                           new InitialGuess(new double[] { 0, 0 }));
    Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
    Assert.assertEquals(7, optimum.getPoint()[0], 1e-10);
    Assert.assertEquals(3, optimum.getPoint()[1], 1e-10);
    Assert.assertEquals(4, optimum.getValue()[0], 1e-10);
    Assert.assertEquals(6, optimum.getValue()[1], 1e-10);
    Assert.assertEquals(1, optimum.getValue()[2], 1e-10);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:AbstractLeastSquaresOptimizerAbstractTest.java


示例19: testNoDependency

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testNoDependency() {
    LinearProblem problem = new LinearProblem(new double[][] {
            { 2, 0, 0, 0, 0, 0 },
            { 0, 2, 0, 0, 0, 0 },
            { 0, 0, 2, 0, 0, 0 },
            { 0, 0, 0, 2, 0, 0 },
            { 0, 0, 0, 0, 2, 0 },
            { 0, 0, 0, 0, 0, 2 }
    }, new double[] { 0, 1.1, 2.2, 3.3, 4.4, 5.5 });
    AbstractLeastSquaresOptimizer optimizer = createOptimizer();
    PointVectorValuePair optimum =
        optimizer.optimize(new MaxEval(100),
                           problem.getModelFunction(),
                           problem.getModelFunctionJacobian(),
                           problem.getTarget(),
                           new Weight(new double[] { 1, 1, 1, 1, 1, 1 }),
                           new InitialGuess(new double[] { 0, 0, 0, 0, 0, 0 }));
    Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
    for (int i = 0; i < problem.target.length; ++i) {
        Assert.assertEquals(0.55 * i, optimum.getPoint()[i], 1e-10);
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:24,代码来源:AbstractLeastSquaresOptimizerAbstractTest.java


示例20: testOneSet

import org.apache.commons.math3.optim.MaxEval; //导入依赖的package包/类
@Test
public void testOneSet() {

    LinearProblem problem = new LinearProblem(new double[][] {
            {  1,  0, 0 },
            { -1,  1, 0 },
            {  0, -1, 1 }
    }, new double[] { 1, 1, 1});
    AbstractLeastSquaresOptimizer optimizer = createOptimizer();
    PointVectorValuePair optimum =
        optimizer.optimize(new MaxEval(100),
                           problem.getModelFunction(),
                           problem.getModelFunctionJacobian(),
                           problem.getTarget(),
                           new Weight(new double[] { 1, 1, 1 }),
                           new InitialGuess(new double[] { 0, 0, 0 }));
    Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
    Assert.assertEquals(1, optimum.getPoint()[0], 1e-10);
    Assert.assertEquals(2, optimum.getPoint()[1], 1e-10);
    Assert.assertEquals(3, optimum.getPoint()[2], 1e-10);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:22,代码来源:AbstractLeastSquaresOptimizerAbstractTest.java



注:本文中的org.apache.commons.math3.optim.MaxEval类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Calendars类代码示例发布时间:2022-05-21
下一篇:
Java AxisCameraException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap