A generalized variable formulation for gradient-dependent softening plasticity