Dimod

Latest version: v0.12.14

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

Scan your dependencies

Page 9 of 26

0.10.12

New Features

- Add `cascade` keyword argument to `ConstrainedQuadraticModel.fix_variable()` and `ConstrainedQuadraticModel.fix_variables()`. These methods also now return any variables fixed using the <span class="title-ref">cascade</span> keyword argument.

<!-- -->

- Add `QuadraticModel::swap_variables()` and `BinaryQuadraticModel::swap_variables()` methods to the C++ code.

<!-- -->

- Reintroduce `BinaryQuadraticModel.to_serializable()` and `BinaryQuadraticModel.from_serializable()` methods that were previously removed in dimod 0.10.0, see [847](https://github.com/dwavesystems/dimod/pull/847).

Upgrade Notes

- `ConstrainedQuadraticModel.fix_variable()` and `ConstrainedQuadraticModel.fix_variables()` now raise a `ValueError` if given a variable not in the model.

<!-- -->

- Make `use_bytes` and `bytes_type` keyword-only arguments in `BinaryQuadraticModel.to_serializable()`. Note that `BinaryQuadraticModel.to_serializable()` was removed in 0.10.0 but restored in 0.10.12.

<!-- -->

- The `bias_dtype` keyword-only argument in `BinaryQuadraticModel.to_serializable()` now does nothing. Note that `BinaryQuadraticModel.to_serializable()` was removed in 0.10.0 but restored in 0.10.12.

Bug Fixes

- Fix `QuadraticModel.fix_variable()` to correctly update the vartypes and bounds of of variables that are not fixed.

<!-- -->

- Fix `QuadraticModel.fix_variable()` when fixing the last variable in the quadratic model. Previously it would incorrectly raise an `AttributeError`.

0.10.11

New Features

- Add `.fix_variable()` and `.fix_variables()` methods to `ConstrainedQuadraticModel`.

<!-- -->

- Add `.fix_variable()` and `.fix_variables()` methods to `QuadraticModel`.

<!-- -->

- Add `QuadraticModel::resize()` method in C++ code.

<!-- -->

- Speed up printing sample sets with a large number of variables. See [1068](https://github.com/dwavesystems/dimod/issues/1068).

<!-- -->

- Add ability to pass a slice to `Variables.__getitem__`. This allows for syntax like `variables[:5]` which will return a new `Variables` object. See [1069](https://github.com/dwavesystems/dimod/issues/1069).

<!-- -->

- Add `BinaryQuadraticModel.iter_linear()` method.

<!-- -->

- Add `BinaryQuadraticModel.to_polystring()` method.

<!-- -->

- Add `QuadraticModel.iter_linear()` method.

<!-- -->

- Add `QuadraticModel.to_polystring()` method.

<!-- -->

- Introduces variable array methods `dimod.BinaryArray`, `dimod.SpinArray`, and `dimod.IntegerArray`. These methods build numpy object arrays from their respective generator methods `dimod.Binaries`, `dimod.Spins` and `dimod.Integers`.

Upgrade Notes

- `QuadraticViewsMixin` now has `.add_linear()` as an abstract method.

<!-- -->

- `BinaryQuadraticModel.fix_variable()` no longer raises a `ValueError` when given a value that does not match the variable type.

<!-- -->

- Python 3.6 is no longer supported.

<!-- -->

- NumPy 1.17 and 1.18 are no longer supported.

<!-- -->

- `dimod.views.quadratic.QuadraticModelMixin` now has an abstract property `.offset`.

Bug Fixes

- Fix setting linear and quadratic biases on vartype views when the relevant variable or interaction does not already exist.

<!-- -->

- `multiplcation_circuit` now adds the carry from the most significant column in a row into the most significant column of the next row.

0.10.10

Bug Fixes

- Fix energy calculation in binary quadratic models and quadratic models with no variables. Previously an empty sample would incorrectly raise an error.

<!-- -->

- `bqm_structured` decorator now correctly raises a `BinaryQuadraticModelStructureError` error in cases where nodes of the structured sampler do not include all BQM variables.

0.10.9

New Features

- You can now install `dwave-preprocessing` as part of the dimod install with `pip install dimod[all]`

<!-- -->

- Add `ConstrainedQuadraticModel.relabel_variables()` method to relabel the variables in the objective and constraints.

<!-- -->

- Add `drop_variables()` and `keep_variables()` functions that allow the user to create a new sample set from an old one, retaining only a subset of the variables.

<!-- -->

- Backport the use of `dimod.views.quadratic.Adjacency`, `dimod.views.quadratic.Linear`, and `dimod.views.quadratic.Quadratic` for use with the deprecated `AdjVectorBQM` and `AdjDictBQM` binary quadratic model classes.

<!-- -->

- Backport `iter_neighborhood()`, `reduce_linear()`, `reduce_neighborhood()`, and `reduce_quadratic()` methods for use with the deprecated `AdjVectorBQM` and `AdjDictBQM` binary quadratic model classes.

Upgrade Notes

- `dwave-preprocessing` is no longer a direct dependency. It can still be installed with `pip install dimod[all]`.

Bug Fixes

- Fix instance and subclass testing between deprecated and modern binary quadratic model views. For example `instance(bqm.quadratic, dimod.core.bqm.BQMView)` now returns `True` for modern binary quadratic models.

0.10.8

New Features

- Add `ExactCQMSolver` class with `solve_cqm` method to reference solvers.

<!-- -->

- Add `multiplication_circuit()`, a binary quadratic model generator for multiplication circuits.

<!-- -->

- Add optional second parameter to `multiplication_circuit()` enabling the multiplying arguments of different sizes.

<!-- -->

- `dimod.testing.load_sampler_bqm_tests()` now also tests the deprecated BQM subclasses, namely `AdjVectorBQM` and `AdjDictBQM`.

<!-- -->

- Return a named tuple from `BinaryQuadraticModel.to_numpy_vectors()`.

<!-- -->

- Added `make_quadratic_cqm()` - like make quadratic, but returns a CQM treating auxillary variable constraints as proper constraints instead of adding them to the objective.

<!-- -->

- Add `independent_set`, `maximum_independent_set`, and `maximum_weight_independent_set` functions to `dimod.generators`.

<!-- -->

- Add official support for Python 3.10.

<!-- -->

- Add `aarch64` wheels for linux and `universal` wheels for osx.

<!-- -->

- Added `reduce_binary_polynomial()` that factors out a common basis for `make_quadratic()` and a future `make_quadratic_cqm()`. Given a `BinaryPolynomial` it return a list of reduced terms using auxillary variables and a list of constraints on them.

Deprecation Notes

- Deprecate `dimod.decorators.bqm_index_labelled_input()` decorator.

Bug Fixes

- Fix `ConstrainedQuadraticModel.add_discrete()` to correctly accept an iterator of variables as documented rather than instead requiring a collection.

<!-- -->

- Fixed edge case bug when determining dtype in `as_sample()`.

<!-- -->

- No longer throw a `TypeError` from `ConstrainedQuadraticModel.from_lp_file` when adding a integer quadratic term from constraints.

<!-- -->

- Binary quadratic models with `object` data type now correctly support energy calculations where the given samples contain a superset of the variables in the model. This makes them consistent with binary quadratic models with `np.float32` and `np.float64` data types.

<!-- -->

- Fix `BinaryQuadraticModel.add_linear_from` to work correctly with iterables. Before `linear` had to be a mapping or (incorrectly) an iterator.

0.10.7

New Features

- Add `ConstrainedQuadraticModel.is_equal()` and `ConstrainedQuadraticModel.is_almost_equal()` methods. See [\1012](https://github.com/dwavesystems/dimod/issues/1012)

<!-- -->

- Add `QuadraticModel.is_almost_equal()` method

<!-- -->

- Support equality checks between quadratic models and binary quadratic models in `BinaryQuadraticModel.is_equal()`, `BinaryQuadraticModel.is_almost_equal()`, `QuadraticModel.is_equal()`, and `QuadraticModel.is_almost_equal()` methods.

<!-- -->

- Add `GraphLike` type hint to `dimod.typing`.

<!-- -->

- Add `ConstrainedQuadraticModel.iter_constraint_data()`, `ConstrainedQuadraticModel.iter_violations()` and `ConstrainedQuadraticModel.violations()` methods. See [971](https://github.com/dwavesystems/dimod/issues/971).

<!-- -->

- Added `from_lp_file` classmethod to `ConstrainedQuadraticModel` that reads input LP file and converts it to CQM instance.

<!-- -->

- `ConstrainedQuadraticModel.set_objective` now accepts an iterable.

<!-- -->

- Add `ConstrainedQuadraticModel.check_feasible` method.

<!-- -->

- Add `random_bin_packing` function with the same functionality as the (now deprecated) `bin_packing`.

<!-- -->

- Allow `BinaryQuadraticModel` and `QuadraticModel` to be divided by a scalar or squared. See [\864](https://github.com/dwavesystems/dimod/issues/864), [\#984](https://github.com/dwavesystems/dimod/issues/984).

<!-- -->

- Add `SampleSet.filter()` method that returns a sample set with data rows filtered by a given predicate.

<!-- -->

- Add `.to_dict()` and `.from_dict()` methods to the sample inverter returned by the `cqm_to_bqm` function. The methods return a json serializable representation of the inversion for storage if needed. See [977](https://github.com/dwavesystems/dimod/issues/977).

<!-- -->

- Add `random_multi_knapsack` function with the same functionality as the (now deprecated) `multi_knapsack`.

<!-- -->

- Add `random_knapsack` function with the same functionality as the (now deprecated) `knapsack`.

<!-- -->

- Allow the offset of a `BinaryQuadraticModel` to be specified as a keyword argument.

<!-- -->

- Add [PEP 561](https://www.python.org/dev/peps/pep-0561/) compatibility to allow tools like [mypy](http://mypy-lang.org/) to auto-detect typing hints. See [\#980](https://github.com/dwavesystems/dimod/issues/980).

Upgrade Notes

- The `cls` keyword argument of the `chimera_anticluster` function now does nothing.

Deprecation Notes

- Deprecate `cls` keyword argument of the `chimera_anticluster` function.

<!-- -->

- Deprecate `bin_packing` function in favour of `random_bin_packing`.

<!-- -->

- Deprecate `multi_knapsack` function in favour of `random_multi_knapsack`.

<!-- -->

- Deprecate `knapsack` function in favour of `random_knapsack`.

Bug Fixes

- `QuadraticModel` can now be multiplied by a number in place.

<!-- -->

- Fix energy calculations for integer variables with large values. See [\982](https://github.com/dwavesystems/dimod/issues/982).

<!-- -->

- Make `dimod.BinaryQuadraticModel` a virtual subclass of `dimod.core.bqm.BQM`.

Page 9 of 26

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.