The alkali/surfactant/polymer (ASP) flooding is a complex distributed parameter system (DPS). In this paper, an optimization model of ASP flooding is developed, which takes net present value (NPV) as the performance index, oil/water seepage continuity equations and adsorption diffusion equations of displacing agents as the governing equations, physicochemical algebraic equations and boundary conditions of displacing agents as the constraint equations. To solve the injection concentration and size of each slug of the model and terminal flooding time, a dynamic scale iterative dynamic programming with mixed-integer (DSMI-IDP) is proposed. The essence of slug size is time, it can only be integer. In DSMI-IDP, the integer truncation is carried out by a proportion method after time normalization which can convert the free time terminal problem to a fixed time terminal problem. A dynamic contraction factor and a principle of adjustment factors are introduced to realize the dynamic scale. To test the algorithm, three examples are solved by DSMI-IDP. At last, the DSMI-IDP is applied to optimize an optimization model of ASP flooding. The solving effect is shown by the comparison with IGA, MIDP and trial and error solutions.