Gurobi Configuration

Optsicom Framework allows to solve programming models with Gurobi software. If you want to implement a Gurobi model, you have to extend GurobiFormulation class.

Nevertheless, you have to install Gurobi in your machine prior to start using it. It is neccessary to configure several environment variables, execute commands, etc. This page is targeted to document all this issues.

In order to configure Gurobi you need to follow the next steps:
  • Download and install gurobi in the directory you want, for example /opt/gurobi401 (change folder name depending on your specific version)
  • Get a license file following this steps.
  • Add /opt/gurobi401/linux64/lib/gurobi.jar to Java build path (Typically, this is configured in your IDE)
  • Modify the default shared library paths:
    • Linux: execute the following command. Where linux64 can be linux32 depending on your architecture. I think that this modification is temporary, you should execute the command the next time that you init your linux.
      sudo ldconfig /opt/gurobi401/linux64/lib
  • Download a gurobi.lic licence file and put it whereever you want, for example in /opt/gurobi401
  • Configure the environment to point variable GRB_LICENSE_FILE to gurobi.lic file. You can do this in Eclipse's Run Configurations (Environment tab) or executing this command. Note that this command only affect to current terminal session, then, you have to execute this prior to open Eclipse in the same terminal session.
    export GRB_LICENSE_FILE=/opt/gurobi401/gurobi.lic
  • For least, you have to tell to Java where to find gurobi libs. You have to configure the java.library.path to point the library location in the gurobi installation. To do this, you have to add the following option when executing your Java program:
    -Djava.library.path=/opt/gurobi401/linux64/lib

If you found ways to avoid one of the previous steps... please modify this wiki :)