本文整理汇总了Java中org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex类的典型用法代码示例。如果您正苦于以下问题:Java AbstractSimplex类的具体用法?Java AbstractSimplex怎么用?Java AbstractSimplex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractSimplex类属于org.apache.commons.math3.optim.nonlinear.scalar.noderiv包,在下文中一共展示了AbstractSimplex类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStartSimplexInsideRange
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testStartSimplexInsideRange() {
final BiQuadratic biQuadratic = new BiQuadratic(2.0, 2.5, 1.0, 3.0, 2.0, 3.0);
final MultivariateFunctionMappingAdapter wrapped
= new MultivariateFunctionMappingAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper());
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[][] {
wrapped.boundedToUnbounded(new double[] { 1.5, 2.75 }),
wrapped.boundedToUnbounded(new double[] { 1.5, 2.95 }),
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
});
final PointValuePair optimum
= optimizer.optimize(new MaxEval(300),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 })));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), bounded[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), bounded[1], 2e-7);
}
示例2: testOptimumOutsideRange
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testOptimumOutsideRange() {
final BiQuadratic biQuadratic = new BiQuadratic(4.0, 0.0, 1.0, 3.0, 2.0, 3.0);
final MultivariateFunctionMappingAdapter wrapped
= new MultivariateFunctionMappingAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper());
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[][] {
wrapped.boundedToUnbounded(new double[] { 1.5, 2.75 }),
wrapped.boundedToUnbounded(new double[] { 1.5, 2.95 }),
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
});
final PointValuePair optimum
= optimizer.optimize(new MaxEval(100),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 })));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), bounded[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), bounded[1], 2e-7);
}
示例3: testStartSimplexInsideRange
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testStartSimplexInsideRange() {
final BiQuadratic biQuadratic = new BiQuadratic(2.0, 2.5, 1.0, 3.0, 2.0, 3.0);
final MultivariateFunctionPenaltyAdapter wrapped
= new MultivariateFunctionPenaltyAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper(),
1000.0, new double[] { 100.0, 100.0 });
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[] { 1.0, 0.5 });
final PointValuePair optimum
= optimizer.optimize(new MaxEval(300),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(new double[] { 1.5, 2.25 }));
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), optimum.getPoint()[1], 2e-7);
}
示例4: testStartSimplexOutsideRange
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testStartSimplexOutsideRange() {
final BiQuadratic biQuadratic = new BiQuadratic(2.0, 2.5, 1.0, 3.0, 2.0, 3.0);
final MultivariateFunctionPenaltyAdapter wrapped
= new MultivariateFunctionPenaltyAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper(),
1000.0, new double[] { 100.0, 100.0 });
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[] { 1.0, 0.5 });
final PointValuePair optimum
= optimizer.optimize(new MaxEval(300),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(new double[] { -1.5, 4.0 }));
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), optimum.getPoint()[1], 2e-7);
}
示例5: testOptimumOutsideRange
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testOptimumOutsideRange() {
final BiQuadratic biQuadratic = new BiQuadratic(4.0, 0.0, 1.0, 3.0, 2.0, 3.0);
final MultivariateFunctionPenaltyAdapter wrapped
= new MultivariateFunctionPenaltyAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper(),
1000.0, new double[] { 100.0, 100.0 });
SimplexOptimizer optimizer = new SimplexOptimizer(new SimplePointChecker<PointValuePair>(1.0e-11, 1.0e-20));
final AbstractSimplex simplex = new NelderMeadSimplex(new double[] { 1.0, 0.5 });
final PointValuePair optimum
= optimizer.optimize(new MaxEval(600),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(new double[] { -1.5, 4.0 }));
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), optimum.getPoint()[1], 2e-7);
}
示例6: testUnbounded
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testUnbounded() {
final BiQuadratic biQuadratic = new BiQuadratic(4.0, 0.0,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
final MultivariateFunctionPenaltyAdapter wrapped
= new MultivariateFunctionPenaltyAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper(),
1000.0, new double[] { 100.0, 100.0 });
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[] { 1.0, 0.5 });
final PointValuePair optimum
= optimizer.optimize(new MaxEval(300),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(new double[] { -1.5, 4.0 }));
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), optimum.getPoint()[1], 2e-7);
}
示例7: testHalfBounded
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testHalfBounded() {
final BiQuadratic biQuadratic = new BiQuadratic(4.0, 4.0,
1.0, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, 3.0);
final MultivariateFunctionPenaltyAdapter wrapped
= new MultivariateFunctionPenaltyAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper(),
1000.0, new double[] { 100.0, 100.0 });
SimplexOptimizer optimizer = new SimplexOptimizer(new SimplePointChecker<PointValuePair>(1.0e-10, 1.0e-20));
final AbstractSimplex simplex = new NelderMeadSimplex(new double[] { 1.0, 0.5 });
final PointValuePair optimum
= optimizer.optimize(new MaxEval(400),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(new double[] { -1.5, 4.0 }));
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), optimum.getPoint()[1], 2e-7);
}
示例8: testUnbounded
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testUnbounded() {
final BiQuadratic biQuadratic = new BiQuadratic(4.0, 0.0,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
final MultivariateFunctionMappingAdapter wrapped
= new MultivariateFunctionMappingAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper());
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[][] {
wrapped.boundedToUnbounded(new double[] { 1.5, 2.75 }),
wrapped.boundedToUnbounded(new double[] { 1.5, 2.95 }),
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
});
final PointValuePair optimum
= optimizer.optimize(new MaxEval(300),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 })));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), bounded[0], 2e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), bounded[1], 2e-7);
}
示例9: testHalfBounded
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex; //导入依赖的package包/类
@Test
public void testHalfBounded() {
final BiQuadratic biQuadratic = new BiQuadratic(4.0, 4.0,
1.0, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, 3.0);
final MultivariateFunctionMappingAdapter wrapped
= new MultivariateFunctionMappingAdapter(biQuadratic,
biQuadratic.getLower(),
biQuadratic.getUpper());
SimplexOptimizer optimizer = new SimplexOptimizer(1e-13, 1e-30);
final AbstractSimplex simplex = new NelderMeadSimplex(new double[][] {
wrapped.boundedToUnbounded(new double[] { 1.5, 2.75 }),
wrapped.boundedToUnbounded(new double[] { 1.5, 2.95 }),
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
});
final PointValuePair optimum
= optimizer.optimize(new MaxEval(200),
new ObjectiveFunction(wrapped),
simplex,
GoalType.MINIMIZE,
new InitialGuess(wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 })));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), bounded[0], 1e-7);
Assert.assertEquals(biQuadratic.getBoundedYOptimum(), bounded[1], 1e-7);
}