Skip to content

Add optional jvp, vjp, hvp for vno#1

Open
andrewrosemberg wants to merge 5 commits intoar/vector-nonlinear-oraclefrom
ar/vno_vector_callbacks
Open

Add optional jvp, vjp, hvp for vno#1
andrewrosemberg wants to merge 5 commits intoar/vector-nonlinear-oraclefrom
ar/vno_vector_callbacks

Conversation

@andrewrosemberg
Copy link
Owner

@andrewrosemberg andrewrosemberg commented Mar 18, 2026

update exanauts#243

andrewrosemberg and others added 5 commits March 3, 2026 21:05
…cks into ExaModel

Introduces `VectorNonlinearOracle` (and the companion `ExaModelWithOracle`) so
users can inject an arbitrary nonlinear constraint block — e.g. a GPU physics
simulator or external ODE solver — without having to express it in ExaModels'
SIMD generator language.

Design:
- `VectorNonlinearOracle` holds user callbacks `f!(c,x)`, `jac!(vals,x)`,
  `hess!(vals,x,y)` together with a pre-declared sparsity pattern and bounds.
- `constraint(core, oracle)` registers an oracle in `ExaCore`, appending its
  constraint bounds and updating ncon/nnzj/nnzh.
- `ExaModel(core)` automatically returns an `ExaModelWithOracle` (a new
  `AbstractExaModel` subtype) when oracles are registered, and the plain
  `ExaModel` otherwise.  Existing code is unaffected.
- `ExaModelWithOracle` carries the same SIMD fields as `ExaModel` (objs, cons, θ)
  plus a `Tuple` of oracles and pre-computed row/col offsets.  All NLPModels
  callbacks (cons_nln!, jac_coord!, jac_structure!, hess_coord!,
  hess_structure!, jprod_nln!, jtprod_nln!, hprod!) are overloaded to first
  call the SIMD path then call each oracle's callback into the appropriate view.

Sparsity convention (matching MadNLP/NLPModels):
- `jac_rows/jac_cols` are 1-based within the oracle's own constraint block;
  the row-offset is applied automatically during `jac_structure!`.
- `hess_rows/hess_cols` are 1-based variable indices (lower triangle of H).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@michel2323 michel2323 force-pushed the ar/vector-nonlinear-oracle branch 3 times, most recently from c492d0e to bb78827 Compare March 19, 2026 17:26
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