A specific class of stochastic heat engines driven cyclically by time-dependent potential, which is defined in the half-line ($0<x<+infty$), is analysed. For such engines, most of their physical quantities can be obtained explicitly, including the entropy and internal energy of the heat engine, as well as output work (power) and heat exchange with the environment during a finite time interval. The optimisation method based on the external potential to reduce {it irreversible} work and increase energy efficiency is presented. With this optimised potential, efficiency $eta^*$ and its particular value at maximum power $eta^*_{rm EMP}$ are calculated and discussed briefly.