Dwave-optimization

Latest version: v0.3.0

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

Scan your dependencies

0.3.0

New Features

- Add `Symbol.id()` method to return the identity of the underlying
node.
- Add bin packing generator.
- Add support for exponentiation of `ArraySymbol` for positive integer
exponents other than 2.
- Implement `ArrayNode` and `DecisionNode` C++ classes. These classes
are useful when creating nodes that require their predecessor(s) to
be both arrays and node. See [\75](https://github.com/dwavesystems/dwave-optimization/issues/75).
- Update C++ nodes that previously inherited from both `Array` and
`Node` to inherit from `ArrayNode`.
- Update C++ nodes that previously inherited from both `Decision` and
`Node` to inherit from `DecisionNode`.
- Add `ArraySymbol.initialize_arraynode()` Cython method.
- Update C++ `Graph` to hold a vector of `DecisionNode*` for easy
access. This will increase the memory usage for graphs with many
decisions, but provide faster access.
- Support binary operations between symbols representing a scalar and
other array symbols.
- Add `SizeNode` C++ class. `SizeNode` reports the size of its
predecessor. See [\48](https://github.com/dwavesystems/dwave-optimization/issues/48).
- Add `Size` Python class. `Size` reports the size of its predecessor. See [\48](https://github.com/dwavesystems/dwave-optimization/issues/48).
- Add C++ `Graph::objective()` method for accessing the current
objective.
- Add `::operands()` method to C++ `BinaryOpNode`, `NaryOpNode`,
`ReduceNode`, and `UnaryOpNode`. This method allows access to the
`Array*` of the node\'s predecessors without a dynamic cast.
- Add C++ `LogicalNode` and Python `Logical` symbol. `Logical`
propagates the truth value(s) of its predecessor element-wise.
- Add C++ `NotNode` and Python `Not` symbol. `Not` propagates the
inverse of the truth value(s) of its predecessor element-wise.
- Add C++ `void Graph::commit(State& state, std::vector<const Node*>&& changed) const`
overload.
- Add C++ `void Graph::propagate(State& state, std::vector<const Node*>&& changed) const`
overload.
- Add C++ `void Graph::revert(State& state, std::vector<const Node*>&& changed) const`
overload.
- Add predecessor shape test when initializing the state of C++
`ArrayValidationNode`.
- Add C++ `WhereNode`. See [\66](https://github.com/dwavesystems/dwave-optimization/issues/66).
- Add Python `Where` symbol and `where` function. See [\66](https://github.com/dwavesystems/dwave-optimization/issues/66).

Upgrade Notes

- Require and/or return `ArrayNode*` in many places that previously
required and/or returned an `Array*`.

The following `Graph` methods now require an `ArrayNode*` argument:
`Graph.set_objective()`, `Graph.add_constraint()`,
`Graph.constraints()`, `Graph.decisions()`.

The following nodes now require a `ArrayNode*` as argument(s) to
their constructor: `AdvancedIndexingNode`, `ArrayValidationNode`,
`BasicIndexingNode`, `BinaryOpNode`, `NaryOpNode`,
`PermutationNode`, `QuadraticModelNode`. `ReduceNode`,
`ReshapeNode`, and `UnaryOpNode`.

Python code is not affected.
- Remove `ArraySymbol.initialize_array()` Cython method. Python code
is not affected.
- Require `ArrayNode*` as an argument to the `symbol_from_ptr()`
Cython function.

Bug Fixes

- Fix `Array::min()`. Previously it incorrectly reported the smallest
number expressible by a `double`, rather than the lowest. See
[\85](https://github.com/dwavesystems/dwave-optimization/issues/85).
- Implement C++ `UnaryOpNode::max()`, `UnaryOpNode::min()`, and
`UnaryOpNode::logical()`. Therefore `AbsoluteNode`, `NegativeNode`,
and `SquareNode` will now correctly propagate their minimum and
maximum value and will now correctly report if they represent
integer or boolean values.

Other Notes

- Switch to using [Meson](https://mesonbuild.com/) as the build
system. When installing from source with `pip` or `pypa/build`,
Meson will be used to install the package. Previously `setuptools`
and `setuptools_dso` were used.

0.2.0

New Features

- Add C++ `NaryOpNode(std::span<Node*>)` and `NaryOpNode(std::span<Array*>)` constructors.
- Add `Model.num_edges()` method. See [\28](https://github.com/dwavesystems/dwave-optimization/issues/28).
- Add quadratic assignment problem generator. See [\29](https://github.com/dwavesystems/dwave-optimization/issues/29).
- Add C++ method to rotate elements in a disjoint list.
- Add support for `<,>,==,!=,<=,>=` operators between `Constant` and array-like objects.
- Add support for `bool(constant)`, `int(constant)`, and `not constant` when `constant` is an instance of `Constant` encoding a single scalar value.
- Make `repr()` of symbols unique to the underlying node, rather than to the Python symbol. See [\52](https://github.com/dwavesystems/dwave-optimization/issues/52).
- Allow `dwave.optimization.generators.traveling_salesperson()` to accept an asymmetric distance matrix.
- Allow `dwave.optimization.generators.flow_shop_scheduling()` to accept non-integer processing times.
- Implement `ArraySymbol.__iadd__()` and `ArraySymbol.__imul__()`. The `+=` operator will now return a `NaryAdd` symbol. The `*=` operator will now return a `NaryMultiply` symbol.
- Implement `NaryAdd.__iadd__()`. In-place addition with a `NaryAdd` symbol will no longer create a new symbol.
- Implement `NaryAdd.__imul__()`. In-place multiplication with a `NaryMultiply` symbol will no longer create a new symbol.
- Add missing `typing` information to `dwave.optimization.add()`, `dwave.optimization.maximum()`, `dwave.optimization.minimum()`, and `dwave.optimization.multiply()`.
- Support NumPy 2.0. Also, no longer require NumPy at build-time.
- Speed up `Model.iter_symbols()` and other symbol iteration methods.

Upgrade Notes

- Raise a `ValueError` when calling `bool()` on an `ArraySymbol`.
- `dwave.optimization.add()`, `dwave.optimization.maximum()`, `dwave.optimization.minimum()`, and `dwave.optimization.multiply()` no longer accept a tuple of symbols as inputs.
- `dwave.optimization.logical_and()` and `dwave.optimization.logical_or()` arguments have been renamed.
- Remove `.from_ptr()` `cdef` method from all of the symbol classes.

Bug Fixes

- Fix `ArraySymbol.all()` for empty array symbols. See [\43](https://github.com/dwavesystems/dwave-optimization/issues/43).
- Add missing `copy()` override for C++ `DisjointBitSetsNode` states.
- Fix `Symbol.to_networkx()` to no longer be compiler-dependant. See [18](https://github.com/dwavesystems/dwave-optimization/issues/18).
- Fix `dwave.optimization.generators.job_shop_scheduling()` for problems with the number of jobs is different than the number of machines.
- Return `NotImplemented` from `ArraySymbol` operator methods for unknown types.
- Fix return type of `Symbol.maybe_equals()` to be integer instead of boolean. See [\23](https://github.com/dwavesystems/dwave-optimization/issues/23).

0.1.0

Prelude

- The first release of ``dwave-optimization``.

0.1.0rc1

0.1.0rc0

Initial pre-release.

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.