Text this: Optimal Control of Stochastic Dynamic Systems of a Random Structure with Poisson Switches and Markov Switching