You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Objective function contains constant terms. Please use LinearExpression.drop_constants()/QuadraticExpression.drop_constants() or set Model.allow_constant_objective=True."
113
+
"Objective function contains constant terms. Please use expr.drop_constants() or set model.allow_constant_objective=True."
114
114
)
115
115
116
116
# Modify the model objective to drop the constant term
@@ -808,7 +808,7 @@ def add_objective(
808
808
|Sequence[tuple[ConstantLike, VariableLike]],
809
809
overwrite: bool=False,
810
810
sense: str="min",
811
-
allow_constant: bool|None=None,
811
+
allow_constant_objective: bool|None=None,
812
812
) ->None:
813
813
"""
814
814
Add an objective function to the model.
@@ -819,7 +819,7 @@ def add_objective(
819
819
Expression describing the objective function.
820
820
overwrite : False, optional
821
821
Whether to overwrite the existing objective. The default is False.
822
-
allow_constant : bool, optional
822
+
allow_constant_objective : bool, optional
823
823
Set the `Model.allow_constant_objective` attribute. If True, the objective is allowed to contain a constant term.
"Objective function contains constant terms but this is not allowed as Model.allow_constant_objective=False, running solve will result in an error. Please either remove constants from the expression with expr.drop_constants() or set Model.allow_constant_objective=True.",
845
+
"Objective function contains constant terms but this is not allowed as Model.allow_constant_objective=False. Either remove constants from the expression with expr.drop_constants() or pass allow_constant_objective=True.",
0 commit comments