Concepts
Features
Reference
To use our R interface, you’ll need to install the Gurobi package inyour local R installation. The R command for doing this is:
install.packages('<R-package-file>',repos=NULL)
The Gurobi R package file can be found in the<installdir>/R directoryof your Gurobi installation (the default<installdir> for Gurobi 11.0.0is/opt/gurobi1100/linux64 for Linux,c:\gurobi1100win64 for 64-bitWindows, and/Library/gurobi1100/macos_universal2 for Mac). You shouldbrowse the<installdir>/R directory to find the exact name of the filefor your platform (the Linux package is in filegurobi_11.0-0_R_.tar.gz, the Windows package is in filegurobi_11.0-0.zip, and the Mac package is in filegurobi_11.0-0_R_.tgz).
Depending on your local R environment you might need to install the Rpackageslam. To do this, you should issue the following commandwithin R:
install.packages('slam')
You will need to be careful to make sure that the R binary and theGurobi package you install both use the same instruction set. Forexample, if you are using the 64-bit version of R, you’ll need toinstall the 64-bit version of Gurobi, and the 64-bit Gurobi R package.This is particularly important on Windows systems, where the errormessages that result from instruction set mismatches can be quitecryptic.
To run one of the R examples provided with the Gurobi distribution, youcan use thesource command in R. For example, if you are running Rfrom the Gurobi R examples directory, you can say:
>source('mip.R')
If the Gurobi package was successfully installed, you should see thefollowing output:
[1]'Solution:'[1]3[1]101
Help and Feedback