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

Is it possible to run environment and agent on different PCs? #43

Open ffrommel opened 3 years ago

ffrommel commented 3 years ago

Hello.

My name is Fabián and I am doing my Master's thesis on robust optimization of Wi-Fi networks configuration. First of all, I wanted to thank you and congratulate you for the great contribution that ns3-gym is to the investigation of these topics.

From the readme it is clear to me that it is possible to run the environment (simulation ns-3) and the agent (Python code) on separate terminals. But is it possible to do this on separate PCs? This is because I would like to train the agent on Google Colab, while keeping the network simulator on my PC.

Thank you very much in advance. Kind regards.

Fabián.

zubow commented 3 years ago

Dear Fabián,

you can run the ns3 and the agent on two different machines as for IPC we use ZeroMQ protocol. However, at the moment for such remote setup you have to make changes in the ns3 opengym_interface.cc file:

Please replace 'localhost' by the public IP address of your agent: https://github.com/tkn-tub/ns3-gym/blob/master/src/opengym/model/opengym_interface.cc#L163

In the next version of ns3-gym we will make that parameter configurable.

Best, Tolja

ffrommel commented 3 years ago

Hello Tolja. Thank you very much for the quick answer.

I made the modifications indicated in the opengym_interface.cc file, however the agent does not detect the simulation. Should I also modify the ns3env.py file to indicate the public IP of the PC with ns-3? If so, what would be the modifications to be made in the code?

Thank you again. Kind regards.

Fabián.