add the optimizer and model