As a technique for explicitly guiding reservoir operation, the dispatching function can better bring hydropower station benefits into play than does the conventional reservoir diagram. In light of the compiling characteristics of the dispatching function and its optimizing space available, the ant colony algorithm is applied to the optimization model. In the case of the Jinsha River middle reaches cascade hydropower stations, the initial function is optimized and used to simulate the generating operation of long series runoff. The results of calculation show that the dispatching function optimized by the ant colony algorithm can appreciably improve the operation benefits and guide actual dispatching operation.