1. A computer implemented method for generating a policy for optimizing a cost of a resource under a predetermined cost structure, the method comprising: preparing an error distribution that indicates a deviation of an amount of usage from a predicted value, a characteristic of a storing means for storing or releasing the resource, and the cost structure in a computer-readable form; calculating an expected cost in a Markov decision process and a parameter that includes a transition probability on the basis of the error distribution, the characteristic of the storing means, and the cost structure, the Markov decision process including a state that includes a usage amount error, an amount of the resource in the storing means, a specification of a section, and a set target; and deciding an optimal policy that includes an action of storing or releasing the resource of the storing means for the state using the expected cost in the Markov decision process and the parameter including the transition probability.