9999b6e4d5022ef678087b221273378330a229bd,qiskit/optimization/converters/inequality_to_equality.py,InequalityToEquality,_add_integer_slack_var_quadratic_constraint,#InequalityToEquality#Any#Any#Any#Any#Any#,236

Before 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 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.
        new_rhs = rhs
        if sense == Constraint.Sense.LE:

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)

        // If rhs is float number, round up/down to the nearest integer.
        new_rhs = rhs
        if sense == Constraint.Sense.LE:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: Qiskit/qiskit-aqua
Commit Name: 9999b6e4d5022ef678087b221273378330a229bd
Time: 2020-08-03
Author: 47442626+a-matsuo@users.noreply.github.com
File Name: qiskit/optimization/converters/inequality_to_equality.py
Class Name: InequalityToEquality
Method Name: _add_integer_slack_var_quadratic_constraint


Project Name: Qiskit/qiskit-aqua
Commit Name: f826413f09e5a54ceb58939fc24351bef0fbd2e9
Time: 2020-08-04
Author: 31178928+t-imamichi@users.noreply.github.com
File Name: qiskit/optimization/converters/inequality_to_equality.py
Class Name: InequalityToEquality
Method Name: _add_integer_slack_var_linear_constraint


Project Name: Qiskit/qiskit-aqua
Commit Name: 9999b6e4d5022ef678087b221273378330a229bd
Time: 2020-08-03
Author: 47442626+a-matsuo@users.noreply.github.com
File Name: qiskit/optimization/converters/inequality_to_equality.py
Class Name: InequalityToEquality
Method Name: _add_integer_slack_var_linear_constraint