Instead of manually switching from `ADAM` to `BFGS`, we should just use `PolyOpt` which does this for us. I'll try to implement and test it this week.