Commit ee4d329
Fix PowerApprox support after upstream Power/PowerApprox split
The upstream CVXPY split Power into exact (Power) and approximate
(PowerApprox) subclasses. This broke NLP solving because:
1. dnlp2smooth used `power` (function) as dict key but lookup uses
`type(expr)` which returns the class (Power or PowerApprox)
2. power_canon.py used `p_rational` which doesn't exist on PowerApprox
3. diff_engine converters used "power" (lowercase) but class name is "Power"
Fixes:
- dnlp2smooth/__init__.py: Import Power and PowerApprox classes,
register both with power_canon
- power_canon.py: Use `p_used` instead of `p_rational`
- converters.py: Use "Power" and "PowerApprox" as keys
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent eb26d21 commit ee4d329
3 files changed
Lines changed: 6 additions & 4 deletions
File tree
- cvxpy/reductions
- dnlp2smooth/canonicalizers
- solvers/nlp_solvers/diff_engine
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
| 308 | + | |
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
| |||
0 commit comments