Stability of the solutions of one-sided variational problems with applications to the theory of plasticity