sasoptpy.Model.get_grouped_constraints

Model.get_grouped_constraints(self)[source]

Returns an ordered dictionary of constraints

Returns
grouped_consOrderedDict

Dictionary of constraints and constraint groups in the model

Examples

>>> m1 = so.Model(name='test_copy_model_1')
>>> x = m1.add_variable(name='x')
>>> y = m1.add_variables(2, name='y')
>>> c1 = m1.add_constraint(x + y[0] >= 2, name='c1')
>>> c2 = m1.add_constraints((x - y[i] <= 10 for i in range(2)), name='c2')
>>> cons = OrderedDict([('c1', c1), ('c2', c2)])
>>> self.assertEqual(m1.get_grouped_constraints(), cons)
True