Re: [ojAlgo-user] Problem with mixed integer linear programming
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2011-10-10 21:43:34
|
I uploaded a new snapshot https://sourceforge.net/projects/ojalgo/files/ojAlgo/snapshot/ Could you test if that works better for you? /Anders On 10 okt 2011, at 14:45, Anders Peterson wrote: > Haven't looked at this in great detail, but if you change: > > objective[1].setInteger(true); > to > objective[1].setInteger(false); > > and > > model.minimise(); > to > model.setMinimisation(true); > final OptimisationSolver tmpSolver = model.getDefaultSolver(); > final Result tmpResult = tmpSolver.solve(); > > Then you'll see that ojAlgo reports the relaxed problem to be unbounded. If that's true it's a (big) problem for the integer solver. The relaxed problems need to be able to be solved by the linear or quadratic solvers. > > I'm not confident that ojAlgo reports INFEASIBLE and/or UNBOUNDED problems right all the time, but you should definitely not get a NullPointerException! > > X=0, Y=0 & Z=0 is a valid solution to your problem, right? In that case there is a bug with the LinearSolver. > > /Anders > > > On 10 okt 2011, at 12:18, Julien.Cojan wrote: > >> Hello, >> >> I am using OjAlgo to solve mixed linear programming problems. >> However I often get a NullPointerException when running on my examples. >> I tried version 30.0 and 30.6, I get the same error. >> >> This is the smallest example I could find where I get this exception : >> >> >> import static org.ojalgo.constant.BigMath.ONE; >> import static org.ojalgo.constant.BigMath.ZERO; >> >> import java.math.BigDecimal; >> >> import org.ojalgo.optimisation.Expression; >> import org.ojalgo.optimisation.Variable; >> import org.ojalgo.optimisation.linear.LinearExpressionsModel; >> >> >> public class TestOjAlgo { >> >> public static void testBug1(){ >> Variable[] objective = new Variable[] { >> new Variable("X").weight(ONE), >> new Variable("Y").weight(ZERO), >> new Variable("Z").weight(ZERO)}; >> >> objective[1].setInteger(true); >> >> LinearExpressionsModel model = new LinearExpressionsModel(objective); >> >> // c1: X =0 >> Expression c1 = model.addEmptyLinearExpression("c1"); >> c1.level(ZERO); >> c1.setLinearFactor(0, ONE); >> >> // c2: -X +5Y =0 >> Expression c2 = model.addEmptyLinearExpression("c2"); >> c2.level(ZERO); >> >> c2.setLinearFactor(0, new BigDecimal(-1)); >> c2.setLinearFactor(1, ONE); >> >> // c3: X -Z =0 >> Expression c3 = model.addEmptyLinearExpression("c3"); >> c3.level(ZERO); >> // bugs with this constraint >> c3.setLinearFactor(0, ONE); >> c3.setLinearFactor(2, new BigDecimal(-1)); >> // but not with this one ??? >> // c3.setLinearFactor(0, new BigDecimal(-1)); >> // c3.setLinearFactor(2, ONE); >> >> model.minimise(); >> } >> >> public static void main(String[] args){ >> testBug1(); >> } >> >> } >> >> >> >> >> >> I get the following message >> Exception in thread "main" java.lang.NullPointerException >> at org.ojalgo.optimisation.OptimisationSolver$Result.<init>(OptimisationSolver.java:99) >> at org.ojalgo.optimisation.integer.IntegerSolver.solve(IntegerSolver.java:318) >> at org.ojalgo.optimisation.ExpressionsBasedModel.solve(ExpressionsBasedModel.java:741) >> at org.ojalgo.optimisation.ExpressionsBasedModel.minimise(ExpressionsBasedModel.java:458) >> at TestOjAlgo.testBug1(TestOjAlgo.java:57) >> at TestOjAlgo.main(TestOjAlgo.java:61) >> >> >> Is it a bug or am I not using ojAlgo properly ? >> >> >> -- >> The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> >> > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |