Enables data transfer between AI frameworks and ns-3
4.02/5 (123 reviews)


Currently, more and more researchers are willing to apply AI algorithms to network research. Most AI algorithms are likely to rely on open source frameworks such as TensorFlow and PyTorch, but these frameworks are developed independently of ns-3 and extremely hard to merge, so it is more reasonable and convenient to connect them with data interaction. This ns-3 extension module provides a high-efficiency solution to enable the data interaction between ns-3 and other python based AI frameworks.

Inspired by ns3-gym, but using a different approach (shared memory) which is faster and more flexible.


In current release, we provide two examples for test. To run them without depending on the AI frameworks' environment, we provide python scripts only exchanging data. For details, please check here .


This work is designed and finished by Dian Group in Huazhong University of Science and Technology.

  • Pengyu Liu, HUST, eic_lpy@hust.edu.cn
  • Hao Yin, UW, haoyin@uw.edu


Works with ns-3.35

Latest Build :

Build History : ns3-ai v1.1.0

Release Notes

<ul> <li>Add WiFi rate-control and simple instruction examples;</li> <li>Improve the documents and remove the unnecessary parts;</li> <li>Add GPL v2 license;</li> <li>Fix bugs and issues</li> </ul>
Bakefile : Link


Works with ns-3.30

Build History : ns3-ai v1.0.0

Release Notes

<p>The first release of the ns3-ai project.</p> <ul> <li>The core functions using shared memory to exchange data from ns-3 and AI frameworks.</li> <li>Two basic examples to use this module.</li> <li>Some test results and instructions.</li> </ul>


This module is an extension designed to be added to the `contrib` directory of ns-3. The released version can be installed from the download button. The development version can be installed using git. ### Install from the Download button #### Get ns-3: This module needs to be built within ns-3, so you need to get ns-3-dev or a released version first. Check the [ns-3 installation wiki](https://www.nsnam.org/wiki/Installation) for detailed instructions. #### Download the source archive and unpack it: `tar -xzf ns3-ai-1.0.0.tar.gz` #### Move it to your `contrib` dir and rename ``` mv ns3-ai-1.0.0 $YOUR_NS3_DIRECTORY/contrib/ns3-ai ``` Note that in the above, the module is renamed to `ns3-ai`. If this renaming is not done, the ns-3 configuration may fail due to a mismatch with the module's wscript name. #### Rebuild ns-3 ``` cd $YOUR_NS3_DIRECTORY ./waf configure ``` ``` ./waf ``` ## Install from Github #### Get ns-3: This module needs to be built within ns-3, so you need to get ns-3-dev or other ns-3 codes first. Check [ns-3 installation wiki](https://www.nsnam.org/wiki/Installation) for detailed instructions. ### Adding this module via git ``` cd $YOUR_NS3_DIRECTORY/contrib ``` ``` git clone https://github.com/hust-diangroup/ns3-ai.git ``` #### Rebuild ns-3 ``` cd $YOUR_NS3_DIRECTORY ./waf configure ``` ``` ./waf ``` ### Test installation Try to run the provided ns-3 RL-TCP example: `cp -r contrib/ns3-ai/example/rl-tcp scratch/` `./waf --run "rl-tcp"`

### Bug Report Feel free to open issues on [Github Repo](https://github.com/hust-diangroup/ns3-ai/issues). Also welcome to send email to the maintainers. We would like to help you to solve the problems and test our module. ### Examples We will add more examples to test and enrich our module. If you have some interesting ideas, also welcome to connect us.

### Release V1.0.0 This is our first release for ns3-ai module: - The core functions using shared memory to exchange data from ns-3 and AI frameworks. - Two basic examples to use this module. - Some test results and instructions. ### Future Plan - More enhancements for these two basic examples. - New examples. - More higher-level interfaces. - Benchmarking results. ### Contributions To provide more test cases and examples, we encourage you to provide us some ideas and your code using [Pull Request](https://github.com/hust-diangroup/). If you have any suggestions or requests, feel free to open an issue or email us!

This ns-3 extension is one or more contributed modules.

Version v1.1.0

Released Oct. 21, 2021

Works with ns-3.35

Bake bakeconf.xml