Energy-Aware Optimization and Machine Learning Frameworks for Sustainable Cognitive Networks