Skip to content
SWI-Prolog Clingo interface
C Prolog Python Makefile Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
.gitignore
.ycm_extra_conf.py
Makefile
README.md
TODO.md
clingo.c
clingo.pl
playground.pl
swipl.sh

README.md

Clingo ASP Solver binding for SWI-Prolog

This repository contains work in progress for embedding the Clingo ASP solver in SWI-Prolog. To use this, you need:

  • Clingo. You need clingo version 5, which is available on github:

    git clone https://github.com/potassco/clingo.git
    
  • A recent copy of the development version of SWI-Prolog (7.3.x)

Please consult the file INSTALL in the downloaded clingo version and build the target libclingo as shown below. Omit --build-dir=release to compile the debug version.

scons --build-dir=release libclingo

After both SWI-Prolog and Clingo are installed, edit the Makefile to suit your installation. See instructions in the file. After that running make should suffice to build the interface. The interface may be tested by running e.g.:

./swipl.sh examples/map_color.pl
?- map_color(Colors).

Finally, the system is installed as a SWI-Prolog library using make install.

Status

The basic communication is working. Please do not expect the current interface to be stable. Currently, the interface allows for creating a Clingo program from a string or loading one from a file or from a (not yet settled) representation as a Prolog term. The program can be asked for its stable models (if any) on backtracking. A model is represented as a Prolog list of ground atoms in the predicate logic sense. The interface suppors Clingo's abilities to deal with external data and a changing world:

  • Clingo atoms may refer to a Prolog predicate
  • Clingo's support for parameterized grounding is supported
  • Clingo externals are supported
  • Clingo assumptions are supported

Plans

  • Inspect and set configuration options
  • Clingo will provide access to the AST (Abstract Syntax Tree) which allow for:
    • Specifying Clingo source using Quasi Quotation fragments
    • Pass identifier, string and variable values that are valid Prolog atoms, strings or variables, but invalid in Clingo's syntax.
  • More high level interaction.

Further reading:

You can’t perform that action at this time.