hust-diangroup / ns3-ai

Enable the interaction between ns-3 and popular frameworks using Python, which mean you can train and test your AI algorithms in ns-3 without changing any frameworks you are using now!
GNU General Public License v2.0
221 stars 80 forks source link

Applying ns3-ai to multiple nodes #32

Open Necropsy opened 3 years ago

Necropsy commented 3 years ago

Hello, initially congratulations for the project developed!

I am a master's student and I am developing a project that aims to improve the AODV protocol using machine learning. I would like to know if it is possible to use the ns3-ai module in the AODV protocol, where when defining it as a routing protocol for the network, each node will have an individual instance of ns3-ai. I would like each node in the network to be able to manage their own variables to control their AODV instance using their own neural network, is this possible with ns3-ai? Would you have any example of how this can be done (multiple instances of ns3-ai in parallel)?

Mauriyin commented 3 years ago

I think you can do that with ns3-ai. We will present a similar example for the WiFi-rate control algorithm in wns3 this year, and you are welcome to join us!

Necropsy commented 3 years ago

Hi @Mauriyin,

Thank you very much for the answer, I will participate yes, registration already done!

But in relation to this specific application, if I use ns3-ai directly in the AODV protocol, when defining the protocol in the simulation environment, each node would have an instance of the artificial intelligence module, however when executing the code in python containing a neural network I would only be executing a specific network and not each individual network of nodes, correct? (note: in this project I would have to implement one for each node and running directly within the routing protocol, a central network collecting information and identifying the network nodes by id would not be an option)

Mauriyin commented 3 years ago

I see. I think you can establish different processes with python, each one corresponding to one router, and use different memory id to transfer data to the neural net. So basically you need to construct a map like this: in ns-3

node 0 data -> mem 0 -> python 0
node 1 data -> mem 1 -> python 1
node 2 data -> mem 2 -> python 2
....

and then you can have some NN running in different python programs.

Guy122 commented 11 months ago

I see. I think you can establish different processes with python, each one corresponding to one router, and use different memory id to transfer data to the neural net. So basically you need to construct a map like this: in ns-3

node 0 data -> mem 0 -> python 0
node 1 data -> mem 1 -> python 1
node 2 data -> mem 2 -> python 2
....

and then you can have some NN running in different python programs.

Tried doing that and it works, but what I want to do is create a single Python code that populates all the memories like this:

node 0 data -> mem 0 -> python 0 node 1 data -> mem 1 -> python 0 node 2 data -> mem 2 -> python 0 ....

Is it feasible to implement?