How To Install lp-solve on Ubuntu 18.04

In this tutorial we learn how to install lp-solve on Ubuntu 18.04. lp-solve is Solve (mixed integer) linear programming problems

Introduction

In this tutorial we learn how to install lp-solve on Ubuntu 18.04.

What is lp-solve

lp-solve is:

The linear programming (LP) problem can be formulated as: Solve A.x >= V1, with V2.x maximal. A is a matrix, x is a vector of (nonnegative) variables, V1 is a vector called the right hand side, and V2 is a vector specifying the objective function.

An integer linear programming (ILP) problem is an LP with the constraint that all the variables are integers. In a mixed integer linear programming (MILP) problem, some of the variables are integer and others are real.

The program lp_solve solves LP, ILP, and MILP problems. It is slightly more general than suggested above, in that every row of A (specifying one constraint) can have its own (in)equality, <=, >= or =. The result specifies values for all variables.

lp_solve uses the ‘Simplex’ algorithm and sparse matrix methods for pure LP problems. If one or more of the variables is declared integer, the Simplex algorithm is iterated with a branch and bound algorithm, until the desired optimal solution is found. lp_solve can read MPS format input files.

There are three methods to install lp-solve on Ubuntu 18.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 lp-solve Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install lp-solve

Install lp-solve Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install lp-solve

Install lp-solve 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 lp-solve using aptitude by running the following command:

sudo aptitude -y install lp-solve

How To Uninstall lp-solve on Ubuntu 18.04

To uninstall only the lp-solve package we can use the following command:

sudo apt-get remove lp-solve

Uninstall lp-solve And Its Dependencies

To uninstall lp-solve and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove lp-solve

Remove lp-solve Configurations and Data

To remove lp-solve configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge lp-solve

Remove lp-solve configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge lp-solve

References

Summary

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