当前位置: 首页>>代码示例>>Java>>正文


Java GoalType.MAXIMIZE属性代码示例

本文整理汇总了Java中org.apache.commons.math3.optimization.GoalType.MAXIMIZE属性的典型用法代码示例。如果您正苦于以下问题:Java GoalType.MAXIMIZE属性的具体用法?Java GoalType.MAXIMIZE怎么用?Java GoalType.MAXIMIZE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.optimization.GoalType的用法示例。


在下文中一共展示了GoalType.MAXIMIZE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:17,代码来源:SimplexTableauTest.java

示例2: 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());
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:15,代码来源:SimplexTableauTest.java

示例3: 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());
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:15,代码来源:SimplexTableauTest.java

示例4: 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));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:8,代码来源:SimplexTableauTest.java


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