|
From: Roland K. <kam...@cs...> - 2015-02-04 13:37:38
|
On Sunday, February 01, 2015 07:21:38 PM 彭彭 wrote:
> Dear all:
> I'm a postgraduate student from China. I'm working on a experiment project
> which needs to compute stable model of ASP program. The project is written
> in C++. Cause the program needs to compute thousands of different programs
> to compare results, if we use the executable clingo program to compute
> model, there will be too much IO which make our program inefficient. To
> improve our program, we want to call clingo api in our program. I
> downloaded the gringo4.4 source and find the project so complicated that I
> don't know where to work on. The process of solving we need includes
> grounding and computing stable model. But our rules are simple, just facts
> and first order rules, thus we don't the extra features.
> Can you write me a simple c++ program to call clingo api or is there any
> API documents I can refer to?
> Thank you very much.
>
> Best Wishes.
> Xiao Peng
Hello, I prepared a small patch that adds the additional build target example,
which builds a small example program that grounds and solves a logic program
passed as a string.
The code for this is in: app/example/src/main.cc
All the other changes in the patch regard changes to build the example program
plus a copy of clingo_lib.{hh,cc} from pyclingo/luaclingo (in the next clingo
release these are in app/shared).
The example uses the ClingoLib class which is used by the python and lua
gringo modules. The C++ classes are not documented but very closely related to
gringo's python API, which has a reference documentation:
http://potassco.sourceforge.net/gringo.html
-R |