Method of potentials for solving the Monge–Kantorovich transportation problem and the assignment problem