oxfordcontrol / Clarabel.jl

Clarabel.jl: Interior-point solver for convex conic optimisation problems in Julia.
Apache License 2.0
173 stars 16 forks source link

`DirectLDLKKTSolver` assumes an upper triangular KKT system (easily fixed) #155

Closed mipals closed 6 months ago

mipals commented 6 months ago

Hi Paul (and the rest of the Clarabel team),

While adding Panua-Pardiso to the possible solvers I encountered an error where the final KKT-system turned out to be diagonal-only. Initially I was confused, but it turns out this line assumes that the KKT data is given as a upper-triangular.

https://github.com/oxfordcontrol/Clarabel.jl/blob/1f654b0b9a0450673fda7e17f95af5fa9798c1c1/src/kktsolvers/kktsolver_directldl.jl#L76

As this is not the case for Panua-Pardiso it simply removed the lower triangular part and left the KKTSym matrix as a diagonal matrix. I've fixed this in my fork by simply adding this

https://github.com/mipals/Clarabel.jl/blob/94c069b3ad4c43c5f156a660e34bae43d742ec5c/src/kktsolvers/kktsolver_directldl.jl#L76-L80

If you want I can make a PR with the fix + Panua-Pardiso solver.

Cheers, Mikkel

goulart-paul commented 6 months ago

Thanks. It should be fixed now.

Possibly relevant to you : I encountered a similar problem when implementing an interface for the HSL MA57 solver. There is a branch implementing a wrapper for that solver that is in reasonably good shape, but hasn't been merged yet.

If you are testing various linear solvers I could probably fix up the HSL code to give you an additional option.

mipals commented 6 months ago

Perfect, your solution seems a little cleaner than mine :)

I was just testing some stuff. I’ve been helping getting Pardiso.jl back on track (and fixing some issue on Panuas end). Since apple silicon does not run MKL i thought it was a fun project to get Panua-Pardiso to work with Clarabel. It was pretty easy (honestly almost just a total copy-paste of your MKL code), but then ran into the symmetry-issue described here.

Maybe maybe later this year I will do some benchmarking/tests of various sparse solvers. I will get back to you if/when that is. Do you by any chance know if HSL run on apple silicon?

goulart-paul commented 6 months ago

I was able to get HSL to run on Apple M2, yes.