编译执行的一般命令
1、对ns3主项目的编译指令
分为两步:第一、/waf configure; 第二,/waf (或./waf build ) )。
详情请参照《开源网络模拟器ns3》 P13
2 )同时执行多个脚本的编译命令
关于ns3-ai的注释
安装方法
请务必检查基本要求:系统的python版本是否为python3或更高版本。 否则,无法安装ns3-ai的Python-Interface。 3358www.Sina.com/Ubuntu系统(以Ubuntu 16.04为例)成功安装和编译ns-3.30后,请执行以下操作步骤。
ns3-ai适配的ns3版本为ns-3.30(务必使用ns-3.30)
1、ns3-ai文献: Yin H,Liu P,Liu K,et al.ns3-ai : fosteringartificialintelligencealgorithmsfornetworkingresearch [ c ]。
2、在NS3 App Store中介绍ns3-ai网页(建议结合以下详细安装说明)。
https://apps.nsnam.org/app/ns3-ai /
3、ns3-ai在GitHub上的开放源代码页(也可以成功安装) ) )。
3359 github.com/HUST-Dian group/ns3-ai
参考资料:
1 )解压缩网络下载的源代码(建议使用“参考资料2”中的源代码),将其添加到ns-3.30的contrib目录中,并将其重命名为ns3-ai
2、重新编译ns-3.30
./waf configure
./waf
3、add python界面
3.1、Install(python3isusedandtested )。
CD $ your _ ns3 _ code/contrib/ns3-ai/py _ interface
python setup.py install --user
步骤3.1完成后,完成安装
3.2、Baisc usage (这里应该介绍Python Interface的用途,以下代码不需要在安装过程中执行)。
import py_interface
py _ interface.init (1234,4096 ) # key poolSize
v=ns3bigvar(233,c_int*10 ) ) ) )
with v as o:
forIinrange(10 ) :
o[I]=c_int(I ) ) )
打印(* o ) ) )。
py_interface.FreeMemory (
4、测试安装是否成功
详细安装步骤:
4.1、运行ns-3扩展(终端窗口1 ) :
CP-r contrib/ns3-ai/example/rl-TCP scratch//waf-- run ' rl-TCP ' 4.2,Run Python code (终端窗口2 ) :
CD contrib/ns3-ai/example/rl-TCP/pythontesttcp.py note : currentlytherltestinpythonscriptisnotfulyenabled,comcomenabld
问题:当前在步骤4.2中执行命令后没有反应,问题有待解决。 (GitHub相关issue的问答; a可以参考记录) ) )。
关于ns3-gym的注释
安装方法
RL-TCP Examples(ns3和ai是在两个终端窗口上运行的),ns3-gym官方网站上以Ubuntu16.04为例说明安装步骤(不排除与更新版本的Ubuntu系统的兼容性)。 在Ubuntu系统上成功安装和编译ns-3.29,然后执行以下操作:
基本要求:ns3-gym适配的ns3版本为ns-3.29(务必使用ns-3.29)
1,ns3-gym文献: Gawowicz P, zu bowa.ns-3 meetsopenaigym : theplaygroundformachinelearninginnetworkingresearch [ c ]//proceedings of the 22 ndinternation analysisandsimulationofwirelessandmobilesystems.20193360113-1223
2、在NS3 App Store中介绍ns3-gym网页(建议使用以下详细安装过程) )。
3359 apps.nsnam.org/app/ns3-gym /
3、ns3-gym的GitHub上的开放源代码页(因为在编译过程中会出现ZMQ错误,所以可以在GitHub上的closed issues中查找解决方案) ) ) ) ) ) ) ) )。
https://github.com/tkn-tub/ns3-gym
参考资料:
1、installationfromthedownloadbutton
Download the source archive (建议使用参考资料2的源代码) and unpack it:
tar -xzf ns3-gym-1.0.0.tar.gz
move(andrename ) the ns3-gym-1.0.0目录到)将解压缩的文件重命名为opengym (位于contrib目录中) :
ns-3.29/contrib/opengym
注:即使放在src目录中,安装也能成功
2、installzmqandprotocolbufferslibs :
note : toinstallprotobuf-3.6 on Ubuntu 16.04,run:
sudo add-apt-repository PPA : Maarten-fon ville/proto buf
sudo apt-get update
Then:
sdoapt-getinstallibzmq5libz mq5-dev
sudo apt-getinstalllibprotobuf-dev
sdoapt-getinstallprotobuf-compiler
3、configureandbuildns-3 project :
note : ifyousepythonvirtualenvironment,pleaseexecutethesecommandsinsideit。
note : opengymprotocolbuffermessages (cand python ) are build during configure。
./waf configure---- enable-examples
./waf build
(成功运行以上命令后,您将看到从控制台输出的Models built列表中包含opengym。)
4、Install ns3gym Python module。
节点: python 3is recommended。
4.1、compileprotobufmessagesmanually (not required if./wafconfigurewasexecuted ) :
如果在步骤3中使用./waf configure命令进行编译,但不附带--enable-examples,则不需要步骤4.1 )
cd ./ns-3.29/contrib/opengym/
protoc-I=./model//python _ out=./model/ns3 gym/ns3 gym./model/messages.proto
4.2、Install ns3gym Python module:
pip3install./ns-3.29/contrib/open gym/model/ns3 gym
(官方网站使用pip,但请在不同的计算机上尝试pip或pip3) ) )。
5、测试安装是否成功
5.1、测试用例1
CP-r./contrib/open gym/examples/opengymscratch /
cd ./scratch/opengym
./simple_test.py
5.2、测试用例2
# Terminal 1
CP-r contrib/ns3-gym/example/opengymscratch /
./waf --run 'opengym '
# Terminal 2
cd ./scratch/opengym
./test.py --start=0