sasoptpy.Model.add_parameter

Model.add_parameter(self, *argv, name, init=None, value=None, p_type=None)[source]

Adds a abstract.Parameter object to the model

Parameters
argvSet, optional

Index or indices of the parameter

namestring

Name of the parameter

initfloat or expression, optional

Initial value of the parameter

p_typestring, optional

Type of the parameter, ‘num’ for floats or ‘str’ for strings

Returns
pabstract.Parameter or abstract.ParameterGroup

A single parameter or a parameter group

Examples

>>> I = m.add_set(name='I')
>>> a = m.add_parameter(I, name='a', init=5)
>>> print(a._defn())
num a {I} init 5 ;
>>> I = m.add_set(name='I')
>>> J = m.add_set(name='J')
>>> p = m.add_parameter(I, J, name='p')
>>> print(p._defn())
num p {{I,J}};