English
Languages
English
Shortcuts



QuadraticProgram.binary_var_dict

QuadraticProgram.binary_var_dict(keys, name=None, key_format='{}')[source]

Uses ‘var_dict’ to construct a dictionary of binary variables

Parameters
  • name (Optional[str]) – The name(s) of the variable(s).

  • key_format (str) – The format used to name/index the variable(s).

  • keys (Union[int, Sequence]) – If keys: int, it is interpreted as the number of variables to construct. Otherwise, the elements of the sequence are converted to strings via ‘str’ and substituted into key_format.

Return type

Dict[str, Variable]

Returns

A dictionary mapping the variable names to variable instances.

Raises