Dimod

Latest version: v0.12.14

Safety actively analyzes 625214 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 8 of 26

0.11.0.dev0

Prelude

Add support for real-valued variables.

New Features

- Add C++ `Vartype::REAL`, a new variable type for real-valued variables.

<!-- -->

- Support variables with `Vartype::REAL` in C++ `QuadraticModel`.

<!-- -->

- Add `Vartype.REAL`, a new variable type for real-valued variables.

<!-- -->

- Add `Real()` and `Reals()` functions for creating quadratic models with a single real-valued variable.

<!-- -->

- Support variables with `Vartype.REAL` in `QuadraticModel`.

<!-- -->

- `ConstrainedQuadraticModel.to_file()` now uses serialization format 1.3. This format is backwards compatibile.

<!-- -->

- Add `vartype` and `linear_only` arguments to `ConstrainedQuadraticModel.num_biases()`.

<!-- -->

- Add `vartype` and `include_objective` arguments to `ConstrainedQuadraticModel.num_quadratic_variables()`.

Deprecation Notes

- In the future, `ConstrainedQuadraticModel.num_quadratic_variables()` will also include the objective towards the count by default.

0.10.17

New Features

- Add `BinaryQuadraticModel::lower_bound()` and `BinaryQuadraticModel::upper_bound()` methods to the C++ code.

<!-- -->

- Improve the performance of the `QuadraticModel.update()` method.

<!-- -->

- Improve the performance of the `ConstrainedQuadraticModel.set_objective()` method.

<!-- -->

- `QuadraticModel.update()` now accepts binary quadratic models in addition to quadratic models.

<!-- -->

- Add `QuadraticModel.add_variables_from_model()` method. See [1157](https://github.com/dwavesystems/dimod/issues/1157).

0.10.16

New Features

- Add `SampleSet.from_samples_cqm()` method.

Bug Fixes

- `ExactCQMSolver.sample_cqm` now uses `SampleSet.from_samples_cqm`. This corrects a small error in the calculation of constraint satisfaction.

<!-- -->

- `dimod.generators.random_knapsack()` and `dimod.generators.random_bin_packing()` no longer use a fixed seed by default.

<!-- -->

- `ConstrainedQuadraticModel.add_discrete()`, `ConstrainedQuadraticModel.add_constraint_from_iterable()`, and `ConstrainedQuadraticModel.add_discrete_from_model()` now correctly raise an error when given a binary variable that overlaps with an existing discrete constraint. See [1149](https://github.com/dwavesystems/dimod/issues/1149).

<!-- -->

- `SampleSet.from_samples_bqm` now handles empty list input correctly.

0.10.15

Deprecation Notes

- Deprecate `cls` parameter in `dimod.serialization.coo.load()` and `dimod.serialization.coo.loads()`.

Bug Fixes

- Fix energy calculations for quadratic models with squared terms. See [1136](https://github.com/dwavesystems/dimod/issues/1136).

<!-- -->

- `dimod.serialization.fileview.load()` now correctly propagates `KeyError` from the loading function.

0.10.14

New Features

- Add `Polynomial` to `dimod.typing`.

<!-- -->

- Add `Comparison.to_polystring()` method.

<!-- -->

- Printing `Comparison` objects now returns an equation representation of the comparison as a string.

<!-- -->

- Add `ConstrainedQuadraticModel.relabel_constraints()` method. See [1066](https://github.com/dwavesystems/dimod/issues/1066).

<!-- -->

- Add `ConstrainedQuadraticModel.remove_constraint()` method. See [1104](https://github.com/dwavesystems/dimod/issues/1104).

<!-- -->

- Add methods to report memory usage of quadratic models:

- Add `QuadraticModel.nbytes()` method.
- Add `BinaryQuadraticModel.nbytes()` method.
- Add `QuadraticModel::nbytes()` method to C++ the code.
- Add `BinaryQuadraticModel::nbytes()` method to C++ the code.

See [668](https://github.com/dwavesystems/dimod/issues/668)

Deprecation Notes

- Deprecate `cls` parameter in `dimod.generators.random.gnm_random_bqm()`, `dimod.generators.random.gnp_random_bqm()`, `dimod.generators.random.uniform()`, `dimod.generators.random.ran_r()`, `dimod.generators.random.randint()`, and `dimod.generators.random.doped()`.

Bug Fixes

- `Comparison.__repr__()` now correctly returns a representation that can be passed to `eval()`.

<!-- -->

- Fix `dimod.typing.Bias` to correctly exclude `numpy.complexfloating`.

<!-- -->

- Attempting to relabel two model variables to the same target will now correctly raise a `ValueError`. See [1110](https://github.com/dwavesystems/dimod/issues/1110).

0.10.13

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.

Page 8 of 26

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.