sasoptpy.Model.include

Model.include(self, *argv)[source]

Adds existing variables and constraints to a model

Parameters
argv :

Objects to be included in the model

Notes

Examples

Adding an existing variable

>>> x = so.Variable(name='x', vartype=so.CONT)
>>> m.include(x)

Adding an existing constraint

>>> c1 = so.Constraint(x + y <= 5, name='c1')
>>> m.include(c1)

Adding an existing set of variables

>>> z = so.VariableGroup(3, 5, name='z', ub=10)
>>> m.include(z)

Adding an existing set of constraints

>>> c2 = so.ConstraintGroup((x + 2 * z[i, j] >= 2 for i in range(3)
                            for j in range(5)), name='c2')
>>> m.include(c2)

Adding an existing model (including all of its elements)

>>> new_model = so.Model(name='new_model')
>>> new_model.include(m)