Optimal behaviour can violate the principle of regularity