COIN-OR::LEMON - Graph Library

source: lemon-0.x/doc/getstart.dox @ 1971:9a59a6cacfd9

Last change on this file since 1971:9a59a6cacfd9 was 1713:49d22d34d95f, checked in by Alpar Juttner, 18 years ago

Doc improvments

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