pounce-rs
A single-crate entry point for solving nonlinear programs with POUNCE in Rust. It provides two APIs:
- a high-level builder API (
Problem+Nlp) for the common case, where only the objective is required and everything else is optional; and - the low-level
TNLPtrait, re-exported for full control over Hessians, sparsity patterns, scaling, and other advanced features.
Both APIs are backed by the same pure-Rust interior-point solver.
Install
or add it to Cargo.toml:
[]
= "0.8"
Quick start
Implement Problem (only objective is required), then configure and solve
with the Nlp builder:
use *;
// min (x0-1)^2 + (x1-2)^2 s.t. x0 + x1 == 3, 0 <= xi <= 5
;
let sol = new // variable count inferred below
.var_bounds
.constraint_bounds // equality: lower == upper
.x0
.option_num
.solve;
assert!;
assert!;
Anything you don't implement is provided automatically. Missing gradients and Jacobians are approximated with finite differences, while the Hessian defaults to a limited-memory (L-BFGS) approximation. This keeps simple problems concise without sacrificing access to exact derivatives when needed.
Solver options use the same names as upstream Ipopt
(option_num, option_int, option_str).
Result
Nlp::solve returns a Solution containing
successand the fullstatus- the optimal point
x - the objective value
- constraint multipliers (
multipliers) - constraint values (
g) - bound multipliers (
z_landz_u) - solve statistics (
stats): wall time, iteration count, evaluation counts, and final infeasibilities
The vector fields remain empty if the solve aborts before finalization. Opt in
to the full per-iteration trajectory (stats.iterations) with
.capture_iterations() on the builder.
Full control: the TNLP trait
For problems that need an exact Hessian, custom Jacobian/Hessian sparsity, or
NLP scaling, implement the re-exported TNLP trait directly and drive it with
IpoptApplication. The whole surface is reachable through the prelude.
See the crate docs on docs.rs for a complete HS071
TNLP walkthrough.
License
EPL-2.0.