Training does not give the expected result
Hi. I am trying to create an agent that stops a ball from falling down the platform, but for some reason even after 2 million training steps it does nothing then random moving around and hitting the ball sometimes. If any of you did something similar please share your findings with me.

In collectstate I add the velocity of the ball and the agent, the position relative to the platform for both, and the distance between them. My reward increases in every step with 0.005 and if the ball/cube falls down the platform I just simply give a negative reward. In case the ball stops reward is 1.
Here is the code in case anyone wants to check it: https://pastebin.com/YRFyAhns
And my PPO settings.

Can this even be learned this way? Or i need to change up everything? If someone can point me out my errors or point me in the right direction I would be glad. Thank you!
How far apart apart are the objects that you're sending relative position data from? Best practice is to normalise these inputs by e.g. dividing them with the max distance.
Well the middle point is 0,0 and the platform size is 25,25. So from -12.5 to 12.5 in both directions. Could this be the problem? I will try out this suggestion and report back. Thank you
I tried dividing with the max value, but that does not seem to help at all. It does the same thing, Mean reward increases from -0.8 to 0.1 and it does not want to improve from there. Could the problem be with the rewards i'm giving?
Try measuring the distance for each frame and whenever the distance gets shorter - give the agent a small reward. Also give it a small reward whenever the velocity of the ball gets significantly lower. I would also use reward += rather than reward = in case you might have any concurrent rewards being given so that the current reward doesn't get wiped out.
I will update the script and run the simulation again. How can i add a small reward based on the distance between them? Something like 1/DISTANCE*0.001 is okay? So the smaller the distance the larger the reward.
I added the + sing and now i get this error randomly after 5000-37500 steps:
TypeError Traceback (most recent call last)
G:\unity\2D platformer\python\ppo\trainer.py in take_action(self, info, env, brain_name, steps, normalize) 74 self.stats['learning_rate'].append(learn_rate) 75 new_info = env.step(actions, value={brain_name: value})[brain_name] ---> 76 self.add_experiences(info, new_info, epsi, actions, a_dist, value) 77 return new_info 78
G:\unity\2D platformer\python\ppo\trainer.py in add_experiences(self, info, next_info, epsi, actions, a_dist, value) 101 history['action_probs'].append(a_dist[idx]) 102 history['value_estimates'].append(value[idx][0]) --> 103 history['cumulative_reward'] += next_info.rewards[idx] 104 history['episode_steps'] += 1 105
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
EDIT: It was a math error in my code.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.