On the formation and stability of dislocation patterns—I: One-dimensional considerations