Trophallaxis and energy optimization in swarms of robots