Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Constrained

The constrained module in GTSAM provides constrained nonlinear optimization on top of factor graphs. It includes classes for representing constraints, building constrained problems, and solving them with penalty and augmented Lagrangian methods.

Core Problem Model

Equality Constraints

Inequality Constraints

Optimizers

How the Pieces Fit Together

For a new user, it helps to think in two phases:

  1. Build a constrained problem.

  2. Run a constrained solver on that problem.

Inequality constraints can use different smooth penalty shapes via InequalityPenaltyFunction (ramp, smooth polynomial ramps, or softplus), which controls behavior near the active constraint boundary.

1) Build the Problem

This stage is about modeling: you separate what you want to minimize (objective terms) from what must hold (constraints), then combine them into a single ConstrainedOptProblem object that the solvers can consume.

2) Solve the Problem

This stage is algorithmic: pick a constrained solver, form iterative unconstrained subproblems internally, and solve those subproblems with a standard nonlinear optimizer until constraint violation and cost are reduced.