Cgl-src crate is a *-src crate. This links Cgl libraries to executable build by cargo, but does not provide Rust bindings. Cgl is built with CoinUtils (CoinUtils-src), Osi (Clp-src) and Clp (Clp-src)(Optional).
By this package, you don't need to worry about installing Cgl in the system, and it can be built for all platforms.
The COIN-OR Cut Generation Library (Cgl) is a collection of cut generators that can be used with other COIN-OR packages that make use of cuts, such as, the mixed integer linear programming solvers Cbc (Cbc-src). Cgl uses the Osi (Osi-src) to use or communicate with a solver, such as the linear programming solvers Clp Clp-src. It does not directly call a solver.
-
Add the following to your
Cargo.toml:[dependencies] cgl-src = "\*"
-
Add the following to your
lib.rs:extern crate cgl_src;
This package does not provide bindings. Please use coincbc-sys, coinclp-sys to use Cbc, Clp, e.g.
[dependencies]
coincbc-sys = { version = "\*" }The following Cargo features are supported:
-
defaulttowith_clpanddefault_cutsfeature; -
with_clpto build with Clp support; -
default_cutsto provide all the following cut generators; -
Combinatorial cuts
CglAllDifferentto provide CglAllDifferent cut generator;
CglCliqueto provide CglClique cut generator;CglKnapsackCoverto provide CglKnapsackCover cut generator;CglOddHoleto provide CglOddHole cut generator;
CglZeroHalfto provide [CglZeroHalf] cut generator;
-
flow cover cuts:
CglFlowCoverto provide CglFlowCover cut generator;
-
Gomory cuts and variants:
CglGomory= to provide CglGomory cut generator, which requireswith_clpfeature to use clp-src;CglGMIto provide [CglGMI] cut generator;CglRedSplitto provide CglRedSplit cut generator;CglRedSplit2to provide [CglRedSplit2] cut generator;
-
Lift and project cuts:
CglLiftAndProjectto provide CglLiftAndProject cut generator;CglLandP= to provide CglLandP cut generator, which requiresCglGomoryfeature;
-
Mixed integer rounding cuts and variants:
CglMixedIntegerRoundingto provide CglMixedIntegerRounding cut generator;CglMixedIntegerRounding2to provide CglMixedIntegerRounding2 cut generator;CglTwomirto provide CglTwomir cut generator, which requireswith_clpfeature to use clp-src;CglResidualCapacityto provide CglResidualCapacity cut generator;
-
Strengthening:
CglDuplicateRowto provide CglDuplicateRow cut generator;CglPreProcessto provide CglPreProcess cut generator;CglProbingto provide CglProbing cut generator;CglSimpleRoundingto provide CglSimpleRounding cut generator;
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_STATICto link to CoinUtils statically;CARGO_COINUTILS_SYSTEMto link to CoinUtils system library;CARGO_OSI_STATICto link to Osi statically;CARGO_OSI_SYSTEMto link to Osi system library;CARGO_CLP_STATICto link to Clp statically ifwith_clpfeature is enabled;CARGO_CLP_SYSTEMto link to Clp system library ifwith_clpfeature is enabled;CARGO_CGL_STATICto link to Cgl statically;CARGO_CGL_SYSTEMto link to Cgl 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.
On Windows, if ${LIB_NAME}_SYSTEM is set to 1, cgl-src will use
vcpkg to find Cgl. Before building, you must have the correct Cgl
installed for your target triplet and kind of linking. For instance,
to link dynamically for the x86_64-pc-windows-msvc toolchain, install
cgl for the x64-windows triplet:
vcpkg install cgl --triplet x64-windowsTo link Cgl statically, install cgl for the x64-windows-static-md triplet:
vcpkg install cgl --triplet x64-windows-static-mdTo link Cgl and C Runtime (CRT) statically, install cgl for the x64-windows-static triplet:
vcpkg install cgl --triplet x64-windows-staticand build with +crt-static option
RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvcPlease see the "Static and dynamic C runtimes" in The Rust reference for detail.
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 |
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.