qiskit_optimization/problems/quadratic_program.py
def substitute_variables(
        self,
        constants: Optional[Dict[Union[str, int], float]] = None,
        variables: Optional[Dict[Union[str, int], Tuple[Union[str, int], float]]] = None,
    ) -> "QuadraticProgram":
        """Substitutes variables with constants or other variables.

        Args:
            constants: replace variable by constant
                e.g., {'x': 2} means 'x' is substituted with 2

            variables: 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)} means 'x' is substituted with 'y' * 2

        Returns:
            An optimization problem by substituting variables with constants or other variables.
            If the substitution is valid, `QuadraticProgram.status` is still
            `QuadraticProgram.Status.VALID`.
            Otherwise, it gets `QuadraticProgram.Status.INFEASIBLE`.

        Raises:
            QiskitOptimizationError: if the substitution is invalid as follows.
                - Same variable is substituted multiple times.
                - Coefficient of variable substitution is zero.
        """
        # pylint: disable=cyclic-import
        from .substitute_variables import substitute_variables

        return substitute_variables(self, constants, variables)
Substitutes variables with constants or other variables.

        Args:
            constants: replace variable by constant
                e.g., {'x': 2} means 'x' is substituted with 2

            variables: 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)} means 'x' is substituted with 'y' * 2

        Returns:
            An optimization problem by substituting variables with constants or other variables.
            If the substitution is valid, `QuadraticProgram.status` is still
            `QuadraticProgram.Status.VALID`.
            Otherwise, it gets `QuadraticProgram.Status.INFEASIBLE`.

        Raises:
            QiskitOptimizationError: if the substitution is invalid as follows.
                - Same variable is substituted multiple times.
                - Coefficient of variable substitution is zero.
        
Substitutes variables with constants or other variables.
Substitutes variables with constants or other variables .
def substitute_variables(
        self,
        constants: Optional[Dict[Union[str, int], float]] = None,
        variables: Optional[Dict[Union[str, int], Tuple[Union[str, int], float]]] = None,
    ) -> "QuadraticProgram":
        from .substitute_variables import substitute_variables
        return substitute_variables(self, constants, variables)
def substitute_variables ( self , constants : Optional [ Dict [ Union [ str , int ] , float ] ] = None , variables : Optional [ Dict [ Union [ str , int ] , Tuple [ Union [ str , int ] , float ] ] ] = None , ) -> "QuadraticProgram" : from . substitute_variables import substitute_variables return substitute_variables ( self , constants , variables )
Substitutes variables with constants or other variables.
Substitutes variables with constants or other variables .
"""Substitutes variables with constants or other variables.

        Args:
            constants: replace variable by constant
                e.g., {'x': 2} means 'x' is substituted with 2

            variables: 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)} means 'x' is substituted with 'y' * 2

        Returns:
            An optimization problem by substituting variables with constants or other variables.
            If the substitution is valid, `QuadraticProgram.status` is still
            `QuadraticProgram.Status.VALID`.
            Otherwise, it gets `QuadraticProgram.Status.INFEASIBLE`.

        Raises:
            QiskitOptimizationError: if the substitution is invalid as follows.
                - Same variable is substituted multiple times.
                - Coefficient of variable substitution is zero.
        """ # pylint: disable=cyclic-import
An optimization problem by substituting variables with constants or other variables.
If the substitution is valid, `QuadraticProgram.status` is still
`QuadraticProgram.Status.VALID`.
Otherwise, it gets `QuadraticProgram.Status.INFEASIBLE`.
An optimization problem by substituting variables with constants or other variables . If the substitution is valid ` QuadraticProgram . status ` is still ` QuadraticProgram . Status . VALID ` . Otherwise it gets ` QuadraticProgram . Status . INFEASIBLE ` .
if the substitution is invalid as follows.
Same variable is substituted multiple times.
Coefficient of variable substitution is zero.
if the substitution is invalid as follows . Same variable is substituted multiple times . Coefficient of variable substitution is zero .
QiskitOptimizationError
self
constants
Optional[Dict[Union[str, int], float]]
replace variable by constant
e.g., {'x': 2} means 'x' is substituted with 2
replace variable by constant e . g . { ' x ' : 2 } means ' x ' is substituted with 2
variables
Optional[Dict[Union[str, int], Tuple[Union[str, int], float]]]
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.
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 .