Dwave-ocean-sdk

Latest version: v6.10.0

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

Scan your dependencies

Page 17 of 27

0.10.10

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.

- 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.

- 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.

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.

- 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]`.

Deprecation Notes

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

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`.

0.10.6

Prelude

Add `QuadraticModel` implementation to Python, Cython and C++. Quadratic models can be represented by a degree 2 polynomial over binary, spin and integer variables.


New Features

- `gnm_random_bqm` generator [808](https://github.com/dwavesystems/dimod/pull/808)

- Allow sample methods decorated by nonblocking_sample_method to
return sample sets that can indicate their doneness. This allows
ScaleComposite to be properly non-blocking even when there is
a vartype change [805](https://github.com/dwavesystems/dimod/pull/805)

- `DiscreteQuadraticModel.degree()` method

- Support PEP518 for building the package [814](https://github.com/dwavesystems/dimod/pull/814)

- Add `cyVariables.size()` and `.at(..)` to improve cython access to the `Variables` object

- Add new `QuadraticModelBase` and `BinaryQuadraticModel` implementation in c++ [818](https://github.com/dwavesystems/dimod/pull/818), [#819](https://github.com/dwavesystems/dimod/pull/819)

- Add `add_bqm` method to C++ BinaryQuadraticModel [821](https://github.com/dwavesystems/dimod/pull/821), [#823](https://github.com/dwavesystems/dimod/pull/823)

- Add `Structured.valid_bqm_graph` method for verifying input problem structure [832](https://github.com/dwavesystems/dimod/pull/832)

- Reimplement `BinaryQuadraticModel` to use new C++ code [828](https://github.com/dwavesystems/dimod/pull/828)

- `BinaryQuadraticModel` can now be manipulated symbolically [834](https://github.com/dwavesystems/dimod/pull/834)

- `load` function can now load all model types [841](https://github.com/dwavesystems/dimod/pull/841), [#843](https://github.com/dwavesystems/dimod/pull/843)

- `DiscreteQuadraticModel` now has an `.offset` attribute [838](https://github.com/dwavesystems/dimod/pull/838)

- Add `ConstrainedQuadraticModel` class [839](https://github.com/dwavesystems/dimod/pull/839)

- Add `make_header`, `read_header` and `write_header` utility functions [842](https://github.com/dwavesystems/dimod/pull/842)

- Add `ExactDQMSampler` [820](https://github.com/dwavesystems/dimod/pull/820)

- Add `ConstrainedQuadraticModel.add_discrete` method. This allows users to create a discrete variable via a one-hot constraint. A disjoint set of discrete variables are tracked by the `CQM` and serialized.

- Add support for quadratic model objectives and constraints in constrained quadratic models. Previously CQMs only supported binary quadratic models.

- Add new `QuadraticModel` class for creating quadratic models.

- Add `CaseLabelDQM` class. Provides means of labeling cases of discrete variables.

- Begin using reno for changelog.

- Add `BinaryQuadraticModel.add_linear_inequality_constraint` and `DiscreteQuadraticModel.add_linear_inequality_constraint` methods.

- Create `dimod/libcpp.pxd` Cython header file. This allows user to `cimport` C++ classes and functions defined in `dimod/include/`

- Use C++ `BinaryQuadraticModel` rather than `AdjVectorBQM` as the underlying object in `cyDiscreteQuadraticModel`. This means that the underlying implementation is now version controlled.

- Add new `Vartype.INTEGER` variable type.

- Add `QuadraticModelBase::scale` method. Scales offset, linear biases, and quadratic biases by a provided scale factor.

- Add bin\_packing, knapsack and multi\_knapsack constrained quadratic model generators.

- Add `BinaryQuadraticModel.is_almost_equal` method for testing approximate equality to other binary quadratic models.

- Add `Variables.copy` method, implemented as a `cpdef` method for Cython and Python access.

- Support specifying lower and upper bounds for integer variables in quadratic models:

- Add `lower_bound` and `upper_bound` keyword arguments to `QuadraticModel.add_variable`.
- Add `QuadraticModel.lower_bound` and `QuadraticModel.upper_bound` methods.

- Add `num_quadratic_variables` to the header of the file created by `ConstrainedQuadraticModel.to_file`. This increments the version to 1.1.

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

- Add an optional `label` keyword argument to `ConstrainedQuadraticModel.add_discrete`. The method also now returns the assigned label, whether supplied or generated. This is consistent with `ConstrainedQuadraticModel.add_constraint`.

- `cyBQM` and `cyQM` fused types can now be cimported from the `dimod` namespace.

- Add `.data()` method to `cyQM_template` and `cyBQM_template` that returns a const pointer to the underlying C++ `QuadraticModel` and `BinaryQuadraticModel` respectively.

- Add `QuadraticModel.change_vartype()` method.

- Add C++ `dimod::QuadraticModel::change_vartype()` method. Also add non-const versions of `dimod::QuadraticModel::vartype()`, `dimod::QuadraticModel::lower_bound()`, and `dimod::QuadraticModel::upper_bound()`.

- Add `QuadraticModel.set_upper_bound` and `QuadraticModel.set_lower_bound` methods.

- Add `Binaries`, `Spins` and `Integers` functions. See [\918](https://github.com/dwavesystems/dimod/issues/918).

- Add `DiscreteQuadraticModel.get_cases` method to match `CaseLabelDQM.get_cases`.

- Implement `QuadraticModel.remove_interaction` method, previously it raised a `NotImplementedError` error.

- Add `linear` option as a new `slack_method` for `DiscreteQuadraticModel.add_linear_inequality_constraint` method. This will add only one discrete variable to an inequality constraint with linear number of cases, according to right hand side value of the constraint.

- Add `quicksum` function for faster summation of `QuadraticModel` and `BinaryQuadraticModel`. Python's built-in `sum` continues to work, but `quicksum` will generally be faster when adding many objects.

- Add a generator, `dimod.generators.binary_encoding`, to create a binary quadratic model that encodes an integer.

- Add methods to construct a constrained quadratic model from other model types:

- `ConstrainedQuadraticModel.from_discrete_quadratic_model` with an alias `ConstrainedQuadraticModel.from_dqm`
- `ConstrainedQuadraticModel.from_quadratic_model` with two aliases `ConstrainedQuadraticModel.from_qm` and `ConstrainedQuadraticModel.from_bqm`

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

- Add `QuadraticModel.add_quadratic_from()` method.

- Add `QuadraticModel.add_linear_from()` method.

- Add `ConstrainedQuadraticModel.lower_bound()` and `ConstrainedQuadraticModel.upper_bound()` methods.

- Add `cqm_to_bqm` function.

- Add `ConstrainedQuadraticModel.substitute_self_loops` method that replaces integer self-loops by introducing a new variable and adding a constraint.

- Add `copy_always` parameter to `Initialized.parse_initial_states`.

- Add new binary quadratic model generators for simple logic gates:

- `dimod.generators.and_gate`
- `dimod.generators.fulladder_gate`
- `dimod.generators.halfadder_gate`
- `dimod.generators.or_gate`
- `dimod.generators.xor_gate`

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

- `QuadraticModel.energies`, `QuadraticModel.energy`, `BinaryQuadraticModel.energies`, and `BinaryQuadraticModel.energy` now all support samples containing a superset of the variables in the model. Any variables not in the model are ignored when calculating the energy.

- Labels for `dimod.Spin`, `dimod.Binary`, and `dimod.Integer` are no longer required positional arguments. By default, unique labels are applied via the [uuid](https://docs.python.org/3/library/uuid.html) module.



Upgrade Notes

- Drop `AdjMapBQM` and `AdjArrayBQM` [788](https://github.com/dwavesystems/dimod/pull/788)

- Promote `dimod.binary.binary_quadratic_model.BinaryQuadraticModek` to the top-level `dimod` namespace and remove `dimod.binary_quadratic_model.BinaryQuadraticModel` [847](https://github.com/dwavesystems/dimod/pull/847)

- Symbolically multiplying, subtracting and adding `BinaryQuadraticModel`\`s with different vartypes now creates a `QuadraticModel` rather than raising an error.

- Use C++ `BinaryQuadraticModel` rather than `AdjVectorBQM` as the underlying object in `cyDiscreteQuadraticModel`. Any code that relied on the old `AdjVectorBQM` implementation will need to be upgraded.

- Make `dimod.vartypes.ExtendedVartype` an alias for `dimod.vartypes.Vartype`. Also remove `ExtendedVartypeLike` from `dimod.vartypes` and `dimod.typing`.

- Remove `dimod.utils.LockableDict` and `dimod.decorators.lockable_method`. Also `SampleSet.is_writeable` can no longer be set to `False`.

- `BinaryQuadraticModel.data.vartype()` is now accessed as a method rather than as an attribute. This is consistent with `QuadraticModel.data.vartype()`.

- `from dimod cimport cyBQM` now is a fused type containing `cyBQM_float32` and `cyBQM_float64`. You can use the `cyBQM` containing `cyAdjVectorBQM` with `from dimod.bqm cimport cyBQM`.

- `QuadraticModel.objective` is now always a `QuadraticModel`. Previously it could either be a `BinaryQuadraticModel` or a `QuadraticModel`.

- `QuadraticModel.objective` now contains all variables in the constrained quadratic model. Previously it could contain a subset of the variables.


Deprecation Notes

- `AdjVectorBQM` and `AdjDictBQM` are deprecated and will be removed in dimod 0.11.0. Use `BinaryQuadraticModel` with `dtype=np.float64` and `dtype=object` respectively.

- `SampleSet.is_writeable` is deprecated and now always returns True.

- Some composites have been migrated to `dwave-preprocessing`. The affected composites:

- `ClipComposite`
- `ConnectedComponentsComposite`
- `FixedVariableComposite`
- `RoofDualityComposite`
- `ScaleComposite`
- `SpinReversalTransformComposite`

you no longer can use the composites without having `dwave-preprocessing` installed. Using them with it installed results in a deprecation warning.

- The `preprocessing` extra install argument has been removed.

- Remove `dimod.meta` namespace. Its functionality, `SamplerABCMeta` and `samplemixinmethod`, has been migrated to the `dimod.core.sampler` namespace.

- Deprecate `ConstrainedQuadraticModel.variables.vartypes`, `ConstrainedQuadraticModel.variables.lower_bounds`, and `ConstrainedQuadraticModel.variables.upper_bounds` attributes.

- Deprecate `ConstrainedQuadraticModel.variables.vartype()` method.


Bug Fixes

- Windows wheels now correctly include `.pxd` files.

- Fix broken documentation links [815](https://github.com/dwavesystems/dimod/pull/815)

- `DiscreteQuadraticModel.adj` is no longer constructed each time on the fly [807](https://github.com/dwavesystems/dimod/pull/807)

- Cython implementation of the `Variables` object [812](https://github.com/dwavesystems/dimod/pull/812)

- Windows wheels now correctly include `.pxd` files. [826](https://github.com/dwavesystems/dimod/pull/826)

- Fix type promotions in binary quadratic models with object biases [836](https://github.com/dwavesystems/dimod/pull/836)

- Fix issue where `Variables._relabel` mislabeled other variables [a0791b0](https://github.com/dwavesystems/dimod/commit/a0791b0045892d383ad37a53da1bf0ff6c0a2bdb)

- Fix subtracting a `BinaryQuadraticModel` from a number. Before it would return `bqm - 1` rather than correctly returning `1 - bqm`.

- Stop using deprecated numpy aliases like `np.int`, `np.float`, and `np.complex.

- Add support for AdjVectorBQM and AdjDictBQM in ConstrainedQuadraticModel.

- Fix shallow copies of `Variables` objects when using `copy.copy`.

- Implement rule of five for `dimod::NeighborhoodIterator`, `dimod::ConstNeighborhoodIterator`, and `dimod::ConstQuadraticIterator`. This fixes double frees caused by the default copy constructor copying information that is not intended to be shared.

- Fix shallow copies of `BinaryQuadraticModel` with `object` dtype when using `copy.copy`.

- Fix wrong behaviour when the lower bound (lb) equals the upper bound (lb) in `add_linear_equality_constraint`. Correct behaviour is to add constraint as eqaulity when lb is equal ub.

- Fix case where adding linear and quadratic biases whose class requires arguments on construction to a `BinaryQuadraticModel` with `object` dtype could fail.

- Fix `QuadraticModel.spin_to_binary` not correctly updating the variable type of the changed variables.

- Fix `QuadraticModel.energies` when given samples with values greater than the maximum value representable by an 8 bit integer. Previously samples were incorrectly cast to 8 bit integers.

- Fix energy calculation when the lower bound (lb) equals the upper bound (lb) in `DiscreteQuadraticModel.add_linear_inequality_constraint` and `BinaryQuadraticModel.add_linear_inequality_constraint`.

- When a `QuadraticModel` already has an integer variable, adding it with `QuadraticModel.add_variable` with different lower or upper bounds now correctly raises an exception. Likewise, adding or multiplying the same variable symbolically with different bounds will also raise an exception.

- When a `ConstrainedQuadraticModel` already has an integer variable, adding it as part of a constraint or objective with different lower or upper bounds now correctly raises an exception.

- Make `dimod.INTEGER` correctly deepcopy-able.

- Fix (deprecated) `AdjVectorBQM.to_file` and `AdjVectorBQM.from_file`. See [\898](https://github.com/dwavesystems/dimod/issues/898).

- Fix `BinaryQuadraticModel.energies` for a `BQM` with `dtype=object` and a single variable with an integer bias. Previously it would raise a `numpy.core._exceptions._UFuncOutputCastingError`.

- Promote dwave-preprocessing to a full dependency of dimod to avoid issues that occur when dimod is a required package but dwave-preprocessing is not.

- `dimod::QuadraticModelBase.remove_interaction` now correctly returns `true` when removing a self-loop.

- Return `bool` rather than `numpy.bool_` from `QuadraticModel.is_equal` and `BinaryQuadraticModel.is_equal` when comparing empty models to numbers.

- Fix `as_samples` and `Initialized.parse_initial_states` by ensuring that the `copy` argument is not ignored in `as_samples` and `Initialized.parse_initial_states` does not modify any input data. See [\861](https://github.com/dwavesystems/dimod/issues/861).

- Remove unused `ConstrainedQuadraticModel.labels` instance variable.

- Fix adding constraints with integer variables via `ConstrainedQuadraticModel.add_constraint_from_iterable` when those integer variables have pre-existing lower or upper bounds. See [\943](https://github.com/dwavesystems/dimod/issues/943).

- Correctly account for the offset when multiplying binary quadratic models

- `BinaryQuadraticModel.energies` now has consistent behaviour accross all data types when given samples containing a superset of the variables in the model. Previously binary quadratic models with `object` data type would allow a superset of variables, while `float64` and `float32` would not.

0.10.5

New Features

- Add `strict_mode` support to `VersionedAPISession`. Strict mode is now the default, implying API requests will fail if type/version is expected and the response doesn't include it.

- Add `version_strict_mode` config option to `DWaveAPIClient`. It corresponds to underlying session's (`VersionedAPISession`) `strict_mode`.

- Add `VersionedAPISession`, a `requests.Session` subclass (more precisely, further specialized `LoggingSession`) that enforces conformance of API response version with supported version range(s).

- Add `accepts` decorator for declaring accepted media type and response format version (range) on `dwave.cloud.api.Resource` methods.

- Simplify `dwave.cloud.api.resource.accepts` interface (require only `media_type` and `version`), but retain flexibility (pass all keyword arguments to `VersionedAPISession.set_accept`).

- Support `strict_mode` control of API response type validation via `accepts` interface.

Upgrade Notes

- Response type version is now always required (regardless of `strict_mode`) if type is expected and received, and version is expected.

- Enforce D-Wave API response format version on all `cloud.api` resources.

Bug Fixes

- Fix `dwave.cloud.api.resources.accepts` to allow for partial decoration of `Resource` methods. See [\544](https://github.com/dwavesystems/dwave-cloud-client/issues/544).

0.10.4

New Features

- Add Python 3.11 support
- Add dimod 0.12.x support
- Add numpy 1.24.x support

0.10.3

New Features

- Add support for NumPy scalars used as problem parameter values. See 512.

Page 17 of 27

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.