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

True if the variable is real; False otherwise.<br />

EXAMPLE:<br />

sage: p = MixedIntegerLinearProgram()<br />

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

sage: p.set_objective(v[1])<br />

sage: p.is_real(v[1])<br />

True<br />

sage: p.set_binary(v[1])<br />

sage: p.is_real(v[1])<br />

False<br />

sage: p.set_real(v[1])<br />

sage: p.is_real(v[1])<br />

True<br />

linear_constraints_parent()<br />

Return the parent for all linear constraints<br />

See linear_functions for more details.<br />

EXAMPLES:<br />

sage: p = MixedIntegerLinearProgram()<br />

sage: p.linear_constraints_parent()<br />

Linear constraints over Real Double Field<br />

linear_function(x)<br />

Construct a new linear function<br />

EXAMPLES:<br />

sage: p = MixedIntegerLinearProgram()<br />

sage: p.linear_function({1:3, 4:5})<br />

3*x_1 + 5*x_4<br />

This is equivalent to:<br />

sage: p({1:3, 4:5})<br />

3*x_1 + 5*x_4<br />

linear_functions_parent()<br />

Return the parent for all linear functions<br />

EXAMPLES:<br />

sage: p = MixedIntegerLinearProgram()<br />

sage: p.linear_functions_parent()<br />

Linear functions over Real Double Field<br />

new_variable(real=False, binary=False, integer=False, dim=1, name=’‘)<br />

Returns an instance of MIPVariable associated to the current instance of<br />

MixedIntegerLinearProgram.<br />

A new variable x is defined by:<br />

sage: p = MixedIntegerLinearProgram()<br />

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

It behaves exactly as a usual dictionary would. It can use any key argument you may like, as x[5] or<br />

x["b"], and has methods items() and keys().<br />

Any of its fields exists, and is uniquely defined.<br />

20 Chapter 2. Mixed integer linear programming

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

Saved successfully!

Ooh no, something went wrong!