In recent years, utilization of heterogeneous hardware other than small core CPU such as GPU, FPGA or many core CPU is increasing. However, when using heterogeneous hardware, barriers of technical skills such as OpenMP, CUDA and OpenCL are high. Based on that, I have proposed environment-adaptive software that enables automatic conversion, configuration, and high performance operation of once written code, according to the hardware to be placed. However, although the conversion of the code according to the migration destination environment has been studied so far, there has been no research to properly set the resource amount. In this paper, as a new element of environment adaptive software, in order to operate the application with high cost performance, I study a method to optimize the resource amount of CPUs and offload devices.