| 1 |
The instructions here are somewhat outdated. See also README.md. |
| 2 |
|
| 3 |
These are quick install instructions mainly intended for UNIX-like systems |
| 4 |
(including Linux, OS X, AIX, Cygwin and MSys). Additional details for building |
| 5 |
this and other COIN projects are available at |
| 6 |
|
| 7 |
https://projects.coin-or.org/BuildTools |
| 8 |
|
| 9 |
You can find instructions for building with Microsoft Visual Studio under |
| 10 |
Windows at |
| 11 |
|
| 12 |
https://projects.coin-or.org/MSVisualStudio |
| 13 |
|
| 14 |
********************************************************************** |
| 15 |
*** DOWNLOAD *** |
| 16 |
********************************************************************** |
| 17 |
|
| 18 |
For the most recent information on how to install Cbc binaries, please |
| 19 |
see the Cbc Wiki: https://projects.coin-or.org/Cbc |
| 20 |
|
| 21 |
If you would like to build from source, you can obtain the source code for the |
| 22 |
Cbc package in three ways: |
| 23 |
|
| 24 |
1. Obtain the source directly from the COIN-OR subversion repository |
| 25 |
(recommended). For this you needs the program 'svn' installed on your |
| 26 |
machine, and output of "svn --version" must contain "handles 'https' |
| 27 |
scheme". On Windows, it is recommended to get the source with the SVN |
| 28 |
client TortoiseSVN (http://tortoisesvn.net). |
| 29 |
|
| 30 |
Assuming that you want to download a stable version 2.9, as an example, |
| 31 |
you would execute the command |
| 32 |
|
| 33 |
svn co https://projects.coin-or.org/svn/Cbc/stable/2.9 Cbc-2.9 |
| 34 |
|
| 35 |
You can similarly get source for the latest release or the trunk |
| 36 |
(development) version. |
| 37 |
|
| 38 |
2. Obtain the source from Github using git. Assuming that you want to |
| 39 |
download stable version 2.9, as an example, you would execute |
| 40 |
the command |
| 41 |
|
| 42 |
git clone --branch=stable/2.9 https://github.com/coin-or/Cbc Cbc-2.9 |
| 43 |
|
| 44 |
With git, you additionally, need to fetch the dependencies. To do so, |
| 45 |
execute |
| 46 |
|
| 47 |
cd Cbc-2.9 |
| 48 |
git clone --branch=stable/0.8 https://github.com/coin-or-tools/BuildTools |
| 49 |
BuildTools/get.dependencies.sh fetch |
| 50 |
|
| 51 |
3. Download the tarball from http://www.coin-or.org/download/source/Cbc |
| 52 |
and extract it. For example, for the release 2.7.0 you type |
| 53 |
|
| 54 |
gunzip Cbc-2.7.0.tgz |
| 55 |
tar xvf Cbc-2.7.0.tar |
| 56 |
|
| 57 |
********************************************************************** |
| 58 |
*** CONFIGURATION *** |
| 59 |
********************************************************************** |
| 60 |
|
| 61 |
Go into the directory that you just downloaded or extracted (e.g., Cbc-2.7.0). |
| 62 |
Then create a build directory and configure the package by typing |
| 63 |
|
| 64 |
mkdir build |
| 65 |
cd build |
| 66 |
../configure |
| 67 |
|
| 68 |
Note that you might have to specify additional options, in case you |
| 69 |
don't want to use the default choices that configure makes (e.g., |
| 70 |
compilers). Please visit |
| 71 |
|
| 72 |
https://projects.coin-or.org/BuildTools/ |
| 73 |
|
| 74 |
and the Cbc Trac page |
| 75 |
|
| 76 |
https://projects.coin-or.org/Cbc |
| 77 |
|
| 78 |
for more information. |
| 79 |
|
| 80 |
If everything went fine, you will see at the end of the output |
| 81 |
|
| 82 |
"Main configuration of Cbc successful" |
| 83 |
|
| 84 |
********************************************************************** |
| 85 |
*** COMPILATION AND INSTALLATION *** |
| 86 |
********************************************************************** |
| 87 |
|
| 88 |
In the directory where you ran the configure script: |
| 89 |
|
| 90 |
1. Compile the code by typing |
| 91 |
|
| 92 |
make |
| 93 |
|
| 94 |
2. To test if the code works, you can type |
| 95 |
|
| 96 |
make test |
| 97 |
|
| 98 |
3. To install the code, you type |
| 99 |
|
| 100 |
make install |
| 101 |
|
| 102 |
After this, you will find the executables, libraries and header |
| 103 |
files in the "bin", "lib" and "include" subdirectory, respectively. |
| 104 |
|
| 105 |
More information on the compilation and installation can be found at |
| 106 |
|
| 107 |
https://projects.coin-or.org/BuildTools/ |
| 108 |
|
| 109 |
********************************************************************** |
| 110 |
*** USING CBC *** |
| 111 |
********************************************************************** |
| 112 |
|
| 113 |
After installing Cbc, you will have an executable named "cbc" (Unix-like |
| 114 |
environments) or "cbc.exe" (Windows). We will call it "cbc" from here on. |
| 115 |
|
| 116 |
The executable "cbc" takes various options. First, run the program in |
| 117 |
interactive mode by typing just "cbc" on the command line with no arguments. |
| 118 |
You will see the prompt |
| 119 |
|
| 120 |
CoinSolver takes input from arguments ( - switches to stdin) |
| 121 |
Enter ? for list of commands or help |
| 122 |
Coin: |
| 123 |
|
| 124 |
Type ? to get some idea of what you can do. The executable can also be run in |
| 125 |
batch mode. To simply solve a given instance with default parameter settings, type |
| 126 |
|
| 127 |
cbc <file> |
| 128 |
|
| 129 |
By typing a sequence of interactive commands on the command line |
| 130 |
with each command preceded by a "-", you can run set parameters and chane other options. For example, typing |
| 131 |
|
| 132 |
cbc <file> -cuts root -solve |
| 133 |
|
| 134 |
will import file and solve the problem, generating cuts only at the root node. |
| 135 |
On Linux, the cbc interactive solver can do file completion and line editing |
| 136 |
if built from source with that option enabled. |
| 137 |
|
| 138 |
With the installed libraries, you can also link your own code with the |
| 139 |
installed libraries. You can find examples in the |
| 140 |
|
| 141 |
Cbc/examples/ |
| 142 |
|
| 143 |
To build these examples, go into the directory build/Cbc/examples and type |
| 144 |
|
| 145 |
make sample1 |
| 146 |
|
| 147 |
to build the executable corresponding to sample1.cpp. The two simplest samples |
| 148 |
are: |
| 149 |
|
| 150 |
sample.cpp This is a simple program to read an mps file.and solve the |
| 151 |
integer problem. |
| 152 |
|
| 153 |
sample2.cpp. This is the benchmark driver for the competition. It overrides |
| 154 |
the default branching methods and adds a (mildly useless) |
| 155 |
heuristic. It is intended to show you how to add your |
| 156 |
own methods. See CbcCompareUser.hpp for how to modify |
| 157 |
choice of node from tree. See CbcBranchUser.?pp for |
| 158 |
how to modify which variable is chosen at a node. For |
| 159 |
more complex stuff such as new types of branches see |
| 160 |
CbcBranchBase and CbcBranchActual in directory Cbc. |
| 161 |
To see how to add heuristics see CbcHeuristicUser.?pp. |
| 162 |
|
| 163 |
To add cut generators - define them as in Cgl and then just |
| 164 |
add them as in sample2.cpp |
| 165 |
|
| 166 |
The script "runtimes" in Samples directory will |
| 167 |
run some or all of test set. The version checked in |
| 168 |
does some - just take off # to run. An optional time |
| 169 |
in minutes can be passed. |
| 170 |
|