How do I run an Answer Set Programming file from a C++ File?

淺唱寂寞╮ 提交于 2019-12-13 11:26:40

问题


What methods are there that I can use to run an ASP file from the main function of my C++ code?

I'm doing a project in which I am expected to control a simulated turtlebot using a C++ file, and use ASP code to construct an action plan that the robot can use to achieve a specified goal.

I'm using Ubuntu 14.04, SPARC (an ASP solver), ROS indigo, and gazebo.


回答1:


Am I correct that SPARC is implemented in Java (this link)?

If this is the case, there are quite a few options:

  1. You can use Java Native Interface to interact with SPARC tool directly from c++ code
  2. Other option is to create a separate process from c++ code and communicate with it via stdout/files
  3. You can implement ROS node in Java which accepts requests and uses SPARC as a library to process them. In this case your c++ doesn't care about exact SPARC implementation

Resume:

I would suggest you to try the last option. It's slightly more difficult than other 2 options, but it fits perfectly into ROS infrastructure.



来源:https://stackoverflow.com/questions/43488359/how-do-i-run-an-answer-set-programming-file-from-a-c-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!