Adaptive pedestrian behaviour for the preservation of group cohesion