Make eigenvalue PSD/NSD tolerance configurable in hull exact quadratic reformulation#3
Conversation
Co-authored-by: sergey-gusev94 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds a configurable numerical tolerance for eigenvalue-based PSD/NSD checks used by the GDP hull transformation’s exact quadratic hull reformulation, replacing a previously hardcoded constant so users can tune behavior for ill-conditioned quadratic forms.
Changes:
- Document
eigenvalue_toleranceinHull_Reformulationdocstring. - Declare
eigenvalue_toleranceinHull_Reformulation.CONFIG(default1e-10). - Use
self._config.eigenvalue_tolerancein the eigenvalue convexity check instead of a hardcoded1e-10.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| numerical_tolerance = self._config.eigenvalue_tolerance | ||
| eigenvalues, _ = np.linalg.eigh(Q) | ||
| Q_is_psd = not np.any(eigenvalues < -numerical_tolerance) | ||
| Q_is_nsd = not np.any(eigenvalues > numerical_tolerance) |
There was a problem hiding this comment.
This change introduces a new public config option (eigenvalue_tolerance) that affects whether the conic vs general exact-hull formulation is selected, but there do not appear to be any existing tests covering exact_hull_quadratic (and thus none validating that this tolerance is honored). Please add a focused unit test that sets exact_hull_quadratic=True and varies eigenvalue_tolerance to flip the PSD/NSD classification for a nearly-singular Q, asserting the chosen reformulation differs.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
The numerical tolerance used for eigenvalue-based convexity checks in the exact hull quadratic reformulation (
exact_hull_quadratic=True) was hardcoded at1e-10, making it impossible to tune for ill-conditioned Q matrices without modifying source code.Changes
eigenvalue_tolerance(default1e-10,PositiveFloat) added toHull.CONFIG, following the same pattern asEPSself._config.eigenvalue_toleranceUsage
Larger values make the convexity check more conservative; smaller values more permissive.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.