implementation of natural actor critic algorithm