English
Languages
English
Bengali
Japanese
Spanish



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.

Returns:

An dictionary with the coefficients corresponding to the linear expression.

Return type:

Dict[int | str, float]