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!

What it solves

It addresses the difficulty of integrating Python-based AI frameworks (like PyTorch and TensorFlow) with the ns-3 network simulator, which is written in C++. Because these tools are developed independently, connecting them at the source code level is challenging; ns3-ai provides a bridge for interprocess data transmission between the two.

How it works

The project uses a shared-memory-based approach to enable fast and flexible data exchange between C++ (ns-3) and Python. It does not implement AI algorithms itself but provides the connectivity infrastructure. It offers two primary ways to interact:

  • Gym interface: A high-level interface that uses Gymnasium APIs for reinforcement learning workflows.
  • Message interface: A low-level interface for customizing shared data using struct-based or vector-based messages.

Who it’s for

Network researchers and educators who want to apply machine learning or reinforcement learning algorithms to network simulations in ns-3.

Highlights

  • High-performance interaction: Uses shared memory for faster execution compared to other methods.
  • Flexible interfaces: Supports both high-level Gym APIs and low-level custom message structures.
  • Broad application examples: Includes demos for rate control, TCP optimization, and VR gaming scenarios (Multi-BSS).
  • C++ ML support: Provides paths for using pure C++ ML frameworks to eliminate interprocess communication overhead.

Related

  • Project
  • Project
  • Project
  • Project