Exact and metaheuristic approaches to extend lifetime and maintain connectivity in wireless sensors networks