Skip to content

cvxpy port#24

Open
jlperla wants to merge 2 commits into
mainfrom
pkg-update
Open

cvxpy port#24
jlperla wants to merge 2 commits into
mainfrom
pkg-update

Conversation

@jlperla

@jlperla jlperla commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

Pyomo-free cvxpy ports of the economic-dynamics models, solved in-process through cvxpy's DNLP interface (prob.solve(nlp=True, ...)) with UNO (via the unopy wheel) — no solver binary on PATH required. The existing pyomo/ipopt implementations remain selectable via --implementation pyomo.

What's included

  • New *_matern_cvxpy.py models: asset pricing, neoclassical growth (baseline), neoclassical human capital, optimal advertising, and concave-convex growth.
  • Figure/table scripts (figures_*.py, tables_neoclassical_growth.py) take --implementation cvxpy|pyomo, defaulting to cvxpy.
  • Dependencies (pyproject.toml, uv.lock) and README notes on the two solver paths.

Concave-convex threshold figure (final commit)

The bistable threshold sweep now runs on the cvxpy port with UNO instead of pyomo:

  • Flat, complementarity-consistent warm start (k(t)=k_0, consumption at the capital-stationary level, marginal product P seeded on the active production branch). It encodes no knowledge of the steady-state locations or basins of attraction — replacing the earlier ramp toward k_star.
  • Domain bounds on k, mu keep filterSQP trial points in-domain, avoiding the uninterruptible restoration loop that otherwise hung UNO near the kink.
  • Reproduces the pyomo bistable structure away from the threshold; a couple of points right at the kink fail (Skiba ill-conditioning), left visible on purpose.

Per-solve cost away from the boundary (train_points=20): UNO ~14 ms vs ipopt ~10 ms (≈1.4×); full per-call wall comparable (~0.12–0.14 s, dominated by the jax interpolator recompile).

🤖 Generated with Claude Code

jlperla and others added 2 commits June 4, 2026 13:38
Port the kernel-collocation solvers off pyomo onto cvxpy, behind an
`--implementation cvxpy|pyomo` switch on the figure/table scripts (default cvxpy):

- Convex (asset pricing): DCP QP via open-source solvers (OSQP/Clarabel/SCS/HiGHS).
- Nonconvex (neoclassical growth, human capital, optimal advertising): cvxpy DNLP
  (prob.solve(nlp=True, ...)) solved in-process by UNO (unopy, default) or IPOPT (cyipopt).
- Concave-convex growth: an exact DNLP reformulation of the Expr_if production kink,
  with z=k**a making the branches affine so cp.maximum(...) <= Y is a valid L-convex
  epigraph, plus two complementarity equalities pinning the marginal product and binding
  output to the envelope (no smoothing). Defaults to IPOPT; its threshold figure stays on
  pyomo, where the MPCC collocation is fragile on the high-steady-state approach band.

unopy becomes a core dependency (UNO runs in-process, no PATH binary), and the standalone
uno_ampl install instructions are dropped from the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…m start

Switch the concave-convex bistable threshold figure from pyomo back to the
pyomo-free cvxpy DNLP port:

- Flat, complementarity-consistent warm start (k(t)=k_0, consumption at the
  capital-stationary level, P on the active production branch) that encodes no
  knowledge of the steady states or basins of attraction -- replacing the prior
  ramp toward k_star.
- Domain bounds on k and mu keep filterSQP trial points in-domain, avoiding the
  uninterruptible restoration loop that previously hung UNO near the kink.
- Default solver back to UNO; figure default back to cvxpy; UNO console output
  muted via logger=SILENT.

Resolves the bistable structure away from the threshold; a couple of points
right at the kink fail (Skiba ill-conditioning), which is left visible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jlperla

jlperla commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

TODO

  • Consider switching over the cvxpy completely, renaming files accordingly
  • Check setup instructions with UNO on windows/macos/linux to ensure no conda needed.

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.

1 participant