當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。