# HG changeset patch # User athos # Date 1119885754 0 # Node ID b303c1741c9a6a7b29a9c257651b392872c7d58e # Parent 4aeda8d11d5e625428583657c025b8370ad247df Some modifications in this and that. diff -r 4aeda8d11d5e -r b303c1741c9a doc/getstart.dox --- a/doc/getstart.dox Mon Jun 27 14:39:53 2005 +0000 +++ b/doc/getstart.dox Mon Jun 27 15:22:34 2005 +0000 @@ -5,11 +5,7 @@ your computer, through the steps of installation to showing a simple "Hello World" type program that already uses LEMON. We assume that you have a basic knowledge of your operating system and \c C++ or \c C -programming language. If anything is not -clear write to our FAQ. - -\todo Is this FAQ thing a good idea here? Is there such a thing? If -twice YES then a link comes here. +programming language. \section requirementsLEMON Hardware and software requirements @@ -31,8 +27,8 @@ \section downloadLEMON How to download LEMON You can download LEMON from the LEMON web site: -http://lemon.cs.elte.hu -by following the download link. There you will find the issued distributions +http://lemon.cs.elte.hu/dowload.html +. There you will find the issued distributions in form of .tar.gz 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. diff -r 4aeda8d11d5e -r b303c1741c9a doc/quicktour.dox --- a/doc/quicktour.dox Mon Jun 27 14:39:53 2005 +0000 +++ b/doc/quicktour.dox Mon Jun 27 15:22:34 2005 +0000 @@ -141,15 +141,25 @@ Ide Zsuzska fog irni! -
  • Many problems in network optimization can be formalized by means of a -linear programming problem (LP problem, for short). In our library we decided -not to write an LP solver, since such packages are available in the commercial -world just as well as in the open source world, and it is also a difficult -task to compete these. Instead we decided to develop an interface that makes -it easier to use these solvers together with LEMON. So far we have an +
  • Many problems in network optimization can be formalized by means +of a linear programming problem (LP problem, for short). In our +library we decided not to write an LP solver, since such packages are +available in the commercial world just as well as in the open source +world, and it is also a difficult task to compete these. Instead we +decided to develop an interface that makes it easier to use these +solvers together with LEMON. The advantage of this approach is +twofold. Firstly our C++ interface is more comfortable than the +solvers' native interface. Secondly, changing the underlying solver in +a certain software using LEMON's LP interface needs zero effort. So, +for example, one may try his idea using a free solver, demonstrate its +usability for a customer and if it works well, but the performance +should be improved, then one may decide to purchase and use a better +commercial solver. + +So far we have an interface for the commercial LP solver software \b CLPLEX (developed by ILOG) and for the open source solver \b GLPK (a shorthand for Gnu Linear Programming -Toolkit). +Toolkit). We will show two examples, the first one shows how simple it is to formalize and solve an LP problem in LEMON, while the second one shows how LEMON @@ -157,7 +167,7 @@
    1. The following code shows how to solve an LP problem using the LEMON lp -interface. +interface. The code together with the comments is self-explanatory. \code @@ -204,8 +214,62 @@ See the whole code in \ref lp_demo.cc. -
    2. The second example shows how easy it is to formalize a network -optimization problem as an LP problem using the LEMON LP interface. +
    3. The second example shows how easy it is to formalize a max-flow +problem as an LP problem using the LEMON LP interface: we are looking +for a real valued function defined on the edges of the digraph +satisfying the nonnegativity-, the capacity constraints and the +flow-conservation constraints and giving the largest flow value +between to designated nodes. + +In the following code we suppose that we already have the graph \c g, +the capacity map \c cap, the source node \c s and the target node \c t +in the memory. We will also omit the typedefs. + +\code + //Define a map on the edges for the variables of the LP problem + typename G::template EdgeMap x(g); + lp.addColSet(x); + + //Nonnegativity and capacity constraints + for(EdgeIt e(g);e!=INVALID;++e) { + lp.colUpperBound(x[e],cap[e]); + lp.colLowerBound(x[e],0); + } + + + //Flow conservation constraints for the nodes (except for 's' and 't') + for(NodeIt n(g);n!=INVALID;++n) if(n!=s&&n!=t) { + LpDefault::Expr ex; + for(InEdgeIt e(g,n);e!=INVALID;++e) ex+=x[e]; + for(OutEdgeIt e(g,n);e!=INVALID;++e) ex-=x[e]; + lp.addRow(ex==0); + } + + //Objective function: the flow value entering 't' + { + LpDefault::Expr ex; + for(InEdgeIt e(g,t);e!=INVALID;++e) ex+=x[e]; + for(OutEdgeIt e(g,t);e!=INVALID;++e) ex-=x[e]; + lp.setObj(ex); + } + + //Maximization + lp.max(); + + //Solve with the underlying solver + lp.solve(); + +\endcode + +The complete program can be found in file \ref lp_maxflow_demo.cc. After compiling run it in the form: + +./lp_maxflow_demo < ?????????.lgf + +where ?????????.lgf is a file in the lemon format containing a maxflow instance (designated "source", "target" nodes and "capacity" map). + + +See the whole code in \ref lp_demo.cc. +