use of org.ojalgo.optimisation.MathProgSysModel in project ojAlgo by optimatika.
the class LpsolveSemiContCase method testSemiContNot.
@Test
@Disabled("Underscored before JUnit 5")
public void testSemiContNot() {
final File tmpFile = new File(PATH + "lpsolve_sc_not.mps");
final MathProgSysModel tmpMPS = MathProgSysModel.make(tmpFile);
final ExpressionsBasedModel tmpModel = tmpMPS.getExpressionsBasedModel();
tmpModel.minimise();
TestUtils.assertTrue(tmpModel.validate());
final BigDecimal tmpExpVal = new BigDecimal("3.93333");
final double tmpActVal = tmpModel.minimise().getValue();
if (!tmpModel.validate(PRECISION)) {
TestUtils.fail(SOLUTION_NOT_VALID);
}
TestUtils.assertEquals(tmpExpVal.doubleValue(), tmpActVal, PRECISION);
}
use of org.ojalgo.optimisation.MathProgSysModel in project ojAlgo by optimatika.
the class BurkardtDatasetsMps method testMPSafiro.
/**
* Defines a problem of 28 rows and 32 columns. Seems to be the same model as afiro at netlib. Netlib also
* provides the solution.
* <a href="http://www-new.mcs.anl.gov/otc/Guide/TestProblems/LPtest/netlib/afiro.html">afiro@netlib</a>
* OK! 2010-04-19 lp_solve => -464.75314286
*/
@Test
public void testMPSafiro() {
final File tmpFile = new File(PATH + "afiro.mps");
final MathProgSysModel tmpMPS = MathProgSysModel.make(tmpFile);
final ExpressionsBasedModel tmpModel = tmpMPS.getExpressionsBasedModel();
TestUtils.assertTrue(tmpModel.validate());
final BigDecimal tmpExpVal = new BigDecimal("-.46475314286e+3");
final double tmpActVal = tmpModel.minimise().getValue();
TestUtils.assertEquals(tmpExpVal.doubleValue(), tmpActVal, PRECISION);
if (!tmpModel.validate(PRECISION)) {
TestUtils.fail(SOLUTION_NOT_VALID);
}
}
use of org.ojalgo.optimisation.MathProgSysModel in project ojAlgo by optimatika.
the class BurkardtDatasetsMps method testMPSmaros.
/**
* An example taken from Maros, which defines a problem of 3 rows and 4 columns. There's also a model
* named maros at netlib, but that's a different much larger model. ERROR: Något tar lång tid, och sedan
* blir det ArithmaticError. 2010-04-19 lp_solve => 128.33333333
*/
@Test
public void testMPSmaros() {
final File tmpFile = new File(PATH + "maros.mps");
final MathProgSysModel tmpMPS = MathProgSysModel.make(tmpFile);
final ExpressionsBasedModel tmpModel = tmpMPS.getExpressionsBasedModel();
this.assertMinMaxVal(tmpModel, BigFunction.DIVIDE.invoke(new BigDecimal("385"), THREE), new BigDecimal("197.5"));
}
use of org.ojalgo.optimisation.MathProgSysModel in project ojAlgo by optimatika.
the class BurkardtDatasetsMps method testMPSnazareth.
/**
* An example taken from Nazareth, which defines a problem of 3 rows and 3 column. OK! 2010-04-19 lp_solve
* => This problem is unbounded (maximisation seems OK.)
*/
@Test
public void testMPSnazareth() {
final File tmpFile = new File(PATH + "nazareth.mps");
final MathProgSysModel tmpMPS = MathProgSysModel.make(tmpFile);
final ExpressionsBasedModel tmpModel = tmpMPS.getExpressionsBasedModel();
this.assertMinMaxVal(tmpModel, null, BigFunction.DIVIDE.invoke(HUNDRED.add(TEN), THREE));
}
use of org.ojalgo.optimisation.MathProgSysModel in project ojAlgo by optimatika.
the class BurkardtDatasetsMps method testMPSadlittle.
/**
* Defines a problem of 57 rows and 97 columns. Seems to be the same model as adlittle at netlib. Netlib
* also provides the solution.
* <a href="http://www-new.mcs.anl.gov/otc/Guide/TestProblems/LPtest/netlib/adlittle.html" >
* adlittle@netlib</a> Found this info somewhere on the net: "With 56 constraints and 97 variables
* adlittle is one of its smaller members. While being in fact feasible, adlittle suffers from
* ill--posedness. Perturbing the right hand side of the equality constraints by subtracting a tiny
* multiple of the 96th column of the equation matrix renders the linear program infeasible. Running this
* problem through CPLEX and lp_solve does again return a solution without any warnings." FAIL: Hittar
* bara en lösning 0.0, oavsett om jag minimerrar eller maximerar. 2010-04-19 lp_solve => 225494.96316238
*/
@Test
public void testMPSadlittle() {
final File tmpFile = new File(PATH + "adlittle.mps");
final MathProgSysModel tmpMPS = MathProgSysModel.make(tmpFile);
final ExpressionsBasedModel tmpModel = tmpMPS.getExpressionsBasedModel();
// tmpModel.options.debug(LinearSolver.class);
TestUtils.assertTrue(tmpModel.validate());
// Stated to be .22549496316e+6
final BigDecimal tmpExpVal = new BigDecimal("225494.96316238446");
final double tmpActVal = tmpModel.minimise().getValue();
TestUtils.assertEquals(tmpExpVal.doubleValue(), tmpActVal, PRECISION);
if (!tmpModel.validate(PRECISION)) {
TestUtils.fail(SOLUTION_NOT_VALID);
}
}
Aggregations