  Reconstructed mass variables, such as $M_2$, $M_{2C}$, $M_T^\star$, and
$M_{T2}^W$, play an essential role in searches for new physics at hadron
colliders. The calculation of these variables generally involves constrained
minimization in a large parameter space, which is numerically challenging. We
provide a C++ code, OPTIMASS, which interfaces with the MINUIT library to
perform this constrained minimization using the Augmented Lagrangian Method.
The code can be applied to arbitrarily general event topologies and thus allows
the user to significantly extend the existing set of kinematic variables. We
describe this code and its physics motivation, and demonstrate its use in the
analysis of the fully leptonic decay of pair-produced top quarks using the
$M_2$ variables.
