Julia 1.0 is out:
- Julia 1.0, https://julialang.org/blog/2018/08/one-point-zero
- Why we created Julia, https://julialang.org/blog/2012/02/why-we-created-julia (original announcement in 2012)
- Possible Python rival? Programming language Julia is winning over developers, https://www.zdnet.com/article/possible-python-rival-programming-language-julia-is-winning-over-developers/ (I have seen Julia being touted as a "Matlab-killer"; now it seems to be also a "Python-killer"?).
- Should data scientists using R and Python switch over to Julia? https://qz.com/1360318/is-julia-a-good-alternative-to-r-and-python-for-programmers/
- Which numerical computing language is best: Julia, MATLAB, Python or R?, https://voxeu.org/content/which-numerical-computing-language-best-julia-matlab-python-or-r
For optimization modeling, the Julia JuMP package is a good tool. The performance of Julia/JuMP is impressive [2]. And the Jupyter [4] notebook interface is really a pleasure to use when playing with the model.
The JuMP models I have seen, used integers for indexing. (Not only from the JuMP documentation and examples but also real models people were working on). This is a major drawback IMHO: there is limited protection against errors (no type/domain checking). Better is to index by strings. It gives better, more descriptive output and also checking for incorrect indices is better. Basically you want a proper error if you say x[j,i] instead of x[i,j]. Similarly when using demand['february','region3'] instead of demand['region3','february']. This is lost when using demand[2,3]. May be I need to create some motivating examples for this. An example of indexing by strings is the Steel model [1], where dicts are used that index data and variables by strings. The model uses integers for the time periods -- I prefer to have those also labeled something like t1,t2,t3,t4. Of course, in practice they will be labeled by something like jan,feb,mar,apr or may be week11,week12,week13,week14. I often use the rule: the way you want labels to appear in your Excel report (say), should also be used in the model. I am not 100% sure why indexing by integers is so popular in JuMP models (or at least the ones I was studying). I suspect that the fact that matrices (arrays) are an important data structure in Julia, plays a role here. Julia has data frames (a concept popularized by R), but I don't think they are often used directly in optimization models.
Warning: The latest release of JuMP (based on MathProgBase) is not compatible with Julia 0.7 or 1.0. [3]
Update: I fixed my incorrect statement about indexing by integers only. (I will try to expand on this).
The JuMP models I have seen, used integers for indexing. (Not only from the JuMP documentation and examples but also real models people were working on). This is a major drawback IMHO: there is limited protection against errors (no type/domain checking). Better is to index by strings. It gives better, more descriptive output and also checking for incorrect indices is better. Basically you want a proper error if you say x[j,i] instead of x[i,j]. Similarly when using demand['february','region3'] instead of demand['region3','february']. This is lost when using demand[2,3]. May be I need to create some motivating examples for this. An example of indexing by strings is the Steel model [1], where dicts are used that index data and variables by strings. The model uses integers for the time periods -- I prefer to have those also labeled something like t1,t2,t3,t4. Of course, in practice they will be labeled by something like jan,feb,mar,apr or may be week11,week12,week13,week14. I often use the rule: the way you want labels to appear in your Excel report (say), should also be used in the model. I am not 100% sure why indexing by integers is so popular in JuMP models (or at least the ones I was studying). I suspect that the fact that matrices (arrays) are an important data structure in Julia, plays a role here. Julia has data frames (a concept popularized by R), but I don't think they are often used directly in optimization models.
Warning: The latest release of JuMP (based on MathProgBase) is not compatible with Julia 0.7 or 1.0. [3]
Update: I fixed my incorrect statement about indexing by integers only. (I will try to expand on this).
References
- SteelT3 model translated from the AMPL book, https://github.com/JuliaOpt/JuMP.jl/blob/release-0.18/examples/steelT3.jl
- Iain Dunning, Joey Huchette, Miles Lubin, JuMP: A modeling language for mathematical optimization, SIAM Review, 59(2), pp. 295–320, 2017 (preprint at: http://www.optimization-online.org/DB_HTML/2015/04/4891.html).
- https://github.com/JuliaOpt/JuMP.jl
- http://jupyter.org/
These are good suggestions re indexing in JuMP, Erwin. Have you had a chance to revisit JuMP in its more recent incarnations to evaluate its usability? Like you, I really value GAMS, but I often bemoan its clumsy syntax for general programming operations, and its inability to support any modularity or restricted variable name-spaces when building models and pre-post-processing code. So I'm hoping JuMP takes off. Thanks for all your interesting, and fun, posts.
ReplyDeleteI fully agree concrrning the indexing.
ReplyDeleteLukily it is easily achievable. Here an example of the gams transport model in JuMP using dictionaries as variables: https://lobianco.org/antonello/personal/blog/2017/0203_jump_for_gams_users