Skip to content

NamDinhRobotics/Use_Gurobi_Cmake

Repository files navigation

Install the Gurobi Optimizer and test it

Step 1:

Download gurobi9.5.0_linux64.tar.gz from https://www.gurobi.com/downloads/download-center.

Step 2:

You can read more detail in quickstart_linux

Your next step is to choose a destination directory.
I recommend /opt for a shared installation, but other directories will work as well.

Copy the Gurobi distribution to the destination directory and extract the contents.

Extraction is done with the following command:
tar xvfz gurobi9.0.1_linux64.tar.gz

This command will create a sub-directory /opt/gurobi950/linux64 that contains the complete Gurobi distribution (assuming you chose /opt).

Your (which we’ll refer to throughout this document) will be /opt/gurobi950/linux64.

The Gurobi Optimizer makes use of several executable files. In order to allow these files to be found when needed, you will have to modify a few environment variables:

  • GUROBI_HOME should point to your .
  • PATH should be extended to include /bin.
  • LD_LIBRARY_PATH should be extended to include /lib.

Users of the bash shell should add the following lines to their .bashrc files:

export GUROBI_HOME="/opt/gurobi901/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"

Step 3: You can use academic license as follows

Please check this link for more detail
https://www.youtube.com/watch?v=fRKhao2bzsY&t=373s

Step 4:

Copy our CmakeLists.txt file to the /src directory.

And FindGUROBI.cmake file to the /src directory.

Then, enjoy the Gurobi Optimizer!

###You can test your installation typing gurobi.sh in the terminal

Issues when installing Gurobi:
If you find the error:>
“gurobi_continuous.cpp:(.text.startup+0x74): undefined reference to `GRBModel::set(GRB_StringAttr, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'”

The solution is:
cd /opt/gurobi950/linux64/src/build
Note that the name of the folder gurobi950 changes according to the Gurobi version
sudo make
sudo cp libgurobi_c++.a ../../lib/

About

How to use Gurobi on Cmake C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published