News for hackers. Stuff that matters.
Re:A Global Optimization Algorithm Worth Using by wenc on Thursday February 22, 2018 @04:12PM (#16441434)
There's a whole class of deterministic Global Optimization solvers on COIN-OR [0] that don't seem to get noticed outside the Operations Research/Applied math community. (many are free and open source, e.g. Couenne)

These solvers (BARON [1], ANTIGONE [2], Couenne [3] etc.) are capable of solving nonconvex global optimization problems that are structurally more complicated (i.e. non-ML applications) than the ones presented in the article linked above.

They employ a bunch of mathematically-rigorous methods such as interval analysis, branch-and-cut and McCormick relaxations. There's a treasure trove of little ideas from decades of global optimization research that I feel the Deep Learning community could benefit from taking a peek at.

[0] https://neos-server.org/neos/solvers/index.html

[1] http://archimedes.cheme.cmu.edu/?q=baron

[2] http://helios.princeton.edu/ANTIGONE/index.html

[3] https://www.coin-or.org/Couenne/

Re:A Global Optimization Algorithm Worth Using by rsp1984 on Thursday February 22, 2018 @04:43PM (#16441691)
Absolutely. Adding to the list, SIMPLE [1] was recently trending on HN [2]. It looks very applicable to hyperparameter optimization.

[1] https://github.com/chrisstroemel/Simple

[2] https://news.ycombinator.com/item?id=16241659

Re:A Global Optimization Algorithm Worth Using by xoroshiro on Thursday February 22, 2018 @07:19PM (#16442933)
Glad to see someone posted about COIR-OR!

I've been looking at open source solvers for a while now to solve an MIP, and this one seems to be the best.

There is this annoying thing about the whole ecosystem though, aside from the proprietary bits.

I started by looking at GLPK and wrote my MIP in GMPL. For some reason a lot of tools I looked at don't "just work". I have to export it to some other format. It works, but feels like a work-around.

I wish there were a lingua franca in this domain and sort of have support from all major solver implementations, but each one seems to have their own way, or just provide an API (ehem google/or-tools)

I am happy I can make it work, but it may not be as easy for others.

Re:A Global Optimization Algorithm Worth Using by tavert on Thursday February 22, 2018 @07:42PM (#16443101)
> I wish there were a lingua franca in this domain and sort of have support from all major solver implementations

JuMP is kind of that in terms of modeling software - http://www.juliaopt.org/

Pyomo is also pretty useful if you'd rather use Python than Julia, though it's not as well-documented and doesn't make installation of the open-source solvers quite as easy for you.

Re:A Global Optimization Algorithm Worth Using by xoroshiro on Thursday February 22, 2018 @07:58PM (#16443216)
Thanks, but it was not really what I was looking for. I was looking for something that feels closer to a DSL than an API. In OR, a language like AMPL (IIRC, by Brian Kernighan) or GAMS is typically used where you define sets, variables, etc. It's something I feel I can more easily share to co-workers with different backgrounds, since it's closer to math, and follows the whole objective function, constraint, etc. organization in OR problems.

If you want to get a feel for it, here's an example in GMPL, which is a subset of AMPL used in GLPK:

https://en.wikibooks.org/wiki/GLPK/GMPL_%28MathProg%29

Re:A Global Optimization Algorithm Worth Using by tavert on Thursday February 22, 2018 @08:49PM (#16443524)
JuMP and Pyomo are both exactly that. Pyomo is as near as you can get to an AMPL clone with python syntax. JuMP is an optimization DSL using Julia macros.
Re:A Global Optimization Algorithm Worth Using by xoroshiro on Thursday February 22, 2018 @09:29PM (#16443710)
Maybe I was confusing my terms or something. I think of these as like an API as well, although packaged into a nice library that automates some stuff. So I guess I'll try to describe my ideal scenario instead.

What I was thinking of was a common language that can be used by all solvers. Similar to how C can be compiled by gcc or clang, this language can be used directly with the solver binary. Something like `export CC=my_solver` and `CC -d data.dat -m model.mod`, if you will.

What a lot of these projects do feels like calling a solver by translating it into some format that's different for everyone, whereas I wanted for the solvers to all agree on some language.

Or at the very least, some standard similar to how languages have libraries for something like XML. It would be nice if JuMP and PyOmO could read these standardized formats.

Then again, it's probably a pain to implement and even C compilers implement different extensions. But one can dream.

Re:A Global Optimization Algorithm Worth Using by tavert on Thursday February 22, 2018 @11:09PM (#16444148)
See the COIN-OR Optimization Services (OS) project for a solver-independent xml format called OSiL. It's functionally equivalent to AMPL .nl format but more human-readable. Unfortunately the osil readers for solvers have more performance problems and bugs than .nl readers, since the AMPL format has been around longer and is commercially supported.

The proprietary part of AMPL is the program that turns human-readable .mod and .dat files into low-level .nl encodings of the problem representation. The .nl format is documented, and there's an MIT licensed library on netlib (and now github too) that reads it and evaluates functions, constraints, gradients, Jacobians, Hessians, etc. (AD is super useful and has been around way longer than the deep learning popularization of it.)

Julia has a low-level solver-independent API called MathProgBase that sits between solver wrappers and modeling languages like JuMP / Convex.jl. It's in the process of being rewritten as MathOptInterface, but it would allow people to write solvers in pure Julia and be usable right away with JuMP.

Re:A Global Optimization Algorithm Worth Using by wenc on Thursday February 22, 2018 @10:10PM (#16443886)
> whereas I wanted for the solvers to all agree on some language.

Umm, they (mostly) do. Pyomo supports the AMPL .nl format, which means you can call any AMPL solver from Pyomo (most COIN-OR solvers have AMPL interfaces). The AMPL .nl format is the de facto standard for open-source optimization solvers because it's the only open standard, I believe [0].

So you would define your mathematical program in Pyomo (which isn't a terribly challenging syntax compared to AMPL). When you invoke solve, Pyomo will spit out an .nl file and call a solver (which reads the .nl file, solves the problem, and outputs a .sol file which can be read back into Pyomo).

Incidentally this is exactly how it works in AMPL as well -- all the interop is done through .nl and .sol files. I recommend reading [0] to understand how this works.

[0] https://ampl.com/resources/hooking-your-solver-to-ampl/

Re:A Global Optimization Algorithm Worth Using by xoroshiro on Thursday February 22, 2018 @10:57PM (#16444089)
Oh, wow. I couldn't really figure out which parts of AMPL were proprietary and I guess I immediately dismissed it after that without understanding how it worked.

As for Pyomo, while at first glance I dislike the syntax (it's not as easy to share with others, at least compared to something like GNU MathProg, where the receiver doesn't need to concern themselves with python or julia), I like python enough to maybe give it a try. I'll have to learn more about it though. Thanks to you and the others!

Re:A Global Optimization Algorithm Worth Using by gugagore on Thursday February 22, 2018 @10:03PM (#16443851)
Why does it matter whether the solvers themselves have a common language if it's possible to make interfaces to solvers that expose a common language?
Re:A Global Optimization Algorithm Worth Using by xoroshiro on Thursday February 22, 2018 @10:31PM (#16443972)
I guess it doesn't matter that much, but if there were a common language, it would be a nice feature that would allow you to skip the middleman altogether and have simpler dependencies if you know which solvers you want.

It's the common language that matter more though. I've used GAMS in my undergrad, so I'm under the impression that it's had at least some adoption, but it's proprietary AFAIK. I've know some people who use AMPL too, which also seems popular, but I'm not sure about it's licenses.

Re:A Global Optimization Algorithm Worth Using by mzl on Friday February 23, 2018 @01:59AM (#16444732)
You might also be interested in looking at MiniZinc (http://minizinc.org/). It is mostly used int the constraint programming community, but the language is solver technology neutral and there are back-ends that translate to MIP systems.

The MiniZinc Challenge (http://www.minizinc.org/challenge2017/results2017.html) is a competition between various solvers where the organizers enter some MIP solver back-ends also.

Personally I enjoy using MiniZinc as a language for prototyping models in, and enabling me to experiment and compare various different solver technologies easily.

Re:A Global Optimization Algorithm Worth Using by perturbation on Thursday February 22, 2018 @04:36PM (#16441620)
Speaking of optimization libraries, I've been checking out https://developers.google.com/optimization/ for scheduling and assignment problems. The documentation is not... wonderful, but it has a lot of examples and a decent Python API.

I recently did an "Intro to OR" class and most of the tools we used were proprietary. I've been looking for more open source tools (and more info on OR in general, I think it's fascinating!).

Edit: NLOpt (https://nlopt.readthedocs.io/en/latest/) is also a nice suite of optimization algorithms for non-linear optimization.

Re:A Global Optimization Algorithm Worth Using by wenc on Thursday February 22, 2018 @04:42PM (#16441675)
I highly recommend taking a look at the COIN-OR (Computational Infrastructure for Operations Research) project page. All the code is open-source. There are some amazing solvers in that list. https://www.coin-or.org/projects/

The only issue is that much of the code on that site is very cutting-edge and academic. You may need to read a few benchmarks/publications to figure which solvers are production quality and which are not.

That said, a handful of these free solvers are so well-written that they exceed the performance of many commercial solvers for certain types of optimization problems.

(A notable exception is MIPs. Commercial MIP solvers like Gurobi or CPLEX are orders of magnitude better than the open-source CBC or GLPK. CBC is still pretty ok though, and I bundle it when I need to include a free solver in my code to solve smaller problems.)

Re:A Global Optimization Algorithm Worth Using by twic on Thursday February 22, 2018 @05:58PM (#16442357)
I've used the linear programming bit of COIN-OR - Clp and Cbc. They may not be as good as the commercial solvers, but they're still way better than the other open-source options. That is particularly impressive given that, AIUI, they are largely the work of one man, John Forrest.

For general optimisation, i've used NLopt. It was very easy to use, and has a pretty sensible set of algorithms.

One thing i've learnt is that comparing optimisation algorithms is really hard. One might be better at one problem, one at another. One pretty general axis of variation is problem size: some algorithms scale to orders of magnitude more variables (or constraints etc) than others.

In particular, i get the impression that a lot of the cutting-edge research is about being able to solve huge problems at all, or in hours instead of days. Perhaps those algorithms will be more useful for ML hyperparameter optimisation, but unfortunately, my needs are about solving much simpler problems in a fraction of a second. I get a lot more excited about Michael Powell's algorithms, which are cunning but simple, and work well on my problems.

Re:A Global Optimization Algorithm Worth Using by wenc on Thursday February 22, 2018 @08:09PM (#16443287)
> They may not be as good as the commercial solvers, but they're still way better than the other open-source options.

Agreed. CBC/Clp are the best open-source LP/MIP solvers out there. SCIP is better, but it's not fully free.

> For general optimisation, i've used NLopt. It was very easy to use, and has a pretty sensible set of algorithms.

I noticed the omission of IPOPT support in NLopt. IPOPT is one of the best large-scale nonconvex NLP solvers out there (if you have exactly 2nd order derivative information, typically from AD).

> One thing i've learnt is that comparing optimisation algorithms is really hard. One might be better at one problem, one at another. One pretty general axis of variation is problem size: some algorithms scale to orders of magnitude more variables (or constraints etc) than others.

Very true. The academic world has standardized on Dolan-More charts for comparing optimizers on a standard corpus of problems, and those are the closest we have to quantifying general performance. But the no-free lunch theorem applies. There's also a lot of randomness and chance involved, e.g. initialization points can drastically affect nonconvex solver performance on the same problem. So can little things like ordering of constraints or the addition of redundant non-binding constraints (!) for MIPs (this was demonstrated by Fischetti). That's why modern MIP solvers include a random perturbation parameter.

> ML hyperparameter optimisation

Most types of hyperparameter optimization are black-box optimization problem with no analytic derivative information, which much of research in deterministic optimization does not address. Black-box problems typically rely on DFO (Derivative-Free Optimization) methods. DFO methods are even harder to quantify in terms of performance. The Nelder-Mead Simplex method is as good a method as any.

Re:A Global Optimization Algorithm Worth Using by twic on Friday February 23, 2018 @05:50PM (#16450316)
Interesting! My problems are derivative-free, and my gut feeling is that a lot of real-world engineering-type problems are, because at some point they involve some gnarly nonlinear maths. In my case, my variables are about the positions of some knots from which i construct a monotonic cubic spline, which i then use as a parameter to another model; my objective function is how well that model reproduces some real measurements. I get a headache just writing it all down.

I've had good results from simplex; i'm a bit sad to hear there isn't some magical algorithm that will give me a massive speedup over it.

I haven't tried automatic differentiation. That seems extremely daunting given the volume of code in my problem. Someone has done some groundwork on AD of the main library i use in my model, but it would still be a serious bit of work.

Re:A Global Optimization Algorithm Worth Using by wenc on Saturday February 24, 2018 @12:32PM (#16454280)
> positions of some knots

Optimal knot placement, though seemingly simple, can be a gnarly problem due to degeneracy in many cases. Anecdotally I've found quadratic splines to still be somewhat tractable with exact methods, but polynomial splines with cubic or higher orders can be tricky, especially when they are large-scale.

For derivative-free optimization, you can sometimes get speedups from just adopting a embarassingly parallel algorithm like Particle Swarm. These types of stochastic algorithms aren't necessarily algorithmically better than Nelder-Mead Simplex, but they can explore a larger terrain in parallel, which may help. If you can find some parallel stochastic code, you should be able to spin up a VM on the cloud with lots of cores to help you search the space.

Re:A Global Optimization Algorithm Worth Using by tavert on Thursday February 22, 2018 @08:54PM (#16443562)
Have you contributed to Ipopt? Just wondering if I'd recognize you from the mailing list.
Re:A Global Optimization Algorithm Worth Using by wenc on Thursday February 22, 2018 @11:02PM (#16444115)
No, but I was a big-time user and really pushed it to its limits with my large-scale nonconvex problems. I never actually tinkered with its internals but I did feed it some very unorthodox formulations. :)
Re:A Global Optimization Algorithm Worth Using by tavert on Thursday February 22, 2018 @07:33PM (#16443029)
John Forrest is a hell of a character too if you ever talk to him in person. He's retired to a villa in Italy but still works on Clp, Cbc, and various consulting projects for fun: http://fastercoin.com/f2_files/about.html
Re:A Global Optimization Algorithm Worth Using by twic on Friday February 23, 2018 @05:42PM (#16450257)
I'm not working on linear programming stuff at the moment, but i am seriously thinking that if i ever get back to it, i'll ask my boss if we can rustle up some budget to hire him!
Re:A Global Optimization Algorithm Worth Using by xoroshiro on Thursday February 22, 2018 @07:33PM (#16443028)
>One thing i've learnt is that comparing optimisation algorithms is really hard

It still boggles my mind how simplex, something that theoretically runs worse that interior point methods is competitive (at least based on what I've read online). I guess with these problems, the instances of the problem has a huge effect on how long approaches take.

>In particular, i get the impression that a lot of the cutting-edge research is about being able to solve huge problems at all

This is also the impression I get. When I look at benchmarks (btw, does anyone know an updated publication for these? A lot of what I find seems to be from years ago. I'm not sure how fast development of these are, but it would be nice to be updated once in a while) it always has some measure of time along with number of instances solved.

>Perhaps those algorithms will be more useful for ML hyperparameter optimisation

I thought about this, and maybe the reason why they largely don't use these have to do with getting results that are good enough (generalize well). A global optimum might not be worth the effort, so they stick to some variant of gradient descent. The measure they look at, after all, is performance on the test set. Aside from that, there may be something specific about a well defined problem that they can use to speed computations up, and a more general approach probably can't assume these for other instances of NLP for example.

Re:A Global Optimization Algorithm Worth Using by wenc on Thursday February 22, 2018 @08:19PM (#16443343)
> It still boggles my mind how simplex, something that theoretically runs worse that interior point methods is competitive (at least based on what I've read online). I guess with these problems, the instances of the problem has a huge effect on how long approaches take.

Well, theoretical worst cases are just that. They are worst case bounds. People think NP-hard problem are intractable, but this is a misunderstanding. Many NP-hard problems can actually be solved with fairly good average case performance.

Case in point: the Simplex method is worst-case exponential time, but its average case performance is actually pretty good.

When Khachiyan first came up with his elipsoid method, it was polynomial time but in practice it was too slow. Karmarkar's interior point algorithm was polynomial time too, but performs much efficiently.

These days though, solve times are predominantly affected by solver heuristics and randomness. The choice of Simplex vs Interior Point does not make a significant difference in many cases.

Re:A Global Optimization Algorithm Worth Using by gugagore on Thursday February 22, 2018 @10:08PM (#16443881)
Just to be clear, NP hardness is a property of a problem class, not an algorithm. Similarly, "NP Hard" isn't the same as "worst case exponential time"
Re:A Global Optimization Algorithm Worth Using by tavert on Thursday February 22, 2018 @07:38PM (#16443069)
> does anyone know an updated publication for these?

Hans Mittelmann (also a wonderful individual) has you covered: http://plato.la.asu.edu/bench.html

Re:A Global Optimization Algorithm Worth Using by blt on Thursday February 22, 2018 @04:31PM (#16441585)
Thanks for sharing this!