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. Keywords-Grobner Bases, SLA, Stochastic Integer Programming, Cloud Computing