this repo has no description
at develop 9.7 kB view raw
1.. _ch-installation_detailed_linux: 2 3Installation Instructions for Linux and macOS 4--------------------------------------------- 5 6These instructions should work for most Linux distributions. 7 8MiniZinc 9~~~~~~~~ 10 11Required development tools: 12 13- CMake, version 3.4.0 or later 14- On Linux: A recent C++ compiler (g++ or clang) 15- On macOS: The Xcode developer tools 16 17Before compiling MiniZinc, consider whether you want to install additional solvers. In particular, MIP solvers such as CBC, SCIP, Gurobi, IBM ILOG CPLEX, and XPRESS need to be installed prior to compiling MiniZinc, so that the build system can find them. If you want to use the solution checking functionality or extended presolving, you will also need to install Gecode before compiling MiniZinc. See below for installation instructions for these solvers. 18 19To install MiniZinc, unpack the source code (or clone the git repository). Open a terminal and change into the source code directory. The following sequence of commands will build the MiniZinc compiler tool chain: 20 21.. code-block:: bash 22 23 mkdir build 24 cd build 25 cmake -DCMAKE_BUILD_TYPE=Release .. 26 cmake --build . 27 28MiniZinc IDE 29~~~~~~~~~~~~ 30 31Required development tools: 32 33- A recent C++ compiler (g++ or clang) 34- Qt toolkit, version 5.9 or later (http://qt.io) 35 36Unpack the source code (or clone the git repository). Open a terminal and change into the source code directory for the MiniZinc IDE. Then use the following commands to compile: 37 38.. code-block:: bash 39 40 mkdir build 41 cd build 42 qmake ../MiniZincIDE 43 make 44 45Gecode 46~~~~~~ 47 48You can obtain the Gecode source code from GitHub (https://github.com/gecode/gecode). You can find detailed compilation instructions for Gecode on its web site (https://www.gecode.org). In short, to compile from source, run the following in a terminal (from within the Gecode source code directory): 49 50.. code-block:: bash 51 52 mkdir build 53 cd build 54 ../configure 55 make -j8 56 sudo make install 57 58which compiles Gecode and installs it in the standard location. You can choose a different installation directory using ``../configure --prefix=<INSTALLATION_PREFIX>``. In that case you can run ``make install`` without ``sudo``. 59 60After installing Gecode, you can compile MiniZinc with built-in support for Gecode, which enables extended pre-solving and solution checking. In order for the MiniZinc compilation to find your Gecode installation, Gecode either has to be in the default location (such as ``/usr/local/include`` etc.), or you have to use the option ``-DGECODE_ROOT=<INSTALLATION_PREFIX>`` when calling ``cmake``. 61 62In order to use Gecode as a *solver* with MiniZinc (as opposed to an internal pre-solving tool), you have to create an appropriate solver configuration file. Add a file ``gecode.msc`` in an appropriate location (see :ref:`sec-cmdline-conffiles`) containing the following, where you replace ``<INSTALLATION_PREFIX>`` with the actual installation path and update the version number if necessary: 63 64.. code-block:: json 65 66 { 67 "id": "org.gecode.gecode", 68 "name": "Gecode", 69 "description": "Gecode FlatZinc executable", 70 "version": "6.2.0", 71 "mznlib": "<INSTALLATION_PREFIX>/share/gecode/mznlib", 72 "executable": "<INSTALLATION_PREFIX>/bin/fzn-gecode", 73 "tags": ["cp","int", "float", "set", "restart"], 74 "stdFlags": ["-a","-f","-n","-p","-r","-s","-t"], 75 "supportsMzn": false, 76 "supportsFzn": true, 77 "needsSolns2Out": true, 78 "needsMznExecutable": false, 79 "needsStdlibDir": false, 80 "isGUIApplication": false 81 } 82 83 84OR Tools 85~~~~~~~~ 86 87You can install the OR-Tools FlatZinc module as binary or obtain the source code from GitHub (https://github.com/google/or-tools). 88You can find detailed compilation instructions for OR-Tools on https://developers.google.com/optimization/. 89To compile the FlatZinc module from source, run the following in a terminal (from within the OR-Tools source code directory): 90 91.. code-block:: bash 92 93 make fz -j8 94 make test_fz 95 96In order to use OR-Tools with MiniZinc, you have to create an appropriate solver configuration file. 97Add a file ``ortools.msc`` in an appropriate location (see :ref:`sec-cmdline-conffiles`) containing the following, 98where you replace ``<INSTALLATION_PREFIX>`` with the actual installation path and update the version number if necessary: 99 100.. code-block:: json 101 102 { 103 "id": "org.ortools.ortools", 104 "name": "OR Tools", 105 "description": "Or Tools FlatZinc executable", 106 "version": "7.0/stable", 107 "mznlib": "<INSTALLATION_PREFIX>/ortools/flatzinc/mznlib_sat", 108 "executable": "<INSTALLATION_PREFIX>/bin/fz", 109 "tags": ["cp","int", "lcg", "or-tools"], 110 "stdFlags": ["-a", "-n", "-p", "-f", "-r", "-v", "-l", "-s"], 111 "supportsMzn": false, 112 "supportsFzn": true, 113 "needsSolns2Out": true, 114 "needsMznExecutable": false, 115 "needsStdlibDir": false, 116 "isGUIApplication": false 117 } 118 119 120Chuffed 121~~~~~~~ 122 123You can obtain Chuffed's source from https://github.com/chuffed/chuffed. You can compile and install it using the following commands: 124 125.. code-block:: bash 126 127 mkdir build 128 cd build 129 cmake .. 130 cmake --build . -- -j8 131 sudo cmake --build . --target install 132 133This will install Chuffed in the default location. Alternatively, you can choose a different installation directory by calling ``cmake .. -DCMAKE_INSTALL_PREFIX=<INSTALLATION_PREFIX>`` before ``cmake --build``. In that case, you may be able to install without using ``sudo``. 134 135In order for MiniZinc to recognise the Chuffed solver, add a configuration file ``chuffed.msc`` to an appropriate location (see :ref:`sec-cmdline-conffiles`) with the following content, where you replace ``<INSTALLATION_PREFIX>`` with the actual installation path and update the version number if necessary: 136 137.. code-block:: json 138 139 { 140 "id": "org.chuffed.chuffed", 141 "name": "Chuffed", 142 "description": "Chuffed FlatZinc executable", 143 "version": "0.9", 144 "mznlib": "<INSTALLATION_PREFIX>/share/chuffed/mznlib", 145 "executable": "<INSTALLATION_PREFIX>/bin/fzn-chuffed", 146 "tags": ["cp","lcg","int"], 147 "stdFlags": ["-a","-f","-n","-r","-s","-t","-v"], 148 "supportsMzn": false, 149 "supportsFzn": true, 150 "needsSolns2Out": true, 151 "needsMznExecutable": false, 152 "needsStdlibDir": false, 153 "isGUIApplication": false 154 } 155 156 157COIN-OR CBC 158~~~~~~~~~~~ 159 160CBC is an open-source Mixed Integer Programming solver. You can find out more about it at https://github.com/coin-or/Cbc. MiniZinc contains a built-in interface to CBC, so in order to use it you have to install CBC *before* compiling MiniZinc. 161 162These instructions apply to CBC versions 2.10/stable or newer. 163 164To download and compile CBC, run the following: 165 166.. code-block:: bash 167 168 svn checkout https://projects.coin-or.org/svn/Cbc/stable/2.10/ Cbc-stable 169 cd Cbc-stable 170 ./configure --enable-cbc-parallel 171 make 172 sudo make install 173 174This will install CBC in the default location. You can choose a different installation directory using ``../configure --enable-cbc-parallel --prefix=<INSTALLATION_PREFIX>``. In that case you can run ``make install`` without ``sudo``. 175 176The MiniZinc build system should find CBC automatically if it is installed in the default location. You can use the command line flag ``-DOSICBC_ROOT=<INSTALLATION_PREFIX>`` when running ``cmake`` for MiniZinc if you installed CBC in a different location. 177 178SCIP 179~~~~ 180 181For *SCIP (as of 7.0.0)*, it seems best to install the binary package because it also installs the include files and thus even when compiling MiniZinc from source, 182SCIP is invoked; moreover the binary package has all the bells&whistles like symmetry handling and IPOPT. Use the ``scipoptsuite`` binary installation. 183 184If you want to compile ``scipoptsuite``, the installation commands should be as follows. 185 1861. Download the SCIP Optimization Suite 7.0.0 source code: https://scip.zib.de/download.php?fname=scipoptsuite-7.0.0.tgz 187 1882. Untar it and change into scipoptsuite-7.0.0. 189 1903. Run the following commands: 191 192.. code-block:: bash 193 194 mkdir build 195 cd build 196 cmake .. [-DSOPLEX_DIR=/path/to/soplex] 197 make 198 # optional: run a quick check on some instances 199 make check 200 # optional: install scip executable, library, and headers 201 # Helps MiniZinc find SCIP if in the standard location 202 make install 203 2044. You might want to install LAPACK, bliss patch and any other support libraries for performance. 205 206 207For *SCIP (as of 6.0.1.0)*, the installation commands should be as follows. 208 2091. Download the SCIP Optimization Suite 6.0.1 (or higher) source code: https://scip.zib.de/download.php?fname=scipoptsuite-6.0.1.tgz 210 2112. Untar it and change directories into scipoptsuite-6.0.1 212 2133. create a build directory and change directories there 214 2154. Execute 216 217.. code-block:: bash 218 219 cmake .. -DCMAKE_BUILD_TYPE=Release [-DCMAKE_INSTALL_PREFIX=/home/user/local/scip/installation] 220 221The first flag is necessary, the second one is optional in order to install SCIP and SoPlex non-systemwide. 222 2235. Compile and install SoPlex, SCIP, and its optional components: 224 225.. code-block:: bash 226 227 make && make install 228 2296. Configure minizinc: 230 231.. code-block:: bash 232 233 cmake .. -DUSE_PROPRIETARY=on [-DCMAKE_PREFIX_PATH=/home/user/local/scip/installation] 234 235The optional prefix path variable is only necessary if you installed SCIP in a non-systemwide directory. 236 2377. Compile Minizinc and enjoy SCIP as a solver. 238 239If you have folders for SCIP and SoPlex separately, follow these steps: 240 241.. code-block:: bash 242 243 $ tar xvfz scipoptsuite-6.0.1.tgz 244 $ cd scipoptsuite-6.0.1 245 $ cd soplex 246 $ mkdir build 247 $ cd build 248 $ cmake .. 249 $ make -j5 250 $ cd ../scip 251 $ mdkir build 252 $ cd build 253 $ cmake .. -DSOPLEX_DIR=~/Downloads/Software/scipoptsuite-6.0.1/soplex/build 254 $ make -j5 255 $ sudo make install ## Now MZN should find it