使用 Python 来实现 ns-3 和流行框架之间的交互,这意味着您可以在不更改任何框架的情况下,在 ns-3 中训练和测试您的 AI 算法。
使用 Python 来实现 ns-3 和流行框架之间的交互,这意味着您可以在不更改任何框架的情况下,在 ns-3 中训练和测试您的 AI 算法。
ns–3 is widely recognized as an excellent open-source networking simulation tool utilized in network research and education. In recent times, there has been a growing interest in integrating AI algorithms into network research, with many researchers opting for open-source frameworks such as TensorFlow and PyTorch. Integrating the ML frameworks with simulation tools in source code level has proven to be a challenging task due to their independent development. As a result, it is more practical and convenient to establish a connection between the two through interprocess data transmission.
Our model offers an efficient solution to facilitate the data exchange between ns-3 and Python-based AI frameworks. It does not implement any specific AI algorithms. Instead, it focuses on enabling interconnectivity between Python and C++. Therefore, it is necessary to separately install the desired AI framework. Then, by cloning or downloading our work and importing the relevant Python modules, you can seamlessly exchange data between ns-3 and your AI algorithms.
The approach for enabling this data exchange is inspired by ns3-gym, but it utilizes a shared-memory-based approach, which not only ensures faster execution but also provides greater flexibility.
Check out install.md for how to install and setup ns3-ai.
To get started on ns3-ai, check out the A-Plus-B example. This example shows how C++ passes two numbers to Python and their sum is passed back to C++, with the implementation using all available interfaces: Gym interface, message interface (struct-based) and message interface (vector-based).
Ready to deploy ns3-ai in your own research? Before you code, please go over the tutorials on Gym interface and message interface. They provide step-by-step guidance on writing C++-Python interfaces, with some useful code snippets.
We also created some pure C++ examples, which uses C++-based ML frameworks to train models. They don't rely on interprocess communication, so there is no overhead in serialization and interprocess communication. See using-pure-cpp for details.
Please refer to the README.md in corresponding directories for more information.
This example show how you can use ns3-ai by a very simple case that you transfer a and b from ns-3 (C++) to Python
and calculate a + b in Python to put back the results.
This example simulates a VR gaming scenario. We change the CCA threshold using DQN to meet VR delay and throughput requirements. Model optimization is in progress.
This example is inspired by ns3-gym example. We build this example for the benchmarking and to compare with their module.
This is an example that shows how to develop a new rate control algorithm for the ns-3 Wi-Fi module using ns3-ai. Available examples are Constant Rate and Thompson Sampling.
This original work is done based on 5G NR branch in ns-3. We made some changes to make it also run in LTE codebase in ns-3 mainline. We didn't reproduce all the experiments on LTE, and the results in our paper are based on NR work.
'ns3-ai improvements' has been chosen as one of the project ideas for the ns-3 projects in GSoC 2023. The project developed the message interface (struct-based & vector-based) and Gym interface, provided more examples and enhanced stability and usability.
Note: this tutorial explains the original design, which is not up to date with the newer interface.
Join us in this online recording to get better knowledge about ns3-ai. The slides introducing the ns3-ai model could also be found here.
Please use the following bibtex:
…暂无开放 Issues,或尚未同步最近议题。