Skip to main content

pounce_nl/
lib.rs

1//! AMPL `.nl` reader, reverse-mode AD tape, and TNLP evaluator.
2//!
3//! This crate holds the `.nl` pipeline that used to live in `pounce-cli`:
4//!
5//! - [`nl_reader`] parses a `.nl` file into an [`nl_reader::NlProblem`] (the
6//!   `Expr` DAG, linear parts, bounds, names, starting point) and provides
7//!   [`nl_reader::NlTnlp`], a [`pounce_nlp::tnlp::TNLP`] implementation that
8//!   evaluates objective/gradient/Hessian and constraints/Jacobian.
9//! - [`nl_tape`] flattens an `Expr` DAG into a reverse-mode AD tape with
10//!   colored forward-over-reverse Hessian products.
11//! - [`nl_external`] supports AMPL imported (external) functions via the
12//!   `funcadd_ASL` ABI.
13//! - [`nl_fbbt_translate`] lowers an `Expr` to an `FbbtTape` for
14//!   feasibility-based bound tightening.
15//! - [`sol_writer`] is the reader's inverse: it formats a solve's primals,
16//!   duals, and suffixes as an AMPL `.sol` file. It lives here (rather than
17//!   in the CLI, which owned it until the browser frontend needed it too) so
18//!   every frontend emits the same file — same dual sign convention, same
19//!   suffix headers.
20//!
21//! It is a leaf crate (depends only on `pounce-common` and `pounce-nlp`) so
22//! both the CLI and the Python bindings can read and evaluate `.nl` models
23//! without depending on each other.
24
25pub mod nl_external;
26pub mod nl_fbbt_translate;
27pub mod nl_reader;
28pub mod nl_tape;
29pub mod sol_writer;