New Features
- Add `ConstrainedQuadraticModel.add_discrete_from_comparison()` method.
<!-- -->
- Add `ConstrainedQuadraticModel.add_discrete_from_iterable()` method.
<!-- -->
- Add `ConstrainedQuadraticModel.add_discrete_from_model()` method.
<!-- -->
- `ConstrainedQuadraticModel.add_discrete()` now supports additional argument types.
<!-- -->
- Add `QuadraticModel.flip_variable()` method.
<!-- -->
- Add `ConstrainedQuadraticModel.flip_variable()` method.
<!-- -->
- Support iterator inputs to `as_samples()`. See [543](https://github.com/dwavesystems/dimod/issues/543).
<!-- -->
- Add `SamplesLike` and `SampleLike` to `dimod.typing`. See [1008](https://github.com/dwavesystems/dimod/issues/1008).
<!-- -->
- Add `dimod::vartype_limits` to C++ code for compile-time information about variable types.
<!-- -->
- Add `dimod::vartype_info` to C++ code for runtime information about variable types.
<!-- -->
- Add `vartype_info()` function.
<!-- -->
- `BinaryQuadraticModel.resize()` now returns the difference in the number of variables between the current and previous binary quadratic model. Previously it always returned 0. See [1091](https://github.com/dwavesystems/dimod/issues/1091)
<!-- -->
- Add `BinaryQuadraticModel.maximum_energy_delta()` method.
<!-- -->
- Add `ConstrainedQuadraticModel.set_lower_bound()` method. See [1105](https://github.com/dwavesystems/dimod/issues/1105).
<!-- -->
- Add `ConstrainedQuadraticModel.set_upper_bound()` method. See [1105](https://github.com/dwavesystems/dimod/issues/1105).
Upgrade Notes
- `as_samples()` no longer always casts input sample values to integers.
<!-- -->
- `QuadraticModel.energies()` and `BinaryQuadraticModel.energies()` now return a NumPy array with dtype `np.float64` be default. Previously they defaulted to match the dtype of the model.
<!-- -->
- Bounds for integer variables are no longer rounded to the nearest int in `QuadraticModel` and `ConstrainedQuadraticModel`.
Deprecation Notes
- Deprecate support for a 2-tuple of `(dict, list)` as a samples-like. E.g. `({'a': 1, 'b': 0}, ['a', 'b'])` is no longer supported. `(array_like, labels)` is still supported, as is a dictionary. Support will be removed in dimod 0.12.0.
Bug Fixes
- `QuadraticModel.energies()` and `BinaryQuadraticModel.energies()` will return the correct energy when given samples with non-integer values.
<!-- -->
- It is no longer possible to add an integer variables to a quadratic model with bounds that do not include at least one integer between them. E.g. `qm.add_variable('INTEGER', 'v', lower_bound=1.2, upper_bound=1.5)` will now raise a `ValueError`.
<!-- -->
- `ConstrainedQuadraticModel.add_variable()` now correctly raises an error when a variable is added twice with inconsistent bounds.
<!-- -->
- `ConstrainedQuadraticModel.add_variable()` now correctly returns the variable label when a variable is added twice.