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

BPCG with direct solve extension #507

Merged
merged 21 commits into from
Oct 25, 2024
Merged

BPCG with direct solve extension #507

merged 21 commits into from
Oct 25, 2024

Conversation

pokutta
Copy link
Member

@pokutta pokutta commented Oct 3, 2024

adds a new option to BPCG to directly solve local optimality system as LP if the objective function is of the form f(x) = || x - x_0||^2, i.e., we are solving projection problems. Important for e.g., Sébastien etc. Also, using the same methodology added a sparsify_iterate function that sparsifies the active_set and iterate by solving the representation LP and taking a basis.

Update: added a generic direct_solve method for any quadratic function exploiting chain rule + affine-linearity + convex combinations to build optimality system with black-box access to gradients only. However, slower than the one specific for \ell-2projections; see plots below.

TODO:

  • adjust documentation
  • add unit tests
  • solve the stack overflow issue (@matbesancon this seems to be a julia issue or recursion issue. fixed with loops for now)
  • Parametrize the direct solve intervals
  • Add reporting of step type
  • Add same methodology to sparsify last iterate
  • Move functions direct_solve and sparsify_iterate out of blended_pairwise.jl into e.g., utils.jl
  • Decide whether to propagate, e.g., sparsify to PP for all active set based methods

Speed-ups are very substantial in some cases. See plots below (LP solver was HiGHS):

Screenshot 2024-10-04 at 08 55 05 Screenshot 2024-10-04 at 08 56 41 Screenshot 2024-10-04 at 09 06 45

General Quadratics:

Screenshot 2024-10-04 at 14 00 04 Screenshot 2024-10-04 at 14 24 20

@pokutta
Copy link
Member Author

pokutta commented Oct 3, 2024

@matbesancon there is a weird issue with a stack overflow though that seems to come from julia, e.g., in the example if you set n = 1e4. I guess it happens in the direct_solve function when doing the hcat. maybe there is a better way to do it.

@pokutta
Copy link
Member Author

pokutta commented Oct 3, 2024

@sebastiendesignolle might be also relevant or useful for you to test for bellpolytopes.jl. This is an advanced version of what I explained this morning

@pokutta
Copy link
Member Author

pokutta commented Oct 4, 2024

@matbesancon there is a weird issue with a stack overflow though that seems to come from julia, e.g., in the example if you set n = 1e4. I guess it happens in the direct_solve function when doing the hcat. maybe there is a better way to do it.

seems to be resolved now. I unwrapped the loops

@matbesancon
Copy link
Member

@pokutta
Copy link
Member Author

pokutta commented Oct 4, 2024

@matbesancon ready for review now. feel free to add unit tests and please check the documentation; didn't show up in the preview.

pokutta and others added 7 commits October 4, 2024 21:01
* sparsifier active set

* fix typo

* added sparsifying tests

* generic tolerane

* remove sparsification

* format

* HiGHS dep
* sparsifier active set

* start working on LP AS

* first working quadratic

* remove quadratic LP from current

* cleanup

* HiGHS in test deps

* working reworked LP quadratic

* working version generic quadratic

* slow version generic quadratic

* faster term manipulation

* copy sufficient

* remove comment

* added test for quadratic

* minor

* simplify example

* clean up code, verify error with ASQuad

* Add update_weights! to fix direct solve with active_set_quadratic

* remove direct solve from BPCG

* rng changed

---------

Co-authored-by: Sébastien Designolle <sebastien.designolle@gmail.com>
@matbesancon matbesancon merged commit 1ac1797 into master Oct 25, 2024
12 checks passed
@matbesancon matbesancon deleted the BPCG-with-direct-solve branch October 25, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants