GraphOptimizationApplication#
- class GraphOptimizationApplication(graph)[ソース]#
ベースクラス:
OptimizationApplication
An abstract class for graph optimization applications.
- パラメータ:
graph (Graph | ndarray | List) – A graph representing a problem. It can be specified directly as a NetworkX graph, or as an array or list format suitable to build out a NetworkX graph.
Attributes
- graph#
Getter of the graph
- 戻り値:
A graph for a problem
Methods
- draw(result=None, pos=None)[ソース]#
Draw a graph with the result. When the result is None, draw an original graph without colors.
- パラメータ:
result (OptimizationResult | ndarray | None) – The calculated result for the problem
- abstract interpret(result)#
Convert the calculation result of the problem (
OptimizationResult
or a binary array using np.ndarray) to the answer of the problem in an easy-to-understand format.- パラメータ:
result (OptimizationResult | ndarray) – The calculated result of the problem
- static sample_most_likely(state_vector)#
Compute the most likely binary string from state vector.
- パラメータ:
state_vector (QuasiDistribution | Statevector | ndarray | Dict) – state vector or counts or quasi-probabilities.
- 戻り値:
binary string as numpy.ndarray of ints.
- 例外:
ValueError – if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.
- 戻り値の型:
- abstract to_quadratic_program()#
Convert a problem instance into a
QuadraticProgram
- 戻り値の型: