#85: 'is None' should be 'is not None'

This commit is contained in:
Ryan J. O'Neil 2015-12-29 08:43:47 -05:00
parent 46086ea084
commit aac2fc3f24
1 changed files with 2 additions and 2 deletions

View File

@ -1331,12 +1331,12 @@ class LpProblem(object):
elif isinstance(other, LpConstraint):
self.addConstraint(other, name)
elif isinstance(other, LpAffineExpression):
if self.objective is None:
if self.objective is not None:
warnings.warn("Overwriting previously set objective.")
self.objective = other
self.objective.name = name
elif isinstance(other, LpVariable) or isinstance(other, (int, float)):
if self.objective is None:
if self.objective is not None:
warnings.warn("Overwriting previously set objective.")
self.objective = LpAffineExpression(other)
self.objective.name = name