Skip to content

Where (and maybe other symbols) use a default initialization for their SizeInfo when dynamic, preventing their state from being serialized #316

@wbernoudy

Description

@wbernoudy
>>> model = dwave.optimization.Model()
>>> where = dwave.optimization.where(model.binary(), model.set(100), model.set(100))
>>> where.state_size()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[5], line 1
----> 1 where.state_size()

File ~/dwave-optimization/dwave/optimization/_model.pyx:1867, in dwave.optimization._model.ArraySymbol.state_size()
  1865 # This shouldn't happen, but just in case...
  1866 if not sizeinfo.max.has_value():
-> 1867     raise RuntimeError("size is unbounded")
  1868 
  1869 return sizeinfo.max.value() * self.array_ptr.itemsize()

RuntimeError: size is unbounded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions