A variational approach to problems of plastic deformation