Task partitioning in swarms of robots: An adaptive method for strategy selection