Sage Reference Manual: Numerical Optimization - Mirrors
Sage Reference Manual: Numerical Optimization - Mirrors
Sage Reference Manual: Numerical Optimization - Mirrors
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Numerical</strong> <strong>Optimization</strong>, Release 6.1.1<br />
sage: vertices = [None for i in range(3)]<br />
sage: gbe.add_vertices(vertices)<br />
[’0’, ’1’, ’2’]<br />
sage: gbe.set_vertex_demand(’0’, 2)<br />
sage: gbe.get_vertex(’0’)[’rhs’]<br />
2.0<br />
sage: gbe.set_vertex_demand(’3’, 2)<br />
Traceback (most recent call last):<br />
...<br />
KeyError: ’Vertex 3 does not exist.’<br />
set_vertices_demand(pairs)<br />
Sets the parameters of selected vertices.<br />
INPUT:<br />
•pairs – A list of pairs (vertex, demand) associating a demand to each vertex. For more<br />
information, see the documentation of set_vertex_demand().<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: vertices = [None for i in range(3)]<br />
sage: gbe.add_vertices(vertices)<br />
[’0’, ’1’, ’2’]<br />
sage: gbe.set_vertices_demand([(’0’, 2), (’1’, 3), (’3’, 4)])<br />
sage: sorted(gbe.get_vertex(’1’).items())<br />
[(’cut’, 0), (’es’, 0.0), (’ls’, 0.0), (’pi’, 0.0), (’rhs’, 3.0)]<br />
vertices()<br />
Returns the list of all vertices<br />
Note: Changing elements of the list will not change anything in the the graph.<br />
Note: If a vertex in the graph does not have a name / label it will appear as None in the resulting list.<br />
EXAMPLE:<br />
sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />
sage: gbe = GLPKGraphBackend()<br />
sage: verts = ["A", "B", "C"]<br />
sage: gbe.add_vertices(verts)<br />
sage: a = gbe.vertices(); a<br />
[’A’, ’B’, ’C’]<br />
sage: a.pop(0)<br />
’A’<br />
sage: gbe.vertices()<br />
[’A’, ’B’, ’C’]<br />
write_ccdata(fname)<br />
Writes the graph to a text file in DIMACS format.<br />
Writes the data to plain ASCII text file in DIMACS format. A discription of the DIMACS format can be<br />
found at http://dimacs.rutgers.edu/Challenges/.<br />
INPUT:<br />
90 Chapter 5. LP Solver backends