diff -r b2a79aaa6867 -r c9b9bc63db4e doc/quicktour.dox
--- a/doc/quicktour.dox Fri Jun 24 21:02:47 2005 +0000
+++ b/doc/quicktour.dox Fri Jun 24 21:03:08 2005 +0000
@@ -18,14 +18,18 @@
graph: a very good description can be found in the page
about \ref graphs "graphs".
-You will also want to assign data to the edges or nodes of the graph, for example a length or capacity function defined on the edges. You can do this in LEMON using so called \ref maps "maps". You can define a map on the nodes or on the edges of the graph and the value of the map (the range of the function) can be practically almost of any type. Read more about maps \ref maps-page "here".
+You will also want to assign data to the edges or nodes of the graph, for
+example a length or capacity function defined on the edges. You can do this in
+LEMON using so called \b maps. You can define a map on the nodes or on the edges of the graph and the value of the map (the range of the function) can be practically almost of any type. Read more about maps \ref maps-page "here".
Some examples are the following (you will find links next to the code fragments that help to download full demo programs: save them on your computer and compile them according to the description in the page about \ref getsart How to start using LEMON):
-- First we give two examples that show how to instantiate a graph. The
+
+- First we give two examples that show how to instantiate a graph. The
first one shows the methods that add nodes and edges, but one will
usually use the second way which reads a graph from a stream (file).
--# The following code fragment shows how to fill a graph with data. It creates a complete graph on 4 nodes. The type Listgraph is one of the LEMON graph types: the typedefs in the beginning are for convenience and we will suppose them later as well.
+
+- The following code fragment shows how to fill a graph with data. It creates a complete graph on 4 nodes. The type Listgraph is one of the LEMON graph types: the typedefs in the beginning are for convenience and we will suppose them later as well.
\code
typedef ListGraph Graph;
typedef Graph::NodeIt NodeIt;
@@ -42,9 +46,9 @@
See the whole program in file \ref helloworld.cc.
-If you want to read more on the LEMON graph structures and concepts, read the page about \ref graphs "graphs".
+ If you want to read more on the LEMON graph structures and concepts, read the page about \ref graphs "graphs".
--# The following code shows how to read a graph from a stream (e.g. a file). LEMON supports the DIMACS file format: it can read a graph instance from a file
+
- The following code shows how to read a graph from a stream (e.g. a file). LEMON supports the DIMACS file format: it can read a graph instance from a file
in that format (find the documentation of the DIMACS file format on the web).
\code
Graph g;
@@ -53,8 +57,8 @@
\endcode
One can also store network (graph+capacity on the edges) instances and other things in DIMACS format and use these in LEMON: to see the details read the documentation of the \ref dimacs.h "Dimacs file format reader".
-
-- If you want to solve some transportation problems in a network then
+
+ - If you want to solve some transportation problems in a network then
you will want to find shortest paths between nodes of a graph. This is
usually solved using Dijkstra's algorithm. A utility
that solves this is the \ref lemon::Dijkstra "LEMON Dijkstra class".
@@ -129,7 +133,7 @@
by step and gain full control of the execution. For a detailed description, see the documentation of the \ref lemon::Dijkstra "LEMON Dijkstra class".
-- If you want to design a network and want to minimize the total length
+
- If you want to design a network and want to minimize the total length
of wires then you might be looking for a minimum spanning tree in
an undirected graph. This can be found using the Kruskal algorithm: the
class \ref lemon::Kruskal "LEMON Kruskal class" does this job for you.
@@ -137,11 +141,73 @@
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
+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).
+
+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
+facilitates solving network optimization problems using LP solvers.
+
+
+- The following code shows how to solve an LP problem using the LEMON lp
+interface.
\code
+ //A default solver is taken
+ LpDefault lp;
+ typedef LpDefault::Row Row;
+ typedef LpDefault::Col Col;
+
+
+ //This will be a maximization
+ lp.max();
+
+ //We add coloumns (variables) to our problem
+ Col x1 = lp.addCol();
+ Col x2 = lp.addCol();
+ Col x3 = lp.addCol();
+
+ //Constraints
+ lp.addRow(x1+x2+x3 <=100);
+ lp.addRow(10*x1+4*x2+5*x3<=600);
+ lp.addRow(2*x1+2*x2+6*x3<=300);
+ //Nonnegativity of the variables
+ lp.colLowerBound(x1, 0);
+ lp.colLowerBound(x2, 0);
+ lp.colLowerBound(x3, 0);
+ //Objective function
+ lp.setObj(10*x1+6*x2+4*x3);
+
+ //Call the routine of the underlying LP solver
+ lp.solve();
+
+ //Print results
+ if (lp.primalStatus()==LpSolverBase::OPTIMAL){
+ printf("Z = %g; x1 = %g; x2 = %g; x3 = %g\n",
+ lp.primalValue(),
+ lp.primal(x1), lp.primal(x2), lp.primal(x3));
+ }
+ else{
+ std::cout<<"Optimal solution not found!"<The second example shows how easy it is to formalize a network
+optimization problem as an LP problem using the LEMON LP interface.
+
+
+
*/