A Variational Principle For Plastic Hinges In A Beam