Cloud computing is a resource delivery and usage model to get resource (hardware, software and applications) via network \"On-demand\" and \"At scale\" as services in a multi-tenant environment. Resource scheduling based on SLA (Service Level Agreement) in cloud computing is NP-hard problem. There is no efficient method to solve it. This paper proposes an optimal model for the problem and gives an algorithm by applying stochastic integer programming technique. Applying Grobner bases theory for solving the stochastic integer programming problem and the experimental results of the implementation are also presented.