Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement open source solvers #363

Merged
merged 17 commits into from
Oct 11, 2023

Commits on Oct 2, 2023

  1. Configuration menu
    Copy the full SHA
    3ce457d View commit details
    Browse the repository at this point in the history
  2. Remove initialize() from solvers

    The advantage of an initialize() method is to pre-cache an expensive operation.
    
    For QPSolver:
      QPSolvers are always instantiated, then solved immediately.
      There's no caching going on here.
    
    For MIQPSolver:
      In BIC threshold loops, MIQP solver.solve is run a few times.
      The initialize method can either
        a. be made private here, since it saves us N loop iterations * 2 inner products
        b. be thrown away, since these inner products are pretty cheap as
           there aren't many conformers for MIQP
      I've decided on (a), as I don't know the performance improvement of
      pre-caching here, and maybe later on MIQP will be done in situations
      with lots of conformers?
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    fae2263 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d0aa619 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    aad11de View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    33386f3 View commit details
    Browse the repository at this point in the history
  6. Remove duplicate code

    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    539f1b7 View commit details
    Browse the repository at this point in the history
  7. Refactor solvers.py: use ABC to define "interface", present only avai…

    …lable solvers to user.
    
    **Single responsibility**
    - The solvers.py module shouldn't be responsible / shouldn't contain the
      logic for deciding _which_ solver to use.
      This should be left up to the invocation script (e.g. qfit_protein.py).
    - We should however, guarantee that all Solvers will conform to a particular
      interface. solvers.py is thus an _adapter_ module between a variety of
      solver packages and the common interface we define here.
    
    **importlib hooks, lazy module loading** (utils/optional_lazy_import.py)
    - We will provide some helper functions to allow the invocation scripts
      to know what solvers are available (and present them as options to the
      user).
    - Each solver must try to import its own 'driver' module (e.g. cplex,
      cvxopt). This is _modular_.
    - We also want to have a lazy import: modules are not executed when they
      are imported, only on first property call.
      Without a LazyLoader, since all solver 'driver' modules are imported
      during creating the argparse options, they would be eagerly executed,
      taking a lot of time for the user.
      With a LazyLoader, while the driver modules have been "imported", we
      delay their code execution until when they are first used.
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    9d24cc0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    cbd9f1a View commit details
    Browse the repository at this point in the history
  9. Roll back "Remove MIOSQP"

    This rolls back commit a2bba46, and updates
    it for the current architecture.
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    4cfd927 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    1076f96 View commit details
    Browse the repository at this point in the history
  11. Add solver combinations as "extras"

    If the user installs with `pip install qfit[cplex]`, they get the cvxopt and cplex solver modules.
    `pip install qfit[osqp]` installs the osqp + miosqp solver modules.
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    9f3ace4 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    9173914 View commit details
    Browse the repository at this point in the history
  13. (m) scipy.sparse needs to be imported separately

    All SciPy subpackages need to be imported separately (https://docs.scipy.org/doc/scipy/tutorial/index.html)
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    b7298d5 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    9b3ef29 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    73a68e3 View commit details
    Browse the repository at this point in the history
  16. Add osqp and miosqp to environment.yml

    This is required to get pytest to test these modules
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    a0ef586 View commit details
    Browse the repository at this point in the history
  17. Fix tests/test_qfit_ligand.py for new solvers

    This test actually runs a QFitLigand job, so needs to know which solver to use.
    WARNING: test_qfit_protein.py does not actually run a QFitProtein job,
      so it doesn't need this same mod. It should be re-written.
    blake-riley committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    3adcc6f View commit details
    Browse the repository at this point in the history