QuadraticProgram.substitute_variables¶
- QuadraticProgram.substitute_variables(constants=None, variables=None)[source]¶
Substitutes variables with constants or other variables.
- প্যারামিটার:
constants (Dict[int | str, float] | None) -- replace variable by constant e.g.,
{'x': 2}
meansx
is substituted with 2variables (Dict[str | int, Tuple[str | int, float]] | None) -- replace variables by weighted other variable need to copy everything using name reference to make sure that indices are matched correctly. The lower and upper bounds are updated accordingly. e.g.,
{'x': ('y', 2)}
meansx
is substituted withy * 2
- রিটার্নস:
An optimization problem by substituting variables with constants or other variables. If the substitution is valid,
QuadraticProgram.status
is stillQuadraticProgram.Status.VALID
. Otherwise, it getsQuadraticProgram.Status.INFEASIBLE
.- রেইজেস:
QiskitOptimizationError -- if the substitution is invalid as follows. - Same variable is substituted multiple times. - Coefficient of variable substitution is zero.
- রিটার্ন টাইপ: