A gradient computational technique for a class of optimal control problems subject to inequality constraints