Installation
- Install all required dependencies required by ns-3.
# minimal requirements for C++:
apt-get install gcc g++ python
see https://www.nsnam.org/wiki/Installation
- Install ZMQ and Protocol Buffers libs:
# to install protobuf-3.6 on ubuntu 16.04:
sudo add-apt-repository ppa:maarten-fonville/protobuf
sudo apt-get update
apt-get install libzmq5 libzmq5-dev
apt-get install libprotobuf-dev
apt-get install protobuf-compiler
- 下载:https://github.com/tkn-tub/ns3-gym
- 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
./waf build
- Install ns3gym located in src/opengym/model/ns3gym (Python3 required)
pip3 install ./src/opengym/model/ns3gym
-
(Optional) Install all libraries required by your agent (like tensorflow, keras, etc.).
-
Run example:
cd ./scratch/opengym
./simple_test.py
- (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