How to: compile C++ with Gurobi in Linux

In order to compile your C++ project with Gurobi, you first need to create the appropriate libgurobi_c++.a compatible with your g++ version. To do so, access the following directory and compile it:

cd [GRB_path]/linux64/src/build
The file is now created, so copy it to the lib folder:
cp libgurobi_c++.a ../../lib/
Now you can create your makefile. For example:
CCC = g++ 
FLAGS = -g -Wall -Wextra 
GRBPATH = /[full path to]/gurobi752/ 

exec: code.cpp 
     $(CCC) $(FLAGS) code.cpp -o exec -I$(GRBPATH)/linux64/include -L$(GRBPATH)/linux64/lib -lgurobi_c++ -lgurobi75 

     rm -f code *.o *~

You might need to change spaces to tabs in the above makefile.

This was useful? Buy me a cup of coffee to help me keep this website running!

Installing Concorde TSP with CPLEX in Linux

Concorde TSP is one of the best solvers for the Traveling Salesman Problem. Its current version was released in 2003, but it is still considered to be the state of the art in its field.

CPLEX is a general purpose solver. It is also considered to be one of the best in its class.

In order to obtain exact solutions with Concorde, one needs to link it to a solver. However, Concorde’s documentation falls short, since in 2003 CPLEX’s version was 8.0, and it is currently under version 12.5 (as of november 2012).

In order to link and compile Concorde with CPLEX, you will need to make the following modifications:

Continue reading Installing Concorde TSP with CPLEX in Linux