qiskit_optimization/problems/substitute_variables.py
def substitute_variables(
        self, quadratic_program: QuadraticProgram, subs: Dict[str, SubstitutionExpression]
    ) -> QuadraticProgram:
        """Substitutes variables with constants or other variables.

        Args:
            quadratic_program: a quadratic program whose variables are substituted.

            subs: substitution expressions as a dictionary.
                e.g., {'x': SubstitutionExpression(const=1, coeff=2, variable='y'} means
                `x` is substituted with `1 + 2 * y`.

        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`.
        """
        self._src = quadratic_program
        self._dst = QuadraticProgram(quadratic_program.name)
        self._subs = subs
        results = [
            self._variables(),
            self._objective(),
            self._linear_constraints(),
            self._quadratic_constraints(),
        ]
        if not all(results):
            self._dst._status = QuadraticProgram.Status.INFEASIBLE
        return self._dst
Substitutes variables with constants or other variables.

        Args:
            quadratic_program: a quadratic program whose variables are substituted.

            subs: substitution expressions as a dictionary.
                e.g., {'x': SubstitutionExpression(const=1, coeff=2, variable='y'} means
                `x` is substituted with `1 + 2 * y`.

        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`.
        
Substitutes variables with constants or other variables.
Substitutes variables with constants or other variables .
def substitute_variables(
        self, quadratic_program: QuadraticProgram, subs: Dict[str, SubstitutionExpression]
    ) -> QuadraticProgram:
        self._src = quadratic_program
        self._dst = QuadraticProgram(quadratic_program.name)
        self._subs = subs
        results = [
            self._variables(),
            self._objective(),
            self._linear_constraints(),
            self._quadratic_constraints(),
        ]
        if not all(results):
            self._dst._status = QuadraticProgram.Status.INFEASIBLE
        return self._dst
def substitute_variables ( self , quadratic_program : QuadraticProgram , subs : Dict [ str , SubstitutionExpression ] ) -> QuadraticProgram : self . _src = quadratic_program self . _dst = QuadraticProgram ( quadratic_program . name ) self . _subs = subs results = [ self . _variables ( ) , self . _objective ( ) , self . _linear_constraints ( ) , self . _quadratic_constraints ( ) , ] if not all ( results ) : self . _dst . _status = QuadraticProgram . Status . INFEASIBLE return self . _dst
Substitutes variables with constants or other variables.
Substitutes variables with constants or other variables .
"""Substitutes variables with constants or other variables.

        Args:
            quadratic_program: a quadratic program whose variables are substituted.

            subs: substitution expressions as a dictionary.
                e.g., {'x': SubstitutionExpression(const=1, coeff=2, variable='y'} means
                `x` is substituted with `1 + 2 * y`.

        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`.
        """
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 ` .
self
quadratic_program
QuadraticProgram
a quadratic program whose variables are substituted.
a quadratic program whose variables are substituted .
subs
Dict[str, SubstitutionExpression]
substitution expressions as a dictionary.
e.g., {'x': SubstitutionExpression(const=1, coeff=2, variable='y'} means
`x` is substituted with `1 + 2 * y`.
substitution expressions as a dictionary . e . g . { ' x ' : SubstitutionExpression ( const = 1 coeff = 2 variable = ' y ' } means ` x ` is substituted with ` 1 + 2 * y ` .