← 开源
tkn-tub

ns3-gym

ns3-gym - The Playground for Reinforcement Learning in Networking Research

Model DevelopmentEnvironmentsReinforcement LearningC++
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
697
Star
221
Fork
+1
本周
7
贡献者
创建于 2018-10-08 · 更新于 2026-10-10 · 今日第 14870 名
主要开发者
pgawlowiczmchwalisza-andre

tkn-tub/ns3-gym 排名第 14,870,有 697 个星标。

同类别比较

tkn-tub/ns3-gym 排名第 14,870,此处有 8 个同类条目;vecxoz/vecstack 排名第 14,871。

同类别比较
名称排名指标
bes-dev/MobileStyleGAN.pytorch14,851
语言:
Python
星标数:
698
分叉数:
87
简介:
An official implementation of MobileStyleGAN in PyTorch
jonasrauber/eagerpy14,857
语言:
Python
星标数:
698
分叉数:
39
adipandas/multi-object-tracker14,862
语言:
Python
星标数:
697
分叉数:
101
简介:
Multi-object trackers in Python
auroua/InsightFace_TF14,863
语言:
Python
星标数:
697
分叉数:
247
简介:
Insight Face on TensorFlow
vecxoz/vecstack14,871
语言:
Python
星标数:
697
分叉数:
79
简介:
Python package for stacking (machine learning technique)
HasnainRaz/Fast-SRGAN14,879
语言:
Python
星标数:
695
分叉数:
120
简介:
A Fast Deep Learning Model to Upsample Low Resolution Videos to High Resolution at 30fps
aleju/mario-ai14,883
语言:
Lua
星标数:
695
分叉数:
142
简介:
Playing Mario with Deep Reinforcement Learning
mv-lab/swin2sr14,889
语言:
Python
星标数:
695
分叉数:
83
简介:
[ECCV] Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration. Advances in Image Manipulation (AIM) workshop ECCV 2022. Try it out! over 3.3M runs https://replicate.com/mv-lab/swin2sr
关键参数与规格
关键参数与规格
参数值
语言C++
类别Model Development
子类别Environments,Reinforcement Learning
关键词RL
星标数697
分叉数221
贡献者7
创建日期2018-10-08
更新日期2026-10-10
1 天星标数0
7 天星标数1
排名14,870
上次排名14,708
排名变化-162
7 天星标排名10,906
上次 7 天星标排名10,963
7 天星标排名变化57
总星标排名14,942
上次总星标排名14,911
总星标排名变化-31
国家Germany
README 摘录

ns3-gym ============ OpenAI Gym is a toolkit for reinforcement learning (RL) widely used in research. The network simulator ns–3 is the de-facto standard for academic and industry studies in the areas of networking protocols and communication technologies. ns3-gym is a framework that integrates both OpenAI Gym and ns-3 in order to encourage usage of RL in networking research. Versions ======== This branch contains the entire ns-3 network simulator (ns-3. Moreover, the ns3-gym is also

available as an ns-3 App that can be used with any ns-3 version. Two ns3-gym versions are provided in separate branches: ns3-gym app for versions = ns-3. 36 (with cmake build system) is avaiable on app-ns-3. Install all required dependencies required by ns-3. Install ZMQ and Protocol Buffers libs: 3. Configure and build ns-3 project (if you are going to use Python virtual environment, please execute these commands inside it): 4. Install

ns3gym located in src/opengym/model/ns3gym (Python3 required) 5. (Optional) Install all libraries required by your agent (like tensorflow, keras, etc. (Optional) Start ns-3 simulation script and Gym agent separately in two terminals (useful for debugging): Examples ======== All examples can be found here. Note, that starts ns-3 simulation script located in current working directory. Any ns-3 simulation script can be used as a Gym environment. This requires only to instantiate OpenGymInterface and implement the ns3-gym

C++ interface consisting of the following functions: Note, that the generic ns3-gym interface allows to observe any variable or parameter in a simulation. A more detailed description can be found in our Paper. Cognitive Radio We consider the problem of radio channel selection in a wireless multi-channel environment, e. The objective of the agent is to select for the next time slot a channel free of interference. We consider a simple illustrative example where the external interference follows

a periodic pattern, i. sweeping over all channels one to four in the same order as shown in the table. We created such a scenario in ns-3 using existing functionality from ns-3, i. interference created using class and sensing performed using class. Such a periodic interferer can be easily learned by an RL-agent so that based on the current observation of the occupation on each channel in a given time slot the correct channel can be determined

for the next time slot avoiding any collision with the interferer. Our proposed RL mapping is: observation - occupation on each channel in the current time slot, i. wideband-sensing, actions - set the channel to be used for the next time slot, reward - +1 in case of no collision with interferer; otherwise -1, gameover - if more than three collisions happened during the last ten time-slots The figure below shows the learning performance when using a simple neural network with fully

connected input and an output layer. We see that after around 80 episodes the agent is able to perfectly predict

常见问题

记录了多少星标和分叉?

tkn-tub/ns3-gym 有 697 个星标和 221 个分叉。

仓库排名是多少?

tkn-tub/ns3-gym 排名第 14,870。

记录的语言和类别是什么?

tkn-tub/ns3-gym 有 697 个星标,语言为 C++,类别为 Model Development。

哪个仓库排名最接近?

tkn-tub/ns3-gym 与 vecxoz/vecstack 比较,后者排名第 14,871,有 697 个星标。

README

ns3-gym

OpenAI Gym is a toolkit for reinforcement learning (RL) widely used in research. The network simulator ns–3 is the de-facto standard for academic and industry studies in the areas of networking protocols and communication technologies. ns3-gym is a framework that integrates both OpenAI Gym and ns-3 in order to encourage usage of RL in networking research.

Versions

This branch contains the entire ns-3 network simulator (ns-3.29) with ns3-gym (opengym) module. Moreover, the ns3-gym is also available as an ns-3 App that can be used with any ns-3 version. Two ns3-gym versions are provided in separate branches:

  • ns3-gym app for versions < ns-3.36 (with waf build system) is avaiable on app branch
  • ns3-gym app for versions >= ns-3.36 (with cmake build system) is avaiable on app-ns-3.36+ branch

Installation

  1. Install all required dependencies required by ns-3.
# minimal requirements for C++:
apt-get install gcc g++ python

Check ns-3 requirements

  1. Install ZMQ and Protocol Buffers libs:
sudo apt-get update
apt-get install libzmq5 libzmq3-dev
apt-get install libprotobuf-dev
apt-get install protobuf-compiler
  1. Configure and build ns-3 project (if you are going to use Python virtual environment, please execute these commands inside it):
# Opengym Protocol Buffer messages (C++ and Python) are build during configure
./waf configure --enable-examples
./waf build
  1. Install ns3gym located in src/opengym/model/ns3gym (Python3 required)
pip3 install --user ./src/opengym/model/ns3gym
  1. (Optional) Install all libraries required by your agent (like tensorflow, keras, etc.).

  2. Run example:

cd ./scratch/opengym
./simple_test.py
  1. (Optional) Start ns-3 simulation script and Gym agent separately in two terminals (useful for debugging):
# Terminal 1
./waf --run "opengym"

# Terminal 2
cd ./scratch/opengym
./test.py --start=0

Examples

All examples can be found here.

Basic Interface

  1. Example Python script. Note, that gym.make('ns3-v0') starts ns-3 simulation script located in current working directory.
import gym
import ns3gym
import MyAgent
from ns3gym import ns3env

#env = gym.make('ns3-v0')  <--- causes some errors with the new OpenAI Gym framework, please use ns3env.Ns3Env()
env = ns3env.Ns3Env()
obs = env.reset()
agent = MyAgent.Agent()

while True:
  action = agent.get_action(obs)
  obs, reward, done, info = env.step(action)

  if done:
    break
env.close()
  1. Any ns-3 simulation script can be used as a Gym environment. This requires only to instantiate OpenGymInterface and implement the ns3-gym C++ interface consisting of the following functions:
Ptr GetObservationSpace();
Ptr GetActionSpace();
Ptr GetObservation();
float GetReward();
bool GetGameOver();
std::string GetExtraInfo();
bool ExecuteActions(Ptr action);

Note, that the generic ns3-gym interface allows to observe any variable or parameter in a simulation.

A more detailed description can be found in our Paper.

Cognitive Radio

We consider the problem of radio channel selection in a wireless multi-channel environment, e.g. 802.11 networks with external interference. The objective of the agent is to select for the next time slot a channel free of interference. We consider a simple illustrative example where the external interference follows a periodic pattern, i.e. sweeping over all channels one to four in the same order as shown in the table.

We created such a scenario in ns-3 using existing functionality from ns-3, i.e. interference created using WaveformGenerator class and sensing performed using SpectrumAnalyzer class.

Such a periodic interferer can be easily learned by an RL-agent so that based on the current observation of the occupation on each channel in a given time slot the correct channel can be determined for the next time slot avoiding any collision with the interferer.

Our proposed RL mapping is:

  • observation - occupation on each channel in the current time slot, i.e. wideband-sensing,
  • actions - set the channel to be used for the next time slot,
  • reward - +1 in case of no collision with interferer; otherwise -1,
  • gameover - if more than three collisions happened during the last ten time-slots

The figure below shows the learning performance when using a simple neural network with fully connected input and an output layer. We see that after around 80 episodes the agent is able to perfectly predict the next channel state from the current observation hence avoiding any collision with the interference.

The full source code of the example can be found here.

Note, that in a more realistic scenario the simple waveform generator in this example can be replaced by a real wireless technology like LTE unlicensed (LTE-U).

RL-TCP

The proper RL-TCP agent example is still under development. However, we have already implemented and released two versions (i.e. time and event-based) of an interface allowing to monitor parameters of a TCP instance and control its Congestion Window and Slow Start Threshold -- see details here. Note, that both versions inherits from TcpCongestionOps and hence can be used as an argument for ns3::TcpL4Protocol::SocketType.

Moreover, using the event-based interface, we already have an example Python Gym agent that implements TCP NewReno and communicates with the ns-3 simulation process using ns3gym -- see here. The example can be used as a starting point to implement an RL-based TCP congestion control algorithms.

In order to run it, please execute:

cd ./scratch/rl-tcp
./test_tcp.py 

Or in two terminals:

# Terminal 1:
./waf --run "rl-tcp --transport_prot=TcpRl"

# Terminal 2:
cd ./scratch/rl-tcp/
./test_tcp.py --start=0

Note, that our Python TCP NewReno implementation achieves the same number of transmitted packets like the one implemented in ns3 (see the output of ns-3 simulation, i.e. RxPkts: 5367 in both cases). Please execute the following command to cross-check:

./waf --run "rl-tcp --transport_prot=TcpNewReno"

Contact

  • Piotr Gawlowicz, TU-Berlin, gawlowicz@tkn
  • Anatolij Zubow, TU-Berlin, zubow@tkn
  • tkn = tkn.tu-berlin.de

How to reference ns3-gym?

Please use the following bibtex :

@inproceedings{ns3gym,
  Title = {{ns-3 meets OpenAI Gym: The Playground for Machine Learning in Networking Research}},
  Author = {Gaw{\l}owicz, Piotr and Zubow, Anatolij},
  Booktitle = {{ACM International Conference on Modeling, Analysis and Simulation of Wireless and Mobile Systems (MSWiM)}},
  Year = {2019},
  Location = {Miami Beach, USA},
  Month = {November},
  Url = {http://www.tkn.tu-berlin.de/fileadmin/fg112/Papers/2019/gawlowicz19_mswim.pdf}
}
排名相邻
同类项目