dwave.optimization.model.States.resize#
- States.resize(n)#
Resize the number of states.
If
n
is smaller than the currentsize()
, states are reduced to the firstn
states by removing those beyond. Ifn
is greater than the currentsize()
, new uninitialized states are added as needed to reach a size ofn
.Resizing to 0 is not guaranteed to clear the memory allocated to states.
- Parameters:
n – Required number of states.
Examples
This example adds three uninitialized states to a model.
>>> from dwave.optimization.model import Model >>> model = Model() >>> i = model.integer(2) >>> model.states.resize(3)