tkn-tub / ns3-gym

ns3-gym - The Playground for Reinforcement Learning in Networking Research
GNU General Public License v2.0
521 stars 197 forks source link

I can't change nodeNum where I run the example of qlearn.py #8

Closed hzr1140521792 closed 5 years ago

hzr1140521792 commented 5 years ago

When I change the nodeNum in the code,I get nothing but this image My environment is :Ubuntu 16.04 and Python3 Thanks very much

pgawlowicz commented 5 years ago

Hi,

The dqn-agent-v1.py is not generic and will work only with 5 nodes. If you change the node number to 6, then the action vector should contain 6 values , but in a current version, it still sends a vector with 5 elements.

You can simply extend it to more nodes or make it more generic - i.e. independent of the number of nodes.

The linear-mesh ns3 simulation script is generic. To test it please play with no_op2.py that is independent of number of nodes, i.e. you can change it easily.

Best, Piotr

hzr1140521792 commented 5 years ago

I got it,thank you very much.

hzr1140521792 commented 5 years ago

But I hava another question.Did you write all of your param of environment in the file sim.cc,but how can you use it with python,these code are written with C++?

pgawlowicz commented 5 years ago

This part of the code allows you to pass command line arguments to the ns-3 process, that will be started by ns3gym. Of course those command line parameters have to be parsed correctly in ns3 simulation script, here called sim.cc:

simArgs = {"--simTime": simTime,
       "--testArg": 123,
       "--nodeNum": 5,
       "--distance": 500}

env = ns3env.Ns3Env(port=port, stepTime=stepTime, startSim=startSim, simSeed=seed, simArgs=simArgs, debug=debug)
hzr1140521792 commented 5 years ago

OK,I got it.Thank you very much.