Towards a reference architecture for swarm intelligence-based internet of things