Sage Reference Manual: Numerical Optimization - Mirrors
Sage Reference Manual: Numerical Optimization - Mirrors
Sage Reference Manual: Numerical Optimization - Mirrors
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Numerical</strong> <strong>Optimization</strong>, Release 6.1.1<br />
•u – Name (as str) of the tail vertex<br />
•v – Name (as str) of the head vertex<br />
OUTPUT:<br />
A triple describing if edge was found or None if not. The third value of the triple is a dict containing<br />
the following edge parameters:<br />
•low – The minimum flow through the edge<br />
•cap – The maximum capacity of the edge<br />
•cost – The cost of transporting one unit through the edge<br />
•x – The actual flow through the edge after solving<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: edges = [("A", "B"), ("A", "C"), ("B", "C")]<br />
sage: gbe.add_edges(edges)<br />
sage: ed = gbe.get_edge("A", "B")<br />
sage: print ed[0], ed[1], ed[2][’x’]<br />
A B 0.0<br />
sage: gbe.get_edge("A", "F") is None<br />
True<br />
get_vertex(vertex)<br />
Returns a specific vertex as a dict Object.<br />
INPUT:<br />
•vertex – The vertex label as str.<br />
OUTPUT:<br />
The vertex as a dict object or None if the vertex does not exist. The dict contains the values used or<br />
created by the different algorithms. The values associated with the keys following keys contain:<br />
•“rhs” – The supply / demand value the vertex (mincost alg)<br />
•“pi” – The node potential (mincost alg)<br />
•“cut” – The cut flag of the vertex (maxflow alg)<br />
•“es” – The earliest start of task (cpp alg)<br />
•“ls” – The latest start of task (cpp alg)<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: verts = ["A", "B", "C", "D"]<br />
sage: gbe.add_vertices(verts)<br />
sage: sorted(gbe.get_vertex("A").items())<br />
[(’cut’, 0), (’es’, 0.0), (’ls’, 0.0), (’pi’, 0.0), (’rhs’, 0.0)]<br />
sage: gbe.get_vertex("F") is None<br />
True<br />
get_vertices(verts)<br />
Returns a dictionary of the dictonaries associated to each vertex.<br />
INPUT:<br />
5.3. GLPK Backend for access to GLPK graph functions 87