Skip to content
Snippets Groups Projects
Clp.md 1.67 KiB
Newer Older
Radim Sojka's avatar
Radim Sojka committed

# Clp

## Introduction
Radim Sojka's avatar
Radim Sojka committed

Radim Sojka's avatar
Radim Sojka committed
Clp (Coin-or linear programming) is an open-source linear programming solver written in C++. It is primarily meant to be used as a callable library, but a basic, stand-alone executable version is also available.
Radim Sojka's avatar
Radim Sojka committed
Clp ([projects.coin-or.org/Clp](https://projects.coin-or.org/Clp)) is a part of the COIN-OR (The Computational Infrastracture for Operations Research) project ([projects.coin-or.org/](https://projects.coin-or.org/)).
Radim Sojka's avatar
Radim Sojka committed
## Modules
Radim Sojka's avatar
Radim Sojka committed
Clp, version 1.16.10 is available on Salomon via module Clp:
Radim Sojka's avatar
Radim Sojka committed
```console
$ ml Clp
```
Radim Sojka's avatar
Radim Sojka committed
The module sets up environment variables required for linking and running applications using Clp. This particular command loads the default module Clp/1.16.10-intel-2017a, Intel module intel/2017a and other related modules.
Radim Sojka's avatar
Radim Sojka committed
## Compiling and linking
Radim Sojka's avatar
Radim Sojka committed
    Link with -lClp
Radim Sojka's avatar
Radim Sojka committed
Load the Clp module. Link using -lClp switch to link your code against Clp.
Radim Sojka's avatar
Radim Sojka committed
```console
$ ml Clp
$ icc myprog.c -o myprog.x -Wl,-rpath=$LIBRARY_PATH -lClp
Radim Sojka's avatar
Radim Sojka committed
## Example
Radim Sojka's avatar
Radim Sojka committed
An example of Clp enabled application follows. In this example, the library solves linear programming problem loaded from file.
Radim Sojka's avatar
Radim Sojka committed
```cpp
#include "coin/ClpSimplex.hpp"
Radim Sojka's avatar
Radim Sojka committed
int main (int argc, const char *argv[])
{
David Hrbáč's avatar
David Hrbáč committed
    ClpSimplex model;
Radim Sojka's avatar
Radim Sojka committed
    int status;
    if (argc<2)
        status=model.readMps("/apps/all/Clp/1.16.10-intel-2017a/lib/p0033.mps");
    else
        status=model.readMps(argv[1]);
    if (!status) {
        model.primal();
    }
    return 0;
}
Radim Sojka's avatar
Radim Sojka committed
### Load modules and compile:
Radim Sojka's avatar
Radim Sojka committed
```console
ml Clp
icc lp.c -o lp.x -Wl,-rpath=$LIBRARY_PATH -lClp
Radim Sojka's avatar
Radim Sojka committed

In this example, the lp.c code is compiled using the Intel compiler and linked with Clp. To run the code, the Intel module has to be loaded.