Gravity will automatically download and link to Ipopt libraries (linked with HSL) from here.
Note: If you have an old version of Windows (prior to 2018), you will need to install curl and tar.
First, install Cmake.
Then, follow the instructions to install Visual Studio Code and the Mingw extension here.
Install the Cmake extension too, instructions can be found here.
Finally, open the Gravity directory from Visual Studio Code and go to the Cmake panel (Cmake icon on the left) and click on Configure then Build (make sure to select the Mingw GCC 8.1.0 Kit).
The executables will be under Gravity/bin/Release
Download and install cmake: http://www.cmake.org (Version 3.2 or better)
Gravity can link to the solvers below (see instructions in next section):
Bonmin: https://projects.coin-or.org/Bonmin
Gurobi: http://www.gurobi.com
Cplex: https://www-01.ibm.com/software/commerce/optimization/cplex-optimizer/
Mosek: https://www.mosek.com
Follow these simple instructions:
1) cd Gravity
2) If your solver is not installed in a default location, you need to add the following to your ~/.bash_profile
(edit or create the file named bash_profile
under your home and add the following lines):
export SOLVERNAME_ROOT_DIR="your_location"
, whereyour_location
contains the corresponding include/headers and lib/libraries.
For instance, I have the following:
-
export IPOPT_ROOT_DIR="/Users/hh/Dev/CoinIpopt/build"
-
export MOSEK_ROOT_DIR="/Users/hh/mosek/8/tools/platform/osx64x86"
Note: If you are getting an undefined reference to
when linking with Gurobi, check this post. You might need to recompile the gurobi C++ API library.
Note: For Mosek, refer to mosek-setup for general setup and license information.
You also need to install and setup Mosek Fusion API for C++ by following instructions in fusion-url.
- Additionally, you need to set the enviroment variable
MOSEK_ROOT_DIR
andDYLD_LIBRARY_PATH
for your operating system.
For instance, if you install MOSEK 8 under DIR/mosek8/
on a linux machine, you need to add the following to your .bash_profile
file:
export MOSEK_ROOT_DIR = DIR/mosek/8/tools/platform/linux64x86/
export DYLD_LIBRARY_PATH= DIR/mosek/8/tools/platform/linux64x86/bin:$DYLD_LIBRARY_PATH
3) You're now ready to compile everything, just enter:
-
mkdir build
-
cd build
-
cmake -DIpopt=ON -DGurobi=ON -DCplex=ON -DBonmin=ON ..
All dependencies are switched off by default, to enable a solver that is installed on your system,
append the flag -D$Solvername$=ON
as shown above.
Note: To build an Xcode project append -G Xcode
to the command above
make -j4
This will install all the models found under Gravity/examples
.
The corresponding binaries will then appear under Gravity/bin/Release
.