Releases: dwavesystems/dwave-optimization
Releases · dwavesystems/dwave-optimization
0.6.10
New Features
- Add the
MatrixMultiplicationsymbol and corresponding method
matmul. Thematmulmethod follows the behavior of NumPy's
matmul, meaning that it works with matrices, vectors, and higher
order arrays.
Upgrade Notes
- Opt
ArraySymbolout of NumPy interoperability. This means that
trying to use anArraySymbolwith most NumPy functions/operators
will fail. Prefer to use the functions in
dwave.optimization.mathematical.
Bug Fixes
- Fix type promotion when using NumPy arrays as the left-hand-side of
operations withArraySymbol. - Fix the maximum possible value reported by
SetNode::max().
Previously it would erroneously return a value derived from the
maximum subset size. - Fix
BinaryOpNodeat C++ level so that it does not
accept predecessors that have different, broadcastable shape if they
have the same size.
0.6.9
New Features
- Add
Rollsymbol and correspondingroll()function. See
#423. - Support
Modulussymbol in expressions used inAccumulateZip.
Bug Fixes
- Change C++ function
broadcast_shape()correctly throw an error
when an attempt to broadcast a dynamically sized shape would result
in an invalid result. See
#429. - Fix
BinaryNode::shape(const State&)and
BinaryNode::size(const State&)so that they do not propagate the
wrong shape/size when both predecessors have the same shape. - Fix
Reducesymbol's bounds when given a dynamic predecessor that
is always empty.
0.6.8
New Features
- Add
ArraySymbol.info()method for information about the values an
array might take. - Add set union operation to C++
ValuesInfoclass. DisjointListssymbols are now indexable, returning the
correspondingDisjointList(singular) symbol for the given index.
This allows the method of creating disjoint lists on the model to be
simplified, returning only aDisjointListssymbol instead of a
tuple of the symbol and a list ofDisjointListsymbols. A new
methodModel.disjoint_lists_symbol()has been added to the Model
class which implements this.- Added
IsInsymbol/node which computes the element-wise containment
of one symbol with another. - Support equality and inequality comparison to
std::default_sentinelfor C++BufferIterator. - Implement
BufferIterator::operator+=and
BufferIterator::operator+for multi-increments. - Make
ARangesymbol aware of theSizesymbol. See
#390. - Added
Transposesymbol/node which computes the transpose of a
symbol. - Consolidate C++
ReduceNodeandPartialReduceNodeinto a single
node type. - Support reductions over multiple axes for all reduce operations. See
#347.
Upgrade Notes
- Drop support for Python 3.9.
Deprecation Notes
- The
Model.disjoint_lists()method has been deprecated. Use
Model.disjoint_lists_symbol()instead. - Make
PartialProdandPartialSumsymbols aliases forProdand
Sum.
Bug Fixes
- Fixed issue (#409) in how ARangeNode calculated its sizeinfo.min and
sizeinfo.max. - Fix an issue with
AccumulateZipwhen given an expression that
contains unbounded input symbols. For some expressions, this would
result in malformed data being propagated through the expression on
initialization, which could then affect all subsequent propagations. - Fix
BroadcastTosymbol's diff creation. Previously it would
sometimes propagate the wrong information when broadcasting
high-demensional arrays. - Make the C++
deduplicate_diff_viewa non-template class. Rather,
make the constructor templated. This avoids a potential recursion
when usingdeduplicate_diff_viewin some concepts.
0.6.7
New Features
- Make
dwave.optimization.symbolsa sub-package rather than a sub-module. - Index-wise bounds added to
NumberNode. Available to bothIntegerNodeand
BinaryNode.
0.6.6
Bug Fixes
- Fix setting or mutating
Model.objective. Until dwave-optimization
0.6.4, it was possible to set the objective of aModeldirectly.
However, in 0.6.4 and 0.6.5 doing so would result in that change not
being reflected in serialized models. This fix restores support for
setting or mutatingModel.objectivedirectly.
0.6.5
New Features
- Add support for
booldtype to the C++BufferIterator. - Add new
dwave-optimization/common.hppfor compiler support and
backports from C++23. - Add new
dwave-optimization/fraction.hppfor C++fractionclass. - Add support for broadcasting array symbols to new shapes. This
includes:- A
BroadcastTosymbol. - New
broadcast_to()andbroadcast_symbols()functions. - A C++
BroadcastToNode.
- A
- Support reshaping dynamically sized symbols when the size of each
"row" in the new shape evenly divides the size of each "row" in
the original shape. - Add
CosandSinsymbols to support trigonometric sine and
cosine. - Add C++
CosNodeandSinNodeto support trigonometric sine and
cosine. - Added
SoftMaxsymbol/node which returns the softmax of its
predecessor.
Upgrade Notes
- Remove
dwave-optimization/utils.hppheader. - Move C++
double_kahanimplementation behind the compilation
barrier.
Bug Fixes
- Fix
SetNode::assign()method. Previously it would sometimes
propagate incorrect updates when assigned a smaller state.
0.6.4
New Features
- Add
ArgSortsymbol/node which returns a stable argsort of its
predecessor. - Add
expression()decorator for constructing expressions. - Add the
AccumulateZipsymbol and correspondingAccumulateZipNode
node in the C++. This symbol computes an arbitrary accumulate
operation on 1-d arrays, similar tonumpy.ufunc.accumulate, except
that it takes any number of operands/predecessors. The accumulate
operation is supplied by the user and encoded as anExpression. - The
Constantsymbol is now able to pass ownership of the
corresponding numpy array to theConstantNodewhich prevents the
numpy array from being garbage collected even after the symbol has
been collected. This means it is no longer necessary to save
references to all the numpy arrays used byConstantsymbols on the
model itself. To support this, a new constructor for the C++
ConstantNodehas been added which takes a special
ConstantNode::DataSourcestruct allowing the Python reference
count to modified when appropriate. - Support automatic constant promotion for arithmetic operations on
Symbols. This enables operations likemodel.binary() + 5, where
the5will automatically be converted to aConstantsymbol and
added to the model. - Add
std::initializer_listandstd::spanoverloads to several
InputNodemethods. - Allow the user to provide an initial value to
ArraySymbol.max(),
.min(),.prod(), and.sum()methods. - Add
Resizesymbol and C++ResizeNode. - Change the behavior of
Model.constant()to keep a cache of
symbols. Multiple calls toModel.constant()with the same array
will no longer create redundant symbols. - Add C++
deduplicate_diff_viewrange view. - Add C++
type_listutility class. - Added
Meansymbol/node which returns the mean of its predecessor. - Add support for Python 3.14.
Upgrade Notes
- Move C++
deduplicate_diff()function from
dwave-optimization/utils.hpptodwave-optimization/array.hpp. - Change the signatures of the C++
ravel_multi_index()and
unravel_index()functions to accept shapes rather than strides.
This is consistent with NumPy. - Remove C++
Array::View::at()method.
Bug Fixes
- Implement the C++
UnaryOpNode::sizeinfo()method to handle unary
operations on dynamic arrays. - There was an issue on some models with "diamonds" in the multi-DAG
structure where adding subsequent nodes could trigger a exponential
recursion of callingArray::min()/max(). This has been fixed by
using a min/max cache by default in these methods.
0.6.3
New Features
- Update the C++
ConstantNodeconstructors to acceptconst double*
rather thandouble*. - Add the
Extractsymbol and node, following the behavior of
numpy.extract. See
#272. - Allow BinaryOpNode (which Add, And, Multiply, etc. rely on) to
accept two dynamic-sized predecessors, as long as they have an
equivalent shape as determined by theirsizeinfo(). - Add
.lower_bound(),.upper_bound(), and.integral()methods to
theInputsymbol. - The Where node/symbol now supports the case of all three
predecessors being dynamic, as long as they have the same shape and
size.
Upgrade Notes
- Switch from pkgutil-style namespace package to native namespace
package (PEP 420). While native namespace packages and pkgutil-style
namespace packages are largely compatible, we recommend using only
native ones going forward.
Bug Fixes
- Fix constructing
Constantsymbols from read-only NumPy arrays. See
#296. - Fix potential
IndexErrorraised by
capacitated_vehicle_routing_with_time_windows(). See
#306. - Due to the way
AdvancedIndexingNodeheld the data for
its shape in the dynamic size case (i.e. when the indexers are
dynamic), it was possible to encounter issues when mutating multiple
states on the model. This has been fixed by tracking the shape on
the node's state data. - Previously, the size info as reported by
ArrayIndexingNodewas correct only when the advanced
indexing operation had no empty slices (i.e. all axes were specified
with indexing arrays), and even in that case, the full size
information from the indexing predecessors was not utilized. This
has been fixed, so certain operations on advanced indexing nodes may
now be allowed that weren't previously, and a size check may fail
on certain models that worked before (operations such as
A + B\[i,:, j, :\]whereAis a dynamic 2d array,
andiandjare dynamic 1d arrays, but
the dimensions do not match). - Fix C++
SizeInfo::substitute()method. Previously it would not
correctly update the min/max. - Fix C++
BasicIndexingNode::sizeinfo()and
AdvancedIndexingNode::sizeinfo()methods. Previously they would
sometimes report incorrect size information when indexing or being
indexed by dynamic nodes. - Previously, the check in
BinaryOpNode(used by Add, Subtract,
Maximum, etc) for ensuring that predecessors have the same dynamic
size did not recurse, meaning that the node might reject some
predecessors that were actually valid. This has been fixed. - Update buffer access to
Constantand toArraySymbolstates to
raise aBufferErrorwhen requesting unsupported flags.
0.6.2
New Features
- Add C++
ExpNodeand PythonExpsymbol.Exppropagates the
base-e exponential values of its predecessor element-wise. See
#282. - Add
Inputsymbol and correspondingInputNodenode in the C++.
This symbol is meant to function as a "placeholder" in a model. - Improve the error messages returned by
ListVariable.set_state()
andSetVariable.set_state(). - Add C++
CollectionNode::assign()method. - Add
absolutefunction as an alias for the built-inabs. - Add Python
safe_divide()function andSafeDividesymbol. Also
add C++SafeDivideNode. See
#290. - Add overloads to C++ methods
Graph::commit(),
Graph::propagate(), andGraph::revert()that commit, propagate,
or revert respectively all nodes in the graph. - Add a default constructor for C++
BinaryNode.
Upgrade Notes
- Rename the first argument
ListVariable.set_state()and
SetVariable.set_state()fromstatetovalues.
Bug Fixes
- Make C++
dwave::optimization::functionalobjects more consistent
with the standard library by adding overloads for other numeric
types and marking most operations asconstexpr. - Fix iteration over
ArraySymbols. Now iteration works correctly for
ArraySymbols with more than one dimension and a fixed size. Other
ArraySymbols now raise aTypeError. See
#287.
0.6.1
New Features
- Add C++
BSplineNodeand PythonBSplinesymbol.BSpline
propagates the bspline interpolation values of its predecessor
element-wise given the bspline constants (degree, knots and
coefficients).