// If a coefficient that is not integer exist, raise an error
if any(
isinstance(coef, float) and not coef.is_integer() for coef in quadratic.values()
) or any(isinstance(coef, float) and not coef.is_integer() for coef in linear.values()):
raise QiskitOptimizationError("Can not use a slack variable for " + name)
// If rhs is float number, round up/down to the nearest integer.
After Change
def _add_integer_slack_var_quadratic_constraint(self, linear, quadratic, sense, rhs, name):
// If a coefficient that is not integer exist, raise an error
if (self._contains_any_float_value(list(linear.values()))
or self._contains_any_float_value(list(quadratic.values()))):
raise QiskitOptimizationError(name + " contains float coefficients. "
"We can not use an integer slack variable for " + name)