This is a super hacky version right now. But it does a minimization

and returns a result.

I've got to sanity check this for a while, though.