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


Java TestUtils.assertFalse方法代码示例

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


在下文中一共展示了TestUtils.assertFalse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testInfeasibleCase

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
/**
 * Just make sure an obviously infeasible problem is recognised as such - this has been a problem in the
 * past
 */
public void testInfeasibleCase() {

    final Variable[] tmpVariables = new Variable[] { new Variable("X1").lower(ONE).upper(TWO).weight(ONE),
            new Variable("X2").lower(ONE).upper(TWO).weight(TWO), new Variable("X3").lower(ONE).upper(TWO).weight(THREE) };

    final ExpressionsBasedModel tmpModel = new ExpressionsBasedModel(tmpVariables);

    final Expression tmpExprQ = tmpModel.addExpression("Q1");
    for (int i = 0; i < tmpModel.countVariables(); i++) {
        for (int j = 0; j < tmpModel.countVariables(); j++) {
            tmpExprQ.set(i, i, Math.random());
        }
    } // May not be positive definite, but infeasibillity should be realised before that becomes a problem
    tmpExprQ.weight(TEN);

    // tmpModel.options.debug(ConvexSolver.class);

    final Expression tmpExprC1 = tmpModel.addExpression("C1");
    for (int i = 0; i < tmpModel.countVariables(); i++) {
        tmpExprC1.set(i, ONE);
    }
    tmpExprC1.upper(TWO);

    Optimisation.Result tmpResult = tmpModel.maximise();

    TestUtils.assertFalse(tmpResult.getState().isFeasible());

    tmpExprC1.upper(null);
    tmpExprC1.lower(SEVEN);

    tmpResult = tmpModel.maximise();

    TestUtils.assertFalse(tmpResult.getState().isFeasible());

    OptimisationConvexTests.assertDirectAndIterativeEquals(tmpModel, null);
}
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:41,代码来源:ConvexProblems.java

示例2: testUnboundedCase

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
public void testUnboundedCase() {

        final Variable[] tmpVariables = new Variable[] { new Variable("X1").weight(ONE), new Variable("X2").weight(TWO), new Variable("X3").weight(THREE) };

        final ExpressionsBasedModel tmpModel = new ExpressionsBasedModel(tmpVariables);

        final Expression tmpExprC1 = tmpModel.addExpression("C1");
        for (int i = 0; i < tmpModel.countVariables(); i++) {
            tmpExprC1.set(i, ONE);
        }
        tmpExprC1.level(ONE);

        final Optimisation.Result tmpMinResult = tmpModel.maximise();

        TestUtils.assertTrue(tmpMinResult.getState().isFeasible());
        TestUtils.assertFalse(tmpMinResult.getState().isOptimal());
        TestUtils.assertTrue(tmpMinResult.getState().isFailure());
        TestUtils.assertTrue(tmpModel.validate(tmpMinResult));
        TestUtils.assertEquals(Optimisation.State.UNBOUNDED, tmpMinResult.getState());

        final Optimisation.Result tmpMaxResult = tmpModel.maximise();

        TestUtils.assertTrue(tmpMaxResult.getState().isFeasible());
        TestUtils.assertFalse(tmpMaxResult.getState().isOptimal());
        TestUtils.assertTrue(tmpMaxResult.getState().isFailure());
        TestUtils.assertTrue(tmpModel.validate(tmpMaxResult));
        TestUtils.assertEquals(Optimisation.State.UNBOUNDED, tmpMaxResult.getState());
    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:29,代码来源:LinearDesignTestCases.java

示例3: testP20100412

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
/**
 * Didn't recognise this as an infeasible problem.
 */
public void testP20100412() {

    final ExpressionsBasedModel tmpModel = OptimisationIntegerData.buildModelForP20100412().relax(true);
    //tmpModel.relax(); // Relax the integer constraints
    tmpModel.getVariable(1).lower(ONE); // Set branch state

    final State tmpResultState = tmpModel.maximise().getState();

    TestUtils.assertFalse("Should be INFEASIBLE", tmpResultState == State.FEASIBLE);
}
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:14,代码来源:LinearProblems.java

示例4: testP20150127

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
/**
 * Problemet var att en av noderna som IntegerSolver genererade var infeasible, men det misslyckades
 * LinearSolver med att identifiera och returnerade en felaktig lösning som OPTIMAL. Detta testfall
 * motsvarar
 */
public void testP20150127() {

    final ExpressionsBasedModel tmpModel = P20150127b.getModel(true, true);

    // tmpModel.options.debug(LinearSolver.class);
    // Kan få testfallet att gå igenom, men dåsmäller andra testfall
    // tmpModel.options.objective = tmpModel.options.objective.newScale(8);

    final Result tmpResult = tmpModel.minimise();

    TestUtils.assertStateLessThanFeasible(tmpResult); // Should be infeasible
    TestUtils.assertFalse(tmpModel.validate(tmpResult));
}
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:19,代码来源:LinearProblems.java

示例5: testData

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
@Override
public void testData() {

    final RationalMatrix tmpProb = P20030528Case.getProblematic();

    TestUtils.assertFalse(tmpProb.isEmpty());
    TestUtils.assertTrue(tmpProb.isFat());
}
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:9,代码来源:P20030528Case.java

示例6: testMPStestprob

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
public void testMPStestprob() {

        final Variable tmpXONE = new Variable("XONE").weight(ONE).lower(ZERO).upper(FOUR);
        final Variable tmpYTWO = new Variable("YTWO").weight(FOUR).lower(NEG).upper(ONE);
        final Variable tmpZTHREE = new Variable("ZTHREE").weight(NINE).lower(ZERO).upper(null);

        final Variable[] tmpVariables = new Variable[] { tmpXONE, tmpYTWO, tmpZTHREE };

        final ExpressionsBasedModel tmpModel = new ExpressionsBasedModel(tmpVariables);

        final BigDecimal[] tmpFactorsLIM1 = new BigDecimal[] { ONE, ONE, ZERO };
        final Expression tmpLIM1 = tmpModel.addExpression("LIM1");
        for (int v = 0; v < tmpVariables.length; v++) {
            tmpLIM1.set(v, tmpFactorsLIM1[v]);
        }
        tmpLIM1.upper(FIVE.add(TENTH));

        final BigDecimal[] tmpFactorsLIM2 = new BigDecimal[] { ONE, ZERO, ONE };
        final Expression tmpLIM2 = tmpModel.addExpression("LIM2");
        for (int v = 0; v < tmpVariables.length; v++) {
            tmpLIM2.set(v, tmpFactorsLIM2[v]);
        }
        tmpLIM2.lower(TEN.add(TENTH));

        final BigDecimal[] tmpFactorsMYEQN = new BigDecimal[] { ZERO, ONE.negate(), ONE };
        final Expression tmpMYEQN = tmpModel.addExpression("MYEQN");
        for (int v = 0; v < tmpVariables.length; v++) {
            tmpMYEQN.set(v, tmpFactorsMYEQN[v]);
        }
        tmpMYEQN.level(SEVEN);

        TestUtils.assertTrue(tmpModel.validate());

        final Result tmpMinRes = tmpModel.minimise();
        final Result tmpMaxRes = tmpModel.maximise();

        if (OptimisationTests.DEBUG) {
            BasicLogger.debug(tmpMinRes);
            BasicLogger.debug(tmpMaxRes);
        }

        TestUtils.assertTrue(tmpModel.validate(tmpMinRes));
        TestUtils.assertTrue(tmpModel.validate(tmpMaxRes));

        tmpXONE.integer(true);
        tmpYTWO.integer(true);
        tmpZTHREE.integer(true);

        TestUtils.assertFalse(tmpModel.validate(tmpMinRes)); // Not integer solution
        TestUtils.assertTrue(tmpModel.validate(tmpMaxRes)); // Integer solution

        tmpYTWO.lower(ONE).upper(NEG);

        TestUtils.assertFalse(tmpModel.validate());

    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:57,代码来源:ExpressionsBasedModelTest.java

示例7: testInfeasibleCase

import org.ojalgo.TestUtils; //导入方法依赖的package包/类
public void testInfeasibleCase() {

        final Variable[] tmpVariables = new Variable[] { new Variable("X1").lower(ONE).weight(ONE), new Variable("X2").lower(ONE).weight(TWO),
                new Variable("X3").lower(ONE).weight(THREE) };

        final ExpressionsBasedModel tmpModel = new ExpressionsBasedModel(tmpVariables);

        final Expression tmpExprC1 = tmpModel.addExpression("C1");
        for (int i = 0; i < tmpModel.countVariables(); i++) {
            tmpExprC1.set(i, ONE);
        }
        tmpExprC1.upper(TWO);

        final Optimisation.Result tmpResult = tmpModel.maximise();

        TestUtils.assertFalse(tmpResult.getState().isFeasible());

    }
 
开发者ID:optimatika,项目名称:ojAlgo,代码行数:19,代码来源:LinearDesignTestCases.java


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