Model.add_set(self, name, init=None, value=None, settype=None)[source]

Adds a set to the model

namestring, optional

Name of the set

initSet, optional

Initial value of the set

valuelist, float, optional

Exact value of the set

settypelist, optional

Types of the set as a list

The list can have one more num (for float) and str (for string) values. You can use sasoptpy.NUM and sasoptpy.STR for floats and strings, respectively.


>>> I = m.add_set(name='I')
>>> print(I._defn())
set I;
>>> J = m.add_set(name='J', settype=['str'])
>>> print(J._defn())
set <str> J;
>>> N = m.add_parameter(name='N', init=4)
>>> K = m.add_set(name='K', init=so.exp_range(1, N))
>>> print(K._defn())
set K = 1..N;
>>> m.add_set(name='W', settype=[so.STR, so.NUM])
>>> print(W._defn())
set <str, num> W;