Optimal treatment and stochastic modeling of heterogeneous tumors