A multi-armed bandit framework for online optimization in green integrated terrestrial and non-terrestrial networks