QuadraticProgram.substitute_variables¶
- QuadraticProgram.substitute_variables(constants=None, variables=None)[fuente]¶
Substitutes variables with constants or other variables.
- Parámetros:
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
- Devuelve:
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
.- Muestra:
QiskitOptimizationError – if the substitution is invalid as follows. - Same variable is substituted multiple times. - Coefficient of variable substitution is zero.
- Tipo del valor devuelto: