COIN-OR::LEMON - Graph Library

Changeset 6:da96f28684f7 in lemon-tutorial


Ignore:
Timestamp:
10/23/08 14:07:30 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Extend and improve the first two chapters

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • getting_started.dox

    r3 r6  
    1818
    1919/**
    20 \page getting_started How to Start Using LEMON
     20\page getting_started Getting Started
    2121
    2222In this page we detail how to start using LEMON, from downloading it to
     
    2525have a basic knowledge of your operating system and C++ programming
    2626language. The procedure is pretty straightforward, but if you have any
    27 difficulties don't hesitate to
     27difficulties do not hesitate to
    2828<a href="mailto:lemon-user@lemon.cs.elte.hu"><b>ask</b></a>.
    2929
     
    3232In LEMON we use C++ templates heavily, thus compilation takes a
    3333considerable amount of time and memory. So some decent box would be
    34 advantageous. But otherwise there are no special hardware requirements.
     34advantageousm, but otherwise there are no special hardware requirements.
    3535
    3636You will need a recent C++ compiler. Our primary target is the GNU C++
    3737Compiler (g++), from version 3.3 upwards. We also checked the Intel C++
    38 Compiler (icc) and Microsoft Visual C++ .NET 2003, 2005.
    39 If you want to develop with LEMON under Windows you could consider
    40 using Cygwin.
     38Compiler (icc) and Microsoft Visual C++ (on Windows).
     39If you want to develop with LEMON under Windows, you can use a Windows
     40installer or you can consider using Cygwin.
    4141
    4242In this description we will suppose a Linux environment and GNU C++ Compiler.
     43If you would like to develop under Windows and use a Windows installer,
     44you could skip the following sections and continue reading \ref hello_lemon.
     45However keep in mind that you have to make appropriate steps instead of
     46the instructions detailed here to be able to compile the example code
     47with your compiler.
    4348
    4449\subsection requirements_lp LP Solver Requirements
    4550
    4651The LEMON LP solver interface can use the GLPK (GNU Linear Programming
    47 Kit), CPLEX (was tested with CPLEX 7.5) and SoPlex solver. If you want
    48 to use it you will need at least one of these. See \ref configure_flags
    49 how to enable these at compile time.
     52Kit), CPLEX and SoPlex solver. If you want to use it, you will need at
     53least one of these.
     54See the <b><tt>INSTALL</tt></b> file how to enable these at compile time.
    5055
    5156\section download_lemon How to Download LEMON
    5257
    53 You can download LEMON from the LEMON web site:
    54 <a href="http://lemon.cs.elte.hu/">https://lemon.cs.elte.hu/</a>.
    55 There you will find released versions in form of <tt>.tar.gz</tt> files.
     58You can download LEMON from our web site:
     59<a href="http://lemon.cs.elte.hu/">http://lemon.cs.elte.hu/</a>.
     60There you will find released versions in form of <tt>.tar.gz</tt> files
     61(and Windows installers).
    5662If you want a developer version (for example you want to contribute in
    57 developing the library LEMON) then you might want to use our Mercurial
    58 repository. This case is detailed later, so from now on we suppose that
    59 you downloaded a <tt>.tar.gz</tt> file.
     63developing LEMON) then you might want to use our Mercurial repository.
     64This case is detailed \ref hg_checkout "later", so from now on we
     65suppose that you downloaded a <tt>.tar.gz</tt> file.
    6066
    6167\section install_lemon How to Install LEMON
     
    118124\endverbatim
    119125This step is optional, but recommended. It runs the test programs that
    120 we developed for LEMON to check whether the library works properly on
     126have been developed for LEMON to check whether the library works properly on
    121127your platform.
    122128
     
    131137
    132138Several other configure flags can be passed to <tt>./configure</tt>.
    133 For more information see <tt>./configure --help</tt> and the INSTALL
    134 file in the install directory.
     139For more information see the <b><tt>INSTALL</tt></b> file.
    135140
    136141\section hg_checkout How to Checkout LEMON from our Mercurial Repository
    137142
    138 You can obtain the latest version of LEMON from our Mercurial repository.
    139 To do this issue the following command:
    140 \verbatim
    141 hg clone http://lemon.cs.elte.hu/hg/lemon lemon-src
     143You can obtain the latest (developer) version of LEMON from our Mercurial
     144repository. To do this issue the following command.
     145\verbatim
     146hg clone http://lemon.cs.elte.hu/hg/lemon-main lemon-src
    142147\endverbatim
    143148
     
    145150
    146151You can compile the code from the repository similarly to the packaged
    147 version, but you will need to run <b><tt>autoreconf -vif</tt></b> or
    148 <b><tt>./bootstrap</tt></b> in some older environment before
     152version, but you will need to run <b><tt>autoreconf -vif</tt></b>
     153(or <b><tt>./bootstrap</tt></b> in some older environment) before
    149154<tt>./configure</tt>. See <tt>./configure --help</tt> for options.
    150155For bootstrapping you will need the following tools:
     
    158163You will need <a href="http://www.doxygen.org/">Doxygen</a> for this.
    159164
     165\section hello_lemon Compile Your First Code
     166
     167If you have installed LEMON on your system you can paste the following
     168code segment into a file called <tt>hello_lemon.cc</tt> to have a first
     169working program that uses LEMON.
     170
     171\dontinclude hello_lemon.cc
     172\skip #include
     173\until }
     174
     175First let us briefly explain how this example program works.
     176(The used notions will be discussed in detail in the following chapter.)
     177
     178After some convenience typedefs we create a directed graph (\e digraph)
     179and add some nodes and arcs to it.
     180ListDigraph is one of the digraph classes implemented in LEMON.
     181It is based on linked lists, therefore iterating through its nodes and
     182arcs is fast.
     183
     184Then we iterate through all nodes of the digraph and print their unique
     185IDs. We use a constructor of the node iterator to initialize it to the
     186first node.
     187The <tt>operator++</tt> is used to step to the next node. After the last
     188node the iterator becomes invalid (i.e. it is set to \c INVALID).
     189This is what we exploit in the stop condition.
     190We iterate through all arcs of the digraph very similarly and print the
     191IDs of their source (tail) and target (head) nodes using the \c source()
     192and \c target() member functions.
     193
     194After that we create an arc map, which is actually a mapping that assigns
     195an \c int value (length) to each arc, and we set this value for each arc.
     196Finally we iterate through all arcs again and print their lengths.
     197
     198Now let's compile this simple example program.
     199
     200\subsection hello_lemon_system If LEMON is Installed System-Wide
     201
     202If your installation of LEMON into directory \c /usr/local was
     203successful, then it is very easy to compile this program with the
     204following command (the argument <tt>-lemon</tt> tells the compiler
     205that we are using the installed LEMON):
     206
     207\verbatim
     208g++ hello_lemon.cc -o hello_lemon -lemon
     209\endverbatim
     210
     211As a result you will get the exacutable \c hello_lemon in the current
     212directory, which you can run by the following command.
     213
     214\verbatim
     215./hello_lemon
     216\endverbatim
     217
     218\subsection hello_lemon_user If LEMON is Installed User-Local
     219
     220Compiling the code is a bit more difficult if you installed LEMON
     221user-local into a directory (e.g. <tt>~/lemon</tt>) or if you just
     222skipped the step <tt>make install</tt>.
     223You have to issue a command like this.
     224
     225\verbatim
     226g++ -I ~/lemon hello_lemon.cc -o hello_lemon -lemon -L ~/lemon/lemon/.libs
     227\endverbatim
     228
     229\subsubsection hello_lemon_pkg_config Use pkg-config
     230
     231\todo Write this sub-subsection (\ref hello_lemon_pkg_config).
     232
     233If everything has gone well, then our program prints out the followings.
     234
     235\verbatim
     236Hello World!
     237This is LEMON library here. We have a direceted graph.
     238
     239Nodes: 3 2 1 0
     240Arcs: (2,3) (1,3) (1,2) (0,2) (0,1)
     241
     242There is a map on the arcs (length):
     243
     244length(2,3)=10
     245length(1,3)=25
     246length(1,2)=5
     247length(0,2)=20
     248length(0,1)=10
     249\endverbatim
     250
     251You may note that iterating through the nodes and arcs is done in the
     252reverse order compared to the creating order (the IDs are in decreasing
     253order).
     254This is due to implementation aspects, that may differ at other graph
     255types, moreover it may be changed in the next releases.
     256Thus you should not exploit this method in any way, you should not
     257suppose anything about the iteration order.
     258
     259If you managed to compile and run this example code without any problems,
     260you can go on reading this tutorial to get to know more features and tools
     261of LEMON.
     262Otherwise if you encountered problems that you did not manage to solve,
     263do not hesitate to
     264<a href="mailto:lemon-user@lemon.cs.elte.hu"><b>contact us</b></a>.
     265
    160266*/
  • intro.dox

    r3 r6  
    2222\section intro_lemon What is LEMON
    2323
    24 LEMON stands for <b>L</b>ibrary of <b>E</b>fficient <b>M</b>odels and
     24<b>LEMON</b> stands for <b>L</b>ibrary of <b>E</b>fficient <b>M</b>odels and
    2525<b>O</b>ptimization in <b>N</b>etworks. It is a C++ template
    26 library aimed at combinatorial optimization tasks which often involve
    27 in working with graphs.
     26library aimed at combinatorial optimization tasks, especially those
     27working with graphs and networks.
    2828
    2929<b>LEMON is an <a class="el" href="http://opensource.org/">open&nbsp;source</a>
    3030project.
    3131You are free to use it in your commercial or non-commercial applications
    32 under very permissive \ref license "license terms".
    33 </b>
     32under very permissive \ref license "license terms".</b>
     33
     34This library helps to write programs that solve optimization problems
     35that arise frequently when designing and testing certain networks,
     36for example in telecommunication, computer networks, logistics, scheduling,
     37and other areas.
     38A very natural way of modelling these networks is by means of a graph.
     39Generally if you want to write any program that works with graphs,
     40then you might find it useful and convenient to use LEMON.
     41
     42For more information visit the LEMON web site:
     43<a href="http://lemon.cs.elte.hu/"><b>http://lemon.cs.elte.hu/</b></a>.
    3444
    3545\section intro_tutorial LEMON Tutorial
    3646
    3747This tutorial introduces the reader to the basic concepts and features of
    38 LEMON, and there are some sections about advanced topics showing the power
    39 of the various tools implemented in the library.
     48LEMON, and there are also some sections about advanced topics showing the
     49power of various tools implemented in the library.
    4050
    41 After getting familiar with the basic concepts you may start using LEMON
    42 with the help of the detailed documentation (that can also be used as a
    43 reference manual).
     51After getting familiar with the basics of the library, you may start using
     52LEMON with the help of the detailed documentation (that can also be used
     53as a reference manual).
    4454
    4555*/
Note: See TracChangeset for help on using the changeset viewer.