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

Min/Max are numerical<br />

sage: v = p.new_variable()<br />

sage: p.add_constraint(v[3] + v[5], min = v[6])<br />

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

...<br />

ValueError: min and max arguments are required to be numerical<br />

sage: p.add_constraint(v[3] + v[5], max = v[6])<br />

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

...<br />

ValueError: min and max arguments are required to be numerical<br />

Do not add redundant elements (notice only one copy of each constraint is added):<br />

sage: lp = MixedIntegerLinearProgram(solver = "GLPK", check_redundant=True)<br />

sage: for each in xrange(10): lp.add_constraint(lp[0]-lp[1],min=1)<br />

sage: lp.show()<br />

Maximization:<br />

Constraints:<br />

1.0

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

Saved successfully!

Ooh no, something went wrong!