JazASP plugin integrates Smodels ASP solver into a Jazzyk KR module.
The author of this KR module is Michael Koester, at the time a diploma student of the Department of Informatics of Clausthal University of Technology.
JzASP integrates Lparse and Smodels, an Answer Set Programming grounder and solver respectively. The stored knowledge base thus consists of a logic program in the syntax of AnsProlog (Prolog style syntaxi for Answer Set Programming) and can be accessed by two query methods sure believes and poss\_believes and two update methods add and del allowing for retrieval and modification of the stored knowledge base. Internally, the JzASP module processes the program by passing it to the Lparse library and subsequently let’s Smodels solver to compute the program’s answer sets. The two query methods sure believes and poss believes check whether the query formula, an AnsProlog term, is contained in all the computed answer sets, or there exists at least a single answer set containing it respectively. Before the query formula is processed by the module, all the free variables occurring in it are substituted by their valuations and subsequently, the query method attempts matching the remaining free variables with a term from a computed answer set. The update interface methods add and del provide a means to assert, or retract a clause (a fact, or a rule) to/from the stored knowledge base. The variable substitution treatment is similar to that in processing query formulae. While the Jazzbot agent employs the JzASP for both, reasoning about its beliefs regarding its environment, other agents and its own body state, as well as to represent and reason about its goals, the Urbibot agent employs the module only to treat its goal base. Using the power of non-monotonic reasoning, in particular the default negation, to reason about agent’s goals turned out to be advantageous and led to an elegant encoding of interrelations between various goals
Update interface implements a trivial belief revision operators similar to Prolog’s assert and retract. A more elaborate belief revision operator in style of Dynamic Logic Programming are subject of a future work.
To describe the functionality of the ASP plugin, first let us provide an example of a functional code:
declare module brain as asp notify brain on initialize [{ :− alive, dead. :− peaceful life, attacked. alive :− health(X), X > 0, not dead. dead :− health(X), X <= 0, not alive. peaceful life :− health(X), X > 50, not attacked. attacked :− health(X), X <= 50. jump :− alive, peaceful life. run :− alive, attacked. }] when poss_believes brain [{attacked}] then { del brain(Y) [{health(Y).}] } when sure_believes brain [{peaceful_life}] then { add brain(X) [{health(X).}] }
To compile the module code simply execute the standard sequence:
$ ./configure $ make $ make install
You might need root rights on your system to install the module properly.