#gurobi #api #optimization #bindings #declaration #grb #gurobi95

sys grb-sys2

Gurobi C API FFI declarations

4 releases (1 stable)

9.5.0 Apr 12, 2022
0.2.0 Jan 11, 2022
0.1.1 Feb 18, 2021
0.1.0 Feb 18, 2021

#24 in #declaration

Download history 2/week @ 2023-11-27 28/week @ 2023-12-11 44/week @ 2023-12-18 1/week @ 2024-01-22 2/week @ 2024-02-12 13/week @ 2024-02-19 23/week @ 2024-02-26 8/week @ 2024-03-04 17/week @ 2024-03-11

61 downloads per month
Used in 3 crates (via grb)

MIT license

18KB
555 lines

grb GitHub tag (latest SemVer)

This crate provides Rust bindings for Gurobi Optimizer. It currently requires Gurobi 9.0 or higher.

This library started as fork of the gurobi which appears to be no longer maintained. It has since undergone a number of fundamental API changes.

This crate supports Gurobi 9.5

Installing and Linking

Before using this crate, you should install Gurobi and obtain a license.

Building

In this section, it is assumed Gurobi is install at /opt/gurobi/linux64.

It is recommended you use the environment variables for you system's linker to ensure Gurobi can be found. For example, on Linux systems this can be done by appending the path to the lib subfolder of the gurobi installation to LIBRARY_PATH. For example, put

export LIBRARY_PATH="LIBRARY_PATH:/opt/gurobi/linux64/lib"

in your ~/.profile file. You can also set this in a PROJECT/.cargo/config.toml file on per project basis (see the [env] section).

The other option is to set the environment variable GUROBI_HOME set to the installation path of Gurobi (like eg /opt/gurobi911/linux64). If you are using the Conda package from the Gurobi channel, you can set GUROBI_HOME=${CONDA_PREFIX} from within your Conda environment.

Running

When running the compiled binaries or running tests, you may get

error while loading shared libraries: libgurobi95.so: cannot open shared object file: No such file or directory

In this case, you need to set the LD_LIBRARY_PATH (on Windows I believe this is called PATH) environment variable or embed the path to libgurobi95.so in the rpath by supplying the appropriate linker flags in RUSTFLAGS.

For the example below, suppose Gurobi is in the path /opt/gurobi/linux64/lib/libgurobi95.so. You set LD_LIBRARY_PATH in the same manner as the LIBRARY_PATH variable, in your ~/.profile:

export LD_LIBRARY_PATH="LD_LIBRARY_PATH:/opt/gurobi/linux64/lib"

Documentation

Docs can be found on docs.rs

License

This software is released under the MIT license.

Dependencies