Re: [ojAlgo-user] Knapsack problem with binary variables
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2010-04-19 06:45:43
|
Not finished fixing yet... Yes, please write a junit test. Most likely the problem is actually with the LP (sub) solver, and not the MIP (master) solver. My guess is that there is one particular MIP-branch that is incorrectly reported as solved by the LP solver. (That was the problem last time.) Write a junit test for that particular LP problem as well. If you also check out theTestProj module from CVS you'll find your problem/case in org.ojalgo.optimisation.integer.ReportedProblems and org.ojalgo.optimisation.linear.ReportedProblems Don't forget to set GenericSolver.DEBUG=true when you debug. /Anders On 18 apr 2010, at 23.16, Luke Lindsay wrote: > On 12 April 2010 20:31, Anders Peterson <an...@op...> wrote: >> Don't think you've done anything wrong. >> >> I've looked briefly at your test case and can already conclude that the IntegerSolver does not work properly for maximization problems (all the test cases are minimization problems). Immediately fixed one part of the problem, but it still doesn't work... >> >> I'll definitely look into this some more, but I'm a little short on time currently. It may take some time. >> >> You can turn on debugging with >> >> GenericSolver.DEBUG = true; >> >> >> Once you've called >> >> model.maximise(); >> >> the problem is already solved, and the solution written back to your variables. >> >> You may simply >> >> System.out.println(model); >> >> go "see" the results. This way you don't get access to the OptimisationState. >> >> >> If you want to solve the problem with explicit access to the Solver and Result you'd do something like this: >> >> model.setMaximisation(true); >> final OptimisationSolver solver = model.getDefaultSolver(); >> final Result result = solver.solve(); >> >> >> /Anders >> >> > Thank you for your reply. > > I have checked out the latest code from CVS. The test case in my > previous email now works as expected. However, when I change the > numbers, I still get some unexpected results. For instance, when I > set my variable maxWeight = 1.1 or maxWeight = 5, the integer > constraints don't hold. I can write a junit test if it would help. > > Best, > > Luke > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |