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

EXAMPLE:<br />

sage: from sage.numerical.backends.generic_backend import get_solver<br />

sage: p = get_solver(solver = "Nonexistent_LP_solver") # optional - Nonexistent_LP_solver<br />

sage: p.ncols()<br />

# optional - Nonexistent_LP_solver<br />

0<br />

sage: p.add_variable()<br />

# optional - Nonexistent_LP_solver<br />

1<br />

sage: p.set_variable_type(0,0)<br />

# optional - Nonexistent_LP_solver<br />

sage: p.is_variable_binary(0)<br />

# optional - Nonexistent_LP_solver<br />

True<br />

is_variable_continuous(index)<br />

Test whether the given variable is of continuous/real type.<br />

INPUT:<br />

•index (integer) – the variable’s id<br />

EXAMPLE:<br />

sage: from sage.numerical.backends.generic_backend import get_solver<br />

sage: p = get_solver(solver = "Nonexistent_LP_solver") # optional - Nonexistent_LP_solver<br />

sage: p.ncols()<br />

# optional - Nonexistent_LP_solver<br />

0<br />

sage: p.add_variable()<br />

# optional - Nonexistent_LP_solver<br />

1<br />

sage: p.is_variable_continuous(0)<br />

# optional - Nonexistent_LP_solver<br />

True<br />

sage: p.set_variable_type(0,1)<br />

# optional - Nonexistent_LP_solver<br />

sage: p.is_variable_continuous(0)<br />

# optional - Nonexistent_LP_solver<br />

False<br />

is_variable_integer(index)<br />

Test whether the given variable is of integer type.<br />

INPUT:<br />

•index (integer) – the variable’s id<br />

EXAMPLE:<br />

sage: from sage.numerical.backends.generic_backend import get_solver<br />

sage: p = get_solver(solver = "Nonexistent_LP_solver") # optional - Nonexistent_LP_solver<br />

sage: p.ncols()<br />

# optional - Nonexistent_LP_solver<br />

0<br />

sage: p.add_variable()<br />

# optional - Nonexistent_LP_solver<br />

1<br />

sage: p.set_variable_type(0,1)<br />

# optional - Nonexistent_LP_solver<br />

sage: p.is_variable_integer(0)<br />

# optional - Nonexistent_LP_solver<br />

True<br />

ncols()<br />

Return the number of columns/variables.<br />

EXAMPLE:<br />

sage: from sage.numerical.backends.generic_backend import get_solver<br />

sage: p = get_solver(solver = "Nonexistent_LP_solver") # optional - Nonexistent_LP_solver<br />

sage: p.ncols()<br />

# optional - Nonexistent_LP_solver<br />

0<br />

sage: p.add_variables(2)<br />

# optional - Nonexistent_LP_solver<br />

54 Chapter 5. LP Solver backends

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

Saved successfully!

Ooh no, something went wrong!