sasoptpy.Model.get_all_objectives

Model.get_all_objectives(self)[source]

Returns a list of objectives in the model

Returns
all_objectiveslist

A list of Objective objects

Examples

>>> m = so.Model(name='test_set_get_objective')
>>> x = m.add_variable(name='x')
>>> obj1 = m.set_objective(2 * x, sense=so.MIN, name='obj1')
>>> obj2 = m.set_objective(5 * x, sense=so.MIN, name='obj2') # Overrides obj1
>>> obj3 = m.append_objective(10 * x, sense=so.MIN, name='obj3')
>>> assertEqual(m.get_all_objectives(), [obj2, obj3])
True