German
Sprachen
English
Japanese
German
Korean
Portuguese, Brazilian
French
Shortcuts

Quellcode für qiskit.optimization.converters.quadratic_program_converter

# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""An abstract class for optimization algorithms in Qiskit's optimization module."""

import warnings

from abc import ABC, abstractmethod

import qiskit.optimization.algorithms  # pylint: disable=unused-import
from ..problems.quadratic_program import QuadraticProgram


[Doku]class QuadraticProgramConverter(ABC): """ An abstract class for converters of quadratic programs in Qiskit's optimization module. """
[Doku] @abstractmethod def convert(self, problem: QuadraticProgram) -> QuadraticProgram: """Convert a QuadraticProgram into another form and keep the information required to interpret the result. """ raise NotImplementedError
[Doku] @abstractmethod def interpret(self, result: 'qiskit.optimization.algorithms.OptimizationResult') \ -> 'qiskit.optimization.algorithms.OptimizationResult': # type: ignore """ Interpret a result into another form using the information of conversion""" raise NotImplementedError
[Doku] def encode(self, problem: QuadraticProgram) -> QuadraticProgram: # type: ignore """DEPRECATED Encode a QuadraticProgram into another form and keep the information required to decode the result. """ warnings.warn('The qiskit.optimization.converters.QuadraticProgramConverter.encode() ' 'method is deprecated as of 0.7.4 and will be removed no sooner ' 'than 3 months after the release. You should use ' 'qiskit.optimization.converters.QuadraticProgramConverter.convert() ' 'instead.', DeprecationWarning, stacklevel=1) return self.convert(problem)
[Doku] def decode(self, result: 'qiskit.optimization.algorithms.OptimizationResult') \ -> 'qiskit.optimization.algorithms.OptimizationResult': # type: ignore """DEPRECATED Decode a result into another form using the information of conversion.""" warnings.warn('The qiskit.optimization.converters.QuadraticProgramConverter.decode() ' 'method is deprecated as of 0.7.4 and will be removed no sooner ' 'than 3 months after the release. You should use ' 'qiskit.optimization.converters.QuadraticProgramConverter.interpret() ' 'instead.', DeprecationWarning, stacklevel=1) return self.interpret(result)

© Copyright 2020, Qiskit Development Team. Zuletzt aktualisiert am 2021/06/04.

Built with Sphinx using a theme provided by Read the Docs.