How to understand the function CollectState and AgentStep?
Q1: Function CollectState this function calls at every step. When I want to create a train enviroment in the project , I have to decide which variables should be added to the state list. But I do not know which variables should be added to the list. for example , I want to train A move to B, so I must add the position of A to the state list , but should I need add the position of B to the list ? If so , why ? and do any object deal with them? and what's the effect about the state list?
Q2: Function AgentStep(float[] action) this function calls at every step too.I am a little confuse about the parameter "action". In the function , I will get a float[] action , and I will use action[0] or more values to deside the agents' behaviour, but where does the parameter "action" come from? In my mind , I think the action[0] is the same as the statelist[0] , and the action[1] is the same as the statelist[1] .I do not know if I am right.
In fact , when I log the action[0] in the game , I do not know how the value comes out .. Could you help me understand this parameter?
CollectState is used to collect the state of the agent which is a list of floats. It must contain the information needed to make a decision (choose an action). In the example you made, if you want an object to move from A to B (and B is not always at the same position), then you must give your agent information about where he is and where he should go.
This list of state is then sent to the Brain component in order for it to chose what is the best action given the state. Depending on the Brain Type of your brain, this decision can be made by a Player, a Heuristic, an External Python process or an internal Neural Network.
Once the brain has decided which action to take given the state, it will call AgentStep with the action. The agent must then realize the action. Implement in AgentStep what each float correspond to.
In the BallanceBall example, the state is the position of the ball (3 floats), the velocity of the ball (3 floats) and the orientation of the platform (2 floats). That is 8 states in total (Collected in CollectState). The brain then decides by how much the platform must rotate along x and z : 2 floats (Implement in AgentStep what each float correspond to).
Thanks so much. Now I understand , if I use mechine learning to train the AI ,the states I collected are used to give to the mechine , let the mechine know the information about the enviroment . So if I add the distance of A and B to the state list, and then I check the distance in the AgentStep and set the reward , thus the AI will be smater after training . This is what I understand the states list now.
However, I am still confuse about the parameter "float[] action". In the BallanceBall example , the act[0] presents the ratetion z, but in other examples , it may present the position or something else . and in the AgentStep function , we must check the value of the act[0]. But I even do not know what the act[0] represents, and I do not know how to deal with the act[0].
@vincentpierre maybe the mechine set the value of the act[0], but I do not understand what the parameter represent! hope you can help me , thank you!
@Maomao110 That is the best part, you decide what the action represents. If you want an object to go from A to B, your object must be able to move. That is what float[] act represents. The first one could be move along the x, the second along y but you could swap them. The machine will learn which one corresponds to which and change the actions accordingly.
Thanks very much , I got it perfectly.
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.