ericphanson / ConvexTests.jl

Uses the Convex.jl Problem Depot to test various optimization solvers
MIT License
10 stars 5 forks source link

Add Hypatia #5

Closed ericphanson closed 3 years ago

ericphanson commented 4 years ago

it has reached 0.1 according to https://discourse.julialang.org/t/hypatia-jl-a-new-solver-for-generic-conic-optimization/47786, and it might be nice to see how it does here

chriscoey commented 4 years ago

Thanks! Hypatia isn't as optimized as most other conic solvers for "standard" cones like nonneg/second-order/PSD/exp/pow (the union of cones recognized by common conic solvers), but on more "exotic" cones eg logdet, rootdet, L1 epigraph, relative entropy, complex PSD, it should have an advantage in many cases. BTW we have many examples in https://github.com/chriscoey/Hypatia.jl/tree/master/examples, some written in JuMP, most using "exotic" cones (only a few of these are recognized by MOI though currently). Some of these examples may be useful to adapt for ConvexTests and anyone is welcome to do that.

ericphanson commented 4 years ago

That's really cool :). I think it would be great to hook up Convex better to MOI so we can pass through exotic cones easily (ref https://github.com/jump-dev/Convex.jl/pull/393). I'm not really doing much optimization these days though so I probably won't have time for that any time soon.

ConvexTests is aimed at checking correctness more than speed, btw; these aren't traditional benchmarking problems, but rather are problems from SumOfSquares and Convex.jl's test suite, reformatted to be easily accessible to solver-developers and users. I first put it together when SCS was failing a couple of Convex.jl's tests, and when I went to find another open source solver to use instead, I found none that could pass the tests (with their default parameters). I found that a bit disturbing so I put together this repo to help bring visibility to correctness issues. Luckily things have improved a bit since then (and some solvers just need some parameter tweaks).

chriscoey commented 4 years ago

Good to know! This is very useful for checking correctness of Hypatia's certificates, which is handy because we have a few things going on with preprocessing for example. So does ConvexTests check termination status, or does it just ignore that? I suppose it does not allow for nearly/almost statuses, e.g. NEARLY_FEASIBLE_POINT? I am worried Hypatia would fail tests because we often can't quite converge to our default tolerance of about 1e-7/1e-8. We haven't yet set up Hypatia to return "nearly" statuses but we will soon. How would you choose a tolerance to use for Hypatia in ConvexTests, or do you just use Hypatia's defaults? edit: also Hypatia can be run in BigFloat (I see you ran this with Tulip) etc, though currently not thru our MOI interface as I need to make those MOI functions accept generic reals. We should pass tests more reliably there, assuming the test/convergence tolerances stay the same.

ericphanson commented 4 years ago

So does ConvexTests check termination status, or does it just ignore that?

Some of the Convex.jl-based ones tests do, but most don't, AFAIK. I'm not sure about the SumOfSquares tests (cc @blegat). I think ideally we would have a good system for this (ref https://github.com/ericphanson/ConvexTests.jl/issues/3).

Currently all the Convex.jl-based tests use atol=1e-3 to test solution values independently of the solver. I think also ideally we would let the solvers choose to what tolerance they should be reliable for (this is theoretically easy to do for the Convex.jl-based tests because they all take an atol and rtol argument; they are written as functions as documented here: https://jump.dev/Convex.jl/stable/problem_depot/#How-to-write-a-ProblemDepot-problem-1).

How would you choose a tolerance to use for Hypatia in ConvexTests, or do you just use Hypatia's defaults?

Whatever Hypatia wants; we have a test-harness that takes in an optimizer constructor, so we can put whatever arguments there as needed; see COSMO for example: https://github.com/ericphanson/ConvexTests.jl/blob/a4c02dca1c42558144c72d7a25afd365a4dc9a81/COSMO/test.jl#L5

Relatedly, the issue https://github.com/ericphanson/ConvexTests.jl/issues/4 tracks the need for more explicit requirements for the solvers. So far I've suggested a 30 minute total solve time limit to make running the tests not take too long.

also Hypatia can be run in BigFloat (I see you ran this with Tulip) etc, though currently not thru our MOI interface as I need to make those MOI functions accept generic reals. We should pass tests more reliably there, assuming the test/convergence tolerances stay the same.

Great to hear! I've solved problems with BigFloats (and Double64 in fact) through MOI with Convex via SDPA-GMP (we have a wrapper here) and we fixed up some MOI type-bugs on the way but I wouldn't be so surprised to here there's more. Note that we don't run the MOI tests themselves here (which are not generalized to BigFloats as you know, ref https://github.com/jump-dev/MathOptInterface.jl/issues/841) so that part shouldn't be an issue.

chriscoey commented 3 years ago

Thanks for the info! I just registered v0.4.0 of Hypatia. To set us up on here, should I just try copying https://github.com/ericphanson/ConvexTests.jl/blob/master/ECOS/test.jl but not exclude sdp?

ericphanson commented 3 years ago

Yep! And add it here: https://github.com/ericphanson/ConvexTests.jl/blob/ea8cf4caf4888b38c3310238cef4a7eb6f43e68f/.github/workflows/ci.yml#L17