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

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: p.add_constraint(p[0] - 2*p[1], min = 1)<br />

sage: p.number_of_variables()<br />

3<br />

sage: p = MixedIntegerLinearProgram(solver="glpk")<br />

sage: p.add_constraint(p[0] - p[2], min = 1, max = 4)<br />

sage: p.number_of_variables()<br />

2<br />

sage: p = MixedIntegerLinearProgram(solver="gurobi")<br />

sage: p.add_constraint(p[0] - p[2], min = 1, max = 4)<br />

sage: p.number_of_variables()<br />

3<br />

# optional - Gurobi<br />

# optional - Gurobi<br />

# optional - Gurobi<br />

polyhedron(**kwds)<br />

Returns the polyhedron defined by the Linear Program.<br />

INPUT:<br />

All arguments given to this method are forwarded to the constructor of the Polyhedron() class.<br />

OUTPUT:<br />

A Polyhedron() object whose i-th variable represents the i-th variable of self.<br />

Warning: The polyhedron is built from the variables stored by the LP solver (i.e. the output<br />

of show()). While they usually match the ones created explicitely when defining the LP, a<br />

solver like Gurobi has been known to introduce additional variables to store constraints of the type<br />

lower_bound

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

Saved successfully!

Ooh no, something went wrong!