You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename ESR/HSR to linearizable_convex/linearizable_concave
Spell out opaque acronyms for clarity per PR review feedback:
is_atom_esr → is_atom_linearizable_convex,
is_atom_hsr → is_atom_linearizable_concave,
is_esr → is_linearizable_convex, is_hsr → is_linearizable_concave,
is_smooth → is_linearizable.
Docstrings clarify that "linearizable convex" means the expression is
convex after linearizing all smooth subexpressions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New files should include the Apache 2.0 license header:
84
+
New files should include the Apache 2.0 license header (matching the convention used in the majority of the codebase):
83
85
```python
84
86
"""
85
-
Copyright 2025, the CVXPY developers
87
+
Copyright, the CVXPY authors
86
88
87
89
Licensed under the Apache License, Version 2.0 (the "License");
88
90
you may not use this file except in compliance with the License.
@@ -129,6 +131,8 @@ Key reduction classes in `cvxpy/reductions/`:
129
131
130
132
For DNLP: `CvxAttr2Constr` → `Dnlp2Smooth` → `NLPSolver`
131
133
134
+
Note: The standard `SolvingChain` in `solving_chain.py` handles DCP/DGP/DQCP solver selection automatically. NLP solving is triggered explicitly via `prob.solve(nlp=True)` and bypasses the standard chain.
135
+
132
136
### Solver Categories
133
137
134
138
-**ConicSolvers** (`cvxpy/reductions/solvers/conic_solvers/`) - SCS, Clarabel, ECOS, etc.
@@ -142,12 +146,20 @@ The NLP infrastructure provides oracle-based interfaces for nonlinear solvers:
142
146
-`Bounds` class: extracts variable/constraint bounds from problem
143
147
-`Oracles` class: provides function and derivative oracles (objective, gradient, constraints, jacobian, hessian)
144
148
-`dnlp2smooth.py` - Transforms DNLP problems to smooth form via `Dnlp2Smooth` reduction
145
-
- DNLP validation: expressions must be smooth (ESR and HSR)
149
+
- DNLP validation: expressions must be linearizable (linearizable convex and linearizable concave)
146
150
- Problem validity checked via `problem.is_dnlp()` method
147
151
148
152
### Diff Engine (SparseDiffPy)
149
153
150
-
The automatic differentiation engine is provided by the [SparseDiffPy](https://github.com/SparseDifferentiation/SparseDiffPy) package (`pip install sparsediffpy`), which wraps the [SparseDiffEngine](https://github.com/SparseDifferentiation/SparseDiffEngine) C library. It builds expression trees from CVXPY problems and computes derivatives (gradients, Jacobians, Hessians) for NLP solvers. New diff engine atoms require C-level additions in SparseDiffPy.
154
+
The automatic differentiation engine is provided by the [SparseDiffPy](https://github.com/SparseDifferentiation/SparseDiffPy) package (installed automatically as a hard dependency), which wraps the [SparseDiffEngine](https://github.com/SparseDifferentiation/SparseDiffEngine) C library. It builds expression trees from CVXPY problems and computes derivatives (gradients, Jacobians, Hessians) for NLP solvers.
155
+
156
+
Adding a new diff engine atom requires:
157
+
1. C-level implementation in SparseDiffPy
158
+
2. Python-side converter in `cvxpy/reductions/solvers/nlp_solvers/diff_engine/converters.py` (add to `ATOM_CONVERTERS` dict)
159
+
160
+
The diff engine supports CVXPY `Parameter` objects: `C_problem` registers parameters with the C engine and `update_params()` re-pushes values without rebuilding the expression tree. Sparse parameter values are fused into sparse matmul operations.
161
+
162
+
`DerivativeChecker` in `nlp_solver.py` provides finite-difference verification of gradients, Jacobians, and Hessians during development.
151
163
152
164
## Implementing New Atoms
153
165
@@ -164,15 +176,15 @@ The automatic differentiation engine is provided by the [SparseDiffPy](https://g
164
176
1. Create a canonicalizer in `cvxpy/reductions/dnlp2smooth/canonicalizers/`
165
177
2. The canonicalizer converts non-smooth atoms to smooth equivalents using auxiliary variables
166
178
3. Register in `canonicalizers/__init__.py` by adding to `SMOOTH_CANON_METHODS` dict
167
-
4. Ensure the atom has proper `is_smooth()`, `is_esr()`, `is_hsr()` methods
179
+
4. Ensure the atom has proper `is_linearizable()`, `is_linearizable_convex()`, `is_linearizable_concave()` methods
0 commit comments