dwave.optimization.model.Model.set#
- Model.set(n, min_size=0, max_size=None)#
Create a set symbol as a decision variable.
- Parameters:
n – Values in the set are subsets of
range(n)
.min_size – Minimum set size. Defaults to
0
.max_size – Maximum set size. Defaults to
n
.
- Returns:
A set symbol.
Examples
This example creates a set symbol of up to 4 elements with values between 0 to 99.
>>> from dwave.optimization.model import Model >>> model = Model() >>> destinations = model.set(100, max_size=4)