Added regularization and constraints to optimizer API