Optimization of a heat engine based on a dissipative system