dwave.optimization.model.ArraySymbol.state#
- ArraySymbol.state(index=0, *, copy=True)#
Return the state of the node.
- Parameters:
index – Index of the state.
copy – Currently only True is supported.
- Returns:
State as a
numpy.ndarray
.
Examples
This example prints a node two states: initialized and uninitialized.
>>> from dwave.optimization import Model >>> model = Model() >>> x = model.binary((2, 3)) >>> z = x.sum() >>> with model.lock(): ... model.states.resize(2) ... x.set_state(0, [[0, 0, 1], [1, 0, 1]]) ... print(z.state(0)) ... print(z.state(1)) 3.0 0.0