How To Install gringo on Ubuntu 22.04

In this tutorial we learn how to install gringo on Ubuntu 22.04. gringo is grounding tools for (disjunctive) logic programs

Introduction

In this tutorial we learn how to install gringo on Ubuntu 22.04.

What is gringo

gringo is:

Current answer set solvers work on variable-free programs. Hence, a grounder is needed that, given an input program with first-order variables, computes an equivalent ground (variable-free) program.

This package contains the following tools:

  • gringo: a grounder that, given an input program with first-order variables, computes an equivalent ground (variable-free) program in aspif format. Its output can be processed further with answer set solver clasp. Starting with gringo series 5, its output is no longer directly compatible with solvers like smodels or cmodels reading smodels format. Use lpconvert for translating aspif format to smodels format.
  • clingo: combines both gringo and clasp into a monolithic system. This way it offers more control over the grounding and solving process than gringo and clasp can offer individually: multi-shot solving.
  • lpconvert: converter between gringo’s aspif and smodels format.
  • reify: small utility that reifies logic programs given in aspif format. It produces a set of facts, which can be processed further with gringo.

There are three methods to install gringo on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install gringo Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install gringo using apt-get by running the following command:

sudo apt-get -y install gringo

Install gringo Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install gringo using apt by running the following command:

sudo apt -y install gringo

Install gringo Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install gringo using aptitude by running the following command:

sudo aptitude -y install gringo

How To Uninstall gringo on Ubuntu 22.04

To uninstall only the gringo package we can use the following command:

sudo apt-get remove gringo

Uninstall gringo And Its Dependencies

To uninstall gringo and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove gringo

Remove gringo Configurations and Data

To remove gringo configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge gringo

Remove gringo configuration, data, and all of its dependencies

We can use the following command to remove gringo configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge gringo

References

Summary

In this tutorial we learn how to install gringo package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.