qiskit.optimization.problems.LinearExpression.to_dict¶
-
LinearExpression.
to_dict
(use_name=False)[source]¶ Returns the coefficients of the linear expression as dictionary, either using variable names or indices as keys.
- Parameters
use_name (
bool
) – Determines whether to use index or names to refer to variables.- Return type
Dict
[Union
[int
,str
],float
]- Returns
An dictionary with the coefficients corresponding to the linear expression.