To achieve the economic operation of distributed energy resources in the grid, a GAMS-based multi-distributed resource optimization and control method is proposed. Firstly, considering the coexistence of electricity load and heat load in the grid system, a virtual power plant structure involving heat generation from distributed energy is established. Secondly, the General Algebraic Modeling System (GAMS) is utilized to create a detailed mathematical model for the distributed resources within the virtual grid. Subsequently, considering the influence of various uncertain factors, the CLPEX solver is employed for optimization and solution. Research results indicate that during the operation of the virtual power plant, the introduction of system heat load significantly enhances the expected profit and improves the economic efficiency of the operation.