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
- argv
Set
, 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
- argv
- Returns
- p
abstract.Parameter
orabstract.ParameterGroup
A single parameter or a parameter group
- p
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}};