本文整理汇总了Java中org.apache.commons.math3.optim.nonlinear.scalar.GoalType.MAXIMIZE属性的典型用法代码示例。如果您正苦于以下问题:Java GoalType.MAXIMIZE属性的具体用法?Java GoalType.MAXIMIZE怎么用?Java GoalType.MAXIMIZE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.optim.nonlinear.scalar.GoalType
的用法示例。
在下文中一共展示了GoalType.MAXIMIZE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTableauWithNoArtificialVars
@Test
public void testTableauWithNoArtificialVars() {
LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {15, 10}, 0);
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2));
constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3));
constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.LEQ, 4));
SimplexTableau tableau =
new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6);
double[][] initialTableau = {
{1, -15, -10, 25, 0, 0, 0, 0},
{0, 1, 0, -1, 1, 0, 0, 2},
{0, 0, 1, -1, 0, 1, 0, 3},
{0, 1, 1, -2, 0, 0, 1, 4}
};
assertMatrixEquals(initialTableau, tableau.getData());
}
示例2: optimize
private PointValuePair optimize(final MultivariateOptimizer optimizer, final double[] initialValues,
final OptimizationData... data) {
final OptimizationData[] d = new OptimizationData[5 + data.length];
d[0] = new MaxIter(convergence.maxIt + 1);
d[1] = new MaxEval(convergence.maxIt * 2);
d[2] = new ObjectiveFunction(this);
d[3] = GoalType.MAXIMIZE;
d[4] = new InitialGuess(fixBounds(initialValues));
for (int i = 0; i < data.length; ++i) {
d[5 + i] = data[i];
}
return optimizer.optimize(d);
}
示例3: testInitialization
@Test
public void testInitialization() {
LinearObjectiveFunction f = createFunction();
Collection<LinearConstraint> constraints = createConstraints();
SimplexTableau tableau =
new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6);
double[][] expectedInitialTableau = {
{-1, 0, -1, -1, 2, 0, 0, 0, -4},
{ 0, 1, -15, -10, 25, 0, 0, 0, 0},
{ 0, 0, 1, 0, -1, 1, 0, 0, 2},
{ 0, 0, 0, 1, -1, 0, 1, 0, 3},
{ 0, 0, 1, 1, -2, 0, 0, 1, 4}
};
assertMatrixEquals(expectedInitialTableau, tableau.getData());
}
示例4: testDropPhase1Objective
@Test
public void testDropPhase1Objective() {
LinearObjectiveFunction f = createFunction();
Collection<LinearConstraint> constraints = createConstraints();
SimplexTableau tableau =
new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6);
double[][] expectedTableau = {
{ 1, -15, -10, 0, 0, 0, 0},
{ 0, 1, 0, 1, 0, 0, 2},
{ 0, 0, 1, 0, 1, 0, 3},
{ 0, 1, 1, 0, 0, 1, 4}
};
tableau.dropPhase1Objective();
assertMatrixEquals(expectedTableau, tableau.getData());
}
示例5: testSerial
@Test
public void testSerial() {
LinearObjectiveFunction f = createFunction();
Collection<LinearConstraint> constraints = createConstraints();
SimplexTableau tableau =
new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6);
Assert.assertEquals(tableau, TestUtils.serializeAndRecover(tableau));
}