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