Add DisjointCover node#557
Conversation
arcondello
left a comment
There was a problem hiding this comment.
Couple random aesthetic comments
|
Misc unhelpful notes from trying to find precedent for similar functions in other libraries we like to follow.
Maybe we want |
|
I think if we were writing this from scratch we'd want an API like from dwave.optimization import Model, is_disjoint_cover
model = Model()
universe = 100
num_lists = 10
lists = [model.list(universe, min_size=0) for _ in range(num_lists)]
model.add_constraint(is_disjoint_cover(lists))open to suggestions |
I'm convinced adding "Is" is the way to go. At least, its consistent with "IsIn", and its probably not a good idea to go the other way and rename that to just "In" |
So, add |
| return concatenate(arrays, 1) | ||
|
|
||
|
|
||
| def is_disjoint_cover(primary_set_size: int, subsets: list[ArraySymbol]) -> IsDisjointCover: |
There was a problem hiding this comment.
Can't tell if I should future-proof this interface and make the primary set an ArraySymbol? (but for now, just assert its a constant)
And don't bother with the "container" object
c9f86e2 to
eed5066
Compare
and include set_routines.hpp to nodes.hpp
Finally revisiting this and I think I understand your suggestion: you would prefer to remove the "primary set size" argument to I'm tempted to agree - this would address my other comment about future-proofing the interface. Just wondering if we wouldn't want the flexibility in the future. |
|
Can make it a kwarg with |
Allow primary_set_size to be optional on python side
Adds a logical-valued node that determines whether its predecessors are a disjoint cover of a given primary set
Reference issue
What does this implement/fix?
Implements a
DisjointCovernode, enabling construction ofDisjointListsviaListsymbolsAI Generation Disclosure
No AI tools used