Stochastic optimization for Markov modulated networks with application to delay constrained wireless scheduling