NLP Tutorial Series

A series of 15 Jupyter notebooks taking you from "beginner in nonlinear programming" to understanding every component of ripopt — written in Python (numpy, scipy, matplotlib), with each notebook connecting directly to ripopt's source code.

All notebooks are in tutorials/ in the repository.

Module 1: NLP Foundations

#NotebookKey concepts
01Introduction to Nonlinear ProgrammingProblem formulation, feasibility vs optimality, HS071
02Unconstrained OptimizationGradient descent, Newton's method, Armijo/Wolfe line search, L-BFGS
03KKT ConditionsLagrangian, complementarity, geometric interpretation, LICQ

Module 2: Classical Constrained Methods

#NotebookKey concepts
04Penalty Methods and Augmented LagrangianQuadratic penalty, ill-conditioning, Method of Multipliers
05Sequential Quadratic ProgrammingQP subproblem, active set, BFGS update, L1 merit function

Module 3: Barrier Methods

#NotebookKey concepts
06The Logarithmic Barrier MethodLog barrier, central path, barrier parameter sequence
07Primal-Dual Interior Point MethodPerturbed KKT, Newton step derivation, fraction-to-boundary, complete IPM

Module 4: Linear Algebra at the Core

#NotebookKey concepts
08The KKT (Saddle-Point) MatrixKKT structure, Sylvester's Law of Inertia, condensed KKT
09LDL^T and Bunch-Kaufman PivotingSymmetric Gaussian elimination, BK pivoting, inertia from D
10Inertia Correction and Regularizationδ_w and δ_c perturbations, correction loop, iterative refinement

Module 5: Line Search, Filter, and Convergence

#NotebookKey concepts
11Filter Line SearchFilter concept, acceptance criteria, switching condition, SOC
12Convergence Criteria and ScalingThree KKT residuals, s_d/s_c scaling, NLP scaling

Module 6: Robustness

#NotebookKey concepts
13The Restoration PhaseGauss-Newton restoration, NLP restoration subproblem, recovery strategies
14Mehrotra Predictor-CorrectorAffine-scaling predictor, adaptive centering σ = (μ_aff/μ)³, Gondzio corrections

Module 7: ripopt in Practice

#NotebookKey concepts
15ripopt in PracticeNlpProblem interface, fallback cascade, sensitivity analysis, benchmarking

Running the notebooks

git clone https://github.com/jkitchin/ripopt.git
cd ripopt/tutorials
pip install numpy scipy matplotlib jupyter
jupyter lab

Each notebook is self-contained. No Rust installation required for notebooks 01–14. Notebook 15 describes the Rust interface with Python equivalents for all concepts.

ripopt source pointers

Each notebook ends with a "Connection to ripopt" section. The key mappings:

TopicNotebookripopt source
KKT assembly08src/kkt.rsassemble_kkt()
Bunch-Kaufman LDL^T09src/linear_solver/dense.rsDenseLdl
Inertia correction10src/kkt.rsfactor_with_inertia_correction()
Filter line search11src/filter.rscheck_acceptability()
Convergence12src/convergence.rscheck_convergence()
Restoration13src/restoration.rs, src/restoration_nlp.rs
Mehrotra PC14src/ipm.rs — main loop
Problem interface15src/problem.rsNlpProblem trait