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 />
9. Solve it and print the solution.<br />
The following example shows all these steps:<br />
sage: p = MixedIntegerLinearProgram(maximization=False, solver = "GLPK")<br />
sage: w = p.new_variable(integer=True)<br />
sage: p.add_constraint(w[0] + w[1] + w[2] - 14*w[3] == 0)<br />
sage: p.add_constraint(w[1] + 2*w[2] - 8*w[3] == 0)<br />
sage: p.add_constraint(2*w[2] - 3*w[3] == 0)<br />
sage: p.add_constraint(w[0] - w[1] - w[2] >= 0)<br />
sage: p.add_constraint(w[3] >= 1)<br />
sage: _ = [ p.set_min(w[i], None) for i in range(1,4) ]<br />
sage: p.set_objective(w[3])<br />
sage: p.show()<br />
Minimization:<br />
x_3<br />
Constraints:<br />
0.0