The Potassco Guide
The Potsdam Answer Set Solving Collection (gringo, clasp, and the integrated ASP system clingo) empowers users to efficiently tackle computationally challenging problems using Answer Set Programming (ASP)—a declarative paradigm based on logic programs and their answer sets.
This guide is designed both for newcomers seeking to get started with these tools and for experienced users looking for a comprehensive reference. For topics that extend beyond the scope of this guide, we provide external references: a formal introduction to the clingo input language and its semantics can be found in [AG]; the foundational algorithms and technologies behind gringo and clasp are detailed in [Foundations]; and further aspects of ASP are discussed in [Background].
Our focus here is on ASP and the computation of answer sets using clingo. Note, however, that clasp also serves as a full-featured SAT, MaxSAT, or PB solver (see [SATHandbook]), supporting propositional CNF formulas in (extended) DIMACS format as well as PB formulas in OPB and WBO formats.
Download and Installation
clingo is written in C++ and released under the MIT License. Source packages are available on our GitHub repository, and installation instructions for various platforms can be found on our website. If you encounter any issues, please consult our support pages.
Once installed, verify your setup by running:
clingo --version
clingo --help
clingo is a command-line tool (usable from Linux shell, Windows command prompt, etc.). Typically, you provide input file names as arguments:
clingo [ options | files | number ]
A numerical argument specifies the maximum number of answer sets to compute
(0 means compute all answer sets). By default, only one answer set is
computed (if it exists).
Outline
This guide introduces the essentials of using clingo, aiming to help you minimize time to solution for complex problems. The Quickstart section presents an introductory example, serving as both a prototype for problem modeling and a taste of clingo's language.
The main Language section covers the input languages of our tools, detailing clingo's modeling language and briefly describing the intermediate language used between grounder and solver (not intended for direct user editing). Section Multi-shot explores clingo's control features for multi-shot solving.
For practical illustration, Examples demonstrates solutions to three classic problems. Sections Options and Warnings offer guidance on command-line options and handling input-related errors and warnings.
Advanced topics include meta-programming (Meta), domain-specific heuristics (Heuristics), preference handling and optimization (Preferences), and constraint solving for multi-valued variables (Contstraint Solving). Section Configuration discusses strategies for tuning solver efficiency.
With these foundations in place, you are ready to begin your guided tour. We hope you find it both enjoyable and helpful!
References
-
[AG] M. Gebser & A. Harrison & R. Kaminski & V. Lifschitz & T. Schaub. 'Abstract Gringo'. Theory and Practice of Logic Programming. 2015. arxiv.org.
-
[Foundations] M. Gebser & R. Kaminski & B. Kaufmann and T. Schaub. 'Answer Set Solving in Practice'. Morgan and Claypool Publishers. 2012.
-
[Background] C. Baral. Knowledge Representation, Reasoning and Declarative Problem Solving. Cambridge University Press. 2003.
-
[SATHandbook] A. Biere & M. Heule & H. van Maaren & T. Walsh. 'Handbook of Satisfiability'. IOS Press. 2009.