tag:blogger.com,1999:blog-4946490806848569840.post5436394783364517533..comments2017-11-16T08:02:18.406-08:00Comments on R snippets: Optimization matchup: R's glpkAPI vs Julia's JuMPBogumił Kamińskinoreply@blogger.comBlogger6125tag:blogger.com,1999:blog-4946490806848569840.post-58607957929094905012016-12-06T22:45:44.517-08:002016-12-06T22:45:44.517-08:00Great post. Thanks. Great post. Thanks. 常青树https://www.blogger.com/profile/09499813030229291918noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-17136789747140136352016-12-06T08:56:54.244-08:002016-12-06T08:56:54.244-08:00Thanks for a nicer version of gen_data func!
Regar...Thanks for a nicer version of gen_data func!<br />Regarding pam. The post is about optimization in general. pam is limited in functionality and do not handle side constraints. For a real life problem you can check my presentation I gave at EARL 2014 (https://goo.gl/YY1d31). Wit Jakuczunhttps://www.blogger.com/profile/11026188487219287866noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-82417787117758010962016-12-06T05:47:53.382-08:002016-12-06T05:47:53.382-08:00An absolutely killer-feature of Julia JuMP is the ...An absolutely killer-feature of Julia JuMP is the ability to define lazy-constraints via callbacks in a solver-independent manner. Many of the best algorithms for problems make use of such techniques (such as subtour-elimination in Travelling Salesman) and the ability to easily program them is something that I have not seen in any library other than JuMP.Adam Sardarhttps://www.blogger.com/profile/07517057242770665359noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-14996400736357874222016-12-06T04:22:54.917-08:002016-12-06T04:22:54.917-08:00Thank you for the comment about ompr package. This...Thank you for the comment about ompr package. This is exactly what I have been looking for! I will have to check it out in detail, but it looks very good.<br /><br />As for the speed - most of the time is spent in solver and the solver is the same in both cases.Bogumił Kamińskihttps://www.blogger.com/profile/06250268799809238730noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-73424061757968941182016-12-06T04:09:11.603-08:002016-12-06T04:09:11.603-08:00I really understand that glpkAPI has poor designed...I really understand that glpkAPI has poor designed interface in comparison with JuMP. But why R code is so unnecessary obfuscated and complicated in your example? Especially confusing is two type-castings to data.frame in 'gen_data'. In Julia you use matrix type for your data. Why don't you use matrix in R? Just for completeness - in real life R code for this tasks looks like this:<br /><br />gen_data = function(N, K, scaling) {<br /> alpha = 2 * pi * (1:N) / K<br /> sin_pi_K = 2 * sin(pi / K)<br /> x = matrix(rnorm(n = 2*N), nrow = N)<br /> x + cbind(cos(alpha), sin(alpha)) * scaling / sin_pi_K<br />}<br /><br />set.seed(1)<br />x = gen_data(200, 4, 5)<br /><br />library(cluster)<br />lapply(2:6, function(k) pam(x, k = k))Gregory Deminhttps://www.blogger.com/profile/09827917062640566527noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-42416569071838202612016-12-06T02:29:01.511-08:002016-12-06T02:29:01.511-08:00Great post! Nice to have the comparisons, pretty c...Great post! Nice to have the comparisons, pretty clear that Julia's syntax really wins the day here, is there much of a speed difference? <br /><br />Also, have you seen the ompr package (https://github.com/dirkschumacher/ompr) that Dirk Schumacher is working on? It's inspired by the JuMP project.Surferhttps://www.blogger.com/profile/10433810043220326846noreply@blogger.com