Enhancement/Sum constraints on NumberNode#471
Enhancement/Sum constraints on NumberNode#471fastbodin wants to merge 34 commits intodwavesystems:mainfrom
Conversation
bebd145 to
15f7b67
Compare
|
Feature is fully implemented. |
e3b0255 to
1c177b4
Compare
|
Closes #216. |
dwave/optimization/include/dwave-optimization/nodes/numbers.hpp
Outdated
Show resolved
Hide resolved
dwave/optimization/include/dwave-optimization/nodes/numbers.hpp
Outdated
Show resolved
Hide resolved
dwave/optimization/include/dwave-optimization/nodes/numbers.hpp
Outdated
Show resolved
Hide resolved
|
First round of comments addressed. |
4b2205c to
c6a93d5
Compare
|
I do see "hyperslice" used in a lot of comments. Would prefer that is changed to just "slice" as well, or at least a small comment maybe in the header |
c6a93d5 to
72c6d96
Compare
|
Second round of comments addressed. |
arcondello
left a comment
There was a problem hiding this comment.
Looks great! Just two aesthetic comments
dwave/optimization/include/dwave-optimization/nodes/numbers.hpp
Outdated
Show resolved
Hide resolved
|
Third round of comments addressed. |
Data is stored at C++ level with the class `AxisBoundInfo` as private attribute to `NumberNode`. Added relevant C++ tests.
For each bound axis and each hyperslice along said axis, we store the running sum of the values within the hyperslice. This state dependant data is stored via `NumberNodeStateData`. If `NumberNode` is initialized with values, we check that all axis-wise bounds are satisfied.
Added satisfies_axis_wise_bounds(), update_bound_axis_slice_sums(), axis_wise_bounds(), and bound_axis_sums() to NumberNode. Updated various NumberNode, IntegerNode, and BinaryNode methods to reference NumberNodeStateData as opposed to ArrayNodeStateData. Updated all NumberNode mutate methods to reflect changes to the axis-wise bound running sums. Added C++ tests to check said mutate methods on BinaryNode and IntegerNode.
Make use of BufferIterators to compute the sum of the values within each hyperslice along each bound axis as opposed making a custom method to do this.
`BoundAxisInfo` -> `AxisBound` and `BoundAxisOperator` -> `Operator`. `Operator` is now a nested enum classs of `AxisBound`.
Added indicator variable that all bound axis operators are `==` to reduce redundancy in `NumberNode::exchange()` method.
Made axis, operators, and bounds private members. Added axis(), num_bounds(), and num_operators() methods. Updated C++ code/tests, Python, and Cython to reflect this.
Removed `asserts()` that axis-wise bounds were satisfied to `NumberNode::propagate()`.
a92e2bd to
116d03b
Compare
Added a `const` to `State& state`. Fixed typos.
f2b1cc4 to
3b10b41
Compare
Previously, users could not define a bound for the sum of the values over an entire `NumberNode` array. This lead to the undesired behaviour that users could not define a bound on the sum of the values in a `NumberNode` vector.
|
Previously, users could not define a bound for the sum of the values over an entire |
ba928be to
11bcf25
Compare
Users may now define a bound on the sum of the values in the entire `NumberNode` array.
11bcf25 to
0553d55
Compare
In previous commits, we expanded the functionality of `NumberNode` such that a user may define implicit constraints on the sum of values within the node. We allow constraints on the entire array and along a fixed axis. The naming convention axis-wise bounds was given before we allowed constraints over the entire array. In the latter case, there is no `axis`. Changing naming convention to `sum constraints`.
5002a9b to
d800bc8
Compare
See prior commit message.
d800bc8 to
8380096
Compare
|
Changed naming convention to reflect that this features is really a summation constraint that is either applied to the entire array or to each slice along an axis. |
Naming convention change to methods, variables, and comments.
Do not merge. Draft PR.
Only C++ has been implemented.Simply checking CircleCi.