Open mdhaber opened 3 years ago
@mdhaber is there a wishlist ranking of projects, i.e. what makes sense to prioritize first?
I've updated the HiGHS wrappers (waiting on some bug fixes to open a PR), but it leaves me in the position to start looking at a MIP interface for HiGHS (and presumably the rest of the MIP solvers mentioned here)
I wrote this up for @rgommers based on what we had written for the CZI Cycle 3 proposal and what I'd most like to do for the NASA ROSES opportunity. There's no need to get started on anything yet, but yes, we could start looking into those other HiGHS features we've discussed.
It's pretty difficult to figure out what to prioritize I think. Based on what I'd expect the effort to be plus licensing constraints and future maintenance considerations, my opinion would be:
Sure, I can add more HiGHS work to the list. There are a lot of features they've had that we'd like to wrap (dual problem / sensitivity analysis information and MPS format conversion), and they recently merged a MIP solver into master.
@mdhaber FYI, MPS writer is already available as a development debugging tool in scipy.optimize._highs, just needs a public API. The HiGHS reader should be similarly easy to wrap. The hard part here is making tests
@mdhaber I have a HiGHS MIP wrapper working in a branch of my HiGHS fork.
Major changes:
intcon
argument to highs_wrapper
to give the index of integer-valued variablesmip_feasibility_tolerance
(there are more and another set of message levels we'll have to figure out...)intcon
is nonempty. We can set this manually, but MIP seems to crash if mip=True
and intcon
is empty, so I'm doing the thing that makes it not crashI only tested on a few small examples and I expect it will require a lot more testing and debugging.
I would like to wait until https://github.com/scipy/scipy/pull/13197 is merged before I start on another PR because my changes are based on updates in the existing PR.
Ok. I can't really work on optimize right now, though : / There is too much to finish on stats. When this project is done, though, I'll take a look.
I have a HiGHS MIP wrapper working in a branch of my HiGHS fork.
That sounds great!
I would like to wait until scipy#13197 is merged before I start on another PR because my changes are based on updates in the existing PR.
You can always base one PR on the other one - it'll have duplicate commits, but those will disappear as soon as PR 1 is merged.
@mdhaber it would be nice to move this content, which will be useful long-term, into a couple of issues on the main repo. Maybe one for sparse and one for optimize, as tracking issues for external libraries that we'd like to have wrappers/interfaces for?
SciPy seeks to provide access
This issue summarizes the status of SciPy's support for sparse linear algebra and optimization, and it details what I propose to add.
Linear Algebra
SciPy has some support for sparse linear algebra:
scipy.sparse.linalg.spsolve
uses SuperLU unlessscikit-umfpack
can be imported, in which case it usesscikit-umfpack
's interface to the GPL-licensed UMFPACK, the LU solver from SuiteSparse.scipy.sparse.linalg
provides interfaces to these for solving eigenvalue and singular value problems.SciPy lacks sparse support for other fundamental linear algebra algorithms, most notably Cholesky decomposition and QR decomposition. Also, better support for sparse SVD has been desired for years (gh-857). There is some support for solving these problems in the greater scientific Python ecosystem, but there are also unmet needs. Following the model of SciPy's
scipy.sparse.linalg.spsolve
, my goal is to enable easy access to both permissively-licensed implementations and more performant (potentially copyleft-licensed) implementations of algorithms for these problems from Linux, Mac, and (the oft forgotten) Windows.scikit-sparse provides an interface to the LGPL-licensed CHOLMOD, the Cholesky routines from SuiteSparse. However, installation on Windows is problematic (see Installation Notes below), and scikit-sparse does not appear to be actively maintained. I propose to
scipy.sparse.linalg
interface to both the permissively-licensed implementation and the more performant CHOLMOD.sparseqr/PySPQR provides an interface to the GPL-licensed SPQR, the QR routines from SuiteSparse. However, installation on Windows is problematic (see Installation Notes below). I propose to:
scipy.sparse.linalg
interface to both the permissively-licensed implementation and the more performant SPQR.scikit-umfpack provides an interface to the GPL-licensed UMFPACK, the LU routines from SuiteSparse. However, installation on Windows is problematic (see Installation Notes below), and scikit-umfpack does not appear to be actively maintained. I propose to:
For improved sparse SVD support, @WarrenWeckesser has also indicated interest in vendoring PROPACK, finishing the pypropack wrapper, and including an interface in
scipy.sparse.linalg.svd
Optimization
SciPy has some support for sparse optimization:
scipy.optimize.minimize(method='trust-constr')
andscipy.optimize.linprog(method='interior-point')
exploit sparsity, and SciPy 1.6 will vendor the linear programming software HiGHS and add an interface vialinprog
. However, these offerings are substantially less powerful than copyleft-licensed counterparts, and convenient Python interfaces to the copyleft software is not available on all platforms. Following the model of SciPy'sscipy.sparse.linalg.spsolve
, my goal is to enable access to both permissively-licensed implementations and more performant (potentially copyleft-licensed) implementations of these solvers from Mac, Linux, and Windows.CyLP provides an interface to COIN-OR's Eclipse 2.0-licensed linear and mixed-integer program solvers, including CLP (the highest performance open-source linear programming solver) and CBC (one of the best open-source mixed-integer programming solvers). Installation on Windows is easy via
pip
, but is not available viaconda
. Also, the interface uses a modeling language approach rather than the direct approach more familiar to users of Matlab and SciPy, and the documentation is not very friendly. I propose to:scipy.optimize
interface to the CLP/CBC solvers.scipy.optimize
interface to HiGHS' mixed-integer programming capabilities.cyipopt and Gekko both provide interfaces to COIN-OR's Eclipse 2.0-licensed nonlinear programming solver IPOPT, the highest performance open-source linear programming solver. Installation of cyipopt on Windows is problematic (see Installation Notes below), and Gekko's interface uses a modeling language approach rather than the direct approach more familiar to users of Matlab and SciPy. I propose to:
scipy.minimize
interface to IPOPT.Installation Notes
Notes from attempts to install the software above on Windows 11/30/2020:
conda install suitesparse
worksconda install -c conda-forge scikit-umfpack
failspip install scikit-umfpack
reports success, butfrom scikits import umfpack
failsconda install -c conda-forge scikit-sparse
failspip install scikit-sparse
failssparseqr
is not available on conda-forgepip install git+https://github.com/yig/PySPQR.git
failspip install sparseqr
failspip install cylp
works, and the software workscylp
is not available on conda-forgepip install ortools
works, and the software worksconda install -c conda-forge ipopt
worksconda install -c conda-forge cyipopt
failspip install ipopt
fails