Calculus of variations provide useful information about the form of the optimal control law for a special class of optimal control problems. Nevertheless, the difficult task still remains to determine the times were the optimal control switches between its admissible boundaries. Using the theoretical results of the Pontryagin's Minimum Principle we propose an adaptive critic architecture, which determines the optimal control strategy using approximate dynamic programming and neural networks. The application of the proposed method on a challenging problem of ecology, the optimal control of a prey-predator system, is presented.