Multimodal Function Optimization using a Glowworm Metaphor with Applications to Collective Robotics