Numerical approximations in optimal control of a class of heterogeneous systems. (December 2015)