Self-adaptation to device distribution in the internet of things