Cloud computing is a resource delivery and usage model to get resource (hardware, software, applications) via network \"On-demand\" and \"At scale\" as services in a multitenant 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 a solution 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.