  Heat engines are fundamental physical objects to develop nonequilibrium
thermodynamics. The thermodynamic performance of the heat engine is determined
by the choice of cycle and time-dependence of parameters. Here, we propose a
systematic numerical method to find a heat engine cycle to optimize some target
functions. We apply the method to heat engines with slowly varying parameters
and show that the method works well. Our numerical method is based on the
genetic algorithm which is widely applied to various optimization problems.
