Hacker News new | ask | show | jobs
by geebee 4014 days ago
Interesting. I agree, though linear programming does get a spot almost all the way back in "Introduction to Algorithms", which I believe is a pretty common standard text for CS students (one of the authors is an IEOR professor at Columbia). My guess is that most algorithms courses don't make it all that far back. I wasn't a CS student - I was a math major and did an MS in IEOR, and I was a little surprised to see this topic at the end of this book when I was doing some self-study in algorithms. It seems very different, and I hadn't thought of it as an algorithm before, but of course it is, just one that is heavily based on linear algebra.

LP and NLP do seem to be treated as a niche subject, something that would be taught in an Industrial Engineering (or barring that, a math) class rather than as a core CS topic.

Interesting that you mentioned excel - I agree that this is a good way to learn and play around with LP, but normally I'd have a good python library to point to. I used a python library a while back to do some homework problems, and I wouldn't' be surprised if it has improved considerably since then. Still, interesting that LP and NLP aren't part of scikit-learn (http://scikit-learn.org), which covers classification, regression, clustering, dimensionality reduction, model selection, and preprocessing, but not optimization per se, even though non-linear optimization is a key bit of mathematics behind many of these algorithms (regression that uses a cost function almost certainly uses some kind of NLP, right?). It really is notable that LP is not part of the main packages, front and center.

If you go on kaggle or other data science sites, linear and non-linear optimization don't seem to get much attention, either. Wonder why that is. Anyway, interesting topic.

1 comments

I believe that the optimize package within Scipy has a linear programming feature (http://docs.scipy.org/doc/scipy/reference/optimize.html), although I have never used it because I have found the documentation lacking.

However, for Python I would actually recommend the PuLP package (http://pythonhosted.org/PuLP/), which has pretty good documentation and let's you use various solvers (CBC, GLPK, CPLEX, Gurobi, etc.) on the backend. This package definitely has it's advantages over Excel, especially for large or complex LP problems where I have found Excel to be much slower and/or incapable of finding as food of a solution. However, for someone learning about LP (linear programming) or integer programming, it's unlikely that they will be doing anything that can't be done efficiently enough in Excel, particularly with an add-on such as OpenSolver. I think that Excel is just easier to use than any of the Python packages that I've come across for this (hopefully that will change though!). But once someone knows what they're doing, learning how to use something such as PuLP can be very valuable in my opinion.