One major branch in mathematical sciences, which recently has been given especial attention, is optimization, including various methods such as linear programming, integer programming, and dynamic programming. Due to the unique characteristics of air treatment systems, specifically multistage nature of such systems, dynamic programming has been widely applied. The purpose of this paper is to find the best cost effective way to treat the waste gas stream from industries, such as foundries, which contains different kinds of pollutants. To attain this goal in dynamic programming, it is necessary to determine the cost of each system in various conditions. The dynamic programming procedure determines the optimum system. Iran Khodro Co. was considered as the case study of this investigation. The cost of each treatment unit calculated under the special conditions of the study. In order to minimize the emissions from foundries, Cyclone has been found to be the most optimum system to collect particulate matters, and as for controlling volatile organic compounds, Carbon Adsorber found to be the most optimum device.