As a form of operation organization for the production and consumption of electric power system, microgrid plays a important role in the grid network. Power generation cost is taken as objective function, the cost of power generation is divided into operation cost and environmental cost according to the cost type or is divided into cost of cogeneration system, the cost of fuel cell and the cost of grid according to generating unit type, thus two kinds of multi objective functions are formed. The micro grid system including wind turbine, photovoltaic array, micro turbine, fuel cell and battery is established. Then, using particle swarm optimization algorithm based on dynamic adjustment of similarity weights to optimize the output of micro source and power consumption of grid when connected to the grid. And the non dominated solutions of two kinds of multi objective functions are optimized. Finally, all costs and benefits of the day are given. The numerical results show the feasibility and effectiveness of the proposed model and algorithm.