def rhs(self, rhs):
if rhs is None:
# None has a different meaning depending on the
# context (lb or ub), so there is no way to
# interpret this
raise ValueError(
"Constraint right-hand side can not "
"be assigned a value of None.")
elif isinstance(rhs, NumericValue):
raise ValueError("rhs must be set to "
"a simple numeric type "
"or a numpy array")
elif isinstance(rhs, numpy.ndarray):
numpy.copyto(self._lb, rhs)
numpy.copyto(self._ub, rhs)
else:
self._lb.fill(rhs)
self._ub.fill(rhs)
self._equality.fill(True)
评论列表
文章目录