[size[, name]]) |
""
. It is only used
when displaying variables (or objects that depend on variables, such
as functions or constraints)
using print statements, when calling the built-in functions
repr() or str(), or when writing linear programs
to MPS files.
None
or a dense 'd'
matrix of size len(x)
by 1.
The attribute x.value is set to None
when the
variable x is created. It can be given a numerical value later,
typically by solving an LP that has x as one of its variables.
One can also make an explicit assignment
x.value = y
. The
assigned value y must be an integer or float, or a
dense 'd'
matrix of size (len(x)
,1).
If y is an integer or float all the elements of
x.value are set to the value of y.
>>> from cvxopt.base import matrix >>> from cvxopt.modeling import variable >>> x = variable(3,'a') >>> len(x) 3 >>> print x.name a >>> print x.value None >>> x.value = matrix([1.,2.,3.]) >>> print x.value 1.0000e+00 2.0000e+00 3.0000e+00 >>> x.value = 1 >>> print x.value 1.0000e+00 1.0000e+00 1.0000e+00