use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class UCLAee236aCase method testRelaxedButConstrainedToOptimalMIP.
@Test
public void testRelaxedButConstrainedToOptimalMIP() {
final ExpressionsBasedModel tmpModel = UCLAee236aCase.makeOriginalRootModel().relax(true);
tmpModel.getVariable(0).lower(TWO);
tmpModel.getVariable(0).upper(TWO);
tmpModel.getVariable(1).lower(TWO);
tmpModel.getVariable(1).upper(TWO);
final Optimisation.Result tmpResult = tmpModel.minimise();
// TestUtils.assertEquals(State.OPTIMAL, tmpResult.getState());
TestUtils.assertStateNotLessThanOptimal(tmpResult);
final PrimitiveDenseStore tmpExpX = PrimitiveDenseStore.FACTORY.rows(new double[][] { { 2.0 }, { 2.0 } });
TestUtils.assertEquals(tmpExpX, tmpResult, PRECISION);
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class UCLAee236aCase method testRelaxedNodeP05.
/**
* P5
*/
@Test
public void testRelaxedNodeP05() {
final ExpressionsBasedModel tmpModel = UCLAee236aCase.makeOriginalRootModel().relax(true);
tmpModel.getVariable(0).lower(THREE);
tmpModel.getVariable(1).upper(ONE);
final Optimisation.Result tmpResult = tmpModel.minimise();
TestUtils.assertEquals(State.OPTIMAL, tmpResult.getState());
final PrimitiveDenseStore tmpExpX = PrimitiveDenseStore.FACTORY.rows(new double[][] { { 3.38 }, { 1.00 } });
TestUtils.assertEquals(tmpExpX, tmpResult, PRECISION);
TestUtils.assertEquals(-9.75, tmpModel.minimise().getValue(), PRECISION);
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class UCLAee236aCase method testRelaxedNodeP08.
/**
* P8
*/
@Test
public void testRelaxedNodeP08() {
final ExpressionsBasedModel tmpModel = UCLAee236aCase.makeOriginalRootModel().relax(true);
tmpModel.getVariable(0).lower(THREE);
tmpModel.getVariable(1).upper(ONE);
tmpModel.getVariable(0).lower(FOUR);
final Optimisation.Result tmpResult = tmpModel.minimise();
TestUtils.assertEquals(State.OPTIMAL, tmpResult.getState());
final PrimitiveDenseStore tmpExpX = PrimitiveDenseStore.FACTORY.rows(new double[][] { { 4.00 }, { 0.44 } });
TestUtils.assertEquals(tmpExpX, tmpResult, PRECISION);
TestUtils.assertEquals(-9.33, tmpModel.minimise().getValue(), PRECISION);
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class UCLAee236aCase method testRelaxedNodeP03.
/**
* P3
*/
@Test
public void testRelaxedNodeP03() {
final ExpressionsBasedModel tmpModel = UCLAee236aCase.makeOriginalRootModel().relax(true);
tmpModel.getVariable(0).upper(TWO);
tmpModel.getVariable(1).upper(TWO);
final Optimisation.Result tmpResult = tmpModel.minimise();
TestUtils.assertEquals(State.OPTIMAL, tmpResult.getState());
final PrimitiveDenseStore tmpExpX = PrimitiveDenseStore.FACTORY.rows(new double[][] { { 2.00 }, { 2.00 } });
TestUtils.assertEquals(tmpExpX, tmpResult, PRECISION);
TestUtils.assertEquals(-10.00, tmpModel.minimise().getValue(), PRECISION);
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class UCLAee236aCase method testRelaxedNodeP00.
/**
* P0
*/
@Test
public void testRelaxedNodeP00() {
final ExpressionsBasedModel tmpModel = UCLAee236aCase.makeOriginalRootModel().relax(true);
final Optimisation.Result tmpResult = tmpModel.minimise();
TestUtils.assertEquals(State.OPTIMAL, tmpResult.getState());
final PrimitiveDenseStore tmpExpX = PrimitiveDenseStore.FACTORY.rows(new double[][] { { 2.17 }, { 2.07 } });
TestUtils.assertEquals(tmpExpX, tmpResult, PRECISION);
// The lecture notes states -10.56, but I get -10.55. One of us is rounding incorrectly...
TestUtils.assertEquals(-10.55, tmpModel.minimise().getValue(), PRECISION);
}
Aggregations