Distributed energy systems based on cogeneration have high potential of energy saving due to utilizing waste heat from ,power generators effectively. Some practical designs about distributed energy systems are constructed based on (experimental results by professional system engineers. To spread the concept of distributed energy systems, quantitative design method is needed. Consequently, in this study, the optimization between machinery combination and its operation in order to minimize primary energy consumption is calculated using Genetic Algorithm (GA). Some cases are individual building and some are energy accommodation cases. The calculation results show that GA optimization led objective smaller than experimental designs. Moreover, the result of energy accommodation among buildings is smaller than that of total summation of individual buildings because effective waste heat was utilized among buildings effectively.