Fix more algorithm issues and allow build_polytope to work with both
minimizing and maximizing algorithms