dwave.optimization.model.ArraySymbol.maybe_equals#
- ArraySymbol.maybe_equals(other)#
Compare to another node.
This method exists because a complete equality test can be expensive.
- Parameters:
other – Another node in the model’s directed acyclic graph.
- Returns: integer
Supported return values are:
0
—Not equal (with certainty)1
—Might be equal (no guarantees); a complete equality test is necessary2
—Are equal (with certainty)
Examples
This example compares
IntegerVariable
symbols of different sizes.>>> from dwave.optimization import Model >>> model = Model() >>> i = model.integer(3, lower_bound=0, upper_bound=20) >>> j = model.integer(3, lower_bound=-10, upper_bound=10) >>> k = model.integer(5, upper_bound=55) >>> i.maybe_equals(j) 1 >>> i.maybe_equals(k) 0
See also
equals()
: a more expensive form of equality testing.