MeLOn
Loading...
Searching...
No Matches
Installing and Executing MeLOn

When you want to use machine-learning models in optimization, we recommend to you to download and install the MAiNGO solver. We provide MeLOn as a submodule within MAiNGO. This way, the machine-learning models can be directly used within optimization problems. If you want to see a few examples for the usage of machine learning models in MAiNGO, please see the example problems here: https://git.rwth-aachen.de/avt.svt/public/maingo/-/tree/master/examples As described below, you can also download MeLOn as a standalone library for machine learning models in C++. When compiling MeLOn as a standalone tool, we automatically set up a few tests.

Obtaining MeLOn

In order to obtain MeLOn, we strongly recommend using Git (Git Bash on Windows). It is possible to download MeLOn as a .zip folder, but we strongly recommend to use Git and follow the given instructions (in particular because we use submodules for dependencies, which need to be downloaded separately when not using Git). First you need to clone the MeLOn repository. This is done by

git clone https://git.rwth-aachen.de/avt.svt/public/melon.git <directory>

where <directory> is the name of the directory where you can find all MeLOn files after cloning (default name is melon). After the cloning is done, simply navigate to the directory. In the cloned MeLOn directory execute

git submodule init

If nothing happens, you are not in the cloned MeLOn directory and have to navigate to there first. For Windows users, we recommend the usage of HTTPS protocols for Git and SSH protocols for Linux and Mac OS users to avoid multiple username and password inputs. For more info on SSH keys, see the Git documentation on SSH authentication which can be found under Help -> SSH authentication in your GitLab. If you are having HTTPS authentication problems on Windows, please make sure that your cedential manager has the correct settings. The Windows credential manager can be found at Control Panel -> User Accounts -> Manage your credentials.

In order to proceed and update all submodules of MeLOn, execute

git submodule update -j 1

in the MeLOn directory. You can determine whether the above worked properly by checking if each dependency folder in the dep/ folder is non-empty. In the case that the above DID NOT work properly, execute the following in the MeLOn directory

git submodule foreach git checkout master
git submodule foreach git pull

A note for user more familiar with Git: the git submodule update is exectued without the –recursive option. This avoids instantiating any indirect dependencies; in the repository design of MeLOn, all dependencies (including indirect ones) are present in the dep folder. It is also executed using only one process -j 1 to avoid input failures.

Updating MeLOn

If you want to update to the latest MeLOn version, use the following git commands

git pull
git submodule update

If you changed any of the source files in MeLOn or any dependency found in the dep/ folder, you should restore the original state of MeLOn by first saving a copy of the files you changed (or using git stash) and then executing

git checkout .

in the MeLOn repository and/or in any dependency repository you edited. Then, update the MeLOn repository with the pull and submodule update commands. Finally, you can replace the files of interest by your saved copies (or retrieve them via git stash pop).

Required Software

Building MeLOn requires the following non-standard programs that are not in the Git repository:

  • CMake 3.8 or later
  • Visual Studio 2017 (Windows only)
  • A Fortran Compiler (Linux and Mac OS)

All other third-party software that MeLOn depends on comes with the MeLOn Git. Unless you feel the need to modify the folder structure or switch to other versions (in which case we would appreciate you contacting the MeLOn team as well), there is nothing you need to do.

Generating and Compiling the Project

MeLOn uses CMake for setting up the required Visual Studio project (for Windows) or Makefile (for Linux or Mac OS).

A note for users seeking to include MeLOn in their own code: MeLOn uses modern target-oriented cmake commands. The CMakeLists.txt in the root directory is the sole entry point both for building MeLOn as a standalone solver or including it into your project. However, when including it into your code you will need to add all dependencies (i.e., all folders within the dep folder in the MeLOn repository) in your own CMakeLists.txt using add_subdirectory. Please see also section embedded.

Windows

On Windows, only Microsoft Visual C++ 2017 is supported. We supply pre-compiled versions for all Fortran libraries, so no Fortran compiler (or runtime) should be needed. To generate the Visual Studio project and compile MeLOn, you need to complete the following steps:

  1. Start CMake and navigate or type the path to your MeLOn directory (this is the one where the Readme.md is) and select your build directory.
  2. Use the Configure button to choose Visual Studio 15 2017 Win64 as generator (or Visual Studio 15 2017 as generator and x64 as optional platform for generator in the newer versions of CMake). Make sure that you use default native compilers. Press Finish and wait for the configuration to complete. If at the end you get a message saying Configuring done, everything worked fine.
  3. If desired, you can now change the CMake variables. (not applicable here)
  4. Press the Generate button. You should get a message saying Generating done.
  5. Press the Open Project button (or open the MeLOn.sln file (with Visual Studio 15 2017) that was created by CMake in the build directory you specified). Make sure to set the build type to Release, since this will result in MeLOn being significantly faster.
  6. Compile MeLOn by clicking Build->Build solution. This will create the executables.

Linux and Mac OS

We recommend to create a build folder in the MeLOn directory first and then navigate to it (you can create the build folder anywhere else on you machine).

mkdir build
cd build

Then simply execute cmake using the CMakeLists.txt from the MeLOn directory by

cmake ..

You can change the CMake variables explained above by adding -D<name_of_cmake_variable>=<value> after the cmake command. To compile the code execute

make

You can add the option -j n to compile using n cores of your machine, e.g., execute make -j 4 to compile using 4 cores.