Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some problem in run cognitive-agent-v1.py #80

Open
bunuaaxjw opened this issue Apr 17, 2023 · 2 comments
Open

some problem in run cognitive-agent-v1.py #80

bunuaaxjw opened this issue Apr 17, 2023 · 2 comments

Comments

@bunuaaxjw
Copy link

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.

@GeorgeFrangulea
Copy link

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?

@bunuaaxjw
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants