Releases: dwavesystems/dwave-optimization
Releases · dwavesystems/dwave-optimization
0.7.0
New Features
- Make C++
BufferIteratoralways shaped. - Implicit sum constraints added to NumberNode.
- Users may define a sum constraint over the entire array or along
an single axis. - Enabled at the Python level for BinaryVariable and
IntegerVariable. See #216. - Added
NumberNode::sum_constraints()(returns sum constraint). - Added
NumberNode::sum_constraints_lhs()(returns
state-dependent sums associated with sum constraint). - Modified
NumberNode::exchange()to accept optional slice
arguments. - Modified
NumberNode::clip_and_set_value()to accept optional
slice argument. - Modified
IntegerNode::set_value()to accept optional slice
argument. - Modified
BinaryNode::flip()to accept optional slice argument.
- Users may define a sum constraint over the entire array or along
- BinaryNode optionally tracks indices with buffer value 1 and 0.
- Enabled when users define a sum constraint.
- Added
BinaryNode::num_true()(return # of indices with buffer
value 1 in slice given sum constraint). - Added
BinaryNode::num_false()(return # of indices with
buffer value 0 in slice given sum constraint). - Added
BinaryNode::ith_true_index()(returns ith index with
buffer value 1 in slice given sum constraint). - Added
BinaryNode::ith_false_index()(returns ith index with
buffer value 0 in slice given sum constraint).
- Add three methods to the model returned by the job-shop scheduling
model generator:model.get_global_task_ordering(),
model.get_start_times(), andmodel.get_end_times().
Upgrade Notes
- Drop support for contiguous C++
BufferIterator. This means that
one must always provide ashapeandstridesargument when
constructing the iterator. - Change
Array::viewto usestd::default_sentinel. This means
Array::viewis no longer astd::common_range. - Drop the
Array::Viewtype declaration. - Update job-shop scheduling generator to use a list variable for the
global ordering of all tasks from which the model constructs a
feasible schedule.
Deprecation Notes
- Remove
NumberNodeandBinaryNoderandom state initialization. - Remove mutate methods
set()andunset()fromBinaryNode.
Bug Fixes
- Add missing includes to
dwave-optimization/functional.hpp
0.6.12
New Features
-
Sub-lists are now supported.
See #71. -
Support
numpy.newaxisand...while indexing array symbols. -
Add
LinearProgram.feasible()andLinearProgram.objective_value()
methods. These allow the user to access information about the state of the
linear program without needing the associated symbols.
See #475. -
The symbols:
All,Any,Max,Min,Prod, andSumcan infer
their size from their predecessor's size. -
Transposesymbol can infer its size from its predecessor's size.
Known Issues
- In some cases, combined indexing operations on high dimensional arrays will
not match the behavior of NumPy.
See #465.
Bug Fixes
- Fix an issue with advanced indexing when indexing a dynamic array with
scalar indexers where the index on the first dimension is an empty slice,
such asA[:, i, j, :]whereiandjare scalar symbols. Previously,
this may have resulted in a exception being raised when initializing a
state on the model. This has now been fixed. A specific sub-case of this,
when the scalar indexers are separated by an empty slice in at least one axis,
(e.g.A[:, i, :, j]) is not supported and is now properly disallowed with
an exception being raised at symbol/node construction time.
0.6.11
New Features
- Add
Tanhsymbol to support hyperbolic tangent. See #445. - Add C++
TanhNodeto support hyperbolic tangent. - Add Python
broadcast_shapes()function. - Add
subtract()function. - Add
equal()function. - Add
less_equal()function. - Automatically broadcast when using binary operators with array
symbols. - Add
dwave.optimization.typingmodule. - Allow array symbols to have a state-dependent shape while not having
a state-dependent size. For example, an array with shape(n, 0)
will always have a size of0, but the shape is state-dependent.
Arrays with a state-dependent size always have a state-depenent
shape. - Add C++
is_contiguous()function. - Add
predict()function todwave.optimization.generators. The
predict()function accepts a fitted
sklearn.neural_network.MLPCLassifieror
sklearn.neural_network.MLPRegressorand a symbol representingX,
and returns a symbol encoding the prediction of the estimator.
Upgrade Notes
- Rename C++
broadcast_shape()tobroadcast_shapes()for
consistency with NumPy. - Change the definition of
ArrayNode::dynamic()to returntrueif
ArrayNode::shape()[0] < 0. That is, if the shape is
state-dependent. PreviouslyArrayNode::dynamic()returned true if
the size was state-dependent. - Remove C++
Array::is_contiguous()protected method.
Bug Fixes
- Disallow broadcasting a fixed size array to a dynamic shape with
BroadcastTosymbol. - Support broadcasting arrays to a shape with a
0in one or more
dimensions with theBroadcastTosymbol. - Fix reductions over empty dynamic arrays.
- Fix basic indexing that results in empty dynamic arrays.
- Fix
BroadcastToNode::contiguous()method, previously it would
always report that the node was not contiguous. - Provide a meaningful error message when attempting to make a dynamic
ConstantNodeat the C++ level. - Provide a meaningful error message when attempting to make a dynamic
NumberNode at the C++ level.
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.