#linear-programming

sys clp-src

Redistribution of Coin-OR Clp as a crate

8 releases

0.2.8+1.17.10 Aug 20, 2024
0.2.7+1.17.9 Apr 11, 2024
0.2.6+1.17.9 Oct 27, 2023
0.2.4+1.17.8 May 18, 2023
0.2.2+1.17.7 Mar 28, 2023

#13 in #linear-programming

Download history 28/week @ 2024-06-15 22/week @ 2024-06-22 11/week @ 2024-06-29 3/week @ 2024-07-06 15/week @ 2024-07-13 6/week @ 2024-07-20 11/week @ 2024-07-27 15/week @ 2024-08-03 7/week @ 2024-08-10 150/week @ 2024-08-17 29/week @ 2024-08-24 25/week @ 2024-08-31 9/week @ 2024-09-07 12/week @ 2024-09-14 27/week @ 2024-09-21 18/week @ 2024-09-28

71 downloads per month
Used in 6 crates (3 directly)

Apache-2.0

6.5MB
167K SLoC

C++ 166K SLoC // 0.1% comments Automake 236 SLoC // 0.2% comments Rust 102 SLoC Shell 11 SLoC // 0.3% comments

Clp-src

Package Documentation License

Clp-src crate is a *-src crate. This links Clp libraries to executable build by cargo, but does not provide Rust bindings. Clp is built with CoinUtils (CoinUtils-src), Osi (Osi-src)(Optional).

By this package, you don't need to worry about installing Clp in the system, and it's a package for multi-platforms.

Clp (Coin-or linear programming) is an open-source linear programming solver. It is primarily meant to be used as a callable library, but a basic, stand-alone executable version is also available.

Usage

  1. add the following to your Cargo.toml:

    [dependencies]
    clp-src = "\*"
    
  2. add the following to your lib.rs:

    extern crate clp_src;
    

This package does not provide bindings. Please use coincbc-sys, coinclp-sys to use Cbc, Clp, e.g.

[dependencies]
coinclp-sys = { version = "\*" }

Configuration

Features

The following Cargo features are supported:

  • default to osiclp and clpsolver feature;
  • osiclp to build with Osi supported;
  • clpsolver to build ClpSolver lib and crate the api for Rust. If you do not use Clp directly, you can disable this feature to reduce the build time;

Environment

The package build from the source and link statically by default. It also provide the following environment variables to allow users to link to system library customly:

  • CARGO_COINUTILS_STATIC to link to CoinUtils statically;
  • CARGO_COINUTILS_SYSTEM to link to CoinUtils system library;
  • CARGO_OSI_STATIC to link to Osi statically if with_osi feature is enabled;
  • CARGO_OSI_SYSTEM to link to Osi system library if with_osi feature is enabled;
  • CARGO_CLP_STATIC to link to Clp statically;
  • CARGO_CLP_SYSTEM to link to Clp system library;

Set the environment variable to 1 to enable the feature. For example, to link to system library dynamically, set CARGO_${LIB_NAME}_SYSTEM to 1; to link to system library statically, set both CARGO_${LIB_NAME}_SYSTEM and CARGO_${LIB_NAME}_STATIC to 1.

Windows and vcpkg

On Windows, if ${LIB_NAME}_SYSTEM is set to 1, clp-src will use vcpkg to find Clp. Before building, you must have the correct Clp installed for your target triplet and kind of linking. For instance, to link dynamically for the x86_64-pc-windows-msvc toolchain, install clp for the x64-windows triplet:

vcpkg install clp --triplet x64-windows

To link Clp statically, install clp for the x64-windows-static-md triplet:

vcpkg install clp --triplet x64-windows-static-md

To link Clp and C Runtime (CRT) statically, install clp for the x64-windows-static triplet:

vcpkg install clp --triplet x64-windows-static

and build with +crt-static option

RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc

Please see the "Static and dynamic C runtimes" in The Rust reference for detail.

Cross Compilation

you can compile it for the other target by providing the --target option to cargo build.

Target supported
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
riscv64gc-unknown-linux-gnu
x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
others not test

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.

Dependencies

~3MB
~70K SLoC