Learning ensemble strategy for static and dynamic localization in wireless sensor networks