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 />
0<br />
sage: p.add_variable()<br />
0<br />
sage: p.set_variable_type(0,0)<br />
sage: p.is_variable_binary(0)<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 = "GLPK")<br />
sage: p.ncols()<br />
0<br />
sage: p.add_variable()<br />
0<br />
sage: p.is_variable_continuous(0)<br />
True<br />
sage: p.set_variable_type(0,1)<br />
sage: p.is_variable_continuous(0)<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 = "GLPK")<br />
sage: p.ncols()<br />
0<br />
sage: p.add_variable()<br />
0<br />
sage: p.set_variable_type(0,1)<br />
sage: p.is_variable_integer(0)<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 = "GLPK")<br />
sage: p.ncols()<br />
0<br />
sage: p.add_variables(2)<br />
1<br />
sage: p.ncols()<br />
2<br />
68 Chapter 5. LP Solver backends