sasoptpy.Model.add_implicit_variable¶
-
Model.
add_implicit_variable
(self, argv=None, name=None)[source]¶ Adds an implicit variable to the model
- Parameters
- argvGenerator-type object
Generator object where each item is an entry
- namestring
Name of the implicit variable
Notes
Based on whether the implicit variables are generated by a regular or abstract expression, they can appear in generated OPTMODEL codes.
Examples
>>> x = m.add_variables(range(5), name='x') >>> y = m.add_implicit_variable(( >>> x[i] + 2 * x[i+1] for i in range(4)), name='y') >>> print(y[2]) x[2] + 2 * x[3]
>>> I = m.add_set(name='I') >>> z = m.add_implicit_variable((x[i] * 2 + 2 for i in I), name='z') >>> print(z._defn()) impvar z {i_1 in I} = 2 * x[i_1] + 2;