问题描述
我正在学习R,并通过了名为 RInside 提供c ++类来调用嵌入式R解释器.在按照此博客文章进行配置并在Omnet ++ Eclipse IDE.我们如何将其与诸如静脉(静脉在顶层目录和src目录中已经自动生成的makefile)集成起来? Rinside需要GCC工具链,我认为这是OMNeT ++中的默认工具.
I was learning R and came through this package called RInside which provides c++ classes to call an embedded R interpreter. I am able to run some examples given after configuring as per this blogpost and using provided makefile in Omnet++ eclipse IDE. How can we integrate this with say veins (veins already have auto generated makefiles in top directory and src directory)? Rinside needs GCC toolchain which i think is default in OMNeT++.
根据我到目前为止所学到的,这些是选项:
From what I've learned so far, these are the options:
- Omnet ++用户手册说,我们可以对某些源目录使用自定义makefile.因此,将RInside代码保存在一个源文件夹和一个单独的makefile中,然后从顶层顶层makefile调用此makefile.我尝试了这两种方法:
- Omnet++ user manual says we can use custom makefile for some source directory. So keeping RInside code in one source folder and a separate makefile and calling this makefile from veins top level makefile. I tried both of these approaches:
- 从RInside示例和makefile复制一些源文件,并更改IDE中的Build属性以将该文件夹从构建中排除
- 还为此目录使用了选项自定义生成文件.但是到目前为止还没有成功.可能是我做得不正确.
到目前为止,是否有人尝试将其与基于omnet ++/veins的项目一起使用?有谁知道是否值得尝试?任何其他建议,欢迎.
Has anyone tried to use it with omnet++/veins based project so far? does anyone know if it is worth trying? Any other suggestions are welcome.
我正在使用64位Ubuntu 16.04 LTS.
I'm using Ubuntu 16.04 LTS 64 bit.
推荐答案
您是否真的要在OMNeT ++中使用R,还是要进行结果/数据分析?
Do you really want to use R inside of OMNeT++, or are you looking to do result/data analysis?
您能否提供一些有关您要做什么的信息/为什么要在OMNeT ++中使用R而不是在完成模拟后进行后处理步骤?一般来说,建议您与仿真分开进行后期处理,使用OMNeT ++中的统计信息收集库在结果中生成相关数据,并使用R进行处理.您可以找到与,它是此存储库.我个人更喜欢使用python进行后期处理,但是如果您已经熟悉R,那么我建议您看一下.
Could you provide a bit of information about what you're trying to do/why you're trying to use R inside OMNeT++ instead of doing a post-processing step after your simulations are completed? Generally speaking, I'd recommend doing your post-processing separate from your simulations, generating relevant data in the results using the statistics collection libs in OMNeT++, and process these with R. You can find some examples that are used with Plexe, a VEINS-based simulator for CACC applications, in this repository. I personally prefer to use python for the post-processing, but if you're already familiar with R, then I'd recommend having a look at that.
如果您确实想这样做,我建议您在问题中使用第二种方法,即简单地将RInside库动态链接为系统库,并将它们指定为依赖项.基本上,这是使事情正常工作的最简单方法.
If you really want to do this, I'd recommend the second approach in your question, i.e., simply dynamically linking to the RInside libraries as system libraries and specify them as a dependency. This is basically the easiest way to get things to work.
但是,如果出于某种原因要明确链接到库,则应注意VEINS的构建过程依赖于配置脚本(包括在发行版中).它与普通C ++程序不同的工作方式是,应使用OMNeT ++提供的opp_makemake
工具构建OMNeT ++仿真:这正是VEINS的configure脚本所做的.如果要在构建过程中包括其他库路径,最简单的方法是使用./configure --include PATH/TO/RINSIDE/HEADERS
创建makefile.请参阅脚本源代码以获取更多详细信息
However, if for some reason you want to link against the library explicitly, you should be aware that VEINS' build process relies on the configure script included in the distribution. The way it works differently from normal C++ programs is that OMNeT++ simulations should be built using the OMNeT++-provided opp_makemake
tool: this is exactly what VEINS' configure script does. If you want to include additional library paths into the build process, the easiest way is to create a makefile using ./configure --include PATH/TO/RINSIDE/HEADERS
. Refer to the script source code for more details
这篇关于是否可以在omnet ++/Veins项目中使用RInside来受益于丰富的R功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!