doc/getstart.dox
author alpar
Mon, 04 Sep 2006 19:12:44 +0000
changeset 2194 eaf16c8f6fef
parent 2125 2f2cbe4e78a8
child 2391 14a343be7a5a
permissions -rw-r--r--
'make doc' is now working also in case of external build.
athos@1173
     1
/**
athos@1173
     2
\page getstart How to start using LEMON
athos@1173
     3
klao@1519
     4
In this page we detail how to start using LEMON, from downloading it to
klao@1519
     5
your computer, through the steps of installation, to showing a simple
klao@1519
     6
"Hello World" type program that already uses LEMON. We assume that you
klao@1519
     7
have a basic knowledge of your operating system and \c C++ programming
klao@1519
     8
language. The procedure is pretty straightforward, but if you have any
ladanyi@2167
     9
difficulties don't hesitate to <a href="mailto:etik-ol@cs.elte.hu">ask</a>.
athos@1175
    10
ladanyi@1637
    11
athos@1514
    12
\section requirementsLEMON Hardware and software requirements
athos@1175
    13
klao@1519
    14
In LEMON we use C++ templates heavily, thus compilation takes a
klao@1519
    15
considerable amount of time and memory. So some decent box would be
klao@1519
    16
advantageous. But otherwise there are no special hardware requirements.
athos@1514
    17
klao@1519
    18
You will need a recent C++ compiler. Our primary target is the GNU C++
ladanyi@1637
    19
Compiler (g++), from version 3.3 upwards. We also checked the Intel C++
ladanyi@1637
    20
Compiler (icc). Microsoft Visual C++ .NET 2003 was also reported to
klao@1519
    21
work (but not the earlier versions). If you want to develop with LEMON
klao@1519
    22
under Windows you could consider using Cygwin.
athos@1514
    23
ladanyi@1637
    24
In this description we will suppose a Linux environment and GNU C++ Compiler.
athos@1514
    25
ladanyi@1637
    26
ladanyi@1637
    27
\subsection requirementsLP LP solver requirements
ladanyi@1637
    28
ladanyi@1637
    29
The LEMON LP solver interface can use the GLPK (GNU Linear Programming Kit)
ladanyi@1637
    30
and CPLEX solvers (was tested with CPLEX 7.5). If you want to use it you will
ladanyi@1637
    31
need at least one of these. See \ref configureFlags how to enable these at
ladanyi@1637
    32
compile time.
ladanyi@1637
    33
ladanyi@1637
    34
athos@1173
    35
\section downloadLEMON How to download LEMON
athos@1173
    36
athos@1511
    37
You can download LEMON from the LEMON web site:
ladanyi@1637
    38
http://lemon.cs.elte.hu/download.html .
klao@1519
    39
There you will find released versions in form of <tt>.tar.gz</tt> files.
klao@1519
    40
If you want a developer version (for example you want to contribute in
klao@1519
    41
developing the library LEMON) then you might want to use our Subversion
klao@1519
    42
repository. This case is not detailed here, so from now on we suppose that
klao@1519
    43
you downloaded a tar.gz file.
athos@1514
    44
athos@1175
    45
athos@1173
    46
\section installLEMON How to install LEMON
athos@1173
    47
athos@1528
    48
In order to install LEMON you have to do the following steps.
athos@1173
    49
klao@1519
    50
Download the tarball (named <tt>lemon-x.y.z.tar.gz</tt> where \c x,\c y
klao@1519
    51
and \c z are numbers indicating the version of the library: in our example
klao@1519
    52
we will have <tt>lemon-0.3.1.tar.gz</tt>) and issue the following
klao@1519
    53
commands:
athos@1511
    54
klao@1519
    55
\verbatim
athos@1511
    56
tar xvzf lemon-0.3.1.tar.gz
athos@1511
    57
cd lemon-0.3.1
athos@1511
    58
./configure
athos@1511
    59
make
athos@1528
    60
make check   #(This is optional, but recommended. It runs a bunch of tests.)
athos@1511
    61
make install
klao@1519
    62
\endverbatim
athos@1511
    63
klao@1519
    64
These commands install LEMON under \c /usr/local (you will
klao@1519
    65
need root privileges to be able to install to that
klao@1519
    66
directory). If you want to install it to some other place, then
athos@1528
    67
pass the \c --prefix=DIRECTORY flag to \c ./configure, for example:
athos@1528
    68
athos@1528
    69
\verbatim
ladanyi@2167
    70
./configure --prefix=/home/username/lemon
athos@1528
    71
\endverbatim
athos@1528
    72
athos@1528
    73
In what follows we will assume that you were able to install to directory
klao@1519
    74
\c /usr/local, otherwise some extra care is to be taken to use the
klao@1519
    75
library.
athos@1511
    76
athos@1514
    77
We briefly explain these commands below.
athos@1514
    78
klao@1519
    79
\verbatim
athos@1514
    80
tar xvzf lemon-0.3.1.tar.gz
klao@1519
    81
\endverbatim
klao@1519
    82
This command untars the <tt>tar.gz</tt> file into a directory named <tt>
klao@1519
    83
lemon-0.3.1</tt>.
athos@1514
    84
klao@1519
    85
\verbatim
athos@1514
    86
cd lemon-0.3.1
klao@1519
    87
\endverbatim
athos@1514
    88
Enters the directory.
athos@1514
    89
klao@1519
    90
\verbatim
athos@1514
    91
./configure
klao@1519
    92
\endverbatim
athos@1514
    93
Does some configuration (creates makefiles etc).
athos@1514
    94
klao@1519
    95
\verbatim
athos@1514
    96
make
klao@1519
    97
\endverbatim
klao@1519
    98
This command compiles the non-template part of LEMON into
klao@1519
    99
<b>libemon.a</b> file. It also compiles some benchmark and demo
klao@1519
   100
programs.
athos@1514
   101
klao@1519
   102
\verbatim
klao@1519
   103
make check
klao@1519
   104
\endverbatim
klao@1519
   105
This is an optional step: it runs the test programs that we
klao@1519
   106
developed for LEMON to check whether the library works properly on
klao@1519
   107
your platform.
athos@1514
   108
klao@1519
   109
\verbatim
athos@1514
   110
make install
klao@1519
   111
\endverbatim
athos@1514
   112
This will copy the directory structure to its final destination (e.g. to \c
klao@1519
   113
/usr/local) so that your system can access it. This command should
klao@1519
   114
be issued as "root", unless you provided a \c --prefix switch to
ladanyi@1637
   115
the \c configure to install the library in non-default location.
ladanyi@1637
   116
ladanyi@1637
   117
ladanyi@1637
   118
\subsection configureFlags Configure flags
ladanyi@1637
   119
ladanyi@1637
   120
You can pass the following flags to \c ./configure (see \c ./configure --help
ladanyi@1637
   121
for more):
ladanyi@1637
   122
ladanyi@1637
   123
\verbatim
ladanyi@1637
   124
--with-glpk[=PREFIX]
ladanyi@1637
   125
\endverbatim
ladanyi@1637
   126
Enable GLPK support (default). You should specify the prefix too if you
ladanyi@1637
   127
installed it to some non-standard location (e.g. your home directory). If
ladanyi@1637
   128
GLPK is not found, then GLPK support will be disabled.
ladanyi@1637
   129
ladanyi@1637
   130
\verbatim
ladanyi@1637
   131
--with-glpk-includedir=DIR
ladanyi@1637
   132
\endverbatim
ladanyi@1637
   133
The directory where the GLPK header files are located. This is only useful when
alpar@1713
   134
the GLPK headers and libraries are not under the same prefix (which is
alpar@1713
   135
unlikely).
ladanyi@1637
   136
ladanyi@1637
   137
\verbatim
ladanyi@1637
   138
--with-glpk-libdir=DIR
ladanyi@1637
   139
\endverbatim
ladanyi@1637
   140
The directory where the GLPK libraries are located. This is only useful when
alpar@1713
   141
the GLPK headers and libraries are not under the same prefix (which is
alpar@1713
   142
unlikely).
ladanyi@1637
   143
ladanyi@1637
   144
\verbatim
ladanyi@1637
   145
--without-glpk
ladanyi@1637
   146
\endverbatim
ladanyi@1637
   147
Disable GLPK support.
ladanyi@1637
   148
ladanyi@1637
   149
\verbatim
ladanyi@1637
   150
--with-cplex[=PREFIX]
ladanyi@1637
   151
\endverbatim
ladanyi@1637
   152
Enable CPLEX support (default). You should specify the prefix too if you
ladanyi@1637
   153
installed it to some non-standard location (e.g. \c /opt/ilog/cplex75). If
ladanyi@1637
   154
CPLEX is not found, then CPLEX support will be disabled.
ladanyi@1637
   155
ladanyi@1637
   156
\verbatim
ladanyi@1637
   157
--with-cplex-includedir=DIR
ladanyi@1637
   158
\endverbatim
ladanyi@1637
   159
The directory where the CPLEX header files are located. This is only useful
ladanyi@1637
   160
when the CPLEX headers and libraries are not under the same prefix.
ladanyi@1637
   161
ladanyi@1637
   162
\verbatim
ladanyi@1637
   163
--with-cplex-libdir=DIR
ladanyi@1637
   164
\endverbatim
ladanyi@1637
   165
The directory where the CPLEX libraries are located. This is only useful when
ladanyi@1637
   166
the CPLEX headers and libraries are not under the same prefix.
ladanyi@1637
   167
ladanyi@1637
   168
\verbatim
ladanyi@1637
   169
--without-cplex
ladanyi@1637
   170
\endverbatim
ladanyi@1637
   171
Disable CPLEX support.
ladanyi@1637
   172
ladanyi@1637
   173
ladanyi@1637
   174
\section svnCheckout How to checkout LEMON form our Subversion repository
ladanyi@1637
   175
ladanyi@1637
   176
You can obtain the latest version of LEMON from our Subversion repository. To
ladanyi@1637
   177
do this issue the following command:
ladanyi@1637
   178
\verbatim
ladanyi@1637
   179
svn co https://lemon.cs.elte.hu/svn/hugo/trunk lemon
ladanyi@1637
   180
\endverbatim
ladanyi@1637
   181
Use "lemon" as username, the password is empty.
ladanyi@1637
   182
ladanyi@1637
   183
ladanyi@1637
   184
\section svnCompile How to compile the source from the repository
ladanyi@1637
   185
ladanyi@1637
   186
You can compile the code from the repository similarly to the packaged version,
ladanyi@1637
   187
but you will need to run \c ./bootstrap before \c ./configure. See \c
ladanyi@1637
   188
./bootstrap \c --help for options. For bootstrapping you will need the
ladanyi@1637
   189
following tools:
ladanyi@1637
   190
ladanyi@1637
   191
 - <a href="http://www.gnu.org/software/automake/">automake</a> (1.7 or newer)
ladanyi@1637
   192
 - <a href="http://www.gnu.org/software/autoconf/">autoconf</a> (2.59 or newer)
ladanyi@1637
   193
 - <a href="http://www.gnu.org/software/libtool/">libtool</a>
ladanyi@1637
   194
 - <a href="http://pkgconfig.freedesktop.org/">pkgconfig</a>
ladanyi@1637
   195
ladanyi@1637
   196
To generate the documentation, run \c make \c doc. You will need
ladanyi@1637
   197
<a href="http://www.doxygen.org/">Doxygen</a> for this.
ladanyi@1637
   198
ladanyi@1637
   199
You can pass the \c --enable-doc=full flag to \c ./configure to generate the
ladanyi@1637
   200
internal documentation too.
ladanyi@1637
   201
ladanyi@1637
   202
If you pass the \c --disable-doc flag to \c ./configure then the documentation
ladanyi@1637
   203
won't be installed, when you run \c make \c install (this speeds things up a
ladanyi@1637
   204
bit).
athos@1175
   205
athos@1173
   206
\section helloworld My first program using LEMON
athos@1173
   207
klao@1519
   208
If you have installed LEMON on your system you can paste the
klao@1520
   209
following code segment into a file (you can find it as \c
klao@1520
   210
demo/hello_lemon.cc in the LEMON package) to have a first working
klao@1520
   211
program that uses library LEMON.
athos@1173
   212
alpar@1640
   213
\dontinclude hello_lemon.cc
alpar@1640
   214
\skip include
alpar@1640
   215
\until }
athos@1175
   216
athos@1514
   217
First let us briefly explain how this program works.
athos@1175
   218
athos@1175
   219
ListGraph is one of LEMON's graph classes. It is based on linked lists,
athos@1175
   220
therefore iterating throuh its edges and nodes is fast.
athos@1175
   221
alpar@1713
   222
After some convenience typedefs we create a graph and add three nodes to it.
athos@1175
   223
Then we add edges to it to form a complete graph.
athos@1175
   224
athos@1175
   225
Then we iterate through all nodes of the graph. We use a constructor of the
athos@1175
   226
node iterator to initialize it to the first node. The operator++ is used to
athos@1175
   227
step to the next node. Using operator++ on the iterator pointing to the last
athos@1175
   228
node invalidates the iterator i.e. sets its value to
athos@1175
   229
\ref lemon::INVALID "INVALID". This is what we exploit in the stop condition.
athos@1175
   230
athos@1175
   231
We can also iterate through all edges of the graph very similarly. The 
athos@1175
   232
\c target and
athos@1175
   233
\c source member functions can be used to access the endpoints of an edge.
athos@1175
   234
klao@1520
   235
If your installation of LEMON into directory \c /usr/local was
alpar@1713
   236
successful, then it is very easy to compile this program with the
klao@1520
   237
following command (the argument <tt>-lemon</tt> tells the compiler
klao@1520
   238
that we are using the installed library LEMON):
athos@1514
   239
klao@1519
   240
\verbatim
klao@1519
   241
g++ hello_lemon.cc -o hello_lemon -lemon
klao@1519
   242
\endverbatim
klao@1519
   243
klao@1519
   244
As a result you will get the exacutable \c hello_lemon in
athos@1514
   245
this directory that you can run by the command 
klao@1519
   246
\verbatim
klao@1519
   247
./hello_lemon
klao@1519
   248
\endverbatim
athos@1514
   249
athos@1514
   250
klao@1519
   251
If everything has gone well then the previous code fragment prints
klao@1519
   252
out the following:
athos@1175
   253
klao@1519
   254
\verbatim
athos@1175
   255
Nodes: 2 1 0
athos@1175
   256
athos@1175
   257
Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0)
klao@1519
   258
\endverbatim
athos@1175
   259
athos@1514
   260
Congratulations!
athos@1175
   261
klao@1519
   262
If you want to see more features, go to the
klao@1519
   263
\ref quicktour "Quick Tour to LEMON",
klao@1519
   264
if you want to see see some demo programs then go to our 
athos@1175
   265
\ref demoprograms "Demo Programs" page! 
athos@1175
   266
athos@1175
   267
athos@1175
   268
*/