Some modifications in this and that.
authorathos
Mon, 27 Jun 2005 15:22:34 +0000
changeset 1517b303c1741c9a
parent 1516 4aeda8d11d5e
child 1518 f8efed98d6a3
Some modifications in this and that.
doc/getstart.dox
doc/quicktour.dox
     1.1 --- a/doc/getstart.dox	Mon Jun 27 14:39:53 2005 +0000
     1.2 +++ b/doc/getstart.dox	Mon Jun 27 15:22:34 2005 +0000
     1.3 @@ -5,11 +5,7 @@
     1.4  your computer, through the steps of installation to showing a simple
     1.5  "Hello World" type program that already uses LEMON. We assume that you have a
     1.6  basic knowledge of your operating system and \c C++ or \c C 
     1.7 -programming language. If anything is not 
     1.8 -clear write to our FAQ.
     1.9 -
    1.10 -\todo Is this FAQ thing a good idea here? Is there such a thing? If
    1.11 -twice YES then a link comes here.
    1.12 +programming language. 
    1.13  
    1.14  \section requirementsLEMON Hardware and software requirements
    1.15  
    1.16 @@ -31,8 +27,8 @@
    1.17  \section downloadLEMON How to download LEMON
    1.18  
    1.19  You can download LEMON from the LEMON web site:
    1.20 -http://lemon.cs.elte.hu
    1.21 -by following the download link. There you will find the issued distributions
    1.22 +http://lemon.cs.elte.hu/dowload.html
    1.23 +. There you will find the issued distributions
    1.24  in form of <tt> .tar.gz </tt> files. If you want a developer version  (for example you want to contribute in developing the library LEMON) then you might want to use our Subversion repository. This case is not detailed here, so from now on we suppose that you downloaded a tar.gz file.
    1.25  
    1.26  
     2.1 --- a/doc/quicktour.dox	Mon Jun 27 14:39:53 2005 +0000
     2.2 +++ b/doc/quicktour.dox	Mon Jun 27 15:22:34 2005 +0000
     2.3 @@ -141,15 +141,25 @@
     2.4  
     2.5  Ide Zsuzska fog irni!
     2.6  
     2.7 -<li>Many problems in network optimization can be formalized by means of a
     2.8 -linear programming problem (LP problem, for short). In our library we decided
     2.9 -not to write an LP solver, since such packages are available in the commercial
    2.10 -world just as well as in the open source world, and it is also a difficult
    2.11 -task to compete these. Instead we decided to develop an interface that makes
    2.12 -it easier to use these solvers together with LEMON. So far we have an
    2.13 +<li>Many problems in network optimization can be formalized by means
    2.14 +of a linear programming problem (LP problem, for short). In our
    2.15 +library we decided not to write an LP solver, since such packages are
    2.16 +available in the commercial world just as well as in the open source
    2.17 +world, and it is also a difficult task to compete these. Instead we
    2.18 +decided to develop an interface that makes it easier to use these
    2.19 +solvers together with LEMON. The advantage of this approach is
    2.20 +twofold. Firstly our C++ interface is more comfortable than the
    2.21 +solvers' native interface. Secondly, changing the underlying solver in
    2.22 +a certain software using LEMON's LP interface needs zero effort. So,
    2.23 +for example, one may try his idea using a free solver, demonstrate its
    2.24 +usability for a customer and if it works well, but the performance
    2.25 +should be improved, then one may decide to purchase and use a better
    2.26 +commercial solver.
    2.27 +
    2.28 +So far we have an
    2.29  interface for the commercial LP solver software \b CLPLEX (developed by ILOG)
    2.30  and for the open source solver \b GLPK (a shorthand for Gnu Linear Programming
    2.31 -Toolkit). 
    2.32 +Toolkit).
    2.33  
    2.34  We will show two examples, the first one shows how simple it is to formalize
    2.35  and solve an LP problem in LEMON, while the second one shows how LEMON
    2.36 @@ -157,7 +167,7 @@
    2.37  
    2.38  <ol>
    2.39  <li>The following code shows how to solve an LP problem using the LEMON lp
    2.40 -interface. 
    2.41 +interface. The code together with the comments is self-explanatory.
    2.42  
    2.43  \code
    2.44  
    2.45 @@ -204,8 +214,62 @@
    2.46  
    2.47  See the whole code in \ref lp_demo.cc.
    2.48  
    2.49 -<li>The second example shows how easy it is to formalize a network
    2.50 -optimization problem as an LP problem using the LEMON LP interface.
    2.51 +<li>The second example shows how easy it is to formalize a max-flow
    2.52 +problem as an LP problem using the LEMON LP interface: we are looking
    2.53 +for a real valued function defined on the edges of the digraph
    2.54 +satisfying the nonnegativity-, the capacity constraints and the
    2.55 +flow-conservation constraints and giving the largest flow value
    2.56 +between to designated nodes.
    2.57 +
    2.58 +In the following code we suppose that we already have the graph \c g,
    2.59 +the capacity map \c cap, the source node \c s and the target node \c t
    2.60 +in the memory. We will also omit the typedefs.
    2.61 +
    2.62 +\code
    2.63 +  //Define a map on the edges for the variables of the LP problem
    2.64 +  typename G::template EdgeMap<LpDefault::Col> x(g);
    2.65 +  lp.addColSet(x);
    2.66 +  
    2.67 +  //Nonnegativity and capacity constraints
    2.68 +  for(EdgeIt e(g);e!=INVALID;++e) {
    2.69 +    lp.colUpperBound(x[e],cap[e]);
    2.70 +    lp.colLowerBound(x[e],0);
    2.71 +  }
    2.72 +
    2.73 +
    2.74 +  //Flow conservation constraints for the nodes (except for 's' and 't')
    2.75 +  for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) {
    2.76 +    LpDefault::Expr ex;
    2.77 +    for(InEdgeIt  e(g,n);e!=INVALID;++e) ex+=x[e];
    2.78 +    for(OutEdgeIt e(g,n);e!=INVALID;++e) ex-=x[e];
    2.79 +    lp.addRow(ex==0);
    2.80 +  }
    2.81 +  
    2.82 +  //Objective function: the flow value entering 't'
    2.83 +  {
    2.84 +    LpDefault::Expr ex;
    2.85 +    for(InEdgeIt  e(g,t);e!=INVALID;++e) ex+=x[e];
    2.86 +    for(OutEdgeIt e(g,t);e!=INVALID;++e) ex-=x[e];
    2.87 +    lp.setObj(ex);
    2.88 +  }
    2.89 +
    2.90 +  //Maximization
    2.91 +  lp.max();
    2.92 +
    2.93 +  //Solve with the underlying solver
    2.94 +  lp.solve();
    2.95 +
    2.96 +\endcode
    2.97 +
    2.98 +The complete program can be found in file \ref lp_maxflow_demo.cc. After compiling run it in the form:
    2.99 +
   2.100 +<tt>./lp_maxflow_demo < ?????????.lgf</tt>
   2.101 +
   2.102 +where ?????????.lgf is a file in the lemon format containing a maxflow instance (designated "source", "target" nodes and "capacity" map).
   2.103 +
   2.104 +
   2.105 +See the whole code in \ref lp_demo.cc.
   2.106 +
   2.107  
   2.108  </ol>
   2.109  </ul>