dwave.optimization.model.Model.num_symbols#

Model.num_symbols()#

Number of symbols tracked by the model.

Equivalent to the number of nodes in the directed acyclic graph for the model.

See also

num_nodes()

Examples

This example add a single (size 20) decision symbol and a single (size 3) constant symbol checks the number of symbols in the model.

>>> from dwave.optimization.model import Model
>>> model = Model()
>>> c = model.constant([1, 5, 8.4])
>>> i = model.integer(20, upper_bound=100)
>>> model.num_symbols()
2