09.02.2015 Views

Sage Reference Manual: Numerical Optimization - Mirrors

Sage Reference Manual: Numerical Optimization - Mirrors

Sage Reference Manual: Numerical Optimization - Mirrors

SHOW MORE
SHOW LESS

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 />

•fname – full name of the file<br />

OUTPUT:<br />

Zero if the operations was successful otherwise nonzero<br />

EXAMPLE:<br />

sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />

sage: gbe = GLPKGraphBackend()<br />

sage: a = gbe.add_edge("0", "1")<br />

sage: gbe.write_ccdata(SAGE_TMP+"/graph.dat")<br />

Writing graph to ...<br />

6 lines were written<br />

0<br />

write_graph(fname)<br />

Writes the graph to a plain text file<br />

INPUT:<br />

•fname – full name of the file<br />

OUTPUT:<br />

Zero if the operations was successful otherwise nonzero<br />

EXAMPLE:<br />

sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />

sage: gbe = GLPKGraphBackend()<br />

sage: a = gbe.add_edge("0", "1")<br />

sage: gbe.write_graph(SAGE_TMP+"/graph.txt")<br />

Writing graph to ...<br />

2 lines were written<br />

0<br />

write_maxflow(fname)<br />

Writes the maximum flow problem data to a text file in DIMACS format.<br />

INPUT:<br />

•fname – Full name of file<br />

OUTPUT:<br />

Zero if successful, otherwise non-zero<br />

EXAMPLE:<br />

sage: from sage.numerical.backends.glpk_graph_backend import GLPKGraphBackend<br />

sage: gbe = GLPKGraphBackend()<br />

sage: gbe.add_vertices([None for i in range(2)])<br />

[’0’, ’1’]<br />

sage: a = gbe.add_edge(’0’, ’1’)<br />

sage: gbe.maxflow_ffalg(’0’, ’1’)<br />

0.0<br />

sage: gbe.write_maxflow(SAGE_TMP+"/graph.max")<br />

Writing maximum flow problem data to ...<br />

6 lines were written<br />

0<br />

sage: gbe = GLPKGraphBackend()<br />

sage: gbe.write_maxflow(SAGE_TMP+"/graph.max")<br />

Traceback (most recent call last):<br />

5.3. GLPK Backend for access to GLPK graph functions 91

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!