Re: [ojAlgo-user] ojAlgo v34 on Android (continued)
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Zahar C. <no...@ma...> - 2013-11-04 22:34:54
|
Hi Anders, At the end as you proposed I compiled LP_Solve for Android and it works quite well. The small problem is solved in 0.0s (no typo) and the big one with limitation of 30 is solved in 2.1s. This is good for my needs, I will stick with it. Thank you very much for your support. Regards, Zahar On 11/4/2013 11:28 PM, Anders Peterson wrote: > Looked briefly at your model. Nor sure what you're modeling, but I didn't see any obvious problem. > > When I ran that SimpleTest as you packaged it (masteries_mip3.txt) I got several exceptions like this one: > > Caused by: java.lang.IllegalArgumentException: ValidationException: 2 <= a4: 1.5 <= 1 The lower limit (if it exists) must be smaller than or equal to the upper limit (if it exists)! > at org.ojalgo.optimisation.ExpressionsBasedModel.getDefaultSolver(ExpressionsBasedModel.java:331) > at org.ojalgo.optimisation.integer.IntegerSolver.solve(IntegerSolver.java:66) > > The solver did finish, but I wouldn't trust the results after those exceptions. Switching to the latest version of ojAlgo they disappeared. (No code changes necessary to switch versions.) > > The larger model takes less than 5s. > > /Anders > > > > On 2 nov 2013, at 02:02, Zahar Chikishev <no...@ma...> wrote: > >> Hi Anders, >> >> I have created a self contained test case of my MIP problem. You can find the test project attached to this mail. >> Input file "masteries_mip1.txt" is the small problem (34 variables) and file "masteries_mip3.txt" is the full problem (110 variables). >> >> Below is the list of my observations >> >> 1. The small problem takes 20s on Android Samsung Galaxy S2 and only 0.38s on my notebook with processor i7-3740QM. This is on version 33. I am not sure that the disparity can be assigned purely to the processors calculation power difference... >> >> 2. The small problem takes approximately the same time on v33 and v34.8 on the notebook (0.38s against 0.42s). >> >> 3. The full problem fails on v33 and finishes in 1.66s on v34.8 on the notebook. However changing the constraint "maxc" upper limit from 23 to 30 increases the time to around 90s (30 is the real value and 23 was for tests). This last test shows that even in the optimal environment (notebook + v34.8) my full problem takes too much time. >> >> I think I will switch my attention to alternative 2... but first of all I will check that my problem can be solved fast at least on cplex. >> >> Anders, if you have some spare time, could you please check the attached project. It might be that I have misused ojAlgo in some way. >> >> Thanks, >> Zahar >> >> >> On 10/31/2013 4:00 PM, Anders Peterson wrote: >>> I'd be interested in seeing what the performance difference between v33 and the current/latest version is for your problem. Do you have a (self contained) test case that I can try? >>> >>> Alt. 1 (ojAlgo) >>> >>> Test your problem on a desktop computer using ojAlgo v33 AND v34.8 to see if the improvements in any way make it a feasible alternative. >>> >>> I believe the fork-join-framework existed as a separate download before java 7 was released. Maybe you can use that. Alternatively maybe you can fake the api entirely and just execute everything sequentially (simplest possible implementation). ..or fake the api delegating to the v33 version of the org.ojalgo.concurrent package. >>> >>> There are still improvements to be made regarding how each lp-node is started, and probably other things as well. >>> >>> >>> Alt. 2 (native) >>> >>> I have no experience here, but I've seen other people do interesting things with mixing in native code. The threshold for when it's advantageous (performance) to switch to native code seems to have come down lately. How many native platforms would have to support? If it's just 1 I would try this alternative. >>> >>> http://lpsolve.sourceforge.net/5.5/Java/README.html >>> >>> >>> /Anders >>> >>> >>> >>> On 31 okt 2013, at 11:52, Zahar Chikishev <no...@ma...> wrote: >>> >>>> Hi Anders, >>>> >>>> Excuse me for writing in a new thread, I haven't got your reply in a mail but can see it on sourceforge. For convenience, I am pasting my original mail with your reply at the end of this letter. >>>> >>>> Thank you for the CVS link, I was able to reach the source code. I used "v33" branch for my tests. >>>> >>>> MIP solver required java.lang.management API, and it is not present in Android, so I removed the corresponding function call in file VirtualMachine.java. >>>> >>>> After that I successfully modeled and run my MIP problem in my Android app. The results are as expected, but the performance is low. My test problem took 20 seconds to run (Samsung Galaxy S2, physical device) and it is only a third of my full-size problem. The full-size problem did not finish in 30 minutes. So it looks like my problem is not that small. The problem that took 20 seconds was around 50 integer variables and 150 constraints. Unfortunately, it is not useful for me. I need at least 20 times faster. >>>> >>>> However, I was happy that I was able run MIP on Android at all. I searched a lot for how to do it, and there are only a few options available. Pure java solver is the best way, but ojAlgo is the only pure java MIP solver I have found. The second way is to compile some open-source C/C++ libraries with JNI (like GLPK or lp_solve), but this has its own problems, and I can't find testimonies of anyone who has actually done that. >>>> >>>> Please tell me if you have any words of advice for my situation. >>>> >>>> Thanks a lot, >>>> Zahar >>>> >>>> >>>> >>>> -------------------------------------------------------------------------------------------------------------------------- >>>> >>>> Re: [ojAlgo-user] ojAlgo v34 on Android >>>> From: Anders Peterson <anders@op...> - 2013-10-28 18:20:53 >>>> The source code is definitely available. Where did you get that link? >>>> >>>> ojAlgo uses CVS, not SVN: >>>> >>>> >>>> https://sourceforge.net/p/ojalgo/code/ >>>> >>>> >>>> v34 cannot be compiled using java 5 or 6 without re-coding. One of the things that changed with v34 is the use of the fork-join framework (ForkJoinPool and ForkJoinTask). The MIP solver is (now) highly integrated with these classes - that redesign was part of the improvements that came with v34. >>>> >>>> Java 6 was never a target. Switching back to Java 5 should be roughly the same amount of work. >>>> >>>> My guess is that you'll find this to be too much work... >>>> >>>> /Anders >>>> >>>> >>>> On 28 okt 2013, at 18:10, Zahar Chikishev >>>> <nosound@...> >>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> I wish to use ojAlgo to solve small MIP problems in my Android >>>>> application. The problem is that Android does not support Java 7 >>>>> compiled libraries. Version 33 of ojAlgo seems to work OK in my app, but >>>>> I prefer to use 34 since, as far as I understand, it includes major >>>>> improvements to MIP solver. >>>>> >>>>> So my question is, can version 34 be compiled on java 5 or 6? It is OK >>>>> if some functionality is lost, as long as simple MIP problems can be >>>>> solved. I tried to do it myself, but can't access the source code. I >>>>> understand that the following is SVN link: >>>>> >>>> https://ojalgo.svn.sourceforge.net/svnroot/ojalgo/ >>>> >>>>> but it gives errors. >>>>> >>>>> So my second question is how I can access the source code. Is it still >>>>> available? >>>>> >>>>> Thanks, >>>>> Zahar >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> October Webinars: Code for Performance >>>>> Free Intel webinars can help you accelerate application performance. >>>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from >>>>> the latest Intel processors and coprocessors. See abstracts and register > >>>>> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk >>>> >>>>> _______________________________________________ >>>>> ojAlgo-user mailing list >>>>> ojAlgo-user@... >>>>> >>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Android is increasing in popularity, but the open development platform that >>>> developers love is also attractive to malware creators. Download this white >>>> paper to learn more about secure code signing practices that can help keep >>>> Android apps secure. >>>> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk_______________________________________________ >>>> ojAlgo-user mailing list >>>> ojA...@li... >>>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >>> ------------------------------------------------------------------------------ >>> Android is increasing in popularity, but the open development platform that >>> developers love is also attractive to malware creators. Download this white >>> paper to learn more about secure code signing practices that can help keep >>> Android apps secure. >>> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> ojAlgo-user mailing list >>> ojA...@li... >>> https://lists.sourceforge.net/lists/listinfo/ojalgo-user >> <SimpleTest.rar>------------------------------------------------------------------------------ >> Android is increasing in popularity, but the open development platform that >> developers love is also attractive to malware creators. Download this white >> paper to learn more about secure code signing practices that can help keep >> Android apps secure. >> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk_______________________________________________ >> ojAlgo-user mailing list >> ojA...@li... >> https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > ------------------------------------------------------------------------------ > Android is increasing in popularity, but the open development platform that > developers love is also attractive to malware creators. Download this white > paper to learn more about secure code signing practices that can help keep > Android apps secure. > http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |