Open bunuaaxjw opened 1 year ago
Hello, did you manage to solve this issue?
I have the same problem when I try to use env = ns3env.Ns3Env().
Using env = gym.make('ns3-v0') does seem to compile but the resulting figure shows that no learning has happened. Do you know why that is?
@GeorgeFrangulea I solved this problem. It seems that the connection between ns3 and gym have some problems, so it went wrong. The state in code turned to be None, which cause this problem. I solved it by set when "state = None" then jump out of the loop and continue the loop. The result is correct. As I konw, you should use env = ns3env.Ns3Env() to create the environment.
Traceback (most recent call last): File "./cognitive-agent-v1.py", line 66, in
next_state = np.reshape(next_state, (1, s_size))
File "<__array_function__ internals>", line 5, in reshape
File "/home/xujunwei/anaconda3/envs/tensorflow/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 298, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File "/home/xujunwei/anaconda3/envs/tensorflow/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
ValueError: cannot reshape array of size 1 into shape (1,4)
It seems that the return of the function env.reset() is not an array, so the reshape function could not work.