Complex energy networks optimization for renewables exploitation and efficiency increase